private void ReadIndexData(Boolean update = false) { if (episodeDatabase != null) { episodeDatabase.Close(); } if (update) { if (File.Exists(RuntimeConfig.Instance.m_indexFile)) { File.Delete(RuntimeConfig.Instance.m_indexFile); } m_setup.setUpIndex(); } if (!File.Exists(RuntimeConfig.Instance.m_indexFile)) { Console.WriteLine("No index data found!"); return; } /* Setup Database */ episodeDatabase = new EpisodeDatabase(RuntimeConfig.Instance.m_indexFile); /* Parse csv file */ Episode[] results = episodeDatabase.GetAllEpisodes(); /* Check if we have a result */ if (results == null || results.Count() <= 0) { return; } /* Process services */ foreach (Episode episode in results) { m_episodes.Add(episode); //Add service to internal list } Console.WriteLine("Loaded episode index."); }
public static EpisodeDatabase InitializeEpisodeDatabaseInstance(IConfiguration configuration) { EpisodeDatabase episodeDatabase = new EpisodeDatabase(configuration); return(episodeDatabase); }