/// <summary> /// /// </summary> private void DoStartupJobs() { Log.Debug("Main: DoStartupJobs()"); FilterChecker.CheckInstalledVersions(); Version aParamVersion; // 6.5.2600.3243 = KB941568, 6.5.2600.3024 = KB927544 if (!FilterChecker.CheckFileVersion(Environment.SystemDirectory + "\\quartz.dll", "6.5.2600.3024", out aParamVersion)) { string errorMsg = string.Format("Your version {0} of quartz.dll has too many bugs! \nPlease check our Wiki's requirements page.", aParamVersion); Log.Info("Util: quartz.dll error - {0}", errorMsg); // ReSharper disable LocalizableElement if (MessageBox.Show(errorMsg, "Core DirectShow component (quartz.dll) is outdated!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) // ReSharper restore LocalizableElement { Process.Start(@"http://wiki.team-mediaportal.com/GeneralRequirements"); } } GUIWindowManager.OnNewAction += OnAction; GUIWindowManager.Receivers += OnMessage; GUIWindowManager.Callbacks += MPProcess; GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.STARTING; Utils.OnStartExternal += OnStartExternal; Utils.OnStopExternal += OnStopExternal; // register the playlistplayer for thread messages (like playback stopped,ended) Log.Info("Main: Init playlist player"); g_Player.Factory = new PlayerFactory(); PlaylistPlayer.Init(); // Only load the USBUIRT device if it has been enabled in the configuration using (Settings xmlreader = new MPSettings()) { bool inputEnabled = xmlreader.GetValueAsBool("USBUIRT", "internal", false); bool outputEnabled = xmlreader.GetValueAsBool("USBUIRT", "external", false); if (inputEnabled || outputEnabled) { Log.Info("Main: Creating the USBUIRT device"); _usbuirtdevice = USBUIRT.Create(OnRemoteCommand); Log.Info("Main: Creating the USBUIRT device done"); } // Load Winlirc if enabled. bool winlircInputEnabled = xmlreader.GetValueAsString("WINLIRC", "enabled", "false") == "true"; if (winlircInputEnabled) { Log.Info("Main: Creating the WINLIRC device"); _winlircdevice = new WinLirc(); Log.Info("Main: Creating the WINLIRC device done"); } // Load RedEye if enabled. bool redeyeInputEnabled = xmlreader.GetValueAsString("RedEye", "internal", "false") == "true"; if (redeyeInputEnabled) { Log.Info("Main: Creating the REDEYE device"); _redeyedevice = RedEye.Create(OnRemoteCommand); Log.Info("Main: Creating the RedEye device done"); } // load SerialUIR if enabled inputEnabled = xmlreader.GetValueAsString("SerialUIR", "internal", "false") == "true"; if (inputEnabled) { Log.Info("Main: Creating the SerialUIR device"); _serialuirdevice = SerialUIR.Create(OnRemoteCommand); Log.Info("Main: Creating the SerialUIR device done"); } } // registers the player for video window size notifications Log.Info("Main: Init players"); g_Player.Init(); GUIGraphicsContext.ActiveForm = Handle; var doc = new XmlDocument(); try { doc.Load("mediaportal.exe.config"); XmlNode node = doc.SelectSingleNode("/configuration/appStart/ClientApplicationInfo/appFolderName"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } node = doc.SelectSingleNode("/configuration/appUpdater/UpdaterConfiguration/application/client/baseDir"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } node = doc.SelectSingleNode("/configuration/appUpdater/UpdaterConfiguration/application/client/tempDir"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } doc.Save("MediaPortal.exe.config"); } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause Thumbs.CreateFolders(); GUIGraphicsContext.ResetLastActivity(); }
/// <summary> /// /// </summary> /// <param name="remoteCommandCallback"></param> /// <returns></returns> public static USBUIRT Create(OnRemoteCommand remoteCommandCallback) { try { if (Instance == null) { Instance = new USBUIRT(remoteCommandCallback); } } catch (Exception) {} return Instance; }
private void DoStartupJobs() { FilterChecker.CheckInstalledVersions(); Version aParamVersion; // // 6.5.2600.3243 = KB941568, 6.5.2600.3024 = KB927544 // if ( !FilterChecker.CheckFileVersion(Environment.SystemDirectory + "\\quartz.dll", "6.5.2600.3024", out aParamVersion)) { string ErrorMsg = string.Format("Your version {0} of quartz.dll has too many bugs! \nPlease check our Wiki's requirements page.", aParamVersion.ToString()); Log.Info("Util: quartz.dll error - {0}", ErrorMsg); if ( MessageBox.Show(ErrorMsg, "Core directshow component (quartz.dll) is outdated!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { Process.Start(@"http://wiki.team-mediaportal.com/GeneralRequirements"); } } EnableS3Trick(); GUIWindowManager.OnNewAction += new OnActionHandler(OnAction); GUIWindowManager.Receivers += new SendMessageHandler(OnMessage); GUIWindowManager.Callbacks += new GUIWindowManager.OnCallBackHandler(MPProcess); GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.STARTING; Utils.OnStartExternal += new Utils.UtilEventHandler(OnStartExternal); Utils.OnStopExternal += new Utils.UtilEventHandler(OnStopExternal); // load keymapping from keymap.xml ActionTranslator.Load(); //register the playlistplayer for thread messages (like playback stopped,ended) Log.Info("Main: Init playlist player"); g_Player.Factory = new PlayerFactory(); playlistPlayer.Init(); // Only load the USBUIRT device if it has been enabled in the configuration using (Settings xmlreader = new MPSettings()) { bool inputEnabled = xmlreader.GetValueAsBool("USBUIRT", "internal", false); bool outputEnabled = xmlreader.GetValueAsBool("USBUIRT", "external", false); if (inputEnabled || outputEnabled) { Log.Info("Main: Creating the USBUIRT device"); usbuirtdevice = USBUIRT.Create(new USBUIRT.OnRemoteCommand(OnRemoteCommand)); Log.Info("Main: Creating the USBUIRT device done"); } //Load Winlirc if enabled. bool winlircInputEnabled = xmlreader.GetValueAsString("WINLIRC", "enabled", "false") == "true"; if (winlircInputEnabled) { Log.Info("Main: Creating the WINLIRC device"); winlircdevice = new WinLirc(); Log.Info("Main: Creating the WINLIRC device done"); } //Load RedEye if enabled. bool redeyeInputEnabled = xmlreader.GetValueAsString("RedEye", "internal", "false") == "true"; if (redeyeInputEnabled) { Log.Info("Main: Creating the REDEYE device"); redeyedevice = RedEye.Create(new RedEye.OnRemoteCommand(OnRemoteCommand)); Log.Info("Main: Creating the RedEye device done"); } inputEnabled = xmlreader.GetValueAsString("SerialUIR", "internal", "false") == "true"; if (inputEnabled) { Log.Info("Main: Creating the SerialUIR device"); serialuirdevice = SerialUIR.Create(new SerialUIR.OnRemoteCommand(OnRemoteCommand)); Log.Info("Main: Creating the SerialUIR device done"); } } //registers the player for video window size notifications Log.Info("Main: Init players"); g_Player.Init(); GUIGraphicsContext.ActiveForm = Handle; // hook ProcessExit for a chance to clean up when closed peremptorily #if AUTOUPDATE AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); // hook form close to stop updater too this.Closed += new EventHandler(MediaPortal_Closed); #endif XmlDocument doc = new XmlDocument(); try { doc.Load("mediaportal.exe.config"); XmlNode node = doc.SelectSingleNode("/configuration/appStart/ClientApplicationInfo/appFolderName"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } node = doc.SelectSingleNode("/configuration/appUpdater/UpdaterConfiguration/application/client/baseDir"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } node = doc.SelectSingleNode("/configuration/appUpdater/UpdaterConfiguration/application/client/tempDir"); if (node != null) { node.InnerText = Directory.GetCurrentDirectory(); } doc.Save("MediaPortal.exe.config"); } catch (Exception) {} Thumbs.CreateFolders(); try { #if DEBUG #else #if AUTOUPDATE UpdaterConfiguration config = UpdaterConfiguration.Instance; config.Logging.LogPath = Config.Get(Config.Dir.Log) + "updatelog.log"; config.Applications[0].Client.BaseDir = Config.Get(Config.Dir.Base) config.Applications[0].Client.TempDir = Config.Get(Config.Dir.Base) + "temp"; config.Applications[0].Client.XmlFile = Config.Get(Config.Dir.Base) + "MediaPortal.exe.config"; config.Applications[0].Server.ServerManifestFileDestination = Config.Get(Config.Dir.Base) + @"xml\ServerManifest.xml"; try { System.IO.Directory.CreateDirectory(config.Applications[0].Client.BaseDir + @"temp"); System.IO.Directory.CreateDirectory(config.Applications[0].Client.BaseDir + @"xml"); System.IO.Directory.CreateDirectory(config.Applications[0].Client.BaseDir + @"log"); } catch(Exception){} Utils.DeleteFiles(config.Applications[0].Client.BaseDir + "log", "*.log"); ClientApplicationInfo clientInfo = ClientApplicationInfo.Deserialize("MediaPortal.exe.config"); clientInfo.AppFolderName = System.IO.Directory.GetCurrentDirectory(); ClientApplicationInfo.Save("MediaPortal.exe.config",clientInfo.AppFolderName, clientInfo.InstalledVersion); m_strCurrentVersion = clientInfo.InstalledVersion; Text += (" - [v" + m_strCurrentVersion + "]"); // make an Updater for use in-process with us _updater = new ApplicationUpdateManager(); // hook Updater events _updater.DownloadStarted += new UpdaterActionEventHandler(OnUpdaterDownloadStarted); _updater.UpdateAvailable += new UpdaterActionEventHandler(OnUpdaterUpdateAvailable); _updater.DownloadCompleted += new UpdaterActionEventHandler(OnUpdaterDownloadCompleted); // start the updater on a separate thread so that our UI remains responsive _updaterThread = new Thread(new ThreadStart(_updater.StartUpdater)); _updaterThread.Start(); #endif #endif } catch (Exception) {} using (Settings xmlreader = new MPSettings()) { m_iDateLayout = xmlreader.GetValueAsInt("home", "datelayout", 0); } GUIGraphicsContext.ResetLastActivity(); }