more clean conflicts output

This commit is contained in:
timerix 2022-11-03 01:30:20 +06:00
parent 10a2418871
commit f9f47bbd4d

View File

@ -90,7 +90,6 @@ static class ParadoxModMerger
{ {
string modarch = ""; string modarch = "";
if (Directory.GetFiles(moddirs[i], "*.zip").Length != 0) modarch = Directory.GetFiles(moddirs[i], "*.zip")[0]; if (Directory.GetFiles(moddirs[i], "*.zip").Length != 0) modarch = Directory.GetFiles(moddirs[i], "*.zip")[0];
string modname = "";
if (modarch.Length != 0) if (modarch.Length != 0)
{ {
Log("y", $"archive found: {modarch}"); Log("y", $"archive found: {modarch}");
@ -104,7 +103,7 @@ static class ParadoxModMerger
moddirs[i] = "_TEMP"; moddirs[i] = "_TEMP";
Log("g", "\tfiles extracted"); Log("g", "\tfiles extracted");
} }
modname = File.ReadAllText($"{moddirs[i]}\\descriptor.mod"); string modname = File.ReadAllText($"{moddirs[i]}\\descriptor.mod");
modname = modname.Remove(0, modname.IndexOf("name=\"") + 6); modname = modname.Remove(0, modname.IndexOf("name=\"") + 6);
modname = modname.Remove(modname.IndexOf("\"")) modname = modname.Remove(modname.IndexOf("\""))
.Replace("\\", "").Replace(":", "").Replace("?", "").Replace("\"", "").Replace("/", "") .Replace("\\", "").Replace(":", "").Replace("?", "").Replace("\"", "").Replace("/", "")
@ -135,8 +134,6 @@ static class ParadoxModMerger
Directory.Copy($"{moddirs[i]}\\{subdirs[n]}", $"{outdir}\\{modname}\\{subdirs[n]}", out List<string> _conflicts, true); Directory.Copy($"{moddirs[i]}\\{subdirs[n]}", $"{outdir}\\{modname}\\{subdirs[n]}", out List<string> _conflicts, true);
conflicts.AddRange(_conflicts); conflicts.AddRange(_conflicts);
break; break;
default:
break;
} }
} }
if (Directory.Exists("_TEMP")) Directory.Delete("_TEMP"); if (Directory.Exists("_TEMP")) Directory.Delete("_TEMP");
@ -215,8 +212,8 @@ static class ParadoxModMerger
// вывод конфликтующих файлов при -merge и -clear если такие есть // вывод конфликтующих файлов при -merge и -clear если такие есть
if (conflicts.Count > 0) if (conflicts.Count > 0)
{ {
Log("r", $"found {conflicts.Count} conflicts:"); Log("r", $"found {conflicts.Count} conflicts:\n",
foreach (string conflict in conflicts) Log("m", $"{conflict}"); "m", conflicts.MergeToString("\n"));
} }
} }
catch (Exception ex) catch (Exception ex)