public void PopulateData(byte[] InputData, int savindex) { SaveData = new byte[InputData.Length]; Array.Copy(InputData, SaveData, InputData.Length); PokemonList PL = new PokemonList(); SaveGames.SaveStruct SaveGame = new SaveGames.SaveStruct("XY"); if (savindex > 1) { savindex = 0; } for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = 0x27A00 + 0x7F000 * savindex + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new Byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); PKX pkm = new PKX(dslotdata); if ((pkm.EC == "00000000") && (pkm.Species == "---")) { continue; } PL.Add(pkm); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; }
public void PopulateData(PKM[] Data) { SuspendLayout(); BoxBar.Step = 1; PokemonList PL = new PokemonList(); foreach (PKM pkm in Data.Where(pkm => pkm.ChecksumValid && pkm.Species != 0)) { pkm.Stat_Level = PKX.getLevel(pkm.Species, pkm.EXP); // recalc Level PL.Add(new Preview(pkm)); BoxBar.PerformStep(); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = Data.Length + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; ResumeLayout(); }
public void AddPokemon() { try { PokemonList.Add(new Pokemon(PokemonName, PokemonType, new Statistics(Int32.Parse(PokemonHP), Int32.Parse(PokemonATK), Int32.Parse(PokemonDEF)), PokemonEvolutionList)); } catch (Exception e) { MessageBox.Show(e.ToString()); } this.CloseWindow(); }
public void PopulateData(byte[] InputData, int savindex, int baseoffset) { SaveData = new byte[InputData.Length]; Array.Copy(InputData, SaveData, InputData.Length); PokemonList PL = new PokemonList(); PKX.Structures.SaveGame SaveGame = new PKX.Structures.SaveGame("XY"); if (savindex > 1) { savindex = 0; } BoxBar.Maximum = 930 + 100; BoxBar.Step = 1; for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = baseoffset + 0x7F000 * savindex + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { BoxBar.PerformStep(); int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) { continue; } string Identifier = String.Format("B{0}:{1}", BoxNum.ToString("00"), SlotNum.ToString("00")); PKX pkm = new PKX(dslotdata, Identifier); if ((pkm.EC == "00000000") && (pkm.Species == "---")) { continue; } PL.Add(pkm); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = 930 + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }
public void PopulateData(byte[] InputData, int BoxDataOffset) { SaveData = (byte[])InputData.Clone(); PokemonList PL = new PokemonList(); BoxBar.Maximum = 930 + 100; BoxBar.Step = 1; for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = BoxDataOffset + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { BoxBar.PerformStep(); int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) { continue; } string Identifier = String.Format("B{0}:{1}", (BoxNum + 1).ToString("00"), (SlotNum + 1).ToString("00")); PK6 pkm = new PK6(dslotdata, Identifier); if ((pkm.EncryptionConstant == 0) && (pkm.Species == 0)) { continue; } if (pkm.Checksum != pkm.CalculateChecksum()) { continue; } PL.Add(new Preview(pkm)); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = 930 + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }
public void PopulateData(IList <SlotCache> Data) { SuspendLayout(); var PL = new PokemonList <EntitySummaryImage>(); var strings = GameInfo.Strings; foreach (var entry in Data) { var pkm = entry.Entity; if ((uint)(pkm.Species - 1) >= pkm.MaxSpeciesID) { continue; } pkm.Stat_Level = pkm.CurrentLevel; // recalc Level PL.Add(new EntitySummaryImage(pkm, strings, entry.Identify())); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; for (int i = 0; i < dgData.Columns.Count; i++) { var col = dgData.Columns[i]; if (col is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } col.SortMode = DataGridViewColumnSortMode.Automatic; } // Trigger Resizing dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; for (int i = 0; i < dgData.Columns.Count; i++) { int w = dgData.Columns[i].Width; dgData.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; dgData.Columns[i].Width = w; } dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; Data_Sorted(this, EventArgs.Empty); // trigger row resizing ResumeLayout(); }
public void PopulateData(IList <PKM> Data) { SuspendLayout(); BoxBar.Step = 1; var PL = new PokemonList <PKMPreview>(); var strings = GameInfo.Strings; foreach (PKM pkm in Data.Where(pkm => pkm.ChecksumValid && pkm.Species != 0)) { pkm.Stat_Level = Experience.GetLevel(pkm.EXP, pkm.Species, pkm.AltForm); // recalc Level PL.Add(new PKMPreview(pkm, strings)); BoxBar.PerformStep(); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = Data.Count + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; // Trigger Resizing dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; for (int i = 0; i < dgData.Columns.Count; i++) { int w = dgData.Columns[i].Width; dgData.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; dgData.Columns[i].Width = w; } dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; Data_Sorted(null, EventArgs.Empty); // trigger row resizing ResumeLayout(); }
public void PopulateData(PK6[] data) { BoxBar.Step = 1; PokemonList PL = new PokemonList(); foreach (PK6 p in data) { PL.Add(new Preview(p)); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = data.Length + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }