Beispiel #1
0
        public XBox360Device(Logger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            m_logger = logger;

            device = UPnPDevice.CreateRootDevice(1800, 1.0, "\\");
            device.UniqueDeviceName = "10000000-0000-0000-0200-00125AB07AEF";
            device.FriendlyName     = "Xbox 360 Media Center Extender";
            device.Manufacturer     = "Microsoft Corporation";
            device.ManufacturerURL  = "http://www.xbox.com/";
            device.ModelName        = "Xbox 360";
            device.ModelDescription = "Xbox 360 Media Center Extender";
            device.ModelNumber      = "";
            device.ModelURL         = new Uri("http://go.microsoft.com/fwlink/?LinkID=53081");
            device.HasPresentation  = false;
            device.DeviceURN        = "urn:schemas-microsoft-com:device:MediaCenterExtenderMFD:1";
            device.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            device.ProductCode  = "";
            device.SerialNumber = "";

            rootContentHandler    = new ContentHandler(m_logger);
            device.ContentHandler = rootContentHandler;

            SoftSled.NullService NullService = new SoftSled.NullService();
            device.AddService(NullService);

            UPnPDevice device1 = UPnPDevice.CreateEmbeddedDevice(1, Guid.NewGuid().ToString());

            device1.FriendlyName     = "Xbox 360 Media Center Extender";
            device1.Manufacturer     = "Microsoft Corporation";
            device1.ManufacturerURL  = "http://www.microsoft.com/";
            device1.ModelName        = "Xbox 360";
            device1.ModelDescription = "Xbox 360 Media Center Extender";
            device1.ModelNumber      = "";
            device1.ModelURL         = new Uri("http://go.microsoft.com/fwlink/?LinkID=53081");
            device1.HasPresentation  = false;
            device1.SerialNumber     = "";
            device1.ProductCode      = "";
            device1.DeviceURN        = "urn:schemas-microsoft-com:device:MediaCenterExtender:1";
            device1.AddCustomFieldInDescription("X_compatibleId", "MICROSOFT_MCX_0001", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            device1.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            mcxContentHandler      = new ContentHandler(m_logger);
            device1.ContentHandler = mcxContentHandler;


            SoftSled.TrustAgreementService TrustAgreementService = new SoftSled.TrustAgreementService(m_logger);
            TrustAgreementService.External_Commit   = new SoftSled.TrustAgreementService.Delegate_Commit(TrustAgreementService.Commit);
            TrustAgreementService.External_Confirm  = new SoftSled.TrustAgreementService.Delegate_Confirm(TrustAgreementService.Confirm);
            TrustAgreementService.External_Exchange = new SoftSled.TrustAgreementService.Delegate_Exchange(TrustAgreementService.Exchange);
            TrustAgreementService.External_Validate = new SoftSled.TrustAgreementService.Delegate_Validate(TrustAgreementService.Validate);
            device1.AddService(TrustAgreementService);

            SoftSled.RemotedExperienceService RemotedExperienceService = new SoftSled.RemotedExperienceService(m_logger);
            RemotedExperienceService.External_AcquireNonce = new SoftSled.RemotedExperienceService.Delegate_AcquireNonce(RemotedExperienceService.AcquireNonce);
            RemotedExperienceService.External_Advertise    = new SoftSled.RemotedExperienceService.Delegate_Advertise(RemotedExperienceService.Advertise);
            RemotedExperienceService.External_Inhibit      = new SoftSled.RemotedExperienceService.Delegate_Inhibit(RemotedExperienceService.Inhibit);
            device1.AddService(RemotedExperienceService);


            device.AddDevice(device1);
        }
Beispiel #2
0
        public ExtenderDevice(Logger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            m_logger = logger;

            //Convert the device certificate to Base64 string
            X509Certificate2 deviceCert   = new X509Certificate2(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Certificates\\SoftSled.cer");
            String           certDeviceId = "b8771bb8-5496-498b-a6c7-f2d67a1b0d96"; // default if cert doesn't contain an alternative name

            foreach (X509Extension certExtension in deviceCert.Extensions)
            {
                if (certExtension.Oid.FriendlyName != null && certExtension.Oid.FriendlyName.Equals("Subject Alternative Name"))
                {
                    certDeviceId = Encoding.ASCII.GetString(certExtension.RawData).Remove(0, 9);
                    m_logger.LogInfo("UUID from cert: " + certDeviceId);
                    break;
                }
            }

            byte[] deviceCertBytes    = deviceCert.RawData;
            byte[] newDeviceCertBytes = new byte[deviceCertBytes.Length + 6];
            newDeviceCertBytes[0] = 0x0;
            newDeviceCertBytes[1] = 0x0;
            newDeviceCertBytes[2] = 0x1;
            newDeviceCertBytes[3] = 0x0;
            newDeviceCertBytes[4] = BitConverter.GetBytes(deviceCertBytes.Length)[1];
            newDeviceCertBytes[5] = BitConverter.GetBytes(deviceCertBytes.Length)[0];
            deviceCertBytes.CopyTo(newDeviceCertBytes, 6);
            _DeviceCertificateString = Convert.ToBase64String(newDeviceCertBytes);

            device = UPnPDevice.CreateRootDevice(1800, 1.0, "\\XD");
            device.UniqueDeviceName = "68c4b624-e1a0-42c5-94b8-4f5fa6fec622";
            device.FriendlyName     = "SoftSled Media Center Extender";
            device.Manufacturer     = "SoftSled Project";
            device.ManufacturerURL  = "http://www.codeplex.com/softsled";
            device.ModelName        = "SoftSled";
            device.ModelDescription = "SoftSled Media Center Extender";
            device.ModelNumber      = "";
            device.ModelURL         = new Uri("http://www.codeplex.com/softsled");
            device.HasPresentation  = false;
            device.DeviceURN        = "urn:schemas-microsoft-com:device:MediaCenterExtenderMFD:1";
            device.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            device.ProductCode  = "";
            device.SerialNumber = "";

            rootContentHandler    = new ContentHandler(m_logger);
            device.ContentHandler = rootContentHandler;

            SoftSled.NullService NullService = new SoftSled.NullService();
            device.AddService(NullService);

            UPnPDevice device1 = UPnPDevice.CreateEmbeddedDevice(1, certDeviceId);

            device1.FriendlyName     = "SoftSled Media Center Extender";
            device1.Manufacturer     = "SoftSled Project";
            device1.ManufacturerURL  = "http://www.codeplex.com/softsled";
            device1.ModelName        = "SoftSled";
            device1.ModelDescription = "SoftSled Media Center Extender";
            device1.ModelNumber      = "";
            device1.HasPresentation  = false;
            device1.DeviceURN        = "urn:schemas-microsoft-com:device:MediaCenterExtender:1";
            device1.AddCustomFieldInDescription("X_compatibleId", "MICROSOFT_MCX_0001", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            device1.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11");
            device1.AddCustomFieldInDescription("pakVersion", "dv2.0.0", "http://schemas.microsoft.com/windows/mcx/2007/06");
            device1.AddCustomFieldInDescription("supportedHostVersions", "pc2.0.0", "http://schemas.microsoft.com/windows/mcx/2007/06");
            mcxContentHandler      = new ContentHandler(m_logger);
            device1.ContentHandler = mcxContentHandler;

            SoftSled.TrustAgreementService TrustAgreementService = new SoftSled.TrustAgreementService(m_logger);
            TrustAgreementService.TrustState           = 4;
            TrustAgreementService.A_ARG_TYPE_Iteration = Convert.ToByte(5);
            TrustAgreementService.External_Commit      = new SoftSled.TrustAgreementService.Delegate_Commit(TrustAgreementService_Commit);
            TrustAgreementService.External_Confirm     = new SoftSled.TrustAgreementService.Delegate_Confirm(TrustAgreementService_Confirm);
            TrustAgreementService.External_Exchange    = new SoftSled.TrustAgreementService.Delegate_Exchange(TrustAgreementService_Exchange);
            TrustAgreementService.External_Validate    = new SoftSled.TrustAgreementService.Delegate_Validate(TrustAgreementService_Validate);
            device1.AddService(TrustAgreementService);

            SoftSled.RemotedExperienceService RemotedExperienceService = new SoftSled.RemotedExperienceService(m_logger);
            RemotedExperienceService.External_AcquireNonce = new SoftSled.RemotedExperienceService.Delegate_AcquireNonce(RemotedExperienceService_AcquireNonce);
            RemotedExperienceService.External_Advertise    = new SoftSled.RemotedExperienceService.Delegate_Advertise(RemotedExperienceService_Advertise);
            RemotedExperienceService.External_Inhibit      = new SoftSled.RemotedExperienceService.Delegate_Inhibit(RemotedExperienceService_Inhibit);
            device1.AddService(RemotedExperienceService);


            device.AddDevice(device1);

            //Get the device id to use in the communication...
            _DeviceID = "uuid:" + device1.UniqueDeviceName;

            // Setting the initial value of evented variables
        }
Beispiel #3
0
 internal _RemotedExperienceService(RemotedExperienceService n)
 {
     Outer = n;
     S     = BuildUPnPService();
 }