示例#1
0
        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);
        }
示例#2
0
        public void SerializeFile(object obj, string fileName)
        {
            string text = JsonConvert.SerializeObject(obj);

            TkoolJson.TextWrite(fileName, text);
        }
示例#3
0
 public static void DeSerializeFile(string jsonPath, string foldaPath, string nameSpace, string className)
 {
     TkoolJson.DeSerializeFile(jsonPath, foldaPath, nameSpace, className);
 }
示例#4
0
        public static void DeSerializeMapInfosFile()
        {
            string text = "MapInfos";

            TkoolJson.DeSerializeFile(Path.Combine(TkoolJson.DataDir, text + ".json"), Application.StartupPath + "\\data", text, text);
        }
示例#5
0
 public static void DeSerializeMapFile(int mapID)
 {
     TkoolJson.DeSerializeMapFile(mapID, false);
 }
示例#6
0
 public T DeserializeFromFile <T>(string path)
 {
     return(JsonConvert.DeserializeObject <T>(TkoolJson.ReadText(path)));
 }