示例#1
0
        public override void LoadData(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            name = node.Attributes ["name"].Value;
            type = node.Attributes  ["type"].Value;
            XmlAttribute xatt = node.Attributes ["base"];

            if (xatt != null)
            {
                baseName = xatt.Value;
            }

            xatt     = node.Attributes ["sealed"];
            isSealed = (xatt != null && xatt.Value == "true");

            xatt       = node.Attributes ["abstract"];
            isAbstract = (xatt != null && xatt.Value == "true");

            xatt           = node.Attributes["serializable"];
            isSerializable = (xatt != null && xatt.Value == "true");

            xatt = node.Attributes["charset"];
            if (xatt != null)
            {
                charSet = xatt.Value;
            }

            xatt = node.Attributes["layout"];
            if (xatt != null)
            {
                layout = xatt.Value;
            }

            XmlNode child = node.FirstChild;

            if (child == null)
            {
                // Console.Error.WriteLine ("Empty class {0} {1}", name, type);
                return;
            }

            if (child.Name == "attributes")
            {
                attributes = new XMLAttributes();
                attributes.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "interfaces")
            {
                interfaces = new XMLInterfaces();
                interfaces.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "generic-parameters")
            {
                genericParameters = new XMLGenericParameters();
                genericParameters.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "fields")
            {
                fields = new XMLFields();
                fields.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "constructors")
            {
                constructors = new XMLConstructors();
                constructors.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "properties")
            {
                properties = new XMLProperties();
                properties.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "events")
            {
                events = new XMLEvents();
                events.LoadData(child);
                child = child.NextSibling;
            }

            if (child != null && child.Name == "methods")
            {
                methods = new XMLMethods();
                methods.LoadData(child);
                child = child.NextSibling;
            }

            if (child == null)
            {
                return;
            }

            if (child.Name != "classes")
            {
                Console.WriteLine("name: {0} type: {1} {2}", name, type, child.NodeType);
                throw new FormatException("Expecting <classes>. Got <" + child.Name + ">");
            }

            nested = (XMLClass [])LoadRecursive(child.ChildNodes, typeof(XMLClass));
        }
示例#2
0
		protected override void LoadExtraData (string name, XmlNode node)
		{
			XmlAttribute xatt = node.Attributes ["returntype"];
			if (xatt != null) {
				if (returnTypes == null)
					returnTypes = new Hashtable ();

				returnTypes [name] = xatt.Value;
			}

			SignatureFlags flags = SignatureFlags.None;
			if (((XmlElement) node).GetAttribute ("abstract") == "true")
				flags |= SignatureFlags.Abstract;
			if (((XmlElement) node).GetAttribute ("static") == "true")
				flags |= SignatureFlags.Static;
			if (((XmlElement) node).GetAttribute ("virtual") == "true")
				flags |= SignatureFlags.Virtual;
			if (((XmlElement) node).GetAttribute ("final") == "true")
				flags |= SignatureFlags.Final;
			if (flags != SignatureFlags.None) {
				if (signatureFlags == null)
					signatureFlags = new Hashtable ();
				signatureFlags [name] = flags;
			}

			XmlNode parametersNode = node.SelectSingleNode ("parameters");
			if (parametersNode != null) {
				if (parameters == null)
					parameters = new Hashtable ();

				XMLParameters parms = new XMLParameters ();
				parms.LoadData (parametersNode);

				parameters[name] = parms;
			}

			XmlNode genericNode = node.SelectSingleNode ("generic-parameters");
			if (genericNode != null) {
				if (genericParameters == null)
					genericParameters = new Hashtable ();

				XMLGenericParameters gparams = new XMLGenericParameters ();
				gparams.LoadData (genericNode);
				genericParameters [name] = gparams;
			}

			base.LoadExtraData (name, node);
		}
示例#3
0
        protected override void LoadExtraData(string name, XmlNode node)
        {
            XmlAttribute xatt = node.Attributes ["returntype"];

            if (xatt != null)
            {
                if (returnTypes == null)
                {
                    returnTypes = new Hashtable();
                }

                returnTypes [name] = xatt.Value;
            }

            SignatureFlags flags = SignatureFlags.None;

            if (((XmlElement)node).GetAttribute("abstract") == "true")
            {
                flags |= SignatureFlags.Abstract;
            }
            if (((XmlElement)node).GetAttribute("static") == "true")
            {
                flags |= SignatureFlags.Static;
            }
            if (((XmlElement)node).GetAttribute("virtual") == "true")
            {
                flags |= SignatureFlags.Virtual;
            }
            if (((XmlElement)node).GetAttribute("final") == "true")
            {
                flags |= SignatureFlags.Final;
            }
            if (flags != SignatureFlags.None)
            {
                if (signatureFlags == null)
                {
                    signatureFlags = new Hashtable();
                }
                signatureFlags [name] = flags;
            }

            XmlNode parametersNode = node.SelectSingleNode("parameters");

            if (parametersNode != null)
            {
                if (parameters == null)
                {
                    parameters = new Hashtable();
                }

                XMLParameters parms = new XMLParameters();
                parms.LoadData(parametersNode);

                parameters[name] = parms;
            }

            XmlNode genericNode = node.SelectSingleNode("generic-parameters");

            if (genericNode != null)
            {
                if (genericParameters == null)
                {
                    genericParameters = new Hashtable();
                }

                XMLGenericParameters gparams = new XMLGenericParameters();
                gparams.LoadData(genericNode);
                genericParameters [name] = gparams;
            }

            base.LoadExtraData(name, node);
        }
示例#4
0
		public override void LoadData (XmlNode node)
		{
			if (node == null)
				throw new ArgumentNullException ("node");

			name = node.Attributes ["name"].Value;
			type = node.Attributes  ["type"].Value;
			XmlAttribute xatt = node.Attributes ["base"];
			if (xatt != null)
				baseName = xatt.Value;

			xatt = node.Attributes ["sealed"];
			isSealed = (xatt != null && xatt.Value == "true");

			xatt = node.Attributes ["abstract"];
			isAbstract = (xatt != null && xatt.Value == "true");

			xatt = node.Attributes["serializable"];
			isSerializable = (xatt != null && xatt.Value == "true");

			xatt = node.Attributes["charset"];
			if (xatt != null)
				charSet = xatt.Value;

			xatt = node.Attributes["layout"];
			if (xatt != null)
				layout = xatt.Value;

			XmlNode child = node.FirstChild;
			if (child == null) {
				// Console.Error.WriteLine ("Empty class {0} {1}", name, type);
				return;
			}
				
			if (child.Name == "attributes") {
				attributes = new XMLAttributes ();
				attributes.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "interfaces") {
				interfaces = new XMLInterfaces ();
				interfaces.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "generic-parameters") {
				genericParameters = new XMLGenericParameters ();
				genericParameters.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "fields") {
				fields = new XMLFields ();
				fields.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "constructors") {
				constructors = new XMLConstructors ();
				constructors.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "properties") {
				properties = new XMLProperties ();
				properties.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "events") {
				events = new XMLEvents ();
				events.LoadData (child);
				child = child.NextSibling;
			}

			if (child != null && child.Name == "methods") {
				methods = new XMLMethods ();
				methods.LoadData (child);
				child = child.NextSibling;
			}

			if (child == null)
				return;

			if (child.Name != "classes") {
				Console.WriteLine ("name: {0} type: {1} {2}", name, type, child.NodeType);
				throw new FormatException ("Expecting <classes>. Got <" + child.Name + ">");
			}

			nested = (XMLClass []) LoadRecursive (child.ChildNodes, typeof (XMLClass));
		}