private static async Task <T> ConfigFactory <T>(string name = null) where T : IConfig { var configName = name ?? typeof(T).Name.Replace("Config", ""); _logger.Log(LogLevel.Info, $"Loading {configName} application data..."); try { var config = JsonConvert.DeserializeObject <T>(await Cfg.GetConfigJson(configName)); _logger.Log(LogLevel.Info, $"{configName} application data load complete"); await config.LoadUserConfigAsync(Cfg.AppDataPath); _logger.Log(LogLevel.Info, $"{configName} user data load complete"); return(config); } catch (Exception e) { _logger.Log(LogLevel.Fatal, $"Unable to load {configName} application data"); _logger.Log(LogLevel.Fatal, e.Message); _logger.Log(LogLevel.Fatal, e.StackTrace); throw; } }