public void init(byte[] save) { if (save == null) { BugCheck.bug_check(BugCheck.ErrorCode.VIEWMODEL_NULL_SAVE, "The save file reference is NULL."); } _model = save; _character = new Character(_model); _items = Item.read_all_items(_model); _monsters = new ObservableCollection <Monster>(Monster.read_all_monsters(_model)); _egg_fragments = EggFragment.read_all_egg_fragments(_model); _talismans = Talisman.read_all_talismans(_model); _weapons = Weapon.read_all_weapons(_model); _armors = Armor.read_all_armors(_model); _eggs = Egg.read_all_eggs(_model); }
private void button_eggs_export_Click(object sender, RoutedEventArgs e) { if (this.egg_grid.SelectedItem == null) { MessageBox.Show("Please select an egg.", "MHSEC-G", MessageBoxButton.OK); } else { Egg theEgg = egg_grid.SelectedItem as Egg; SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Binary files (*.bin)|*.bin|All files (*.*)|*.*"; dialog.Title = "Please select the export location."; dialog.FileName = "egg_" + theEgg.spe + ".bin"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { byte[] binary = theEgg.toByteArray(); File.WriteAllBytes(dialog.FileName, binary); MessageBox.Show("Exported to \"" + dialog.FileName + "\"", "MHSEC-G", MessageBoxButton.OK, MessageBoxImage.Information); } } }