private void AddRecipeToOutput(CompositeIngredients rec, ref long supplierTotal, ref DataSet1.dtRecipeDataTable dtRecipes, ref DataSet1.dtIngCraftedDataTable dtIngCrafted, ref DataSet1.dtIngGatheredDataTable dtIngGathered, ref DataSet1.dtIngSupplierDataTable dtIngSupplier, ref DataSet1.dtCraftingXPDataTable dtCraftingXp) { bool bFound = false; // if already added, then sum, else create foreach (DataSet1.dtRecipeRow row in dtRecipes.Rows) { if (row.RecipeName == rec.Name) { row.Quantity = Convert.ToString(Convert.ToInt32(row.Quantity) + rec.QuantityRequested); bFound = true; break; } } if (!bFound) { DataSet1.dtRecipeRow dtRow = dtRecipes.NewdtRecipeRow(); dtRow.Quantity = rec.QuantityRequested.ToString(); dtRow.Profession = GetProfession(rec); dtRow.RecipeName = rec.Name; dtRow.Tier = ProfessionTier.FormatTier(rec.Tier); dtRow.Facility = GetFacility(rec); dtRecipes.AdddtRecipeRow(dtRow); } addCraftingXp(rec, ref dtCraftingXp); // breakdown the ingredients foreach (Ingredient subIng in rec.GetRecipeIngredients().Values) { if (subIng is CompositeIngredients) { var newIng = (CompositeIngredients)subIng; AddComponentToOutput(newIng, ref supplierTotal, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp); } else { AddSimpleToOutput(subIng, ref supplierTotal, ref dtIngGathered, ref dtIngSupplier); } } }
public static DataSet1.dtRecipeDataTable SortRecipeDataTable(DataSet1.dtRecipeDataTable dtRecipesIn) { var sDict = new SortedDictionary <string, DataSet1.dtRecipeRow>(); foreach (DataSet1.dtRecipeRow row in dtRecipesIn.Rows) { sDict.Add(row.RecipeName, row); } var dtRecipesOut = new DataSet1.dtRecipeDataTable(); foreach (DataSet1.dtRecipeRow row in sDict.Values) { DataSet1.dtRecipeRow newRow = dtRecipesOut.NewdtRecipeRow(); newRow.Facility = row.Facility; newRow.Profession = row.Profession; newRow.Quantity = row.Quantity; newRow.RecipeName = row.RecipeName; newRow.Tier = row.Tier; dtRecipesOut.AdddtRecipeRow(newRow); } return(dtRecipesOut); }