Skip to content

Commit 2bd18a2

Browse files
committed
Order the assembly defined symbols before hashing - will save a bit of processing on some borderline situations where the symbols were defined in a different order due some unrelated issue (as KSPe's order of loading some DLLs)
1 parent de03760 commit 2bd18a2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Source/ModuleManager/MMPatchLoader.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,17 @@ private bool IsCacheUpToDate()
304304
sha.TransformBlock(pathBytes, 0, pathBytes.Length, pathBytes, 0);
305305
}
306306

307-
foreach (ModListGenerator.ModAddedByAssembly mod in modsAddedByAssemblies)
307+
// Hash the symbols added by Assemblies, as they impact the patching process.
308308
{
309-
byte[] modBytes = Encoding.UTF8.GetBytes(mod.modName);
310-
sha.TransformBlock(modBytes, 0, modBytes.Length, modBytes, 0);
309+
IEnumerable<string> symbols = from s in this.modsAddedByAssemblies
310+
orderby s.modName
311+
select s.modName
312+
;
313+
foreach (string symbol in symbols)
314+
{
315+
byte[] bytes = Encoding.UTF8.GetBytes(symbol);
316+
sha.TransformBlock(bytes, 0, bytes.Length, bytes, 0);
317+
}
311318
}
312319

313320
byte[] godsFinalMessageToHisCreation = Encoding.UTF8.GetBytes("Fork by Lisias.");

0 commit comments

Comments
 (0)