Exemple #1
0
 public XsdAny(XmlNode node) : base(node)
 {
     {
         string attr = VisualizerHelper.GetAttr(node, "maxOccurs");
         if (attr != null)
         {
             MaxOccurs = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "minOccurs");
         if (attr != null)
         {
             MinOccurs = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "namespace");
         if (attr != null)
         {
             Namespace = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "processContents");
         if (attr != null)
         {
             ProcessContents = attr;
         }
     }
 }
Exemple #2
0
 public XsdSchema(XmlNode node) : base(node)
 {
     Name = "(Root)";
     {
         string attr = VisualizerHelper.GetAttr(node, "attributeFormDefault");
         if (attr != null)
         {
             AttributeFormDefault = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "blockDefault");
         if (attr != null)
         {
             BlockDefault = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "elementFormDefault");
         if (attr != null)
         {
             ElementFormDefault = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "finalDefault");
         if (attr != null)
         {
             FinalDefault = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "id");
         if (attr != null)
         {
             Id = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "targetNamespace");
         if (attr != null)
         {
             TargetNamespace = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "version");
         if (attr != null)
         {
             Version = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "xml:lang");
         if (attr != null)
         {
             XmlLang = attr;
         }
     }
 }
Exemple #3
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("<Any> ");

            VisualizerHelper.ToStringCountable(this, sb);
            return(sb.ToString());
        }
        public static List <RunTimeDebuggers.Helpers.VisualizerHelper.CodeBlock> GetVisualisation(AbstractAssemblyNode node, MethodBase m)
        {
            var blocks = new List <VisualizerHelper.CodeBlock>();

            blocks.AddRange(VisualizerHelper.GetAttributesCodeBlocks(m.GetCustomAttributesDataInclSecurity()));
            blocks.Add(new VisualizerHelper.CodeBlock(Environment.NewLine));

            string il;

            try
            {
                Disassembler disAss = new Disassembler(m);
                disAss.BuildInstructions();
                //MethodBodyReader reader = new MethodBodyReader(m);
                il = disAss.ToRTFCode();
                blocks.AddRange(disAss.GetCodeBlocks());
            }
            catch (Exception ex)
            {
                il = "Error reading IL: " + ex.GetType().FullName + " - " + ex.Message;

                blocks.Add(new VisualizerHelper.CodeBlock("Error reading IL: " + ex.GetType().FullName + " - " + ex.Message + Environment.NewLine));
            }

            return(blocks);
            //return VisualizerHelper.RTFHeader.Replace("@BODY@", VisualizerHelper.GetAttributesRTF(CustomAttributeData.GetCustomAttributes(m)) + @"\line " + node.Text + @"\line " + il);
        }
Exemple #5
0
        public XsdAllSequenceChoice(XmlNode node, string name) : base(node)
        {
            Name = name;
            switch (Name)
            {
            case "choice":
            case "sequence":
            case "all":
                MinOccurs = "1";
                MaxOccurs = "1";
                break;

            default:
                Debug.Fail("Unsupported type: " + Name);
                break;
            }
            {
                string attr = VisualizerHelper.GetAttr(node, "minOccurs");
                if (attr != null)
                {
                    MinOccurs = attr;
                }
            }
            {
                string attr = VisualizerHelper.GetAttr(node, "maxOccurs");
                if (attr != null)
                {
                    MaxOccurs = attr;
                }
            }
        }
Exemple #6
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Name);
            VisualizerHelper.ToStringCountable(this, sb);
            return(sb.ToString());
        }
        public XsdRestriction(XmlNode node) : base(node)
        {
            string attrBase = VisualizerHelper.GetAttr(node, "base");

            if (attrBase != null)
            {
                Base = attrBase;
            }

            string attrId = VisualizerHelper.GetAttr(node, "id");

            if (attrId != null)
            {
                Id = attrId;
            }
        }
Exemple #8
0
 public XsdExtension(XmlNode node) : base(node)
 {
     {
         string attr = VisualizerHelper.GetAttr(node, "base");
         if (attr != null)
         {
             Base = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "id");
         if (attr != null)
         {
             Id = attr;
         }
     }
 }
