コード例 #1
0
 public void TryDispose(ServiceDescription service)
 {
 }
コード例 #2
0
        internal void Dispose()
        {
            if (IsDisposed) {
                return;
            }

            IsDisposed = true;
            OnDispose (DisposedEventArgs.Empty);

            if (description != null) {
                description.Dispose ();
                description = null;
            }
        }
コード例 #3
0
        protected internal ServiceController(ServiceDescription service)
        {
            if (service == null) throw new ArgumentNullException ("service");

            this.service_description = service;
        }
コード例 #4
0
 public ServiceDescription GetDescription()
 {
     if (description == null) {
         if (IsDisposed) {
             throw new ObjectDisposedException (ToString (), "The services has gone off the network.");
         }
         description = client.GetDescription (this);
     }
     return description;
 }
コード例 #5
0
 protected virtual ServiceController CreateController(ServiceDescription service)
 {
     return new ServiceController (service);
 }
コード例 #6
0
 public ServiceController DeserializeController(ServiceDescription service)
 {
     return DeserializeControllerCore (service);
 }
コード例 #7
0
 protected virtual ServiceController DeserializeControllerCore(ServiceDescription service, XmlReader reader)
 {
     try {
         var controller = CreateController (service);
         if (controller != null) {
             controller.Deserialize (reader);
         }
         return controller;
     } catch (Exception e) {
         Log.Exception ("There was a problem deserializing a service control description.", e);
         return null;
     }
 }
コード例 #8
0
        protected virtual ServiceController DeserializeControllerCore(ServiceDescription service)
        {
            if (service == null)
                throw new ArgumentNullException ("service");
            if (service.ScpdUrl == null)
                throw new ArgumentException ("The services does not have an SCPDURL.", "service");

            using (var response = Helper.GetResponse (service.ScpdUrl)) {
                using (var stream = response.GetResponseStream ()) {
                    using (var reader = XmlReader.Create (stream)) {
                        if (reader.ReadToFollowing ("scpd")) {
                            using (var controller_reader = reader.ReadSubtree ()) {
                                controller_reader.Read ();
                                return DeserializeControllerCore (service, controller_reader);
                            }
                        } else {
                            Log.Exception (new UpnpDeserializationException (
                                "The service description does not have an scpd element."));
                            return null;
                        }
                    }
                }
            }
        }