bool ProcessImport() { int num1 = 0; int num2 = lstImport.Items.Count - 1; for (int index = 0; index <= num2 - 1; ++index) { if (!lstImport.Items[index].Checked) { continue; } ImportBuffer[Convert.ToInt32(lstImport.Items[index].Tag)].Apply(); ++num1; } if (Interaction.MsgBox("Check for deleted powers?", MsgBoxStyle.YesNo, "Additional Check") == MsgBoxResult.Yes) { int[] pList = CheckForDeletedPowers(); if (pList.Length > 0 && Interaction.MsgBox((Convert.ToString(pList.Length) + " deleted powers found. Delete them?"), MsgBoxStyle.YesNo, "Additional Check") == MsgBoxResult.Yes) { DeletePowers(pList); } } DatabaseAPI.Database.PowerVersion.SourceFile = dlgBrowse.FileName; DatabaseAPI.Database.PowerVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerVersion.Revision = Convert.ToInt32(udRevision.Value); DatabaseAPI.MatchAllIDs(); var serializer = MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); Interaction.MsgBox(("Import of " + Convert.ToString(num1) + " records completed!"), MsgBoxStyle.Information, "Done"); DisplayInfo(); return(false); }
bool ProcessImport() { bool flag = false; int num1 = 0; int num2 = this.lstImport.Items.Count - 1; for (int index = 0; index <= num2; ++index) { if (this.lstImport.Items[index].Checked) { this.ImportBuffer[Conversions.ToInteger(this.lstImport.Items[index].Tag)].Apply(); ++num1; } } DatabaseAPI.Database.PowersetVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.PowersetVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowersetVersion.Revision = Convert.ToInt32(this.udRevision.Value); DatabaseAPI.MatchAllIDs(null); var serializer = My.MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); int num3 = (int)Interaction.MsgBox(("Import of " + Conversions.ToString(num1) + " records completed!"), MsgBoxStyle.Information, "Done"); this.DisplayInfo(); return(flag); }
void btnDefiance_Click(object sender, EventArgs e) { BusyMsg("Working..."); int num1 = DatabaseAPI.Database.Powersets.Length - 1; for (int index1 = 0; index1 <= num1; ++index1) { if (!string.Equals(DatabaseAPI.Database.Powersets[index1].ATClass, "CLASS_BLASTER", StringComparison.OrdinalIgnoreCase)) { continue; } int num2 = DatabaseAPI.Database.Powersets[index1].Powers.Length - 1; for (int index2 = 0; index2 <= num2; ++index2) { int num3 = DatabaseAPI.Database.Powersets[index1].Powers[index2].Effects.Length - 1; for (int index3 = 0; index3 <= num3; ++index3) { IEffect effect = DatabaseAPI.Database.Powersets[index1].Powers[index2].Effects[index3]; if (effect.EffectType == Enums.eEffectType.DamageBuff && effect.Mag <0.4& effect.Mag> 0.0 & effect.ToWho == Enums.eToWho.Self & effect.SpecialCase == Enums.eSpecialCase.None) { effect.SpecialCase = Enums.eSpecialCase.Defiance; } } } } BusyMsg("Re-Indexing && Saving..."); DatabaseAPI.MatchAllIDs(); var serializer = MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); BusyHide(); }
private bool ProcessImport() { var num1 = 0; var num2 = lstImport.Items.Count - 1; for (var index = 0; index <= num2; ++index) { if (!lstImport.Items[index].Checked) { continue; } ImportBuffer[Convert.ToInt32(lstImport.Items[index].Tag)].Apply(); ++num1; } DatabaseAPI.Database.PowersetVersion.SourceFile = dlgBrowse.FileName; DatabaseAPI.Database.PowersetVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowersetVersion.Revision = Convert.ToInt32(udRevision.Value); DatabaseAPI.MatchAllIDs(); var serializer = MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); MessageBox.Show($"Import of {num1} records completed!", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); DisplayInfo(); return(false); }
bool ProcessImport() { bool flag = false; int num = 0; int num2 = this.lstImport.Items.Count - 1; for (int index = 0; index <= num2 - 1; index++) { if (this.lstImport.Items[index].Checked) { this.ImportBuffer[Conversions.ToInteger(this.lstImport.Items[index].Tag)].Apply(); num++; } } if (Interaction.MsgBox("Check for deleted powers?", MsgBoxStyle.YesNo, "Additional Check") == MsgBoxResult.Yes) { int[] pList = this.CheckForDeletedPowers(); if (pList.Length > 0 && Interaction.MsgBox(Conversions.ToString(pList.Length) + " deleted powers found. Delete them?", MsgBoxStyle.YesNo, "Additional Check") == MsgBoxResult.Yes) { frmImport_Power.DeletePowers(pList); } } DatabaseAPI.Database.PowerVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.PowerVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerVersion.Revision = Convert.ToInt32(this.udRevision.Value); DatabaseAPI.MatchAllIDs(null); DatabaseAPI.SaveMainDatabase(); Interaction.MsgBox("Import of " + Conversions.ToString(num) + " records completed!", MsgBoxStyle.Information, "Done"); this.DisplayInfo(); return(flag); }
void btnDefiance_Click(object sender, EventArgs e) { this.BusyMsg("Working..."); int num = DatabaseAPI.Database.Powersets.Length - 1; for (int index = 0; index <= num; index++) { if (string.Equals(DatabaseAPI.Database.Powersets[index].ATClass, "CLASS_BLASTER", StringComparison.OrdinalIgnoreCase)) { int num2 = DatabaseAPI.Database.Powersets[index].Powers.Length - 1; for (int index2 = 0; index2 <= num2; index2++) { int num3 = DatabaseAPI.Database.Powersets[index].Powers[index2].Effects.Length - 1; for (int index3 = 0; index3 <= num3; index3++) { IEffect effect = DatabaseAPI.Database.Powersets[index].Powers[index2].Effects[index3]; if (effect.EffectType == Enums.eEffectType.DamageBuff && ((double)effect.Mag <0.4& effect.Mag> 0f & effect.ToWho == Enums.eToWho.Self & effect.SpecialCase == Enums.eSpecialCase.None)) { effect.SpecialCase = Enums.eSpecialCase.Defiance; } } } } } this.BusyMsg("Re-Indexing && Saving..."); DatabaseAPI.MatchAllIDs(null); DatabaseAPI.SaveMainDatabase(); this.BusyHide(); }
void btnCancel_Click(object sender, EventArgs e) { this.BusyMsg("Re-Indexing..."); DatabaseAPI.LoadMainDatabase(); DatabaseAPI.MatchAllIDs(null); this.BusyHide(); this.Hide(); }
private void btnCancel_Click(object sender, EventArgs e) { BusyMsg("Re-Indexing..."); DatabaseAPI.LoadMainDatabase(); DatabaseAPI.MatchAllIDs(); BusyHide(); Hide(); }
bool ProcessImport() { bool flag = false; int num = 0; int num2 = 0; this.BusyMsg("Applying..."); base.Enabled = false; int num3 = 0; int num4 = this.lstImport.Items.Count - 1; for (int index = 0; index <= num4; index++) { if (this.lstImport.Items[index].Checked) { if (!this._importBuffer[Conversions.ToInteger(this.lstImport.Items[index].Tag)].Apply()) { num3++; } num++; num2++; if (num2 >= 9) { this.BusyMsg("Applying: " + Conversions.ToString(index) + " records done."); Application.DoEvents(); num2 = 0; } } } base.Enabled = true; this.BusyMsg("Saving..."); DatabaseAPI.Database.PowerEffectVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.PowerEffectVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerEffectVersion.Revision = Convert.ToInt32(this.udRevision.Value); DatabaseAPI.MatchAllIDs(null); DatabaseAPI.SaveMainDatabase(); this.BusyHide(); Interaction.MsgBox(string.Concat(new string[] { "Import of ", Conversions.ToString(num), " records completed!\r\nOf these, ", Conversions.ToString(num3), " records were found read-only." }), MsgBoxStyle.Information, "Done"); this.DisplayInfo(); return(flag); }
private bool ProcessImport() { var num1 = 0; var num2 = 0; BusyMsg("Applying..."); Enabled = false; var num3 = 0; var num4 = lstImport.Items.Count - 1; for (var index = 0; index <= num4; ++index) { if (!lstImport.Items[index].Checked) { continue; } if (!_importBuffer[Convert.ToInt32(lstImport.Items[index].Tag)].Apply()) { ++num3; } ++num1; ++num2; if (num2 < 9) { continue; } BusyMsg("Applying: " + Convert.ToString(index) + " records done."); Application.DoEvents(); num2 = 0; } Enabled = true; BusyMsg("Saving..."); DatabaseAPI.Database.PowerEffectVersion.SourceFile = dlgBrowse.FileName; DatabaseAPI.Database.PowerEffectVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerEffectVersion.Revision = Convert.ToInt32(udRevision.Value); DatabaseAPI.MatchAllIDs(); var serializer = MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); BusyHide(); MessageBox.Show($"Import of {num1} records completed!\r\nOf these, {num3} records were found read-only.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); DisplayInfo(); return(false); }
bool ProcessImport() { bool flag = false; int num1 = 0; int num2 = 0; this.BusyMsg("Applying..."); this.Enabled = false; int num3 = 0; int num4 = this.lstImport.Items.Count - 1; for (int index = 0; index <= num4; ++index) { if (this.lstImport.Items[index].Checked) { if (!this._importBuffer[Conversions.ToInteger(this.lstImport.Items[index].Tag)].Apply()) { ++num3; } ++num1; ++num2; if (num2 >= 9) { this.BusyMsg("Applying: " + Conversions.ToString(index) + " records done."); Application.DoEvents(); num2 = 0; } } } this.Enabled = true; this.BusyMsg("Saving..."); DatabaseAPI.Database.PowerEffectVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.PowerEffectVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerEffectVersion.Revision = Convert.ToInt32(this.udRevision.Value); DatabaseAPI.MatchAllIDs(null); var serializer = My.MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); this.BusyHide(); int num5 = (int)Interaction.MsgBox(("Import of " + Conversions.ToString(num1) + " records completed!\r\nOf these, " + Conversions.ToString(num3) + " records were found read-only."), MsgBoxStyle.Information, "Done"); this.DisplayInfo(); return(flag); }
private void btnSave_Click(object sender, EventArgs e) { BusyMsg("Saving, please wait..."); I9Gfx.LoadEnhancements(); foreach (var power in DatabaseAPI.Database.Power) { power.BaseRechargeTime = power.RechargeTime; } Array.Sort(DatabaseAPI.Database.Power); var serializer = MyApplication.GetSerializer(); DatabaseAPI.AssignStaticIndexValues(serializer, false); DatabaseAPI.AssignRecipeIDs(); DatabaseAPI.SaveEnhancementDb(serializer); DatabaseAPI.MatchAllIDs(); Task.Delay(1000).Wait(); DatabaseAPI.SaveMainDatabase(serializer); BusyHide(); DialogResult = DialogResult.OK; Hide(); }
private bool ProcessImport() { var num1 = 0; var num2 = lstImport.Items.Count - 1; for (var index = 0; index <= num2 - 1; ++index) { if (!lstImport.Items[index].Checked) { continue; } ImportBuffer[Convert.ToInt32(lstImport.Items[index].Tag)].Apply(); ++num1; } if (MessageBox.Show("Check for delted powers?", "Additional Check", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var pList = CheckForDeletedPowers(); if (pList.Length > 0 && MessageBox.Show($"{pList.Length} deleted powers found. Delete them?", "Additional Check", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DeletePowers(pList); } } DatabaseAPI.Database.PowerVersion.SourceFile = dlgBrowse.FileName; DatabaseAPI.Database.PowerVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.PowerVersion.Revision = Convert.ToInt32(udRevision.Value); DatabaseAPI.MatchAllIDs(); var serializer = MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); MessageBox.Show($"Import of {num1} records completed!", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); DisplayInfo(); return(false); }
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 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(); 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(); }