diff --git a/DU-Industry-Tool.favdoc b/DU-Industry-Tool.favdoc deleted file mode 100644 index 1666921..0000000 --- a/DU-Industry-Tool.favdoc +++ /dev/null @@ -1,214 +0,0 @@ - - - - - DU Indy Tool - - - - ContentDocument2.designer.cs - DU-Industry-Tool\Forms\ContentDocument2.designer.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Forms\ContentDocument2.designer.cs - - 333 - 63 - 7kruea8Cju7+TxaGDP1rAJwRztlTVKS2zu6Km3Fy/AY= - - - - ContentDocument2.cs - DU-Industry-Tool\Forms\ContentDocument2.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Forms\ContentDocument2.cs - - 34 - 44 - - - - Calculator2GridClass.cs - DU-Industry-Tool\Classes\Calculator2GridClass.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\Calculator2GridClass.cs - - 253 - 30 - +OXjLGWMa+Izr2q3Yg3TruCBPaaIcUZ+SiXklsMu1hc= - - - - TreeViewSetup.cs - DU-Industry-Tool\Classes\TreeViewSetup.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\TreeViewSetup.cs - - 20 - 10 - ykKUv9CRqXFB28iGGHxkiLH9tlfMTvxW2qWsuJpGHLY= - - - - MainForm.cs - DU-Industry-Tool\Forms\MainForm.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Forms\MainForm.cs - - 230 - 17 - UNngD/4KnSkoDTLkuI+uSPOfRzMWQHCGaH3VX5j0Cng= - - - - IndustryManager.cs - DU-Industry-Tool\Classes\IndustryManager.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\IndustryManager.cs - - 30 - 20 - JLYnbh2LnDwG4ceGFnj6h6kzNva/CDgG3cSYZiTNKvw= - - - - TabTreeListView.cs - E:\software\c#\ObjectListView-main\Demo\TabTreeListView.cs - - 227 - 41 - SsB2UX14De0b1HVehoxix0v5EdyLbPSi3sofrNwuX6s= - - - - TabTreeListView.Designer.cs - E:\software\c#\ObjectListView-main\Demo\TabTreeListView.Designer.cs - - 251 - 35 - IZOPrNf3yMDgpbBSPCwDTRN9NnmFEcRvtWXTXVuPsN8= - - - - TabComplexExample.cs - E:\software\c#\ObjectListView-main\Demo\TabComplexExample.cs - - 35 - 1 - ECtRuXZaVqPomffPDuOOUlH5xQOzV7MwpJGD63sVVgQ= - - - - ObjectListView.cs - E:\software\c#\ObjectListView-main\ObjectListView\ObjectListView.cs - - 5743 - 25 - eg4NKXtQ+kQJ5GhJRI+j8BKd2reBMIhASSwV1Mudzts= - - - - TypedObjectListView.cs - E:\software\c#\ObjectListView-main\ObjectListView\Utilities\TypedObjectListView.cs - - 61 - 37 - hbe+vxhJTZf+buazPpgEtrkRw/iwwd/u01O9bh0so+M= - - - - TreeRenderer.cs - E:\software\c#\ObjectListView-main\ObjectListView\Rendering\TreeRenderer.cs - - 99 - 1 - smk9qqLedsX/aFAu5+WWMuhYt8rj9IOXoDjwfaH5JXc= - - - - TabComplexExample.Designer.cs - E:\software\c#\ObjectListView-main\Demo\TabComplexExample.Designer.cs - - 469 - 59 - lbiie/FAHuJzWlRnklB7g8yFm2IddXcSfkFdR5Vf9nA= - - - - CalculatorClass.cs - DU-Industry-Tool\Classes\CalculatorClass.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\CalculatorClass.cs - - 335 - 120 - P4Qw16Pf9UawLYiToWLSxTuuJ3D+EPR3rTo2ruXn3RA= - - - - ContentDocumentOre.cs - DU-Industry-Tool\Forms\ContentDocumentOre.cs - C:\Users\tobias\github\DU-Industry-Tool\DU-Industry-Tool\Forms\ContentDocumentOre.cs - - 159 - 1 - smk9qqLedsX/aFAu5+WWMuhYt8rj9IOXoDjwfaH5JXc= - - - - Calculator2OutputClass.cs - DU-Industry-Tool\Classes\Calculator2OutputClass.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\Calculator2OutputClass.cs - - 66 - 43 - PuVn3xiShX/0abStBmr8RVXC3H9+v5E06kQIWEeoffc= - - - - RecipeCalculation.cs - DU-Industry-Tool\Classes\RecipeCalculation.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\RecipeCalculation.cs - - 255 - 44 - aMj45SmkxI7cwSP+2ICvt6HZ8ZcWEsL5GZARa0Pv1rE= - - - - ContentDocumentTree.cs - DU-Industry-Tool\Forms\ContentDocumentTree.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Forms\ContentDocumentTree.cs - - 151 - 75 - nCH6easjU4uOIzShzM+J5cmCylelYtaP4iL9uyfA+Fc= - - - - DUData.cs - DU-Industry-Tool\Classes\DUData.cs - c:\users\tobias\github\du-industry-tool\DU-Industry-Tool\Classes\DUData.cs - - 625 - 35 - RAPBglzjD+mvSXHPXSu9enhxUu3u/QwEQslyixh/uOU= - - - - ContentDocumentOre.designer.cs - DU-Industry-Tool\Forms\ContentDocumentOre.designer.cs - C:\Users\tobias\github\DU-Industry-Tool\DU-Industry-Tool\Forms\ContentDocumentOre.designer.cs - - 155 - 66 - T9JMjw6X4MOiFHPaukfCAv3/K3vjwM5jv0CD1Cf+IHI= - - - - Recipe.cs - DU-Industry-Tool\Classes\Recipe.cs - C:\Users\tobias\github\DU-Industry-Tool\DU-Industry-Tool\Classes\Recipe.cs - - 67 - 37 - GUr58m8TlxM63bYHqJaTLWnf4dcLmBxNfhN0YNfA854= - - - - - - - \ No newline at end of file diff --git a/DU-Industry-Tool/App.config b/DU-Industry-Tool/App.config index ecc9b5f..366f9d5 100644 --- a/DU-Industry-Tool/App.config +++ b/DU-Industry-Tool/App.config @@ -11,13 +11,13 @@ - + False - + 0, 0 @@ -29,11 +29,14 @@ True - + -1 + + True + diff --git a/DU-Industry-Tool/Classes/Calculator2OutputClass.cs b/DU-Industry-Tool/Classes/Calculator2OutputClass.cs index dfd3d65..4b6b1b4 100644 --- a/DU-Industry-Tool/Classes/Calculator2OutputClass.cs +++ b/DU-Industry-Tool/Classes/Calculator2OutputClass.cs @@ -51,7 +51,7 @@ public void Fill(CalculatorClass calc) _tlview.BeginInvoke((MethodInvoker)delegate() { _tlview.Collapse(x); - MessageBox.Show(ex.Message, "Recipes Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + MessageBox.Show(ex.Message, @"Recipes Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }); return new ArrayList(); } diff --git a/DU-Industry-Tool/Classes/CalculatorClass.cs b/DU-Industry-Tool/Classes/CalculatorClass.cs index 2d2272e..bc439dd 100644 --- a/DU-Industry-Tool/Classes/CalculatorClass.cs +++ b/DU-Industry-Tool/Classes/CalculatorClass.cs @@ -156,15 +156,15 @@ public static void Collect(CalculatorClass calc) { if (prod.IsByproduct || !CreateByKey(prod.Type, out var pCalc)) continue; - pCalc.GetTalents(); if (pCalc.IsPlasma || string.IsNullOrEmpty(pCalc.SchematicType)) continue; + pCalc.GetTalents(); // TODO determine correct schematics needed (pures, products)! if (pCalc.IsBatchmode) { if (pCalc.BatchOutput != null) { - if (pCalc.CalcSchematicFromQty(prod.SchemaType, prod.Quantity, (decimal)pCalc.BatchOutput, + if (pCalc.CalcSchematicFromQty(pCalc.SchematicType, prod.Quantity, (decimal)pCalc.BatchOutput, out var cnt, out var minCost1, out var _, out var _)) { calc.AddSchema(pCalc.SchematicType, cnt, minCost1); @@ -173,18 +173,19 @@ public static void Collect(CalculatorClass calc) } } else + if (CalcSchematic(pCalc.SchematicType, prod.Quantity, out var minCost2, out _, out _)) { - if (CalcSchematic(prod.SchemaType, prod.Quantity, out var minCost2, out _, out _)) - { - calc.AddSchema(pCalc.SchematicType, (int)Math.Ceiling(prod.Quantity), minCost2); - calc.AddSchematicCost(minCost2); - } + calc.AddSchema(pCalc.SchematicType, (int)Math.Ceiling(prod.Quantity), minCost2); + calc.AddSchematicCost(minCost2); } } } // calculate T2+ ore schematic costs - calc.ResetSchematicCost(); + if (!prodMode) + { + calc.ResetSchematicCost(); + } CollectSchematics(calc, SummationType.PURES); CollectSchematics(calc, SummationType.PRODUCTS); @@ -196,7 +197,11 @@ public static void Collect(CalculatorClass calc) var batches = ProductQuantity; if (calc.IsBatchmode && calc.BatchOutput > 0) { - batches = Math.Floor(ProductQuantity / (decimal)calc.BatchOutput); + batches = ProductQuantity / (decimal)calc.BatchOutput; + if (DUData.FullSchematicQuantities) + { + batches = Math.Floor(batches); + } } if (CalcSchematic(calc.SchematicType, (int)batches, out var minCost, out _, out _)) { @@ -212,7 +217,7 @@ public static void Collect(CalculatorClass calc) /// public static bool CalcSchematic(string schematicId, decimal qtySchematic, out decimal minCost, out decimal copyCost, - out int qtyCopies) + out decimal qtyCopies) { minCost = 0M; copyCost = 0M; @@ -224,12 +229,13 @@ public static bool CalcSchematic(string schematicId, decimal qtySchematic, return false; } - qtySchematic = Math.Ceiling(qtySchematic); - minCost = Math.Round(schemata.Cost * qtySchematic); // cost is a breakdown to x1 schematic + //qtySchematic = Math.Ceiling(qtySchematic); + minCost = Math.Round(schemata.Cost * qtySchematic); // cost is a breakdown to x1 schematic // number of copy jobs that need to be started to cover all needed schematics, // (which depends on the batch size of a copy, e.g. 10 per copy process): - qtyCopies = (int)Math.Ceiling(qtySchematic / (decimal)Math.Max(1, schemata.BatchSize)); - // copyCost is the single schematic cose multiplied by batch size and the number of copies: + qtyCopies = qtySchematic / (decimal)Math.Max(1, schemata.BatchSize); + qtyCopies = Math.Ceiling(qtyCopies); + // copyCost is the single schematic cost multiplied by batch size and the number of copies: copyCost = schemata.Cost * schemata.BatchSize * qtyCopies; copyCost = Math.Round(copyCost, 2); return true; @@ -258,10 +264,14 @@ private static void CollectSchematics(CalculatorClass calc, SummationType sumTyp tmp.Quantity = val.Qty; tmp.GetTalents(); if (tmp.BatchOutput == null) continue;// happens (on purpose) - tmp.Quantity = (int)Math.Ceiling(tmp.Quantity / (decimal)tmp.BatchOutput); + tmp.Quantity = tmp.Quantity / (decimal)tmp.BatchOutput; + if (DUData.FullSchematicQuantities) + { + tmp.Quantity = (int)Math.Ceiling(tmp.Quantity); + } val.QtySchemata = tmp.Quantity; - if (!CalcSchematic(val.SchematicType, (int)tmp.Quantity, + if (!CalcSchematic(val.SchematicType, tmp.Quantity, out var minCost, out _, out var copies)) { continue; @@ -296,7 +306,6 @@ public static decimal CalculateRecipe(string key, decimal amount = 0, string lev // - Catalysts are NOT calculated due to their positive return ratio, i.e. // they usually return in a higher amount than they're used for (with talents) // - Plasma as ingredient is assumed to be 1 L for all recipes. - //if (!DUData.Recipes.Keys.Contains(key)) if (!DUData.GetRecipeCloneByKey(key, out var recipe)) { var err = $"*** Recipe not found: '{key}' !!!"; @@ -398,7 +407,6 @@ public static decimal CalculateRecipe(string key, decimal amount = 0, string lev calc2.OreCost = cost; calc2.Quantity = qty; calc.Add(SummationType.ORES, ingKey, qty, cost); - //calc.Add(SummationType.INGREDIENTS, ingKey, qty, cost); Debug.WriteLineIf(!silent && qty > 0, $"{curLevel} ({ingredient.Name}: {qty:N2} = {cost:N2}q)"); continue; } @@ -428,7 +436,11 @@ public static decimal CalculateRecipe(string key, decimal amount = 0, string lev } if (myRecipe.IsProduct) { - calc.Add(SummationType.PRODUCTS, ingKey, qty, cost); + var excl = ingKey.Contains("Catalyst") || ingKey.Contains("Hydrogen") || ingKey.Contains("Oxygen"); + if (!excl) + { + calc.Add(SummationType.PRODUCTS, ingKey, qty, cost); + } continue; } calc.Add(SummationType.PURES, ingKey, qty, cost); @@ -597,7 +609,7 @@ public static List GetIngredientRecipes(string key, decimal qua if (entry.Recipe.Ingredients.Count > 0) { - results.AddRange(GetIngredientRecipes(ingredient.Type, entry.Quantity, reverse)); + //results.AddRange(GetIngredientRecipes(ingredient.Type, entry.Quantity, reverse)); } } @@ -777,7 +789,7 @@ public List GetTalents() } public bool CalcSchematicFromQty(string schematicType, decimal qty, decimal batchOutput, - out int batches, out decimal minCost, out decimal copyCost, out int qtyCopies) + out int batches, out decimal minCost, out decimal copyCost, out decimal qtyCopies) { minCost = 0M; copyCost = 0M; @@ -792,7 +804,7 @@ public bool CalcSchematicFromQty(string schematicType, decimal qty, decimal batc { qty /= batchOutput; } - batches = (int)Math.Ceiling(qty); + batches = DUData.FullSchematicQuantities ? (int)Math.Ceiling(qty) : (int)qty; return Calculator.CalcSchematic(schematicType, (int)batches, out minCost, out copyCost, out qtyCopies); } } diff --git a/DU-Industry-Tool/Classes/DUData.cs b/DU-Industry-Tool/Classes/DUData.cs index 783b652..7a42bfb 100644 --- a/DU-Industry-Tool/Classes/DUData.cs +++ b/DU-Industry-Tool/Classes/DUData.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Windows.Forms; +using DocumentFormat.OpenXml; using Krypton.Toolkit; using Newtonsoft.Json; @@ -43,7 +44,7 @@ private void CheckInstance() public void Add(string itemName, decimal qty) { CheckInstance(); - if (ProductionBindingList.Any(x => x.Name == itemName)) return; + if (string.IsNullOrEmpty(itemName) || ProductionBindingList.Any(x => x.Name == itemName)) return; var item = new ProductionItem { Name = itemName, @@ -82,7 +83,10 @@ public bool Load(string filename) ProductionBindingList = new BindingList(); foreach (var entry in tmp) { - ProductionBindingList.Add(entry); + if (!string.IsNullOrEmpty(entry?.Name)) + { + ProductionBindingList.Add(entry); + } } ListLoaded = true; Filepath = filename; @@ -157,7 +161,7 @@ public bool PrepareProductListRecipe() * 1667 L Pure Sulfur * */ - if (prod.Name == prodItem.Name) + if (prod.Name.Equals(prodItem.Name, StringComparison.InvariantCultureIgnoreCase)) { prod.Quantity = prodItem.Quantity; prod.Level = calc.Tier; @@ -184,7 +188,7 @@ public bool PrepareProductListRecipe() continue; if (rec2.IsPlasma) continue; prod.IsByproduct = true; - prod.Name += " (B)"; + prod.Name += DUData.ByproductMarker; prod.Quantity *= calc.OutputMultiplier; prod.Quantity *= batchCount; cmp.Products.Add(prod); @@ -253,17 +257,18 @@ public static class DUData ///
which can contain any amount of items and is created with the
///
help of the Production List dialogue/ribbon buttons.
/// + public static bool FullSchematicQuantities { get; set; } public static bool ProductionListMode { get; set; } public static SchematicRecipe CompoundRecipe { get; set; } - public const string CompoundName = "COMPOUNDLIST"; - public const string ProductionListTitle = "Production List"; + public static readonly string CompoundName = "COMPOUNDLIST"; + public static readonly string ProductionListTitle = "Production List"; #endregion - public const string SubpartSectionTitle = "Subpart"; - public const string IndustryTitle = "Industry"; - public const string SchematicsTitle = "Schematics"; - public const string PlasmaStart = "Relic Plasma"; - public const string ByproductMarker = " (B)"; + public static readonly string SubpartSectionTitle = "Subpart"; + public static readonly string IndustryTitle = "Industry"; + public static readonly string SchematicsTitle = "Schematics"; + public static readonly string PlasmaStart = "Relic Plasma"; + public static readonly string ByproductMarker = " (B)"; /// ///
Returns true if result was created as a clone of a recipe identified by key "recipeKey".
diff --git a/DU-Industry-Tool/Classes/Recipe.cs b/DU-Industry-Tool/Classes/Recipe.cs index 4a31717..45a4a84 100644 --- a/DU-Industry-Tool/Classes/Recipe.cs +++ b/DU-Industry-Tool/Classes/Recipe.cs @@ -36,7 +36,7 @@ public string ParentGroupName IsPlasma = Name?.StartsWith("Relic Plasma") == true && _parentGroupName.Equals("Consumables"); IsPure = _parentGroupName.Equals("Pure"); - IsProduct = _parentGroupName.Equals("Product"); + IsProduct = _parentGroupName.Equals("Product") || _parentGroupName.Equals("Refined Materials"); IsFuel = _parentGroupName.Equals("Fuels"); } } diff --git a/DU-Industry-Tool/Classes/RecipeCalculation.cs b/DU-Industry-Tool/Classes/RecipeCalculation.cs index 1fa76e7..a63958a 100644 --- a/DU-Industry-Tool/Classes/RecipeCalculation.cs +++ b/DU-Industry-Tool/Classes/RecipeCalculation.cs @@ -291,14 +291,19 @@ public IEnumerable GetChildren() child.Comment = dataItem.Value.SchematicType; // Exclude ores and special pures from drilldown - if (SumType == SummationType.ORES || - (SumType == SummationType.PURES && - (realKey.StartsWith("Catalyst", StringComparison.InvariantCultureIgnoreCase) || - realKey.Equals("Pure Hydrogen", StringComparison.InvariantCultureIgnoreCase) || - realKey.Equals("Pure Oxygen", StringComparison.InvariantCultureIgnoreCase)))) + var exclude = SumType == SummationType.PRODUCTS && + (realKey.StartsWith("Catalyst", StringComparison.InvariantCultureIgnoreCase) || + realKey.Contains("Hydrogen") || + realKey.Contains("Oxygen")); + if (SumType == SummationType.ORES || exclude) { child.Section = child.Entry; child.Entry = ""; + if (exclude) + { + child.QtySchemata = 0; + child.AmtSchemata = 0; + } children.Add(child); continue; } diff --git a/DU-Industry-Tool/DU-Industry-Tool.csproj b/DU-Industry-Tool/DU-Industry-Tool.csproj index f736441..83c51a9 100644 --- a/DU-Industry-Tool/DU-Industry-Tool.csproj +++ b/DU-Industry-Tool/DU-Industry-Tool.csproj @@ -54,6 +54,9 @@ reshot-icon-factory.ico + + app.manifest + False @@ -170,6 +173,7 @@ SkillForm.cs + Always @@ -246,10 +250,10 @@ - 0.96.0 + 0.101.0 - 2.16.0 + 2.20.0 1.1.0 @@ -267,7 +271,7 @@ 4.7.0 - 13.0.1 + 13.0.3 0.2.1 @@ -276,7 +280,7 @@ 4.3.0 - 6.0.0 + 7.0.0 4.3.0 diff --git a/DU-Industry-Tool/Forms/ContentDocumentTree.cs b/DU-Industry-Tool/Forms/ContentDocumentTree.cs index 84f3a3e..4843671 100644 --- a/DU-Industry-Tool/Forms/ContentDocumentTree.cs +++ b/DU-Industry-Tool/Forms/ContentDocumentTree.cs @@ -16,6 +16,7 @@ public partial class ContentDocumentTree : UserControl, IContentDocument { private bool expand = false; private byte[] treeListViewViewState; + private float fontSize; private Random _rand; private readonly string[] _funHints = new[] @@ -47,6 +48,7 @@ public ContentDocumentTree() { InitializeComponent(); HideAll(); + fontSize = Font.Size; } public void HideAll() @@ -362,7 +364,9 @@ public void SetupGrid(CalculatorClass calc) olvColumnQty.AspectGetter = x => (x is RecipeCalculation t && t.Qty > 0 ? $"{t.Qty:N2}" : ""); olvColumnAmt.AspectGetter = x => (x is RecipeCalculation t && t.Amt > 0 ? $"{t.Amt:N2}" : ""); - olvColumnSchemataQ.AspectGetter = x => (x is RecipeCalculation t && t.QtySchemata > 0 ? $"{t.QtySchemata:N0}" : ""); + olvColumnSchemataQ.AspectGetter = x => (x is RecipeCalculation t && t.QtySchemata > 0 + ? (DUData.FullSchematicQuantities ? $"{t.QtySchemata:N0}" : $"{t.QtySchemata:N2}") + : ""); olvColumnSchemataA.AspectGetter = x => (x is RecipeCalculation t && t.AmtSchemata > 0 ? $"{t.AmtSchemata:N2}" : ""); olvColumnTier.AspectGetter = x => (x is RecipeCalculation t && t.Tier > 0 ? $"{t.Tier}" : ""); @@ -389,6 +393,7 @@ public void SetupGrid(CalculatorClass calc) private static DataGridViewRow CreateTalentsRow(Talent talent) { var row = new DataGridViewRow(); + row.Height = 32; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells.Add(new KryptonDataGridViewNumericUpDownCell()); row.Cells[0].ValueType = typeof(string); @@ -532,21 +537,11 @@ private void BtnFontDownOnClick(object sender, EventArgs e) private void SetFont(float fontDelta) { - var fontSize = this.Font.Size; - if ((fontDelta < 0 && fontSize > 8) || (fontDelta > 0 && fontSize < 15)) + if ((fontDelta < 0 && fontSize > 9) || (fontDelta > 0 && fontSize < 18)) { fontSize += fontDelta; + treeListView.Font = new Font("Segoe UI", fontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); } - Font = new Font("Segoe UI", fontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); - foreach (var ct in this.Controls.OfType()) - { - ct.Font = Font; - } - foreach (var ct in this.Controls.OfType