private void btnLoad_Click(object sender, RoutedEventArgs e) { if (Communicator.Instance.Movesets == null) { MessageBox.Show("Please scan an moveset first!"); } else { Changelog l = ChangeSerializer.DeserializeChangelist(); if (l != null) { if (l.UCM != (short)comboBox1.SelectedValue) { MessageBox.Show("This Moveset Mod is not compatible with the selected Character!"); } //else if (l.MovesetCount != Communicator.Instance.Movesets.Count) // MessageBox.Show("The scanned moveset does not equal the moveset ram countwise.\r\n" + // "Please restart this tool and PCSX2 and rescan the moveset!"); else { Communicator.Instance.Changelog = l; } } } }
public static void SerializeChangelist(Changelog log) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "MSET RAM mod (*.msetram)|*.msetram"; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { using (Stream stream = File.Open(sfd.FileName, FileMode.Create)) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, log); } } }
public static Changelog DeserializeChangelist() { Changelog list = null; OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "MSET RAM mod (*.msetram)|*.msetram"; ofd.RestoreDirectory = true; if (ofd.ShowDialog() == DialogResult.OK) { using (Stream stream = File.Open(ofd.FileName, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); list = (Changelog)formatter.Deserialize(stream); } } return(list); }