コード例 #1
0
        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");
            }
        }
コード例 #2
0
ファイル: FrmFullScreen.cs プロジェクト: L2N6H5B3/SoftSled2
        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();
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: L2N6H5B3/SoftSled
        private static void DoRtspInitial(string url)
        {
            // No resposes so far when making the request beneath.
            string initial = @"DESCRIBE " + url + @" RTSP/1.0
Accept: application/sdp
CSeq: 1
Accept-Language: en-us, *;q=0.1
Supported: dlna.announce, dlna.rtx-dup
User-Agent: MCExtender/1.0.0.0
";

            TcpClient tcp = new TcpClient(SoftSledConfigManager.ReadConfig().RdpLoginHost, 554);

            NetworkStream ns = tcp.GetStream();

            byte[] initialBuff = Encoding.ASCII.GetBytes(initial);
            ns.Write(initialBuff, 0, initialBuff.Length);

            while (true)
            {
                byte[] buff = new byte[512];
                int    read = ns.Read(buff, 0, 512);

                if (read > 0)
                {
                    MessageBox.Show(Encoding.ASCII.GetString(buff));
                }

                buff = new byte[512];
            }
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: L2N6H5B3/SoftSled
        private void HandleAvctrlIncoming(string data)
        {
            // File.WriteAllBytes("g:\\avctrlIncoming_" + avCtrlIter, Encoding.Unicode.GetBytes(data));

            string fileName = vChanRootDir + "avctrl\\av r ";

            if (avCtrlIter == 4)
            {
                fileName += "4";
                //  File.WriteAllText("g:\\4th", data);
            }
            else if (avCtrlIter == 5)
            {
                fileName += "5";
            }
            else if (avCtrlIter == 6)
            {
                fileName += "6";
            }
            else if (avCtrlIter == 7)
            {
                fileName += "7";
            }
            //else if (avCtrlIter == 8)
            //  fileName += "8";
            else
            {
                fileName += "main";
            }


            if (avCtrlIter == 8)
            {
                byte[] rtspBuff = new byte[85];

                string rtspUrl = Encoding.ASCII.GetString(Encoding.Unicode.GetBytes(data), 32, 85);
                MessageBox.Show(rtspUrl);

                // DoRtspInitial(rtspUrl);
            }

            byte[] file = File.ReadAllBytes(fileName);
            file[21] = Convert.ToByte(avCtrlIter);

            if (avCtrlIter == 4)
            {
                // We need to insert the remote host IP into our 4th iteration response.

                byte[] hostIp = Encoding.ASCII.GetBytes(SoftSledConfigManager.ReadConfig().RdpLoginHost);
                Array.Copy(hostIp, 0, file, 36, hostIp.Length);
            }


            rdpClient.SendOnVirtualChannel("avctrl", Encoding.Unicode.GetString(file));
            m_logger.LogDebug("RDP: Sent avctrl iteration " + avCtrlIter.ToString());

            avCtrlIter++;
        }
コード例 #5
0
ファイル: ExtenderDevice.cs プロジェクト: L2N6H5B3/SoftSled
        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!");
        }
コード例 #6
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;
        }
コード例 #7
0
ファイル: frmMain.cs プロジェクト: L2N6H5B3/SoftSled
        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);
        }
コード例 #8
0
        /// <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..."));
        }
コード例 #9
0
ファイル: frmMain.cs プロジェクト: L2N6H5B3/SoftSled
        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");
            }
        }