public void TryDispose(ServiceDescription service)
 {
 }
        internal void Dispose()
        {
            if (IsDisposed) {
                return;
            }

            IsDisposed = true;
            OnDispose (DisposedEventArgs.Empty);

            if (description != null) {
                description.Dispose ();
                description = null;
            }
        }
        protected internal ServiceController(ServiceDescription service)
        {
            if (service == null) throw new ArgumentNullException ("service");

            this.service_description = service;
        }
 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;
 }
Esempio n. 5
0
 protected virtual ServiceController CreateController(ServiceDescription service)
 {
     return new ServiceController (service);
 }
Esempio n. 6
0
 public ServiceController DeserializeController(ServiceDescription service)
 {
     return DeserializeControllerCore (service);
 }
Esempio n. 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;
     }
 }
Esempio n. 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;
                        }
                    }
                }
            }
        }