コード例 #1
0
        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.");
        }
コード例 #2
0
        public static EpisodeDatabase InitializeEpisodeDatabaseInstance(IConfiguration configuration)
        {
            EpisodeDatabase episodeDatabase = new EpisodeDatabase(configuration);

            return(episodeDatabase);
        }