|
4 | 4 | using System.ComponentModel; |
5 | 5 | using System.IO; |
6 | 6 | using System.Linq; |
| 7 | +using System.Text; |
7 | 8 | using System.Text.RegularExpressions; |
8 | 9 | using System.Windows; |
9 | 10 | using System.Windows.Forms; |
@@ -225,6 +226,7 @@ private void WizardFinish(object sender, RoutedEventArgs e) |
225 | 226 | // 2、新建脚本文件 |
226 | 227 | // 3、新建任务参数 |
227 | 228 | Cleaner cleaner = new Cleaner(); |
| 229 | + Dictionary<uint, string> reducePathHashMap = new Dictionary<uint, string>(); |
228 | 230 | foreach (string inputFile in wizardInfo.InputFile) |
229 | 231 | { |
230 | 232 | List<TaskDetail> existing = workerManager.tm.GetTasksByInputFile(inputFile); |
@@ -290,9 +292,13 @@ private void WizardFinish(object sender, RoutedEventArgs e) |
290 | 292 | else |
291 | 293 | { |
292 | 294 | // By default, the last level path is preserved and the crc of the prefix path is added to prevent naming conflicts. |
293 | | - byte[] buffer = System.Text.Encoding.UTF8.GetBytes(effectivePathPrefix); |
| 295 | + byte[] buffer = Encoding.UTF8.GetBytes(effectivePathPrefix); |
294 | 296 | var crc = CRC32.Compute(buffer); |
295 | 297 | newEffectivePath = crc.ToString("X8") + "-" + effectivePathLast; |
| 298 | + if (!reducePathHashMap.ContainsKey(crc)) |
| 299 | + { |
| 300 | + reducePathHashMap.Add(crc, effectivePathPrefix); |
| 301 | + } |
296 | 302 | } |
297 | 303 | string[] newInputSuffixComponents = new string[] {inputSuffixComponents[0], newEffectivePath, inputSuffixComponents[inputSuffixComponents.Length - 1]}; |
298 | 304 | inputSuffixPath = string.Join("\\", newInputSuffixComponents); |
@@ -353,6 +359,18 @@ private void WizardFinish(object sender, RoutedEventArgs e) |
353 | 359 |
|
354 | 360 | workerManager.AddTask(td); |
355 | 361 | } |
| 362 | + |
| 363 | + // 输出缩减路径后的hash映射关系 |
| 364 | + string reducePathMapFile = new DirectoryInfo(wizardInfo.ProjectFile).Parent.FullName + "\\output\\" + "ReducePathMap.log"; |
| 365 | + if (Initializer.Config.reducePath && reducePathHashMap.Count > 0) |
| 366 | + { |
| 367 | + string reducePathMapContent = ""; |
| 368 | + foreach (KeyValuePair<uint, string> kvp in reducePathHashMap) |
| 369 | + { |
| 370 | + reducePathMapContent += kvp.Key.ToString("X8") + " " + kvp.Value + Environment.NewLine; |
| 371 | + } |
| 372 | + File.AppendAllText(reducePathMapFile, reducePathMapContent); |
| 373 | + } |
356 | 374 | } |
357 | 375 | catch (Exception ex) |
358 | 376 | { |
|
0 commit comments