private void B_Save_Click(object sender, EventArgs e) { // Copy Bags int emptyslots = 0; for (int i = 0; i < 12; i++) { var bag = dataGridView1.Rows[i].Cells[1].Value.ToString(); if (Array.IndexOf(trba, bag) == 0) { emptyslots++; continue; } STB.SetBag(i - emptyslots, (byte)Array.IndexOf(trba, bag)); } if (float.TryParse(TB_Time1.Text, out var t1)) { SAV.SetData(BitConverter.GetBytes(t1), offsetTime + (4 * 30)); } if (float.TryParse(TB_Time2.Text, out var t2)) { SAV.SetData(BitConverter.GetBytes(t2), offsetTime + (4 * 31)); } SAV.SetData(BitConverter.GetBytes((ushort)WinFormsUtil.GetIndex(CB_S2)), offsetSpec + (4 * 30)); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { // Copy Bags byte[] bagarray = new byte[12]; int emptyslots = 0; for (int i = 0; i < 12; i++) { string bag = dataGridView1.Rows[i].Cells[1].Value.ToString(); if (Array.IndexOf(trba, bag) == 0) { emptyslots++; continue; } bagarray[i - emptyslots] = (byte)Array.IndexOf(trba, bag); } if (float.TryParse(TB_Time1.Text, out var t1)) { SAV.SetData(BitConverter.GetBytes(t1), offsetTime + (4 * 30)); } if (float.TryParse(TB_Time2.Text, out var t2)) { SAV.SetData(BitConverter.GetBytes(t2), offsetTime + (4 * 31)); } SAV.SetData(BitConverter.GetBytes((ushort)WinFormsUtil.GetIndex(CB_S2)), offsetSpec + (4 * 30)); bagarray.CopyTo(SAV.Data, SAV.SuperTrain + 0x308); Origin.SetData(SAV.Data, 0); Close(); }
private void B_Import_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() != DialogResult.OK) { return; } var path = ofd.FileName; if (new FileInfo(path).Length != SecretBase6.SIZE) { return; } var ofs = GetSecretBaseOffset(currentIndex); var data = File.ReadAllBytes(path); SAV.SetData(data, ofs); PopFavorite(); LB_Favorite.SelectedIndex = currentIndex; B_SAV2FAV(sender, e); // load back from current index }
private void B_Close_Click(object sender, EventArgs e) { Origin.SetData(data, SAV.HoF); Close(); }