public static ItemFilterConfig LoadConfig(string id)
        {
            string filePath = CheckFilePath(id);

            if (!File.Exists(filePath))
            {
                ItemFilterConfig cfg = new ItemFilterConfig()
                {
                    CharId = id
                };
                File.WriteAllText(filePath, JsonUtil.Serialize(cfg));
                return(cfg);
            }
            else
            {
                string json = File.ReadAllText(filePath);
                return(JsonUtil.Deserialize <ItemFilterConfig>(json));
            }
        }
        public static CharacterDynamic LoadDynamic(string id)
        {
            string filePath = CheckFilePath(id);

            if (!File.Exists(filePath))
            {
                CharacterDynamic cfg = new CharacterDynamic()
                {
                    CharId = id
                };
                File.WriteAllText(filePath, JsonUtil.Serialize(cfg));
                return(cfg);
            }
            else
            {
                string json = File.ReadAllText(filePath);
                return(JsonUtil.Deserialize <CharacterDynamic>(json));
            }
        }
Exemple #3
0
        protected T GetPostData <T>()
        {
            string postStr = GetPostString();

            return(JsonUtil.Deserialize <T>(postStr));
        }
        public T GetSourceObject <T>(string path, bool isPost = true, bool useCookie = true)
        {
            string content = GetSourceContent(path, isPost, useCookie);

            return(JsonUtil.Deserialize <T>(content));
        }