Beispiel #1
0
        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;
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     m_device.Stop();
 }