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);
 }
예제 #2
0
 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);
        }
예제 #4
0
 public void addEntry(BgmEntry entry)
 {
     addEntry(entry, entries.Count);
 }
예제 #5
0
 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);
         }
     }
 }
예제 #6
0
 public void removeEntry(BgmEntry entry)
 {
     if (entries.Remove(entry))
     {
         if (entryIds.ContainsKey(entry.id))
         {
             entryIds.Remove(entry.id);
         }
     }
 }
예제 #7
0
 public void moveEntry(BgmEntry entry, int position)
 {
     removeEntry(entry);
     addEntry(entry, position);
 }
예제 #8
0
 public FormBgmEntry(BgmEntry entry)
 {
     this.entry = entry;
     this.bgmTitle = "New entry";
 }