private void FrmMain_Load(object sender, EventArgs e) { InitialiseLogger(); // Configure Buttons btnExtenderDisconnect.Enabled = false; // Create VirtualChannel Handlers AvCtrlHandler = new VirtualChannelAvCtrlHandler(m_logger, rdpClient, _libVLC, _mp); DevCapsHandler = new VirtualChannelDevCapsHandler(m_logger, rdpClient); McxSessHandler = new VirtualChannelMcxSessHandler(m_logger, rdpClient); // Create VirtualChannel Handlers EventHandlers McxSessHandler.StatusChanged += McxSessHandler_StatusChanged; m_logger.LogInfo("Open SoftSled (http://github.com/l2n6h5b3/SoftSled2)"); SoftSledConfig config = SoftSledConfigManager.ReadConfig(); if (!config.IsPaired) { m_logger.LogInfo("Extender is not paired!"); SetStatus("Extender is not paired"); } else { m_logger.LogInfo("Extender is paired with " + config.RdpLoginHost); SetStatus("Extender ready to connect"); } }
private void FrmFullScreen_Load(object sender, EventArgs e) { InitialiseLogger(); // Configure Window //this.TopMost = true; this.Bounds = Screen.PrimaryScreen.Bounds; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; this.rdpClient.Size = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); // Create VirtualChannel Handlers AvCtrlHandler = new VirtualChannelAvCtrlHandler(m_logger, rdpClient, _libVLC, _mp); DevCapsHandler = new VirtualChannelDevCapsHandler(m_logger, rdpClient); McxSessHandler = new VirtualChannelMcxSessHandler(m_logger, rdpClient); // Create VirtualChannel Handlers EventHandlers McxSessHandler.StatusChanged += McxSessHandler_StatusChanged; m_logger.LogInfo("OpenSoftSled (http://github.com/l2n6h5b3/SoftSled2)"); SoftSledConfig config = SoftSledConfigManager.ReadConfig(); if (!config.IsPaired) { m_logger.LogInfo("Extender is not paired!"); } else { m_logger.LogInfo("Extender is paired with " + config.RdpLoginHost); } // Connect Extender ConnectExtender(); }
public void RemotedExperienceService_Advertise(System.UInt32 Nonce, System.String HostId, System.String ApplicationId, System.String ApplicationVersion, System.String ApplicationData, System.String HostFriendlyName, System.String ExperienceFriendlyName, System.String ExperienceIconUri, System.String ExperienceEndpointUri, System.String ExperienceEndpointData, System.String SignatureAlgorithm, System.String Signature, System.String HostCertificate) { _RES_HostNonce = BitConverter.GetBytes(Nonce); _RES_ApplicationId = ApplicationId; _RES_ApplicationVersion = ApplicationVersion; _RES_ExperienceEndpointUri = ExperienceEndpointUri; _RES_ExperienceEndpointData = ExperienceEndpointData; _RES_SignatureAlgorithm = SignatureAlgorithm; _RES_Signature = Signature; _RES_HostCertificate = HostCertificate; m_logger.LogDebug("RemotedExperienceService_Advertise(" + Nonce.ToString() + HostId.ToString() + ApplicationId.ToString() + ApplicationVersion.ToString() + ApplicationData.ToString() + HostFriendlyName.ToString() + ExperienceFriendlyName.ToString() + ExperienceIconUri.ToString() + ExperienceEndpointUri.ToString() + ExperienceEndpointData.ToString() + SignatureAlgorithm.ToString() + Signature.ToString() + HostCertificate.ToString() + ")"); // parse endpoint data Dictionary <String, String> endpointData = new Dictionary <String, String>(); foreach (String part in ExperienceEndpointData.Split(';')) { String[] nameValuePair = part.Split(new char[] { '=' }, 2); endpointData.Add(nameValuePair[0], nameValuePair[1]); } // decrypt MCX user password with cert's signing key (private key) RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Certificates\\SoftSledPrivateKey.xml")); byte[] cryptedPass = Convert.FromBase64String(endpointData["encryptedpassword"]); String rdpPass = ""; try { rdpPass = Encoding.ASCII.GetString(rsa.Decrypt(cryptedPass, true)); } catch (Exception ex) { m_logger.LogError("RSA decryption of encrypted password failed " + ex.Message); m_logger.LogError("Extender Experience Pairing has failed!"); return; } string rdpHost = ExperienceEndpointUri.Substring(6, ExperienceEndpointUri.Length - 12); string rdpUser = endpointData["user"]; m_logger.LogDebug("RDP host: " + rdpHost); m_logger.LogDebug("RDP clear text Password: "******"RDP user: "******"Extender Experience data exchanged!"); }
private void btnExtenderConnect_Click(object sender, EventArgs e) { IPAddress localhost = null; var host = Dns.GetHostEntry(Dns.GetHostName()); // Get IPv4 Address var IPv4Address = host.AddressList.FirstOrDefault(xx => xx.AddressFamily == AddressFamily.InterNetwork); // Check if there is an IPv4 Address if (IPv4Address != null) { localhost = IPv4Address; } else { throw new Exception("No network adapters with an IPv4 address in the system!"); } if (m_device != null) { m_device.Stop(); } SoftSledConfig currConfig = SoftSledConfigManager.ReadConfig(); if (!currConfig.IsPaired) { MessageBox.Show("SoftSled is currently not paired with Windows Media Center. Enter the 'Extender Setup' mode to pair."); return; } txtLog.Text = ""; m_device = new ExtenderDevice(m_logger); m_device.Start(); // If RDP not Initialised if (!rdpInitialised) { // Initialise RDP InitialiseRdpClient(); } // Set RDP Server Address rdpClient.Server = currConfig.RdpLoginHost; // Set RDP Username rdpClient.UserName = currConfig.RdpLoginUserName; // Set RDP Password rdpClient.AdvancedSettings2.ClearTextPassword = currConfig.RdpLoginPassword; // Set RDP Color Depth rdpClient.ColorDepth = 32; // Connect RDP rdpClient.Connect(); SetStatus("Remote Desktop Connecting..."); isConnecting = true; }
private void btnExtenderConnect_Click(object sender, EventArgs e) { if (m_device != null) { m_device.Stop(); } SoftSledConfig currConfig = SoftSledConfigManager.ReadConfig(); if (!currConfig.IsPaired) { MessageBox.Show("SoftSled is currently not paired with Windows Media Center. Enter the 'Extender Setup' mode to pair."); return; } txtLog.Text = ""; devCapsIter = 1; m_device = new ExtenderDevice(m_logger); m_device.Start(); m_channelHandler = new McxVirtualChannelHandler(); rdpClient.OnConnected += new EventHandler(rdpClient_OnConnected); rdpClient.OnDisconnected += new AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEventHandler(rdpClient_OnDisconnected); rdpClient.OnChannelReceivedData += new AxMSTSCLib.IMsTscAxEvents_OnChannelReceivedDataEventHandler(rdpClient_OnChannelReceivedData); rdpClient.AdvancedSettings3.RDPPort = 3390; rdpClient.SecuredSettings.StartProgram = "%windir%\\ehome\\ehshell.exe"; rdpClient.Server = currConfig.RdpLoginHost; rdpClient.UserName = currConfig.RdpLoginUserName; rdpClient.AdvancedSettings2.ClearTextPassword = currConfig.RdpLoginPassword; // McxSess - used by mcrmgr // MCECaps - not known where used // devcaps - used by ehshell to determine extender capabilities // avctrl - used for av signalling // VCHD - something to do with av signalling // NOTICE, if you want ehshell.exe to start up in normal Remote Desktop mode, remove the devcaps channel definition bellow. rdpClient.CreateVirtualChannels("McxSess,MCECaps,devcaps,avctrl,VCHD"); rdpClient.Connect(); SetStatus("Remote Desktop Connecting..."); isConnecting = true; TcpListener tcp1 = new TcpListener(3776); TcpListener tcp2 = new TcpListener(3777); TcpListener tcp3 = new TcpListener(3778); TcpListener tcp4 = new TcpListener(2177); //new Thread(new ParameterizedThreadStart(Listen)).Start(tcp1); //new Thread(new ParameterizedThreadStart(Listen)).Start(tcp2); // new Thread(new ParameterizedThreadStart(Listen)).Start(tcp3); //new Thread(new ParameterizedThreadStart(Listen)).Start(tcp4); }
/// <summary> /// Action: Advertise /// </summary> /// <param name="Nonce">Associated State Variable: A_ARG_TYPE_Nonce</param> /// <param name="HostId">Associated State Variable: A_ARG_TYPE_EndpointID</param> /// <param name="ApplicationId">Associated State Variable: A_ARG_TYPE_EndpointID</param> /// <param name="ApplicationVersion">Associated State Variable: A_ARG_TYPE_Version</param> /// <param name="ApplicationData">Associated State Variable: A_ARG_TYPE_AnyString</param> /// <param name="HostFriendlyName">Associated State Variable: A_ARG_TYPE_Name</param> /// <param name="ExperienceFriendlyName">Associated State Variable: A_ARG_TYPE_Name</param> /// <param name="ExperienceIconUri">Associated State Variable: A_ARG_TYPE_Uri</param> /// <param name="ExperienceEndpointUri">Associated State Variable: A_ARG_TYPE_Uri</param> /// <param name="ExperienceEndpointData">Associated State Variable: A_ARG_TYPE_AnyString</param> /// <param name="SignatureAlgorithm">Associated State Variable: A_ARG_TYPE_SignAlgorithm</param> /// <param name="Signature">Associated State Variable: A_ARG_TYPE_Signature</param> /// <param name="HostCertificate">Associated State Variable: A_ARG_TYPE_Certificate</param> public void Advertise(System.UInt32 Nonce, System.String HostId, System.String ApplicationId, System.String ApplicationVersion, System.String ApplicationData, System.String HostFriendlyName, System.String ExperienceFriendlyName, System.String ExperienceIconUri, System.String ExperienceEndpointUri, System.String ExperienceEndpointData, System.String SignatureAlgorithm, System.String Signature, System.String HostCertificate) { System.Diagnostics.Debug.WriteLine("RemotedExperienceService_Advertise(" + Nonce.ToString() + HostId.ToString() + ApplicationId.ToString() + ApplicationVersion.ToString() + ApplicationData.ToString() + HostFriendlyName.ToString() + ExperienceFriendlyName.ToString() + ExperienceIconUri.ToString() + ExperienceEndpointUri.ToString() + ExperienceEndpointData.ToString() + SignatureAlgorithm.ToString() + Signature.ToString() + HostCertificate.ToString() + ")"); //ToDo: Add Your implementation here, and remove exception // Set the rdp login username/password in the config file. SoftSledConfig currConfig = SoftSledConfigManager.ReadConfig(); currConfig.IsPaired = true; currConfig.RdpLoginUserName = "******"; currConfig.RdpLoginPassword = "******"; SoftSledConfigManager.WriteConfig(currConfig); throw (new UPnPCustomException(800, "This method has not been completely implemented...")); }
private void frmMain_Load(object sender, EventArgs e) { InitialiseLogger(); m_logger.LogInfo("OpenSoftSled (http://www.codeplex.com/softsled"); SoftSledConfig config = SoftSledConfigManager.ReadConfig(); if (!config.IsPaired) { m_logger.LogInfo("Extender is not paired!"); SetStatus("Extender is not paired"); } else { m_logger.LogInfo("Extender is paired with " + config.RdpLoginHost); SetStatus("Extender ready to connect"); } }