private void BtnExtenderDisconnect_Click(object sender, EventArgs e) { if (m_device != null) { m_device.Stop(); if (rdpClient.Connected == 1) rdpClient.Disconnect(); } m_device = null; }
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 Form1_Load(object sender, EventArgs e) { InitialiseLogger(); System.Diagnostics.Debug.WriteLine("OpenSoftSled (http://www.codeplex.com/softsled"); // For now we are passing the instance of the logger. Maybe we should place the logger into a global static class in the future? m_device = new ExtenderDevice(m_logger); #region Old //device = UPnPDevice.CreateRootDevice(1801, 1.0, "\\XD\\DeviceDescription.xml"); //device.FriendlyName = "SoftSled Media Center Extender"; //device.Manufacturer = "SoftSled Project"; //device.ManufacturerURL = "http://softsled.net"; //device.ModelName = "SoftSled Extender"; //device.ModelURL = new Uri("http://softsled.net"); //device.ModelDescription = "SoftSled Extender Software"; //device.DeviceURN = "urn:schemas-microsoft-com:device:MediaCenterExtenderMFD:1"; //device.HasPresentation = false; //device.LocationURL = "/XD/DeviceDescription.xml"; //device.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //UPnPDevice subDevice1 = UPnPDevice.CreateEmbeddedDevice(1.0, "840a20cc-a078-4d53-ac54-56f4972851e5"); //subDevice1.DeviceURN = "urn:schemas-microsoft-com:device:MediaCenterExtender:1"; //subDevice1.FriendlyName = "SoftSled Media Center Extender"; //subDevice1.Manufacturer = "SoftSled Project"; //subDevice1.ModelName = "SoftSled Extender"; //subDevice1.ModelURL = new Uri("http://softsled.net"); //subDevice1.ModelDescription = "SoftSled Extender Software"; //subDevice1.AddCustomFieldInDescription("X_compatibleId", "MICROSOFT_MCX_0001", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //subDevice1.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //subDevice1.AddService(new TrustAgreementService()); //UTF8Encoding utf = new UTF8Encoding(); //textBox1.Text = utf.GetString(subDevice1.Services[0].GetSCPDXml()); //device.AddDevice(subDevice1); //device.AddService(new NullService()); //subDevice1.Services[0].OnUPnPEvent += new UPnPService.UPnPEventHandler(Form1_OnUPnPEvent); //deviceWatcher = new UPnPDeviceWatcher(device); //deviceWatcher.OnSniff += new UPnPDeviceWatcher.SniffHandler(deviceWatcher_OnSniff); //deviceWatcher.OnSniffPacket += new UPnPDeviceWatcher.SniffPacketHandler(deviceWatcher_OnSniffPacket); #endregion m_rsaEncoder = new RSAEncoder(); m_rsaEncoder.InitializeKey(RSA.Create()); }
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); }
private void BtnExtenderSetup_Click(object sender, EventArgs e) { if (m_device != null) { MessageBox.Show("Device is already broadcasting!"); return; } m_device = new ExtenderDevice(m_logger); m_device.Start(); MessageBox.Show("SoftSled is broadcasting! Use the key 1234-3706 to pair the device"); }