示例#1
0
        private static async Task <OuthubResponse> Load(string content)
        {
            var deserialized = await Task.Run(() => {
                content = content.Replace(@"\r", "");
                content = content.Replace(@"\n", "");
                OuthubResponse schema = JsonConvert.DeserializeObject <OuthubResponse>(content);
                return(schema);
            });

            return(deserialized);
        }
示例#2
0
        public static void SaveToFile(OuthubResponse response, string filePath)
        {
            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.Delete(filePath);
            }

            string dir = System.IO.Path.GetDirectoryName(filePath);

            if (!System.IO.Directory.Exists(dir))
            {
                System.IO.Directory.CreateDirectory(dir);
            }

            string converted = JsonConvert.SerializeObject(response);

            System.IO.File.WriteAllText(filePath, converted);
        }