Пример #1
0
        internal static void Serialize(JiraConnectionSettings appSettings)
        {
            if (!Directory.Exists(FilePathSettings.DataSavePath))
            {
                Directory.CreateDirectory(FilePathSettings.DataSavePath);
            }

            File.WriteAllText(SavePath, DataEncryption.Encrypt(JsonConvert.SerializeObject(appSettings)));
        }
Пример #2
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();
 }
Пример #3
0
        internal static JiraConnectionSettings DeSerialize()
        {
            JiraConnectionSettings jiraConnectionSettings;

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

            return(jiraConnectionSettings);
        }
Пример #4
0
 public void ReConnect(JiraConnectionSettings newJiraConnectionSettings)
 {
     jiraConnectionSettings = newJiraConnectionSettings;
     jira = null;
     CheckAndConnectJira();
 }
Пример #5
0
 public JiraConnection(JiraConnectionSettings jiraConnectionSettings)
 {
     this.jiraConnectionSettings = jiraConnectionSettings;
     CheckAndConnectJira();
 }