private void GenerateRefinerIntermediate(string filename, Dictionary <string, InventoryDescription> itemNames, string prefix, string outputFilename) { Dictionary <string, RefinerRecipe> jsonContent = _survivalCraftingFileSysRepo.LoadJsonDictOfType <RefinerRecipe>(filename); List <RefinerRecipeLocalised> recipes = new List <RefinerRecipeLocalised>(); for (int keyIndex = 0; keyIndex < jsonContent.Keys.Count; keyIndex++) { string jsonContentKey = jsonContent.Keys.ToList()[keyIndex]; RefinerRecipe obj = jsonContent[jsonContentKey]; recipes.Add(obj.Localise(jsonContentKey, prefix, keyIndex, itemNames)); } _outputFileSysRepo.WriteBackToJsonFile(recipes, outputFilename); }
public static RefinerRecipeLocalised Localise(this RefinerRecipe refinerRecipe, string itemId, string prefix, int index, Dictionary <string, InventoryDescription> itemNames) { RefinerRecipeLocalised localised = new RefinerRecipeLocalised { AppId = $"{prefix}{(index + 1)}", ItemId = itemId, Title = itemNames.GetTitle(itemId), IngredientListLocalised = new List <IngredientListLocalised> { new IngredientListLocalised { ItemId = refinerRecipe.ItemId, Title = itemNames.GetTitle(refinerRecipe.ItemId), Description = itemNames.GetDescription(refinerRecipe.ItemId), Quantity = refinerRecipe.Quantity } } }; return(localised); }