Example #1
0
        public static McModInfo ImportMcInfo(ISerializer <McModInfo> serializer, string modPath)
        {
            string modname         = new DirectoryInfo(modPath).Name;
            string modInfoFilePath = ModPaths.McModInfoFile(modname).Replace("\\", "/");
            string infoTextFormat  = File.ReadAllText(modInfoFilePath);

            return(serializer.Deserialize(infoTextFormat));
        }
Example #2
0
        public static McModInfo ImportMcInfo(string modPath)
        {
            McModInfoJsonConverter c = new McModInfoJsonConverter();
            string modname           = new DirectoryInfo(modPath).Name;
            string modInfoFilePath   = ModPaths.McModInfoFile(modname).Replace("\\", "/");
            string infoTextFormat    = File.ReadAllText(modInfoFilePath);

            return(JsonConvert.DeserializeObject <McModInfo>(infoTextFormat, c));
        }
Example #3
0
        public static void ExportMcInfo(McModInfo modInfo)
        {
            string modInfoPath       = ModPaths.McModInfoFile(modInfo.Name);
            string serializedModInfo = JsonConvert.SerializeObject(modInfo, Formatting.Indented, new McModInfoJsonConverter());

            using (StreamWriter writer = new StreamWriter(modInfoPath))
            {
                writer.Write(serializedModInfo);
            }
        }
Example #4
0
 public static void ExportMcInfo(ISerializer <McModInfo> serializer, McModInfo modInfo) => File.WriteAllText(ModPaths.McModInfoFile(modInfo.Name), serializer.Serialize(modInfo));