示例#1
0
        private static void LoadModManifests()
        {
            foreach (var modPath in ModPaths)
            {
                foreach (var perModPath in Directory.GetDirectories(modPath))
                {
                    var modJsonFiles = Directory.GetFiles(perModPath, "manifest.json");
                    foreach (var file in modJsonFiles)
                    {
                        using (var r = new StreamReader(file))
                        {
                            var json    = r.ReadToEnd();
                            var modInfo = JsonConvert.DeserializeObject <ModManifest>(json, new Farmhand.Helpers.VersionConverter());

                            modInfo.ModDirectory = perModPath;
                            ModRegistry.RegisterItem(modInfo.UniqueId ?? new UniqueId <string>(Guid.NewGuid().ToString()), modInfo);
                        }
                    }
                }
            }
        }