示例#1
0
		internal UPnPAction(XmlElement Xml, ServiceDescriptionDocument Parent)
		{
			List<UPnPArgument> Arguments = new List<UPnPArgument>();

			this.parent = Parent;
			this.xml = Xml;

			foreach (XmlNode N in Xml.ChildNodes)
			{
				switch (N.LocalName)
				{
					case "name":
						this.name = N.InnerText;
						break;

					case "argumentList":
						foreach (XmlNode N2 in N.ChildNodes)
						{
							if (N2.LocalName == "argument")
							{
								UPnPArgument Argument = new UPnPArgument((XmlElement)N2);
								Arguments.Add(Argument);
								this.argumentByName[Argument.Name] = Argument;
							}
						}
						break;
				}
			}

			this.arguments = Arguments.ToArray();
		}
 internal ServiceDescriptionEventArgs(Exception Ex, UPnPClient Client, object State)
 {
     this.client = Client;
     this.doc    = null;
     this.ex     = Ex;
     this.state  = State;
 }
 internal ServiceDescriptionEventArgs(ServiceDescriptionDocument Doc, UPnPClient Client, object State)
 {
     this.client = Client;
     this.doc    = Doc;
     this.ex     = null;
     this.state  = State;
 }
		internal ServiceDescriptionEventArgs(Exception Ex, UPnPClient Client, object State)
		{
			this.client = Client;
			this.doc = null;
			this.ex = Ex;
			this.state = State;
		}
		internal ServiceDescriptionEventArgs(ServiceDescriptionDocument Doc, UPnPClient Client, object State)
		{
			this.client = Client;
			this.doc = Doc;
			this.ex = null;
			this.state = State;
		}
示例#6
0
        internal UPnPAction(XmlElement Xml, ServiceDescriptionDocument Parent)
        {
            List <UPnPArgument> Arguments = new List <UPnPArgument>();

            this.parent = Parent;
            this.xml    = Xml;

            foreach (XmlNode N in Xml.ChildNodes)
            {
                switch (N.LocalName)
                {
                case "name":
                    this.name = N.InnerText;
                    break;

                case "argumentList":
                    foreach (XmlNode N2 in N.ChildNodes)
                    {
                        if (N2.LocalName == "argument")
                        {
                            UPnPArgument Argument = new UPnPArgument((XmlElement)N2);
                            Arguments.Add(Argument);
                            this.argumentByName[Argument.Name] = Argument;
                        }
                    }
                    break;
                }
            }

            this.arguments = Arguments.ToArray();
        }
示例#7
0
		private void DownloadServiceCompleted(object sender, DownloadDataCompletedEventArgs e)
		{
			object[] P = (object[])e.UserState;
			UPnPService Service = (UPnPService)P[0];
			ServiceDescriptionEventHandler Callback = (ServiceDescriptionEventHandler)P[1];
			object State = P[2];
			ServiceDescriptionEventArgs e2;

			if (e.Error != null)
				e2 = new ServiceDescriptionEventArgs(e.Error, this, State);
			else
			{
				try
				{
					XmlDocument Xml = new XmlDocument();
					Xml.Load(new MemoryStream(e.Result));

					ServiceDescriptionDocument ServiceDoc = new ServiceDescriptionDocument(Xml, this, Service);
					e2 = new ServiceDescriptionEventArgs(ServiceDoc, this, State);
				}
				catch (Exception ex)
				{
					this.RaiseOnError(ex);
					e2 = new ServiceDescriptionEventArgs(e.Error, this, State);
				}
				finally
				{
					WebClient Client = sender as WebClient;
					if (Client != null)
						Client.Dispose();
				}
			}

			try
			{
				Callback(this, e2);
			}
			catch (Exception ex)
			{
				this.RaiseOnError(ex);
			}
		}