protected override void AddEntries( Regex regex, string name, ProgressBar progressBar) { progressBar.Maximum = myNames.EntryCount; for (int i = 0; i < myNames.EntryCount; ++i) { NamesBINEntry entry = myNames.get_Entries(i); if (myRestriction.IsMatch(entry.Name)) { if (regex != null && regex.IsMatch(entry.Name)) { AddEntry( entry.Name, "", entry); } else if (name == entry.Name) { AddEntry( entry.Name, "", entry); } } progressBar.Value = i; progressBar.Update(); } }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { FormTextBox form = new FormTextBox(); form.labelInput.Text = "Input name:"; form.Text = "Names.BIN: New Entry"; if (form.ShowDialog() == DialogResult.OK) { NamesBINEntry entry = myNames.AddEntry(form.textBoxInput.Text); ListViewItem item = new ListViewItem(); item.Text = entry.Name; item.SubItems.Add(entry.Enum.ToString()); item.SubItems.Add(entry.Offset.ToString()); listViewEntries.Items.Add(item); listViewEntries.Sort(); } }
public void Build(NamesBINFile bin, Progress progress) { myNames = bin; progress.Begin(bin.EntryCount); for (int i = 0; i < bin.EntryCount; ++i) { NamesBINEntry entry = bin.get_Entries(i); ListViewItem item = new ListViewItem(); item.Text = entry.Name; item.SubItems.Add(entry.Enum.ToString()); item.SubItems.Add(entry.Offset.ToString()); listViewEntries.Items.Add(item); progress.Update(); } progress.End(); }
/// <summary> /// Select a game object. /// </summary> /// <param name="dst"></param> /// <param name="current"></param> /// <returns>Returns an object depending on the link type</returns> public override object SelectEntry( Link link, object current) { if (link.To == LinkDestination.NamesBINOffset) { if (AutoLoadNames()) { NamesBINEntry entry = Names.GetEntryByOffset( uint.Parse(current.ToString())); string curr = ""; if (entry != null) { curr = entry.Name; } FormSelectNamesEntry form = new FormSelectNamesEntry( Names, curr, link.Restriction); if (form.ShowDialog() == DialogResult.OK) { entry = form.Selected; form.Dispose(); return(entry.Offset); } form.Dispose(); } } else if (link.To == LinkDestination.NamesBINEnum) { if (AutoLoadNames()) { NamesBINEntry entry = Names.GetEntryByEnum( uint.Parse(current.ToString())); string curr = ""; if (entry != null) { curr = entry.Name; } FormSelectNamesEntry form = new FormSelectNamesEntry( Names, curr, link.Restriction); if (form.ShowDialog() == DialogResult.OK) { entry = form.Selected; form.Dispose(); return(entry.Enum); } form.Dispose(); } } else if (link.To == LinkDestination.GameBINEntryName) { if (AutoLoadObjects()) { FormSelectBINEntry form = new FormSelectBINEntry( Objects, current.ToString()); form.CDefType = link.Restriction; if (form.ShowDialog() == DialogResult.OK) { BINEntry entry = form.Selected; form.Dispose(); return(entry.Name); } form.Dispose(); } } else if (link.To == LinkDestination.GameBINEntryID) { if (AutoLoadObjects()) { ContentObject o = FindEntry( link.To, UInt32.Parse(current.ToString())); FormSelectBINEntry form = new FormSelectBINEntry( Objects, o.Name); form.CDefType = link.Restriction; if (form.ShowDialog() == DialogResult.OK) { BINEntry entry = form.Selected; form.Dispose(); return(entry.ID); } form.Dispose(); } } else if (link.To == LinkDestination.ModelID) { if (AutoLoadGraphics()) { ContentObject o = FindEntry( link.To, UInt32.Parse(current.ToString())); FormSelectBIGEntry form = null; if (o != null) { form = new FormSelectBIGEntry( GraphicsBank, link.To, o.Name); } else { form = new FormSelectBIGEntry( GraphicsBank, link.To, null); } if (form.ShowDialog() == DialogResult.OK) { AssetEntry entry = form.Selected; form.Dispose(); return(entry.ID); } form.Dispose(); } } else if (link.To == LinkDestination.MainTextureID) { if (AutoLoadTextures()) { ContentObject o = FindEntry( link.To, UInt32.Parse(current.ToString())); FormSelectBIGEntry form = null; if (o != null) { form = new FormSelectBIGEntry( MainTextureBank, link.To, o.Name); } else { form = new FormSelectBIGEntry( MainTextureBank, link.To, null); } if (form.ShowDialog() == DialogResult.OK) { AssetEntry entry = form.Selected; form.Dispose(); return(entry.ID); } form.Dispose(); } } else if (link.To == LinkDestination.GUITextureID) { if (AutoLoadTextures()) { ContentObject o = FindEntry( link.To, UInt32.Parse(current.ToString())); FormSelectBIGEntry form = null; if (o != null) { form = new FormSelectBIGEntry( GUITextureBank, link.To, o.Name); } else { form = new FormSelectBIGEntry( GUITextureBank, link.To, null); } if (form.ShowDialog() == DialogResult.OK) { AssetEntry entry = form.Selected; form.Dispose(); return(entry.ID); } form.Dispose(); } } else if (link.To == LinkDestination.FrontEndTextureID) { if (AutoLoadFrontEndTextures()) { ContentObject o = FindEntry( link.To, UInt32.Parse(current.ToString())); FormSelectBIGEntry form = null; if (o != null) { form = new FormSelectBIGEntry( FrontEndTextureBank, link.To, o.Name); } else { form = new FormSelectBIGEntry( FrontEndTextureBank, link.To, null); } if (form.ShowDialog() == DialogResult.OK) { AssetEntry entry = form.Selected; form.Dispose(); return(entry.ID); } form.Dispose(); } } else if (link.To == LinkDestination.ModelName) { if (AutoLoadGraphics()) { FormSelectBIGEntry form = new FormSelectBIGEntry( GraphicsBank, link.To, current.ToString()); if (form.ShowDialog() == DialogResult.OK) { AssetEntry entry = form.Selected; form.Dispose(); return(entry.DevSymbolName); } form.Dispose(); } } return(null); }