Exemple #9
0
 public XsdComplexType(XmlNode node) : base(node)
 {
     {
         string attr = VisualizerHelper.GetAttr(node, "name");
         if (attr != null)
         {
             Name = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "abstract");
         if (attr != null)
         {
             Abstract = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "block");
         if (attr != null)
         {
             Block = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "final");
         if (attr != null)
         {
             Final = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "mixed");
         if (attr != null)
         {
             Mixed = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "id");
         if (attr != null)
         {
             Id = attr;
         }
     }
 }
 public XsdImportInclude(XmlNode node, string name) : base(node)
 {
     Name = name;
     {
         string attr = VisualizerHelper.GetAttr(node, "namespace");
         if (attr != null)
         {
             Namespace = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "schemaLocation");
         if (attr != null)
         {
             SchemaLocation = attr;
         }
     }
 }
Exemple #11
0
        public override string ToString()
        {
            StringBuilder result;

            if (string.IsNullOrEmpty(Name))
            {
                if (string.IsNullOrEmpty(RefName))
                {
                    result = new StringBuilder("(none)");
                }
                else
                {
                    result = new StringBuilder("-> ");
                    result.Append(RefName);
                }
            }
            else
            {
                result = new StringBuilder(Name);
            }

            VisualizerHelper.ToStringCountable(this, result);
            return(result.ToString());
        }
Exemple #12
0
 public XsdSimpleType(XmlNode node) : base(node)
 {
     {
         string attr = VisualizerHelper.GetAttr(node, "name");
         if (attr != null)
         {
             Name = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "final");
         if (attr != null)
         {
             Final = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "id");
         if (attr != null)
         {
             Id = attr;
         }
     }
 }
Exemple #13
0
        /// <summary>
        /// Parses the schema and adds the found items to node
        /// </summary>
        /// <param name="schema"></param>
        /// <param name="node"></param>
        private void parse(XmlNode schema, XsdNode node)
        {
            XmlNodeList nl = schema.ChildNodes;

            for (int i = 0; i < nl.Count; i++)
            {
                XmlNode n = nl.Item(i);

                string name = n.Name;
                if (!name.StartsWith(_prefix))
                {
                    continue;
                }
                name = name.Substring(_prefix.Length);

                switch (name)
                {
                case "element":
                {
                    XsdNode newNode = new XsdElement(n);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "sequence":
                case "choice":
                case "all":
                {
                    XsdNode newNode = new XsdAllSequenceChoice(n, name);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "documentation":
                {
                    //last element
                    node.AddAnnotation(n.InnerText);
                    break;
                }

                case "attribute":
                {
                    XsdAttribute newAttr = new XsdAttribute(n);
                    ((IXsdHasAttribute)node).AddAtts(newAttr);
                    parse(n, newAttr);
                    break;
                }

                case "complexType":
                {
                    if (!string.IsNullOrEmpty(VisualizerHelper.GetAttr(n, "name")))
                    {
                        XsdComplexType newType = new XsdComplexType(n);
                        node.AddKids(newType);
                        parse(n, newType);
                    }
                    else
                    {
                        parse(n, node);
                    }
                    break;
                }

                case "simpleType":
                {
                    if (!string.IsNullOrEmpty(VisualizerHelper.GetAttr(n, "name")))
                    {
                        XsdSimpleType newType = new XsdSimpleType(n);
                        node.AddKids(newType);
                        parse(n, newType);
                    }
                    else
                    {
                        parse(n, node);
                    }
                    break;
                }

                case "annotation":
                {
                    parse(n, node);
                    break;
                }

                case "restriction":
                {
                    XsdNode newNode = new XsdRestriction(n);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "enumeration":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).AddEnum(value);
                    break;
                }

                case "pattern":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).Pattern = value;
                    break;
                }

                case "length":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).Length = value;
                    break;
                }

                case "maxLength":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MaxLength = value;
                    break;
                }

                case "minLength":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MinLength = value;
                    break;
                }

                case "maxInclusive":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MaxInclusive = value;
                    break;
                }

                case "maxExclusive":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MaxExclusive = value;
                    break;
                }

                case "minInclusive":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MinInclusive = value;
                    break;
                }

                case "minExclusive":
                {
                    string value = VisualizerHelper.GetAttr(n, "value");
                    ((XsdRestriction)node).MinExclusive = value;
                    break;
                }

                case "notation":
                case "schema":
                case "appInfo":
                case "group":
                case "#comment":
                case "#text":
                case "key":
                case "keyref":
                case "unique":
                    //ignore
                    break;

                case "any":
                {
                    XsdNode newNode = new XsdAny(n);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "import":
                case "include":
                {
                    XsdNode newNode = new XsdImportInclude(n, name);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "complexContent":
                case "simpleContent":
                {
                    parse(n, node);
                    break;
                }

                case "extension":
                {
                    XsdNode newNode = new XsdExtension(n);
                    node.AddKids(newNode);
                    parse(n, newNode);
                    break;
                }

                case "anyAttribute":
                case "attributeGroup":
                case "field":
                case "list":
                case "redefine":
                case "selector":
                case "union":
                    Debug.Fail("Not supported: " + name);
                    Console.Error.WriteLine("Not supported: " + name);
                    break;

                default:
                    Debug.Fail("Unknown type: " + name);
                    break;
                }
            }
        }
