private void bgmGenAddButton_Click(object sender, EventArgs e) { // Add a new element BgmEntry bgmEntry = new BgmEntry(); FormBgmEntry newEntry = new FormBgmEntry(bgmEntry); bgmFormEntries.Insert(currentBgmIndex + 1, newEntry); bgmGenBgmListBox.SetSelected(currentBgmIndex + 1, true); }
public void addEntry(BgmEntry entry, int position) { // Add it to the array if (position > entries.Count) { return; } else if (position == entries.Count) { entries.Add(entry); } else { entries.Insert(position, entry); } // Add to the entryIds hash if it has an ID set != Int16.MaxValue if (entry.id != UInt16.MaxValue) { entryIds.Add(entry.id, entry.internalFileName); } }
private void bgmGenNewButton_Click(object sender, EventArgs e) { BindingList<FormBgmEntry> newBgmFormEntries = new BindingList<FormBgmEntry>(); // Setup slot to 1 by default bgmGenDlcSlotComboBox.SelectedIndex = 0; // Add new dummy entry and select it BgmEntry bgmEntry = new BgmEntry(); FormBgmEntry newEntry = new FormBgmEntry(bgmEntry); newBgmFormEntries.Add(newEntry); bindDataAndEnableForm(newBgmFormEntries); }
public void addEntry(BgmEntry entry) { addEntry(entry, entries.Count); }
private void createFromStream(Stream stream) { using (BinaryReader reader = new BinaryReader(stream)) { header = reader.ReadUInt64(); if (header != BGM_TABLE_HEADER_VALUE) { // Throw exception if needed throw new Exception("Not a valid BGM table file"); } UInt32 entryNumber = reader.ReadUInt32(); reader.ReadUInt32(); for (int i = 0; i < entryNumber; i++) { BgmEntry entry = new BgmEntry(reader); entries.Add(entry); // Save id & internal name entryIds.Add(entry.id, entry.internalFileName); } } }
public void removeEntry(BgmEntry entry) { if (entries.Remove(entry)) { if (entryIds.ContainsKey(entry.id)) { entryIds.Remove(entry.id); } } }
public void moveEntry(BgmEntry entry, int position) { removeEntry(entry); addEntry(entry, position); }
public FormBgmEntry(BgmEntry entry) { this.entry = entry; this.bgmTitle = "New entry"; }