예제 #1
0
        void DoInitialization(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
                {
                    Thread.CurrentThread.Name = "OVInit";
                }

                // Get the BackgroundWorker that raised this event.
                BackgroundWorker worker = sender as BackgroundWorker;

                // clear cache files that might be left over from an application crash
                OnlineVideos.MPUrlSourceFilter.Downloader.ClearDownloadCache();

                // Load localized strings and set them to Translation class and GuiProperties
                Translator.TranslateSkin();

                // The default connection limit is 2 in .Net on most platforms! This means downloading two files will block all other WebRequests.
                System.Net.ServicePointManager.DefaultConnectionLimit = 100;

                // The default .Net implementation for URI parsing removes trailing dots, which is not correct
                Helpers.DotNetFrameworkHelper.FixUriTrailingDots();

                // set a GUI Property to the configured menu entry of the plugin so skins can use it
                GUIPropertyManager.SetProperty("#OnlineVideos.HomeScreenName", PluginConfiguration.Instance.BasicHomeScreenName);

                // When AutoUpdate of sites on startup is enabled and the last update was done earlier than configured run AutoUpdate and deletion of old thumbs
                if (PluginConfiguration.Instance.updateOnStart == true &&
                    PluginConfiguration.Instance.lastFirstRun.AddHours(PluginConfiguration.Instance.updatePeriod) < DateTime.Now &&
                    OnlineVideos.Sites.Updater.VersionCompatible)
                {
                    OnlineVideos.Sites.Updater.UpdateSites();
                    ImageDownloader.DeleteOldThumbs(PluginConfiguration.Instance.ThumbsAge, r => { return(true); });
                    PluginConfiguration.Instance.lastFirstRun = DateTime.Now;
                }

                // instantiates and initializes all siteutils
                OnlineVideoSettings.Instance.BuildSiteUtilsList();
                PluginConfiguration.Instance.BuildAutomaticSitesGroups();

                LatestVideosManager = new LatestVideosManager();
                LatestVideosManager.Start();
            }
            catch (Exception ex)
            {
                Log.Instance.Error("Error during initialization: {0}", ex.ToString());
            }
        }
		void DoInitialization(object sender, DoWorkEventArgs e)
		{
			try
			{
				if (string.IsNullOrEmpty(Thread.CurrentThread.Name)) Thread.CurrentThread.Name = "OVInit";

				// Get the BackgroundWorker that raised this event.
				BackgroundWorker worker = sender as BackgroundWorker;

				// clear cache files that might be left over from an application crash
                OnlineVideos.MPUrlSourceFilter.Downloader.ClearDownloadCache();

				// Load localized strings and set them to Translation class and GuiProperties
				Translator.TranslateSkin();

				// The default connection limit is 2 in .Net on most platforms! This means downloading two files will block all other WebRequests.
				System.Net.ServicePointManager.DefaultConnectionLimit = 100;

				// The default .Net implementation for URI parsing removes trailing dots, which is not correct
                Helpers.DotNetFrameworkHelper.FixUriTrailingDots();

				// set a GUI Property to the configured menu entry of the plugin so skins can use it
				GUIPropertyManager.SetProperty("#OnlineVideos.HomeScreenName", PluginConfiguration.Instance.BasicHomeScreenName);

				// When AutoUpdate of sites on startup is enabled and the last update was done earlier than configured run AutoUpdate and deletion of old thumbs
				if (PluginConfiguration.Instance.updateOnStart == true &&
					PluginConfiguration.Instance.lastFirstRun.AddHours(PluginConfiguration.Instance.updatePeriod) < DateTime.Now &&
					OnlineVideos.Sites.Updater.VersionCompatible)
				{
					OnlineVideos.Sites.Updater.UpdateSites();
					ImageDownloader.DeleteOldThumbs(PluginConfiguration.Instance.ThumbsAge, r => { return true; });
					PluginConfiguration.Instance.lastFirstRun = DateTime.Now;
				}

				// instantiates and initializes all siteutils
				OnlineVideoSettings.Instance.BuildSiteUtilsList();
                PluginConfiguration.Instance.BuildAutomaticSitesGroups();

				LatestVideosManager = new LatestVideosManager();
				LatestVideosManager.Start();
			}
			catch (Exception ex)
			{
				Log.Instance.Error("Error during initialization: {0}", ex.ToString());
			}
		}