Exemple #14
0
 public XsdElement(XmlNode node) : base(node)
 {
     {
         string attr = VisualizerHelper.GetAttr(node, "name");
         if (attr != null)
         {
             Name = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "abstract");
         if (attr != null)
         {
             Abstract = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "block");
         if (attr != null)
         {
             Block = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "default");
         if (attr != null)
         {
             Default = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "final");
         if (attr != null)
         {
             Final = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "fixed");
         if (attr != null)
         {
             Fixed = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "form");
         if (attr != null)
         {
             Form = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "id");
         if (attr != null)
         {
             Id = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "minOccurs");
         if (attr != null)
         {
             MinOccurs = attr;
         }
     }
     {
         string attr = VisualizerHelper.GetAttr(node, "maxOccurs");
         if (attr != null)
         {
             MaxOccurs = attr;
         }
     } {
         string attr = VisualizerHelper.GetAttr(node, "nillable");
         if (attr != null)
         {
             Nillable = attr;
         }
     } {
         string attr = VisualizerHelper.GetAttr(node, "ref");
         if (attr != null)
         {
             RefName = attr;
         }
     } {
         string attr = VisualizerHelper.GetAttr(node, "substitutionGroup");
         if (attr != null)
         {
             SubstitutionGroup = attr;
         }
     } {
         string attr = VisualizerHelper.GetAttr(node, "type");
         if (attr != null)
         {
             TypeName = attr;
         }
     }
 }
Exemple #15
0
        public XsdAttribute(XmlNode node) : base(node)
        {
            string attrName = VisualizerHelper.GetAttr(node, "name");

            if (attrName != null)
            {
                Name = attrName;
            }

            string attrDefault = VisualizerHelper.GetAttr(node, "default");

            if (attrDefault != null)
            {
                Default = attrDefault;
            }

            string attrFixed = VisualizerHelper.GetAttr(node, "fixed");

            if (attrFixed != null)
            {
                Fixed = attrFixed;
            }

            string attrForm = VisualizerHelper.GetAttr(node, "form");

            if (attrForm != null)
            {
                Form = attrForm;
            }

            string attrId = VisualizerHelper.GetAttr(node, "id");

            if (attrId != null)
            {
                Id = attrId;
            }

            string attrRef = VisualizerHelper.GetAttr(node, "ref");

            if (attrRef != null)
            {
                Reference = attrRef;
            }

            string attrType = VisualizerHelper.GetAttr(node, "type");

            if (attrType != null)
            {
                TypeName = attrType;
            }

            string attrUse = VisualizerHelper.GetAttr(node, "use");

            if (attrUse != null)
            {
                Use = attrUse;
            }
            else
            {
                Use = "optional";
            }
        }