Example #1
0
 public Logger()
 {
     Log.Logger = new LoggerConfiguration()
                  .MinimumLevel.Information()
                  .WriteTo.File(System.IO.Path.Combine(StaticFolders.GetUserFolder(), GlobalValues.LogFile),
                                rollingInterval: RollingInterval.Day,
                                rollOnFileSizeLimit: true)
                  .CreateLogger();
 }
Example #2
0
 public void Save()
 {
     try
     {
         var value = JsonConvert.SerializeObject(this);
         var path  = System.IO.Path.Combine(StaticFolders.GetUserFolder(), GlobalValues.SettingsFileName);
         System.IO.File.WriteAllText(path, value);
     } catch (Exception ex)
     {
         _logger.Error(ex);
     }
 }
Example #3
0
 public void Load()
 {
     try
     {
         var path = System.IO.Path.Combine(StaticFolders.GetUserFolder(), GlobalValues.SettingsFileName);
         if (System.IO.File.Exists(path))
         {
             var settings = JsonConvert.DeserializeObject <Settings>(System.IO.File.ReadAllText(path));
             Culture = settings.Culture;
             DBPath  = settings.DBPath;
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
     }
 }
Example #4
0
 public Settings()
 {
     _logger = (Internal.ILogger)Bootstrap.Instance.Services.GetService(typeof(Internal.ILogger));
     Culture = Localize.Language.English;
     DBPath  = System.IO.Path.Combine(StaticFolders.GetUserFolder(), GlobalValues.DBFileName);
 }