private void btnLoadSave_Click(object sender, EventArgs e) { // Pick the file dlgLoadSave.ShowDialog(); if (dlgLoadSave.SafeFileName == null || dlgLoadSave.SafeFileName.Equals("")) { return; } _qualifiedFilename = dlgLoadSave.FileName; // Determine whether or not it is encrypted (done automatically by decryption method) // Decrypt if neccessary var inputFile = File.ReadAllText(dlgLoadSave.FileName); var workingData = CryptoHandler.GetDecryptedSave(inputFile); // Determine if the file is a valid fallout shelter save try { if (!SaveValidator.IsValidSave(workingData)) { MessageBox.Show(@"Unknown error when loading " + dlgLoadSave.SafeFileName + @". The file is most likely corrupt or invalid."); return; } } catch (Exception) { MessageBox.Show(@"Unknown error when loading " + dlgLoadSave.SafeFileName + @". The file is most likely corrupt or invalid."); return; } // Load the save into a new VaultData object vaultData = new VaultDataInterface(workingData); // Parse VaultData object into form controls PopulateVaultData(); // Enable form controls dgridDwellers.Enabled = true; numCaps.Enabled = true; numLunchBox.Enabled = true; numHandyBox.Enabled = true; numStimpak.Enabled = true; numRadaway.Enabled = true; numudEnergy.Enabled = true; numudFood.Enabled = true; numudWater.Enabled = true; numudPetCarriers.Enabled = true; numudNukaQuantums.Enabled = true; numudStarterPacks.Enabled = true; btnSaveEncrypted.Enabled = true; btnSaveJson.Enabled = true; }