diff --git a/diff-text/diff-text.csproj b/diff-text/diff-text.csproj index ad6dfb2..06a8195 100644 --- a/diff-text/diff-text.csproj +++ b/diff-text/diff-text.csproj @@ -8,7 +8,7 @@ diff_text - - + + diff --git a/paradox-dlc-metadata-parser/paradox-dlc-metadata-parser.csproj b/paradox-dlc-metadata-parser/paradox-dlc-metadata-parser.csproj index 65b788d..a2906ca 100644 --- a/paradox-dlc-metadata-parser/paradox-dlc-metadata-parser.csproj +++ b/paradox-dlc-metadata-parser/paradox-dlc-metadata-parser.csproj @@ -7,8 +7,8 @@ ParadoxDlcMetadataParser - - + + diff --git a/paradox-mod-merger.sln b/paradox-mod-merger.sln index 3dff967..a16b4b5 100644 --- a/paradox-mod-merger.sln +++ b/paradox-mod-merger.sln @@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution_files", "solution_ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "diff-text", "diff-text\diff-text.csproj", "{720D8D44-A9D3-4F58-BA1E-EA95808D1376}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "paradox-dlc-metadata-parser", "paradox-dlc-metadata-parser\paradox-dlc-metadata-parser.csproj", "{8663EF88-08DE-4641-AAAE-9FBB54BFF66C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Any CPU = Release|Any CPU @@ -31,6 +33,10 @@ Global {720D8D44-A9D3-4F58-BA1E-EA95808D1376}.Release|Any CPU.Build.0 = Release|Any CPU {720D8D44-A9D3-4F58-BA1E-EA95808D1376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {720D8D44-A9D3-4F58-BA1E-EA95808D1376}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8663EF88-08DE-4641-AAAE-9FBB54BFF66C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8663EF88-08DE-4641-AAAE-9FBB54BFF66C}.Release|Any CPU.Build.0 = Release|Any CPU + {8663EF88-08DE-4641-AAAE-9FBB54BFF66C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8663EF88-08DE-4641-AAAE-9FBB54BFF66C}.Debug|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/paradox-mod-merger/Diff.cs b/paradox-mod-merger/Diff.cs index c24e6d2..472dd3b 100644 --- a/paradox-mod-merger/Diff.cs +++ b/paradox-mod-merger/Diff.cs @@ -1,5 +1,6 @@ using diff_text; using DTLib.Dtsod; +using DTLib.XXHash; namespace ParadoxModMerger; @@ -70,9 +71,7 @@ static class Diff line_i = 0; for (int confl_i = 0; confl_i < conflicts.Length; confl_i++) { - if (confl_i == selected_confl_i) - lines[line_i].color = ConsoleColor.Blue; - else lines[line_i].color = ConsoleColor.White; + lines[line_i].color = confl_i == selected_confl_i ? ConsoleColor.Blue : ConsoleColor.White; line_i++; for (int mod_i = 0; mod_i < conflicts[confl_i].Mods.Length; mod_i++) @@ -207,9 +206,15 @@ static class Diff { if (filePathDiff.State == DiffState.Equal) { - Hasher hasher = new Hasher(); - string hash0=hasher.HashFile(Path.Concat(dir0, filePathDiff.Value)).HashToString(); - string hash1=hasher.HashFile(Path.Concat(dir1, filePathDiff.Value)).HashToString(); + ulong hash0, hash1; + using (var file0 = File.OpenRead(Path.Concat(dir0, filePathDiff.Value))) + { + hash0 = xxHash64.ComputeHash(file0); + } + using (var file1 = File.OpenRead(Path.Concat(dir1, filePathDiff.Value))) + { + hash1 = xxHash64.ComputeHash(file1); + } if (hash0 != hash1) yield return filePathDiff with { State = DiffState.Changed }; else yield return filePathDiff; diff --git a/paradox-mod-merger/IronyIntegration.cs b/paradox-mod-merger/IronyIntegration.cs index aca5dc7..b51d5dd 100644 --- a/paradox-mod-merger/IronyIntegration.cs +++ b/paradox-mod-merger/IronyIntegration.cs @@ -34,9 +34,9 @@ public static class IronyIntegration } } - if (name.IsNullOrEmpty()) + if (string.IsNullOrEmpty(name)) throw new NullReferenceException("name=null"); - if (remote_file_id.IsNullOrEmpty()) + if (string.IsNullOrEmpty(remote_file_id)) throw new NullReferenceException("remote_file_id=null"); mod_desc_values.Add((name,remote_file_id)!); Log("b",$"[{mod_desc_values.Count-1}] {{ ", "c", name!, "b", $", {remote_file_id!} }}"); diff --git a/paradox-mod-merger/Merge.cs b/paradox-mod-merger/Merge.cs index 42455c8..3e825e9 100644 --- a/paradox-mod-merger/Merge.cs +++ b/paradox-mod-merger/Merge.cs @@ -61,7 +61,7 @@ static class Merge while (true) { Log("y", question + " [y/n]"); - string answ = Program.YesAll ? "y" : ColoredConsole.Read("w").ToLower(); + string answ = Program.YesAll ? "y" : (ColoredConsole.Read("w") ?? "").ToLower(); if (answ == "y") { Log("c",$"answer: {answ}"); diff --git a/paradox-mod-merger/Program.cs b/paradox-mod-merger/Program.cs index e46256a..0dbfb39 100644 --- a/paradox-mod-merger/Program.cs +++ b/paradox-mod-merger/Program.cs @@ -8,7 +8,7 @@ global using DTLib; global using DTLib.Extensions; global using DTLib.Filesystem; global using DTLib.Logging; -global using DTLib.Ben.Demystifier; +global using DTLib.Demystifier; global using DTLib.Console; namespace ParadoxModMerger; diff --git a/paradox-mod-merger/paradox-mod-merger.csproj b/paradox-mod-merger/paradox-mod-merger.csproj index 28fbb18..65fafdd 100644 --- a/paradox-mod-merger/paradox-mod-merger.csproj +++ b/paradox-mod-merger/paradox-mod-merger.csproj @@ -10,9 +10,7 @@ paradox-mod-merger - - - +