feat: 未匹配直径在完成弹窗中提示 — ReplaceParameters 返回 unmatchedDiameters 列表
This commit is contained in:
15
App.xaml.cs
15
App.xaml.cs
@@ -1,6 +1,7 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -333,11 +334,19 @@ namespace DrillTools
|
||||
if (selectionWindow.SelectedFilePath == null)
|
||||
return;
|
||||
|
||||
RouParameterReplacer.ReplaceParameters(filePath, selectionWindow.SelectedFilePath);
|
||||
RouParameterReplacer.ReplaceParameters(filePath, selectionWindow.SelectedFilePath, out var unmatchedDiameters);
|
||||
|
||||
string message = $"参数替换完成:\n{filePath}\n原文件已备份为:\n{Path.GetFileName(filePath)}.bak";
|
||||
|
||||
if (unmatchedDiameters.Count > 0)
|
||||
{
|
||||
var diaStrings = unmatchedDiameters.Select(d => d.ToString("F3", CultureInfo.InvariantCulture)).ToList();
|
||||
message += $"\n\n⚠ 以下直径未找到匹配参数,已保留原行:\n{string.Join(", ", diaStrings)}";
|
||||
}
|
||||
|
||||
System.Windows.MessageBox.Show(
|
||||
$"参数替换完成:\n{filePath}\n原文件已备份为 .bak",
|
||||
"替换完成",
|
||||
message,
|
||||
"参数替换完成",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user