static void Main(string[] args) { var sw = Stopwatch.StartNew(); var config = AssetConverterConfig.GetConfig(Path.Combine(Environment.CurrentDirectory, "AssetConverterConfig.json")); Console.WriteLine($"Config loaded: {sw.Elapsed}"); config.Apply(sw); Console.WriteLine($"Generation finished in {sw.Elapsed.TotalSeconds} seconds, press any key to close"); Console.ReadKey(); }
public static AssetConverterConfig GetConfig(string path) { AssetConverterConfig toReturn; CompositeResolver.RegisterAndSetAsDefault(new IJsonFormatter[] { new TimeSpanFormatter() }, new IJsonFormatterResolver[] { StandardResolver.Default }); if (!File.Exists(path)) { toReturn = new AssetConverterConfig(); var strNewConfig = JsonSerializer.PrettyPrint(JsonSerializer.ToJsonString(toReturn)); File.WriteAllText(path, strNewConfig); } using var configStream = File.OpenRead(path); toReturn = JsonSerializer.Deserialize <AssetConverterConfig>(configStream); return(toReturn); }