// C o n s t r u c t o r public CustomObjectsManager(CustomObjectCollection collection, RomManager rommgr) { if (rommgr is object) { this.rommgr = rommgr; rommgr.AfterRomSave += Rommgr_AfterRomSave; } customObjectCollection = collection; // Components InitializeComponent(); UpdateAmbientColors(); layoutControl1.Enabled = false; TextBoxX_BehavAddr.Enabled = false; TextBoxX_ModelID.Enabled = false; ButtonItem_DeleteObject.Enabled = false; buttonItem_Export.Enabled = false; // Props-Timer Timer_PropsChanged = new Timer(1000) { SynchronizingObject = this, AutoReset = false }; Timer_PropsChanged.Elapsed += Timer_PropsChanged_Elapsed; }
private void ImportObjects(string[] filePaths) { var imports = new Dictionary <string, CustomObjectImport>(); foreach (var filePath in filePaths) { var import = CustomObjectCollection.LoadImport(filePath); import.Decompress(); imports.Add(Path.GetFileNameWithoutExtension(filePath), import); } ImportObjects(imports); }
// F e a t u r e s private async Task <IEnumerable <CustomObjectImport> > LoadLocalImports() { var tasks = new List <Task <CustomObjectImport> >(); var imports = new List <CustomObjectImport>(); var localPath = Publics.General.MyCustomObjectsPath; foreach (var filePath in Directory.GetFiles(localPath, "*.rmobj", SearchOption.AllDirectories)) { tasks.Add(Task.Run(() => CustomObjectCollection.LoadImport(filePath))); } foreach (var task in tasks) { imports.Add(await task); } return(imports); }
private void ExportObjects(string filePath, bool multiExport, string exportName) { var objs = GetSelectedCustomObjects(); var options = new CustomObjectExportOptions { ExportName = exportName, EmbeddedFiles = export_EmbeddedFiles, Script = export_Script }; if (multiExport) { foreach (var obj in objs) { var myFilePath = Path.Combine(filePath, obj.Name + ".rmobj"); CustomObjectCollection.Export(myFilePath, obj, options); } } else { CustomObjectCollection.Export(filePath, objs.ToArray(), options); } }