public void Start() { _run = true; g_Player.PlayBackEnded += OnVideoEnded; g_Player.PlayBackStopped += OnVideoStopped; g_Player.PlayBackStarted += OnVideoStarted; g_Player.TVChannelChanged += OnTVChannelChanged; using (Settings reader = new MPSettings()) { b3DMenuAlways = reader.GetValueAsBool("Auto3DPlugin", "3DMenuAlways", false); b3DMenuOnKey = reader.GetValueAsBool("Auto3DPlugin", "3DMenuOnKey", false); String menuHotKey = reader.GetValueAsString("Auto3DPlugin", "3DMenuKey", "CTRL + D"); if (menuHotKey.StartsWith("MCE")) // reject old configs { menuHotKey = ""; } if (menuHotKey.StartsWith("HID")) { bMenuMCERemote = true; mceRemoteKey = menuHotKey; HIDInput.getInstance().HidEvent += Auto3DSetup_HidEvent; } else { bMenuHotKeyShift = menuHotKey.Contains("SHIFT"); bMenuHotKeyCtrl = menuHotKey.Contains("CTRL"); bMenuHotKeyAlt = menuHotKey.Contains("ALT"); if (menuHotKey.Contains("+")) { int pos = menuHotKey.LastIndexOf('+'); menuHotKey = menuHotKey.Substring(pos + 1).Trim(); } _menuHotKey = (Keys)Enum.Parse(typeof(Keys), menuHotKey, true); } bCheckNameSimple = reader.GetValueAsBool("Auto3DPlugin", "CheckNameSimple", true); bCheckNameFull = reader.GetValueAsBool("Auto3DPlugin", "CheckNameFull", true); bCheckSideBySide = reader.GetValueAsBool("Auto3DPlugin", "SideBySide", true); bCheckTopAndBottom = reader.GetValueAsBool("Auto3DPlugin", "TopAndBottom", false); bAnalyzeNetworkStream = reader.GetValueAsBool("Auto3DPlugin", "AnalyzeNetworkStream", true); String activeDeviceName = reader.GetValueAsString("Auto3DPlugin", "ActiveDevice", ""); bTV = reader.GetValueAsBool("Auto3DPlugin", "TV", false); bVideo = reader.GetValueAsBool("Auto3DPlugin", "Video", true); if (reader.GetValueAsBool("Auto3DPlugin", "CheckNameFormatSBS", true)) { _nameFormat = VideoFormat.Fmt3DSBS; } else { _nameFormat = VideoFormat.Fmt3DTAB; } foreach (IAuto3D device in _listDevices) { if (device.ToString() == activeDeviceName) { _activeDevice = device; } } if (_activeDevice == null) { _activeDevice = _listDevices[0]; } Log.Info("Auto3D: Connecting to Device " + _activeDevice.ToString()); _activeDevice.Start(); if (_activeDevice is Auto3DUPnPBaseDevice) { Auto3DUPnP.StartSSDP(); } if (b3DMenuOnKey) { Auto3DHelpers.GetMainForm().PreviewKeyDown += form_PreviewKeyDown; } GUIGraphicsContext.Render3DSubtitle = reader.GetValueAsBool("Auto3DPlugin", "3DSubtitles", true); GUIGraphicsContext.Render3DSubtitleDistance = -reader.GetValueAsInt("Auto3DPlugin", "SubtitleDepth", 0); bConvert2Dto3DEnabled = reader.GetValueAsBool("Auto3DPlugin", "ConvertTo3D", false); GUIGraphicsContext.Convert2Dto3DSkewFactor = reader.GetValueAsInt("Auto3DPlugin", "SkewFactor", 10); bStretchSubtitles = reader.GetValueAsBool("Auto3DPlugin", "StretchSubtitles", false); bSuppressSwitchBackTo2D = reader.GetValueAsBool("Auto3DPlugin", "SupressSwitchBackTo2D", false); bConvert3DTo2D = reader.GetValueAsBool("Auto3DPlugin", "Convert3DTo2D", false); SplitKeywords(ref _keywordsSBS, reader.GetValueAsString("Auto3DPlugin", "SwitchSBSLabels", "\"3DSBS\", \"3D SBS\"")); SplitKeywords(ref _keywordsSBSR, reader.GetValueAsString("Auto3DPlugin", "SwitchSBSRLabels", "\"3DSBSR\", \"3D SBS R\"")); SplitKeywords(ref _keywordsTAB, reader.GetValueAsString("Auto3DPlugin", "SwitchTABLabels", "\"3DTAB\", \"3D TAB\"")); SplitKeywords(ref _keywordsTABR, reader.GetValueAsString("Auto3DPlugin", "SwitchTABRLabels", "\"3DTABR\", \"3D TAB R\"")); bTurnDeviceOff = reader.GetValueAsBool("Auto3DPlugin", "TurnDeviceOff", false); nTurnDeviceOffVia = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0); nTurnDeviceOffWhen = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffWhen", 0); bTurnDeviceOn = reader.GetValueAsBool("Auto3DPlugin", "TurnDeviceOn", false); nTurnDeviceOnVia = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0); nTurnDeviceOnWhen = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnWhen", 0); } SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; SystemEvents.SessionEnding += SystemEvents_SessionEnding; GUIGraphicsContext.OnNewAction += GUIGraphicsContext_OnNewAction; if (bTurnDeviceOff && (nTurnDeviceOnWhen == 0 || nTurnDeviceOnWhen == 2) && _activeDevice.GetTurnOffInterfaces() != DeviceInterface.None) { _activeDevice.TurnOn((DeviceInterface)nTurnDeviceOnVia); } }
private void comboBoxModel_SelectedIndexChanged(object sender, EventArgs e) { if (_lastDevice != null) { _lastDevice.Stop(); } Auto3DUPnP.StopSSDP(); IAuto3DSetup setup = (IAuto3DSetup)((IAuto3D)comboBoxModel.SelectedItem).GetSetupControl(); setup.BringToFront(); setup.GetDevice().Start(); if (setup.GetDevice() is Auto3DUPnPBaseDevice) { Auto3DUPnP.StartSSDP(); } buttonConfig.Visible = (setup.GetDevice().GetRemoteControl() != null); Auto3DBaseDevice baseDevice = (Auto3DBaseDevice)setup.GetDevice(); if (baseDevice.GetTurnOffInterfaces() == DeviceInterface.None) { checkBoxTurnOffDevice.Enabled = false; comboBoxTurnOffDevice.Enabled = false; buttonTurnOffDevice.Enabled = false; radioButtonIpOff.Enabled = false; radioButtonIrOff.Enabled = false; } else { checkBoxTurnOffDevice.Enabled = true; comboBoxTurnOffDevice.Enabled = true; buttonTurnOffDevice.Enabled = true; if ((baseDevice.GetTurnOffInterfaces() & DeviceInterface.IR) == DeviceInterface.IR) { using (Settings reader = new MPSettings()) { radioButtonIrOff.Enabled = true; radioButtonIrOff.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0) == 2; } } else { using (Settings reader = new MPSettings()) { radioButtonIrOff.Enabled = false; radioButtonIrOff.Checked = false; } } if ((baseDevice.GetTurnOffInterfaces() & DeviceInterface.Network) == DeviceInterface.Network) { using (Settings reader = new MPSettings()) { radioButtonIpOff.Enabled = true; radioButtonIpOff.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOffVia", 0) == 1; } } else { using (Settings reader = new MPSettings()) { radioButtonIpOff.Enabled = false; radioButtonIpOff.Checked = false; } } } if (baseDevice.GetTurnOnInterfaces() == DeviceInterface.None) { checkBoxTurnOnDevice.Enabled = false; comboBoxTurnOnDevice.Enabled = false; buttonTurnOnDevice.Enabled = false; radioButtonIpOn.Enabled = false; radioButtonIrOn.Enabled = false; } else { checkBoxTurnOnDevice.Enabled = true; comboBoxTurnOnDevice.Enabled = true; buttonTurnOnDevice.Enabled = true; if ((baseDevice.GetTurnOnInterfaces() & DeviceInterface.IR) == DeviceInterface.IR) { using (Settings reader = new MPSettings()) { radioButtonIrOn.Enabled = true; radioButtonIrOn.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0) == 2; } } else { using (Settings reader = new MPSettings()) { radioButtonIrOn.Enabled = false; radioButtonIrOn.Checked = false; } } if ((baseDevice.GetTurnOnInterfaces() & DeviceInterface.Network) == DeviceInterface.Network) { using (Settings reader = new MPSettings()) { radioButtonIpOn.Enabled = true; radioButtonIpOn.Checked = reader.GetValueAsInt("Auto3DPlugin", "TurnDeviceOnVia", 0) == 1; } } else { using (Settings reader = new MPSettings()) { radioButtonIpOn.Enabled = false; radioButtonIpOn.Checked = false; } } } }