void LoadCraftbot() // Loads item_names.json into ItemBox, and craftbot.json into RecipeBox { String item_names = File.ReadAllText(CraftingPath + "item_names.json"); ItemDictionary = JsonConvert.DeserializeObject <Dictionary <String, String> >(item_names); ItemDictionaryReversed = ItemDictionary.ToDictionary(x => x.Value, x => x.Key); ItemBox.DataSource = ItemDictionary.Values.ToList(); dynamic CraftbotJson = JsonConvert.DeserializeObject <List <Recipe> >(File.ReadAllText(CraftingPath + "craftbot.json")); CraftbotDocument = CraftbotJson; foreach (Recipe r in CraftbotDocument) { RecipeBox.Items.Add(ItemDictionary[r.itemId]); } RecipeBox.SetSelected(0, true); }
void LoadCraftbot(String path) // Loads item_names.json into ItemBox, and craftbot.json into RecipeBox { FullPath = path; FileName = FullPath.Split('\\').Last(); Text = "SMEMT v" + Resources.VersionString + ": Recipe Editor: " + FileName; RecipeBox.Items.Clear(); foreach (String thing in Localization.LocalizeList(DataClass.ItemDictionary.Keys.ToList())) { ItemBox.Items.Add(thing); } dynamic CraftbotJson = JsonConvert.DeserializeObject <List <Recipe> >(File.ReadAllText(path)); CraftbotDocument = CraftbotJson; foreach (Recipe r in CraftbotDocument) { RecipeBox.Items.Add(Localization.Localize(r.itemId.ToString())); } RecipeBox.SetSelected(0, true); }