public void BuildDllFileList() { DllList.Clear(); foreach (var modFile in GetModFiles()) { var fileHash = Common.CalculateSha256FileHash(modFile); DllList.Add(GetRelativePath(modFile), fileHash); } }
public void BuildDllFileList() { DllList.Clear(); var checkList = Directory.GetFiles(CommonUtil.CombinePaths(Client.KspPath, "GameData"), "*", SearchOption.AllDirectories); foreach (var checkFile in checkList.Where(f => f.ToLower().EndsWith(".dll"))) { //We want the relative path to check against, example: LunaMultiPlayer/Plugins/LunaMultiPlayer.dll //Strip off everything from GameData //Replace windows backslashes with mac/linux forward slashes. //Make it lowercase so we don't worry about case sensitivity. var relativeFilePath = checkFile.ToLowerInvariant() .Substring(checkFile.ToLowerInvariant().IndexOf("gamedata", StringComparison.Ordinal) + 9) .Replace('\\', '/'); var fileHash = Common.CalculateSha256Hash(checkFile); DllList.Add(relativeFilePath, fileHash); LunaLog.Log($"[LMP]: Hashed file: {relativeFilePath}, hash: {fileHash}"); } }