Esempio n. 1
0
        public List <IdNamePair> LoadAll()
        {
            string[] lines = { };
            try
            {
                this.EnsureFileExists();
                lines = File.ReadAllLines(PresetManager.SavedTimersPath);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                return(null);
            }

            this.savedSettings.Clear();
            var idNamePairs = new List <IdNamePair>();

            foreach (var line in lines)
            {
                var setting = SimpleTimerSettings.ParseCsv(line);
                var id      = setting.Id;
                if (this.HasSetting(id))
                {
                    this.UpdateSetting(id, setting);
                }
                else
                {
                    this.AddNewSetting(id, setting);
                }

                idNamePairs.Add(new IdNamePair(id, setting.Name));
            }

            return(idNamePairs);
        }
Esempio n. 2
0
 public bool RemoveTimer(string timerString)
 {
     return(this.RemoveTimer(SimpleTimerSettings.ParseCsv(timerString)));
 }
Esempio n. 3
0
 public void AddTimer(string timerString)
 {
     this.AddTimer(SimpleTimerSettings.ParseCsv(timerString));
 }