Ejemplo n.º 1
0
        public IEnumerable <InstanceInformation> GetInstances()
        {
            using (var requestChain = new RequestChain(this))
            {
                Send(new Packet(Header.List, requestChain.Id));

                requestChain.WaitForResult(5000);

                var list = new List <InstanceInformation>();

                var buffer            = requestChain.ResultBuffer;
                var numberOfInstances = buffer.ReadInt32();
                while (numberOfInstances-- > 0)
                {
                    var instanceId  = buffer.ReadString();
                    var status      = (InstanceStatus)buffer.ReadInt32();
                    var packageName = buffer.ReadString();
                    //var configuration = InstanceConfiguration.Deserialize(buffer);

                    //list.Add(new InstanceInformation(instanceId, status, packageName, configuration));
                }

                return(list);
            }
        }
Ejemplo n.º 2
0
        private async void OnMediaProtectionManagerServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
        {
            Debug.WriteLine("ProtectionManager ServiceRequested");

            _serviceCompletionNotifier = e.Completion;
            IPlayReadyServiceRequest serviceRequest = (IPlayReadyServiceRequest)e.Request;

            Debug.WriteLine("Servie request type = " + serviceRequest.GetType());

            var result = false;

            if (serviceRequest.Type == PlayReadyStatics.IndividualizationServiceRequestType)
            {
                result = await PlayReadyLicenseHandler.RequestIndividualizationToken(serviceRequest as PlayReadyIndividualizationServiceRequest);
            }
            else if (serviceRequest.Type == PlayReadyStatics.LicenseAcquirerServiceRequestType)
            {
                // NOTE: You might need to set the request.ChallengeCustomData, depending on your Rights Manager.
                if (RequestConfigData != null)
                {
                    _requestChain = new RequestChain(serviceRequest);
                    _requestChain.RequestConfigData = this.RequestConfigData;
                    _requestChain.FinishAndReportResult(HandleServiceRequest_Finished);

                    return;
                }
                else
                {
                    result = await PlayReadyLicenseHandler.RequestLicense(serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
                }
            }

            _serviceCompletionNotifier.Complete(result);
        }
        public HttpRemoteResponse Process(RequestChain chain, Request request, string verb, Uri uri, string content)
        {
            var response = chain.Next(request, verb, uri, content);

            if (ShouldRetry(response))
                response = chain.Next(request, verb, uri, content);

            return response;
        }
Ejemplo n.º 4
0
 void InitChain(IContainer c)
 {
     Chain = c.ResolveObject(new RequestChain());
     Chain.Add(c.GetInstance <TimeoutManager.PreDbThrowout>());
     Chain.Add(c.GetInstance <DatabaseHandler>());
     Chain.Add(Timeout);
     Chain.Add(c.GetInstance <SaveData>());
     Chain.Add(Commands);
 }
        public HttpRemoteResponse Process(RequestChain chain, Request request, string verb, Uri uri, string content)
        {
            var response = chain.Next(request, verb, uri, content);

            if (ShouldRetry(response))
            {
                response = chain.Next(request, verb, uri, content);
            }

            return(response);
        }
Ejemplo n.º 6
0
        public string CreateInstance(string packageName, InstanceConfiguration configuration)
        {
            using (var requestChain = new RequestChain(this))
            {
                var packet = new Packet(Header.New, requestChain.Id);
                packet.Write(packageName);
                configuration.Serialize(packet);
                Send(packet);

                requestChain.WaitForResult(5000);

                return(requestChain.ResultBuffer.ReadString()); // instanceId
            }
        }
Ejemplo n.º 7
0
        public IRequestChain Build(string Id)
        {
            var Segments = _context.GetSegments(Id);

            if (Segments.Count != 2 || Segments[0] == null || Segments[1] == null)
            {
                return(null);
            }

            IRequestChain requestChain = new RequestChain();

            _context.Release(Id);

            return(requestChain);
        }
Ejemplo n.º 8
0
 public virtual HttpRemoteResponse Process(RequestChain chain, Request request, string verb, Uri uri, string content)
 {
     return new ResponseChain(_service, _responseFeatures)
         .Next(_service.Dispatcher.Process(_service, verb, uri, content));
 }