예제 #1
0
        public static async ValueTask ToJsonAsync <T>(this T obj, AbsolutePath path, bool useGenericSettings = false)
        {
            await using var fs = await path.Create();

            obj.ToJson(fs, useGenericSettings);
        }
예제 #2
0
 public static T FromJson <T>(this AbsolutePath filename)
 {
     return(JsonConvert.DeserializeObject <T>(filename.ReadAllText(), JsonSettings) !);
 }
예제 #3
0
 /// <summary>
 ///     Loads INI data from the given filename and returns a dynamic type that
 ///     can use . operators to navigate the INI.
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 public static dynamic LoadIniFile(this AbsolutePath file)
 {
     return(new DynamicIniData(new FileIniDataParser(IniParser()).ReadFile((string)file)));
 }