protected override void AddEntries( Regex regex, string name, ProgressBar progressBar) { progressBar.Maximum = myBIN.EntryCount; List <string> types = null; if (!string.IsNullOrEmpty(myCDef)) { types = new List <string>(myCDef.Split(';')); } for (int i = 0; i < myBIN.EntryCount; ++i) { BINEntry entry = myBIN.get_Entries(i); if ((regex != null && regex.IsMatch(entry.Name)) || name == entry.Name) { if (types == null || types.IndexOf(entry.Definition) >= 0) { AddEntry( entry.Name, "", entry); } } progressBar.Value = i; progressBar.Update(); } }
public void Build(BINFile bin, Progress progress) { myBIN = bin; progress.Begin(bin.EntryCount); for (int i = 0; i < bin.EntryCount; ++i) { AddEntry(bin.get_Entries(i)); progress.Update(); } progress.End(); }
private void FindModified(BINFile bin, Progress progress) { progress.Begin(bin.EntryCount); for (int i = 0; i < bin.EntryCount; ++i) { BINEntry entry = bin.get_Entries(i); if (entry.Modified) { myObjects.Add( FileDatabase.Instance.GetContentObject(entry)); } progress.Update(); } progress.End(); }
/// <summary> /// Convert the combobox item string into BINEntry. /// </summary> /// <param name="comboItem"></param> /// <returns></returns> private BINEntry GetBINEntry(string comboItem) { BINEntry entry = myGameBin.GetEntryByName(comboItem); if (entry == null) { // CDef might just be the ID. try { entry = myGameBin.get_Entries( int.Parse(comboItem.ToString())); } catch (Exception) { } } return(entry); }
public override void Run(Progress progress) { string fileFormat = Settings.GetString( "BIN", "DumpFormat", "ID-NAME.dat"); progress.Begin(myBIN.EntryCount); for (int i = 0; i < myBIN.EntryCount; ++i) { BINEntry entry = myBIN.get_Entries(i); string name = "UNTITLED"; if (entry.Name != "") { name = entry.Name; } string filename = fileFormat; filename = filename.Replace("ID", string.Format("{0:D5}", entry.ID)); filename = filename.Replace("NAME", name); filename = filename.Replace("DEFINITION", entry.Definition); progress.Info = filename; using (BinaryWriter writer = new BinaryWriter( new FileStream(myFolder + "\\" + filename, FileMode.Create))) { writer.Write(entry.Data, 0, entry.Data.Length); writer.Close(); } progress.Update(); } progress.End(); }