private void CheckPackageForUpdatedLauncher() { List <UpdateItem> filesInPackage = AutoUpdateManager.GetFilesInUpdatePackage(txtPackageName.Text); UpdateItem launcherInstance = filesInPackage.FirstOrDefault(p => p.Name.ToLower() == "launcher.exe"); if (launcherInstance != null) { // Create new launcher hash. using (SHA256Managed sha = new SHA256Managed()) using (FileStream fs = File.Open(launcherInstance.FileInfo.FullName, FileMode.Open, FileAccess.Read)) { byte[] hash; if (Settings.Default.UseDebugBlackBox == true) { hash = new byte[] { 0x37, 0x61, 0xA7, 0x4B, 0x7E, 0x31, 0xC8, 0x5E, 0xD1, 0xC0, 0xF7, 0xB3, 0x95, 0xD4, 0x7E, 0x64, 0xB9, 0xC3, 0x22, 0xED, 0x2F, 0x6F, 0xF8, 0xEB, 0x4D, 0xA1, 0x00, 0x9A, 0x35, 0xE5, 0x10, 0x19 }; } else { hash = sha.ComputeHash(fs); } File.WriteAllBytes(Settings.Default.KnownHashLocation, hash); } // Invalidate all existing blackboxes to force regeneration of key tokens. using (CSSDataContext db = new CSSDataContext()) { // TODO: Is there a LINQ native way to do this? db.ExecuteCommand("UPDATE ActiveKey SET IsValid = 0"); db.SubmitChanges(); } } }