现场优化6
This commit is contained in:
@@ -332,6 +332,14 @@ namespace DeviceCommand.Devices
|
||||
{
|
||||
try
|
||||
{
|
||||
string FileDirectory = Path.GetDirectoryName(saveFilePath) ?? ""; // 获取目录
|
||||
string fileNameWithoutExt = Path.GetFileNameWithoutExtension(saveFilePath); // 获取纯文件名
|
||||
string extension = Path.GetExtension(saveFilePath); // 获取后缀名 (如 .png)
|
||||
// 生成时间戳,格式为 年月日_时分秒 (例如 20260817_123045)
|
||||
string timeStamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||
|
||||
// 组合成新的路径
|
||||
saveFilePath = Path.Combine(FileDirectory, $"{fileNameWithoutExt}_{timeStamp}{extension}");
|
||||
// 1. 调用我们在基类 Tcp 中全新实现的 ReadRawAsync
|
||||
// 它会在内部下发 ":PRINt? PNG\n",自动接收完整的网络字节流
|
||||
byte[] pureImageBytes = await ReadAllBytesAsync($":PRINt? PNG{ScpiDelimiter}", ct);
|
||||
|
||||
Reference in New Issue
Block a user