internal UPnPStateVariable(string VarName) { this._ComplexType = null; this.MinVal = null; this.MaxVal = null; this.StepVal = null; this.ParentService = null; this.DO_VALIDATE = true; this.DefValue = null; this.CurrentValue = null; this.VariableName = VarName; this.Allowed = null; this.SendEvent = false; this.AssociationList = new ArrayList(); }
public UPnPStateVariable(string VarName, Type VType, bool SendEvents) { this._ComplexType = null; this.MinVal = null; this.MaxVal = null; this.StepVal = null; this.ParentService = null; this.DO_VALIDATE = true; this.SendEvent = SendEvents; this.DefValue = null; this.CurrentValue = null; this.VariableName = VarName; this.Allowed = null; this.SendEvent = SendEvents; this.AssociationList = new ArrayList(); this.VarType = ConvertToUPnPType(VType); }
public static UPnPComplexType[] Parse(string xml) { ArrayList list = new ArrayList(); Hashtable hashtable = new Hashtable(); StringReader input = new StringReader(xml); XmlTextReader x = new XmlTextReader(input); while (x.Read()) { Group group; switch (x.NodeType) { case XmlNodeType.Element: { switch (x.LocalName) { case "complexType": { UPnPComplexType type = ParseComplexType(x); list.Add(type); hashtable[type.Name_NAMESPACE + ":" + type.Name_LOCAL] = type; break; } case "group": goto Label_00B4; } continue; } case XmlNodeType.Attribute: case XmlNodeType.Text: case XmlNodeType.EndElement: { continue; } } continue; Label_00B4: group = (Group)ParseComplexType(x, new Group()); hashtable[group.Name_NAMESPACE + ":" + group.Name_LOCAL] = group; list.Add(group); } return((UPnPComplexType[])list.ToArray(typeof(UPnPComplexType))); }
public UPnPStateVariable(string VarName, object VarValue, string[] AllowedValues) { this._ComplexType = null; this.MinVal = null; this.MaxVal = null; this.StepVal = null; this.ParentService = null; this.DO_VALIDATE = true; this.DefValue = VarValue; this.CurrentValue = VarValue; this.VariableName = VarName; this.Allowed = AllowedValues; this.SendEvent = true; this.VarType = ConvertToUPnPType(VarValue.GetType()); if (this.VarType == "boolean") { VarValue = ((string)VarValue).ToLower(); } this.AssociationList = new ArrayList(); }
private static UPnPComplexType ParseComplexType(XmlTextReader X, UPnPComplexType RetVal) { string localName = X.LocalName; int num = 0; bool flag = false; DText text = new DText(); text.ATTRMARK = ":"; RetVal.AddContainer(new GenericContainer()); do { switch (X.NodeType) { case XmlNodeType.Element: { string str = X.LocalName; if (str != null) { str = string.IsInterned(str); if ((str == "complexType") || (str == "group")) { num++; if (X.HasAttributes) { for (int i = 0; i < X.AttributeCount; i++) { X.MoveToAttribute(i); if (X.Name == "name") { text[0] = X.Value; if (text.DCOUNT() == 1) { RetVal.LocalName = X.Value; RetVal.NameSpace = X.LookupNamespace(""); } else { RetVal.LocalName = text[2]; RetVal.NameSpace = X.LookupNamespace(text[1]); } } else if (X.Name == "ref") { } } X.MoveToElement(); } } else { if ((str == "sequence") || (str == "choice")) { RetVal.CurrentContainer.AddCollection(ParseComplexType_SequenceChoice(X)); break; } if (str == "complexContent") { RetVal.AddContainer(new ComplexContent()); break; } if (str == "simpleContent") { RetVal.AddContainer(new SimpleContent()); break; } if (str == "restriction") { Restriction restriction = new Restriction(); if (RetVal.CurrentContainer.GetType() == typeof(ComplexContent)) { ((ComplexContent)RetVal.CurrentContainer).RestExt = restriction; } else if (RetVal.CurrentContainer.GetType() == typeof(SimpleContent)) { ((SimpleContent)RetVal.CurrentContainer).RestExt = restriction; } if (X.HasAttributes) { for (int j = 0; j < X.AttributeCount; j++) { X.MoveToAttribute(j); if (X.Name == "base") { text[0] = X.Value; if (text.DCOUNT() == 1) { restriction.baseType = X.Value; restriction.baseTypeNS = X.LookupNamespace(""); } else { restriction.baseType = text[2]; restriction.baseTypeNS = X.LookupNamespace(text[1]); } } } X.MoveToElement(); } break; } } } break; } case XmlNodeType.EndElement: if (X.LocalName == localName) { num--; if (num == 0) { flag = true; } } break; } }while (!flag && X.Read()); return(RetVal); }