public static void PopulateMethodList(XMLMethods methods, List <CompNamed> method_list) { foreach (object key in methods.keys.Keys) { XMLMethods.SignatureFlags signatureFlags = (methods.signatureFlags != null && methods.signatureFlags.ContainsKey(key) ? (XMLMethods.SignatureFlags)methods.signatureFlags [key] : XMLMethods.SignatureFlags.None); XMLParameters parameters = (methods.parameters == null ? null : (XMLParameters)methods.parameters[key]); XMLGenericParameters genericParameters = (methods.genericParameters == null ? null : (XMLGenericParameters)methods.genericParameters[key]); XMLAttributes attributes = (methods.attributeMap == null ? null : (XMLAttributes)methods.attributeMap[key]); string returnType = (methods.returnTypes == null ? null : (string)methods.returnTypes[key]); method_list.Add(new MasterMethod((string)methods.keys[key], signatureFlags, returnType, parameters, genericParameters, methods.ConvertToString(Int32.Parse((string)methods.access[key])), attributes)); } }
public MasterEvent(string name, string eventType, string eventAccess, XMLAttributes attributes) : base(name) { this.eventType = eventType; this.eventAccess = eventAccess; this.attributes = attributes; }
public MasterField(string name, string fieldType, string fieldValue, string fieldAccess, XMLAttributes attributes) : base(name) { this.fieldType = fieldType; this.fieldValue = fieldValue; // we don't care about the Assembly (internal) part this.fieldAccess = fieldAccess.Replace("FamORAssem", "Family"); this.attributes = attributes; }
public override void LoadData(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.Name != "parameter") { throw new ArgumentException("Expecting <parameter>"); } name = node.Attributes["name"].Value; type = node.Attributes["type"].Value; attrib = node.Attributes["attrib"].Value; if (node.Attributes ["direction"] != null) { direction = node.Attributes["direction"].Value; } if (node.Attributes["unsafe"] != null) { isUnsafe = bool.Parse(node.Attributes["unsafe"].Value); } if (node.Attributes["optional"] != null) { isOptional = bool.Parse(node.Attributes["optional"].Value); } if (node.Attributes["defaultValue"] != null) { defaultValue = node.Attributes["defaultValue"].Value; } XmlNode child = node.FirstChild; if (child == null) { return; } if (child.Name == "attributes") { attributes = new XMLAttributes(); attributes.LoadData(child); child = child.NextSibling; } }
public MasterMethod(string name, XMLMethods.SignatureFlags signatureFlags, string returnType, XMLParameters parameters, XMLGenericParameters genericParameters, string methodAccess, XMLAttributes attributes) : base(String.Format("{0} {1}", returnType, name)) { this.signatureFlags = signatureFlags; this.returnType = returnType; this.parameters = parameters; this.genericParameters = genericParameters; // we don't care about the Assembly (internal) part this.methodAccess = methodAccess.Replace("FamORAssem", "Family"); this.attributes = attributes; }
public static List <CompGenericParameter> GetTypeParameters(XMLGenericParameters gparams) { if (gparams == null) { return(null); } var list = new List <CompGenericParameter> (); foreach (string key in gparams.keys.Keys) { XMLAttributes attributes = gparams.attributeMap == null ? null : (XMLAttributes)gparams.attributeMap [key]; var constraints = gparams.constraints [key]; list.Add(new MasterGenericTypeParameter(key, constraints, attributes)); } return(list); }
public static List <CompNamed> GetAttributes(XMLAttributes attributes) { List <CompNamed> rv = new List <CompNamed>(); if (attributes != null) { XMLAttributeProperties properties; foreach (string key in attributes.keys.Keys) { if (IsImplementationSpecificAttribute(key)) { continue; } if (!attributes.Properties.TryGetValue(key, out properties)) { properties = null; } rv.Add(new MasterAttribute((string)attributes.keys[key], properties)); } } return(rv); }
public MasterField(string name, string fieldType, string fieldValue, string fieldAccess, XMLAttributes attributes) : base(name) { this.fieldType = fieldType; this.fieldValue = fieldValue; // we don't care about the Assembly (internal) part this.fieldAccess = fieldAccess.Replace ("FamORAssem", "Family"); this.attributes = attributes; }
protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["attrib"]; if (xatt != null) access [name] = xatt.Value; XmlNode orig = node; node = node.FirstChild; while (node != null) { if (node != null && node.Name == "attributes") { XMLAttributes a = new XMLAttributes (); a.LoadData (node); if (attributeMap == null) attributeMap = new Hashtable (); attributeMap [name] = a; break; } node = node.NextSibling; } base.LoadExtraData (name, orig); }
public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != "parameter") throw new ArgumentException ("Expecting <parameter>"); name = node.Attributes["name"].Value; type = node.Attributes["type"].Value; attrib = node.Attributes["attrib"].Value; if (node.Attributes ["direction"] != null) direction = node.Attributes["direction"].Value; if (node.Attributes["unsafe"] != null) isUnsafe = bool.Parse (node.Attributes["unsafe"].Value); if (node.Attributes["optional"] != null) isOptional = bool.Parse (node.Attributes["optional"].Value); if (node.Attributes["defaultValue"] != null) defaultValue = node.Attributes["defaultValue"].Value; XmlNode child = node.FirstChild; if (child == null) return; if (child.Name == "attributes") { attributes = new XMLAttributes (); attributes.LoadData (child); child = child.NextSibling; } }
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)); }
public MasterProperty(string key, string propertyAccess, XMLMethods xml_methods, XMLAttributes attributes) : base(FormatName (key)) { string[] keyparts = key.Split(new char[] {':'}, 3); this.propertyType = keyparts[1]; this.propertyAccess = propertyAccess; methods = new List<CompNamed>(); MasterUtils.PopulateMethodList (xml_methods, methods); this.attributes = attributes; }
public MasterParameter(string name, string type, bool optional, XMLAttributes attributes) : base(name, type, optional) { this.attributes = attributes; }
public MasterProperty(string key, string propertyAccess, XMLMethods xml_methods, XMLAttributes attributes) : base(FormatName(key)) { string[] keyparts = key.Split(new char[] { ':' }, 3); this.propertyType = keyparts[1]; this.propertyAccess = propertyAccess; methods = new List <CompNamed>(); MasterUtils.PopulateMethodList(xml_methods, methods); this.attributes = attributes; }
public MasterGenericTypeParameter (string name, XMLGenericParameterConstraints constraints, XMLAttributes attributes) : base (name, (Mono.Cecil.GenericParameterAttributes)Enum.Parse (typeof (Mono.Cecil.GenericParameterAttributes), constraints.attributes)) { this.constraints = constraints; this.attributes = attributes; }
public MasterGenericTypeParameter(string name, string genericAttribute, XMLAttributes attributes) : base(name, (Mono.Cecil.GenericParameterAttributes)Enum.Parse(typeof(Mono.Cecil.GenericParameterAttributes), genericAttribute)) { this.attributes = attributes; }
public static void PopulateMemberLists(XMLClass xml_cls, List <CompNamed> interface_list, List <CompNamed> constructor_list, List <CompNamed> method_list, List <CompNamed> property_list, List <CompNamed> field_list, List <CompNamed> event_list) { if (interface_list != null && xml_cls.interfaces != null) { foreach (object i in xml_cls.interfaces.keys.Keys) { interface_list.Add(new MasterInterface((string)xml_cls.interfaces.keys[i])); } } if (constructor_list != null && xml_cls.constructors != null) { PopulateMethodList(xml_cls.constructors, constructor_list); } if (method_list != null && xml_cls.methods != null) { PopulateMethodList(xml_cls.methods, method_list); } if (property_list != null && xml_cls.properties != null) { foreach (object key in xml_cls.properties.keys.Keys) { XMLAttributes attributes = (xml_cls.properties.attributeMap == null ? null : (XMLAttributes)xml_cls.properties.attributeMap[key]); property_list.Add(new MasterProperty((string)key, xml_cls.properties.ConvertToString(Int32.Parse((string)xml_cls.properties.access[key])), (XMLMethods)xml_cls.properties.nameToMethod[key], attributes)); } } if (field_list != null && xml_cls.fields != null) { foreach (object key in xml_cls.fields.keys.Keys) { string type = (xml_cls.fields.fieldTypes == null || !xml_cls.fields.fieldTypes.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldTypes[key]; string fvalue = (xml_cls.fields.fieldValues == null || !xml_cls.fields.fieldValues.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldValues[key]; XMLAttributes attributes = (xml_cls.fields.attributeMap == null ? null : (XMLAttributes)xml_cls.fields.attributeMap[key]); field_list.Add(new MasterField((string)xml_cls.fields.keys[key], type, fvalue, xml_cls.fields.ConvertToString(Int32.Parse((string)xml_cls.fields.access[key])), attributes)); } } if (event_list != null && xml_cls.events != null) { foreach (object key in xml_cls.events.keys.Keys) { XMLAttributes attributes = (xml_cls.events.attributeMap == null ? null : (XMLAttributes)xml_cls.events.attributeMap[key]); event_list.Add(new MasterEvent((string)xml_cls.events.keys[key], (string)xml_cls.events.eventTypes[key], xml_cls.events.ConvertToString(Int32.Parse((string)xml_cls.events.access[key])), attributes)); } } }
public MasterGenericTypeParameter(string name, string genericAttribute, XMLAttributes attributes) : base(name, (Mono.Cecil.GenericParameterAttributes)Enum.Parse (typeof (Mono.Cecil.GenericParameterAttributes), genericAttribute)) { this.attributes = attributes; }
public MasterMethod(string name, XMLMethods.SignatureFlags signatureFlags, string returnType, XMLParameters parameters, XMLGenericParameters genericParameters, string methodAccess, XMLAttributes attributes) : base(String.Format ("{0} {1}", returnType, name)) { this.signatureFlags = signatureFlags; this.returnType = returnType; this.parameters = parameters; this.genericParameters = genericParameters; // we don't care about the Assembly (internal) part this.methodAccess = methodAccess.Replace ("FamORAssem", "Family"); this.attributes = attributes; }
public MasterParameter (string name, string type, bool optional, XMLAttributes attributes) : base (name, type, optional) { this.attributes = attributes; }
public static List<CompNamed> GetAttributes(XMLAttributes attributes) { List<CompNamed> rv = new List<CompNamed>(); if (attributes != null) { XMLAttributeProperties properties; foreach (string key in attributes.keys.Keys) { if (IsImplementationSpecificAttribute (key)) continue; if (!attributes.Properties.TryGetValue (key, out properties)) properties = null; rv.Add (new MasterAttribute ((string)attributes.keys[key], properties)); } } return rv; }
public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); name = node.Attributes ["name"].Value; version = node.Attributes ["version"].Value; XmlNode atts = node.FirstChild; attributes = new XMLAttributes (); if (atts.Name == "attributes") { attributes.LoadData (atts); atts = atts.NextSibling; } if (atts == null || atts.Name != "namespaces") { Console.Error.WriteLine ("Warning: no namespaces found!"); return; } namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace)); }
public MasterGenericTypeParameter(string name, XMLGenericParameterConstraints constraints, XMLAttributes attributes) : base(name, (Mono.Cecil.GenericParameterAttributes)Enum.Parse(typeof(Mono.Cecil.GenericParameterAttributes), constraints.attributes)) { this.constraints = constraints; this.attributes = attributes; }
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)); }