Пример #1
0
 private void LoadSave(string saveFileName)
 {
     _sav = StructUtils.RawDeserialize <XYSav>(saveFileName);
     //_sav = StructUtils.RawDeserialize<ORASSav>(saveFileName);
     _sav.PCStorageSystem.Boxes.SelectMany(box => box.Pokemon).ToList().ForEach(pokemon => pokemon.Decrypt());
     _boxenamesBindingSource.DataSource = _sav.PCStorageBoxNames.Boxes;
     _boxenamesBindingSource.DataSource = _sav.PCStorageBoxNames.Boxes;
     _boxesBindingSource.DataSource     = _sav.PCStorageSystem.Boxes;
     _boxenamesCurrencyManager          = _boxenamesBindingSource.CurrencyManager;
     _boxesCurrencyManager            = _boxesBindingSource.CurrencyManager;
     _pokemonBindingSource.DataSource = _boxesCurrencyManager.Current;
     for (var slot = 0; slot < 30; slot++)
     {
         pbSlots[slot].DataBindings.Clear();
         pbSlots[slot].DataBindings.Add("Image", _pokemonBindingSource[slot], "BoxIconEgg", true, DataSourceUpdateMode.Never, null);
     }
     comboBoxes.DataBindings.Clear();
     textBoxName.DataBindings.Clear();
     comboBoxes.DataSource = _boxenamesBindingSource;
     comboBoxes.DataBindings.Add("SelectedIndex", _sav, "CurrentBox", false, DataSourceUpdateMode.OnPropertyChanged, -1);
     textBoxName.DataBindings.Add("Text", _boxenamesBindingSource, "Name", false, DataSourceUpdateMode.OnValidation, "");
     dgPokemon.DataSource = _sav.PCStorageSystem.Boxes.SelectMany(box => box.Pokemon).Where(pokemon => pokemon.Species != Species.NoSpecies).ToArray();
 }