public void ImportFile(string path) { open_archive = ZipArchive.Open(path); file_path = path; manifest = new Manifest(); bool md5_validity = true; foreach (var entry in open_archive.Entries) { if (entry.Key.StartsWith("data/")) { string data_path = $".check/{entry.Key.Substring("data/".Length)}.md5"; try { ZipArchiveEntry check_entry = open_archive.Entries.Get(data_path); string check_md5 = entry.GetMD5().Substring(0, 32); string data_md5 = check_entry.ReadContent().Substring(0, 32); md5_validity &= check_entry != null && data_md5.Equals(check_md5, StringComparison.InvariantCultureIgnoreCase); } catch (Exception) { md5_validity = false; } } else if (string.Equals(entry.Key, "manifest", StringComparison.InvariantCultureIgnoreCase)) { manifest = JsonConvert.DeserializeObject <Manifest>(entry.ReadContent()); } } BannerBackground.Visible = !md5_validity; TemplateCheck.Checked = false; SetDisplayedInfo(); }