public static TkoolJson.CsData DeSerializeMapFile(int mapID, bool isReadCsFile) { Directory.CreateDirectory(Application.StartupPath + "\\data"); string text = "Map" + mapID.ToString("000"); TkoolJson.DeSerializeFile(Path.Combine(TkoolJson.DataDir, text + ".json"), Application.StartupPath + "\\data", text, text); if (isReadCsFile) { string path = Application.StartupPath + "\\data\\" + text + ".cs"; string data = TkoolJson.ReadText(path); return(new TkoolJson.CsData { name = text, path = path, data = data }); } return(null); }
public void SerializeFile(object obj, string fileName) { string text = JsonConvert.SerializeObject(obj); TkoolJson.TextWrite(fileName, text); }
public static void DeSerializeFile(string jsonPath, string foldaPath, string nameSpace, string className) { TkoolJson.DeSerializeFile(jsonPath, foldaPath, nameSpace, className); }
public static void DeSerializeMapInfosFile() { string text = "MapInfos"; TkoolJson.DeSerializeFile(Path.Combine(TkoolJson.DataDir, text + ".json"), Application.StartupPath + "\\data", text, text); }
public static void DeSerializeMapFile(int mapID) { TkoolJson.DeSerializeMapFile(mapID, false); }
public T DeserializeFromFile <T>(string path) { return(JsonConvert.DeserializeObject <T>(TkoolJson.ReadText(path))); }