From 52b2c324a32e63e09b9a4fad394203220089f4dc Mon Sep 17 00:00:00 2001 From: akarin Date: Sat, 25 Dec 2021 15:27:37 +0900 Subject: [PATCH] OKEGui/OKEGui/Gui/WizardWindow.xaml.cs: do not make assumption on the relative order of various #OKE tags For example, it's perfectly reasonable to have `#OKE:DEBUG` before `#OKE:INPUTFILE`. Signed-off-by: akarin --- OKEGui/OKEGui/Gui/WizardWindow.xaml.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OKEGui/OKEGui/Gui/WizardWindow.xaml.cs b/OKEGui/OKEGui/Gui/WizardWindow.xaml.cs index d461f856..5c624f10 100644 --- a/OKEGui/OKEGui/Gui/WizardWindow.xaml.cs +++ b/OKEGui/OKEGui/Gui/WizardWindow.xaml.cs @@ -185,28 +185,29 @@ private void WizardFinish(object sender, RoutedEventArgs e) vsScript = dirTag[0] + dirTag[1] + "r\"" + projectDir + "\"" + dirTag[3]; } - string[] inputTemplate = Constants.inputRegex.Split(vsScript); + string updatedVsScript = vsScript; // 处理MEMORY标签 - if(Constants.memoryRegex.IsMatch(vsScript)) + if(Constants.memoryRegex.IsMatch(updatedVsScript)) { - string[] memoryTag = Constants.memoryRegex.Split(inputTemplate[0]); - inputTemplate[0] = memoryTag[0] + memoryTag[1] + eachFreeMemory.ToString() + memoryTag[3]; + string[] memoryTag = Constants.memoryRegex.Split(updatedVsScript); + updatedVsScript = memoryTag[0] + memoryTag[1] + eachFreeMemory.ToString() + memoryTag[3]; } // 处理DEBUG标签 - if (Constants.debugRegex.IsMatch(vsScript)) + if (Constants.debugRegex.IsMatch(updatedVsScript)) { - string[] debugTag = Constants.debugRegex.Split(inputTemplate[3]); + string[] debugTag = Constants.debugRegex.Split(updatedVsScript); if (debugTag.Length < 4) { // error System.Windows.MessageBox.Show("Debug标签语法错误!", "新建任务向导", MessageBoxButton.OK, MessageBoxImage.Error); return; } - inputTemplate[3] = debugTag[0] + debugTag[1] + "None" + debugTag[3]; + updatedVsScript = debugTag[0] + debugTag[1] + "None" + debugTag[3]; } - + + string[] inputTemplate = Constants.inputRegex.Split(updatedVsScript); // 新建任务 // 1、清理残留文件