Наследование: IAppSettings
Пример #1
0
 public SettingsCollection()
 {
     AppSettings = new AppSettings();
     JiraConnectionSettings = new JiraConnectionSettings();
     UiSettings = new UiSettings();
     InternalSettings = new InternalSettings();
     ExportSettings = new ExportSettings();
 }
        internal static AppSettings DeSerialize()
        {
            AppSettings appSettings;

            if (File.Exists(SavePath))
            {
                try
                {
                    var text = DataEncryption.Decrypt(File.ReadAllText(SavePath));
                    appSettings = JsonConvert.DeserializeObject<AppSettings>(text);
                }
                catch (Exception)
                {
                    appSettings = new AppSettings();
                }

            }
            else
            {
                appSettings = new AppSettings();
            }

            return appSettings;
        }
Пример #3
0
 public Backend()
 {
     appSettings = AppSettingsSerializer.DeSerialize();
     jiraConnectionSettings = JiraConnectionSettingsSerializer.DeSerialize();
     jiraTimerCollection = new JiraTimerCollection();
     idleTimerCollection = new IdleTimerCollection();
     ActivityChecker = new ActivityChecker(jiraTimerCollection, appSettings);
     ActivityChecker.NoActivityEvent += OnNoActivityEvent;
     hearbeat = new Timer(3600000);
     hearbeat.Elapsed += HearbeatOnElapsed;
     hearbeat.Start();
 }
        internal static void Serialize(AppSettings appSettings)
        {
            if (!Directory.Exists(FilePathSettings.DataSavePath)) Directory.CreateDirectory(FilePathSettings.DataSavePath);

            File.WriteAllText(SavePath, DataEncryption.Encrypt(JsonConvert.SerializeObject(appSettings)));
        }