This commit is contained in:
2025-12-15 20:53:20 +08:00
parent 3cdf68651f
commit c73555cb9b
8 changed files with 360 additions and 238 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -182,6 +183,16 @@ namespace DrillTools
// 保存原始文件路径
ViewModel.OriginalFilePath = files[0];
Encoding ansiEncoding;
try
{
ansiEncoding = Encoding.GetEncoding(936); // 936是GB2312的代码页
}
catch
{
ansiEncoding = Encoding.Default; // 如果获取失败,使用系统默认编码
}
var process = new Process
{
StartInfo = new ProcessStartInfo
@@ -190,7 +201,8 @@ namespace DrillTools
Arguments = $"/c type \"{files[0]}\"",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
CreateNoWindow = true,
StandardOutputEncoding = ansiEncoding
}
};