private void compileChoices() { Log.info("Creating list of custom farm types..."); var farmTypeDirs = Directory.GetDirectories(Path.Combine(Helper.DirectoryPath, "assets", "FarmTypes")); foreach (var folderPath in farmTypeDirs) { IContentPack contentPack = this.Helper.ContentPacks.CreateFake(folderPath); if (!File.Exists(Path.Combine(folderPath, "type.json")) || !File.Exists(Path.Combine(folderPath, "map.xnb")) || !File.Exists(Path.Combine(folderPath, "icon.png"))) { Log.error($"A required file is missing for custom farm type \"{folderPath}\"."); continue; } FarmType type = contentPack.ReadJsonFile <FarmType>("type.json"); if (type == null) { Log.error($"Problem reading type.json for custom farm type \"{folderPath}\"."); continue; } type.Folder = Path.Combine("assets", "FarmTypes", Path.GetFileName(folderPath)); FarmType.register(type); Log.info($"\tFarm type: {type.Name} ({type.ID})"); } }
private void compileChoices() { Log.info("Creating list of custom farm types..."); var choices = Directory.GetDirectories(Path.Combine(Helper.DirectoryPath, "FarmTypes")); foreach (var choice in choices) { if (!File.Exists(Path.Combine(choice, "type.json")) || !File.Exists(Path.Combine(choice, "map.xnb")) || !File.Exists(Path.Combine(choice, "icon.png"))) { Log.error("A required file is missing for custom farm type \"" + choice + "\"."); continue; } FarmType type = Helper.ReadJsonFile <FarmType>(Path.Combine(choice, "type.json")); if (type == null) { Log.error("Problem reading type.json for custom farm type \"" + choice + "\"."); continue; } type.Folder = Path.Combine("FarmTypes", Path.GetFileName(choice)); FarmType.register(type); Log.info("\tFarm type: " + type.Name + " (" + type.ID + ")"); } }