private void button1_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { XBoxIDFilePath.Text = tempOpen.FileName(); try { ID = new XBoxUniqueID(tempOpen.FileName()); ProfileBox.Text = ID.ProfileID.ToString("X"); DeviceBox.Text = BitConverter.ToString(ID.DeviceID); DeviceBox.Text = DeviceBox.Text.Replace("-", ""); } catch { ID = null; MessageBox.Show("The file is not a valid Xbox 360 savegame file."); return; } } }
private void Open_Click(object sender, EventArgs e) { string fileName = (CurrentWSG != null) ? CurrentWSG.OpenedWsg : ""; Util.WTOpenFileDialog openDlg = new Util.WTOpenFileDialog("sav", fileName); if (openDlg.ShowDialog() == DialogResult.OK) { fileName = openDlg.FileName(); PluginManager.OnGameLoading(new PluginEventArgs(this, fileName)); Application.DoEvents(); CurrentWSG = new WillowSaveGame(); CurrentWSG.AutoRepair = true; CurrentWSG.LoadWsg(fileName); if (CurrentWSG.RequiredRepair == true) { DialogResult result = MessageBox.Show( "Your savegame contains corrupted data so it cannot be loaded. " + "It is possible to discard the invalid data to repair your savegame " + "so that it can be opened. Repairing WILL CAUSE SOME DATA LOSS but " + "should bring your savegame back to a working state.\r\n\r\nDo you want to " + "repair the savegame?", "Recoverable Corruption Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (result == DialogResult.No) { throw new FileFormatException("Savegame file is corrupt."); } } ConvertListForEditing(db.WeaponList, ref CurrentWSG.Weapons); ConvertListForEditing(db.ItemList, ref CurrentWSG.Items); ConvertListForEditing(db.BankList, ref CurrentWSG.Dlc.BankInventory); PluginManager.OnGameLoaded(new PluginEventArgs(this, fileName)); Save.Enabled = true; SaveAs.Enabled = true; SelectFormat.Enabled = true; } else { fileName = ""; } }