public static void LoadData(ref frmInitializing iFrm) { DatabaseAPI.LoadDatabaseVersion(); IsAppInitialized = true; iFrm?.SetMessage("Loading Data..."); iFrm?.SetMessage("Loading Attribute Modifiers..."); DatabaseAPI.Database.AttribMods = new Modifiers(); if (!DatabaseAPI.Database.AttribMods.Load()) { } iFrm?.SetMessage("Loading Powerset Database..."); if (!DatabaseAPI.LoadLevelsDatabase()) { MessageBox.Show("Unable to proceed, failed to load leveling data! We suggest you re-download the application from https://github.com/Reborn-Team/Hero-Designer/releases.", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } if (!DatabaseAPI.LoadMainDatabase()) { MessageBox.Show(@"There was an error reading the database. Aborting!", @"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } if (!DatabaseAPI.LoadMaths()) { Application.Exit(); } iFrm?.SetMessage("Loading Global Chance Modifiers..."); if (!DatabaseAPI.LoadEffectIdsDatabase()) { Application.Exit(); } iFrm?.SetMessage("Loading Enhancement Database..."); if (!DatabaseAPI.LoadEnhancementClasses()) { Application.Exit(); } DatabaseAPI.LoadEnhancementDb(); DatabaseAPI.LoadOrigins(); DatabaseAPI.LoadSetTypeStrings(); iFrm?.SetMessage("Loading Recipe Database..."); DatabaseAPI.LoadSalvage(); DatabaseAPI.LoadRecipes(); iFrm?.SetMessage("Loading Graphics..."); var taskArray = new Task[9]; taskArray[0] = Task.Run(I9Gfx.LoadOriginImages); taskArray[1] = Task.Run(I9Gfx.LoadArchetypeImages); taskArray[2] = Task.Run(I9Gfx.LoadPowersetImages); taskArray[3] = Task.Run(I9Gfx.LoadEnhancements); taskArray[4] = Task.Run(I9Gfx.LoadSets); taskArray[5] = Task.Run(I9Gfx.LoadBorders); taskArray[6] = Task.Run(I9Gfx.LoadSetTypes); taskArray[7] = Task.Run(I9Gfx.LoadEnhTypes); taskArray[8] = Task.Run(I9Gfx.LoadClasses); Task.WaitAll(taskArray); MidsContext.Config.Export.LoadCodes(Files.SelectDataFileLoad(Files.MxdbFileBbCodeUpdate)); if (iFrm != null) { //iFrm.Opacity = 1.0; DatabaseAPI.MatchAllIDs(iFrm); iFrm?.SetMessage("Matching Set Bonus IDs..."); DatabaseAPI.AssignSetBonusIndexes(); iFrm?.SetMessage("Matching Recipe IDs..."); } DatabaseAPI.AssignRecipeIDs(); GC.Collect(); }
public static void LoadData(ref frmLoading iFrm) { DatabaseAPI.LoadDatabaseVersion(); IsAppInitialized = true; iFrm?.SetMessage("Loading Data..."); iFrm?.SetMessage("Loading Attribute Modifiers..."); DatabaseAPI.Database.AttribMods = new Modifiers(); if (!DatabaseAPI.Database.AttribMods.Load()) { } iFrm?.SetMessage("Loading Powerset Database..."); if (!DatabaseAPI.LoadLevelsDatabase()) { Interaction.MsgBox( "Failed to load Leveling data file! The program is unable to proceed.\r\n" + "We suggest you redownload the application from https://github.com/Crytilis/mids-reborn-hero-designer/releases", MsgBoxStyle.Critical, "Error"); ProjectData.EndApp(); } if (!DatabaseAPI.LoadMainDatabase()) { Interaction.MsgBox("There was an error reading the database. Aborting.", MsgBoxStyle.Critical, "Dang"); ProjectData.EndApp(); } if (!DatabaseAPI.LoadMaths()) { ProjectData.EndApp(); } iFrm?.SetMessage("Loading Enhancement Database..."); if (!DatabaseAPI.LoadEnhancementClasses()) { ProjectData.EndApp(); } I9Gfx.LoadClasses(); DatabaseAPI.LoadEnhancementDb(); I9Gfx.LoadEnhancements(); I9Gfx.LoadSets(); DatabaseAPI.LoadOrigins(); I9Gfx.LoadBorders(); DatabaseAPI.LoadSetTypeStrings(); iFrm?.SetMessage("Loading Recipe Database..."); DatabaseAPI.LoadSalvage(); DatabaseAPI.LoadRecipes(); iFrm?.SetMessage("Loading Graphics..."); I9Gfx.LoadSetTypes(); I9Gfx.LoadEnhTypes(); I9Gfx.LoadOriginImages(); I9Gfx.LoadArchetypeImages(); I9Gfx.LoadPowersetImages(); MidsContext.Config.Export.LoadCodes(Files.SelectDataFileLoad(Files.MxdbFileBbCodeUpdate)); if (iFrm != null) { iFrm.Opacity = 1.0; DatabaseAPI.MatchAllIDs(iFrm); iFrm?.SetMessage("Matching Set Bonus IDs..."); DatabaseAPI.AssignSetBonusIndexes(); iFrm?.SetMessage("Matching Recipe IDs..."); } DatabaseAPI.AssignRecipeIDs(); GC.Collect(); }
public static void LoadData(ref frmLoading iFrm) { DatabaseAPI.LoadDatabaseVersion(); MainModule.MidsController._appInitialized = true; if (iFrm != null) { iFrm.SetMessage("Loading Data..."); } if (iFrm != null) { iFrm.SetMessage("Loading Attribute Modifiers..."); } DatabaseAPI.Database.AttribMods = new Modifiers(); DatabaseAPI.Database.AttribMods.Load(); if (iFrm != null) { iFrm.SetMessage("Loading Powerset Database..."); } if (!DatabaseAPI.LoadLevelsDatabase()) { Interaction.MsgBox("Failed to load Levelling data file! The program is unable to proceed.\r\nSuggest you redownload the application from http://www.cohplanner.com/", MsgBoxStyle.Critical, "Error"); ProjectData.EndApp(); } if (!DatabaseAPI.LoadMainDatabase()) { if (Interaction.MsgBox("There was an error reading the database. Attempt to download replacement?", MsgBoxStyle.YesNo | MsgBoxStyle.Information, "Dang") == MsgBoxResult.Yes) { DateTime date = new DateTime(1, 1, 1); DatabaseAPI.Database.Date = date; clsXMLUpdate clsXmlUpdate = new clsXMLUpdate("http://repo.cohtitan.com/mids_updates/"); IMessager iLoadFrm = null; clsXmlUpdate.UpdateCheck(false, ref iLoadFrm); } else { ProjectData.EndApp(); } } if (!DatabaseAPI.LoadMaths()) { ProjectData.EndApp(); } if (iFrm != null) { iFrm.SetMessage("Loading Enhancement Database..."); } if (!DatabaseAPI.LoadEnhancementClasses()) { ProjectData.EndApp(); } I9Gfx.LoadClasses(); DatabaseAPI.LoadEnhancementDb(); I9Gfx.LoadEnhancements(); I9Gfx.LoadSets(); DatabaseAPI.LoadOrigins(); I9Gfx.LoadBorders(); DatabaseAPI.LoadSetTypeStrings(); if (iFrm != null) { iFrm.SetMessage("Loading Recipe Database..."); } DatabaseAPI.LoadSalvage(); DatabaseAPI.LoadRecipes(); if (iFrm != null) { iFrm.SetMessage("Loading Graphics..."); } I9Gfx.LoadSetTypes(); I9Gfx.LoadEnhTypes(); I9Gfx.LoadOriginImages(); I9Gfx.LoadArchetypeImages(); I9Gfx.LoadPowersetImages(); MidsContext.Config.Export.LoadCodes(Files.SelectDataFileLoad("BBCode.mhd")); iFrm.Opacity = 1.0; DatabaseAPI.MatchAllIDs(iFrm); if (iFrm != null) { iFrm.SetMessage("Matching Set Bonus IDs..."); } DatabaseAPI.AssignSetBonusIndexes(); if (iFrm != null) { iFrm.SetMessage("Matching Recipe IDs..."); } DatabaseAPI.AssignRecipeIDs(); GC.Collect(); }