0) { Array.Resize(ref lines, lines.Length + 1); } lineIndex = lines.Length - 1; // End with new line Array.Resize(ref lines, lines.Length + 1); } lines[lineIndex] = newLine; File.WriteAllLines(checkFile, lines); } catch (Exception ex) { Log.LogWarningFromException(ex, showStackTrace: false); } } private int GetCheckFileLineIndexSha256(string[] lines, string name, out string sha256) { for (int i = 0; i < lines.Length; i++) { string line = lines[i]; string[] lineParts = line.Split('='); if (lineParts.Length == 2) { string lineTag = lineParts[0].Trim(); string lineSha256 = lineParts[1].Trim(); if (lineTag == name) { sha256 = lineSha256; return i; } } } sha256 = null; return -1; } private bool CheckFileSha256(string file, string expectedSha256, out string actualSha256) { using (var fs = new FileStream(file, FileMode.Open)) { var hasher = System.Security.Cryptography.SHA256.Create(); byte[] hash = hasher.ComputeHash(fs); actualSha256 = BytesToHexString(hash); if (String.Equals(actualSha256, expectedSha256, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private string BytesToHexString(byte[] data) { var sb = new StringBuilder(); foreach (byte b in data) { sb.Append(b.ToString("x2")); } return sb.ToString(); } private static void ExtractZip(string zipPath, string destinationDirectory, bool overwrite) { var archive = ZipFile.OpenRead(zipPath); if (!overwrite) { archive.ExtractToDirectory(destinationDirectory); return; } foreach (ZipArchiveEntry file in archive.Entries) { string fileName = Path.Combine(destinationDirectory, file.FullName); string directory = Path.GetDirectoryName(fileName); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } if (file.Name != String.Empty) { file.ExtractToFile(fileName, true); } } } ]]> $(MsBuildThisFileDirectory) $(RootDir).dependencies $(RootDir)assets.json https://github.com/OpenRCT2/Dependencies/releases/download/v41/openrct2-libs-v41-arm64-windows-static.zip 5d171f23eee584bdc29b1186dc7a86d935a6ea58efa42b5674c196c5b581923b https://github.com/OpenRCT2/Dependencies/releases/download/v41/openrct2-libs-v41-x64-windows-static.zip 8e78f1c3c09c50cb0f509eab6845a93dd69771ff95cdf82d747568093d138f73 https://github.com/OpenRCT2/Dependencies/releases/download/v41/openrct2-libs-v41-x86-windows-static.zip 490263b873dd02c13a043a04d26bb9837d2d378dacd8b2c8d29660fef44db3db