/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormMain_Load(object sender, EventArgs e) { using (new HourGlass(this)) { this.Show(); _settings = new Settings(); string ret = _settings.Load(); if (ret.Length > 0) { Misc.DisplayErrorMessageBox("An error occurred whilst loading the settings: " + ret); return; } if (_settings.TorrentFileDirectory.Length == 0) { Misc.DisplayMessageBox("The torrent file directory has not been set. It must be set before the application can continue", MessageBoxIcon.Exclamation); } if (_settings.TorrentDirectory.Length == 0) { Misc.DisplayMessageBox("The torrent directory has not been set. It must be set before the application can continue", MessageBoxIcon.Exclamation); return; } _providers = new List<Provider>(); //_providers.Add(new DailyTvTorrent(1)); _providers.Add(new ShowRss(1)); _retriever = new Retriever(API_KEY); _configuration = new Configuration(); _manager = new Manager(API_KEY, _settings, _configuration, _providers); _manager.EpisodeFound += OnManager_EpisodeFound; _manager.SeriesFound += OnManager_SeriesFound; _manager.TorrentFound += OnManager_TorrentFound; _manager.Error += OnManager_Error; _manager.DownloadUpdate += OnManager_DownloadUpdate; _manager.Message += OnManager_Message; _fileSystemWatcher = new FileSystemWatcher(_settings.TorrentDirectory); _fileSystemWatcher.Created += OnFileSystemWatcher_Created; _fileSystemWatcher.EnableRaisingEvents = true; ret = _configuration.Load(); if (ret.Length > 0) { Misc.DisplayErrorMessageBox(this, "An error occurred whilst loading the configuration"); return; } // Ensure we have a base line server timestamp, used for updating with TVDB if (_configuration.LastUpdated == DateTime.MinValue) { _configuration.LastUpdated = _retriever.ServerTime(); } //listEpisodes.ShowGroups = true; LoadSeries(); } }