Exemplo n.º 1
0
        private XsdParameters Read6_XsdParameters(bool isNullable, bool checkType)
        {
            XmlQualifiedName xmlQualifiedName = checkType ? GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != id18_xsdParameters || xmlQualifiedName.Namespace != id2_Item))
            {
                throw CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            XsdParameters xsdParameters = new XsdParameters();

            bool[] array = new bool[6];
            while (Reader.MoveToNextAttribute())
            {
                if (!array[3] && Reader.LocalName == id19_output && Reader.NamespaceURI == id4_Item)
                {
                    xsdParameters.OutputDir = Reader.Value;
                    array[3] = true;
                }
                else if (!array[4] && Reader.LocalName == id20_nologo && Reader.NamespaceURI == id4_Item)
                {
                    xsdParameters.Nologo = XmlConvert.ToBoolean(Reader.Value);
                    array[4]             = true;
                }
                else if (!array[5] && Reader.LocalName == id21_help && Reader.NamespaceURI == id4_Item)
                {
                    xsdParameters.Help = XmlConvert.ToBoolean(Reader.Value);
                    array[5]           = true;
                }
                else if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode(xsdParameters);
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(xsdParameters);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int num         = 0;
            int readerCount = ReaderCount;

            while (Reader.NodeType != XmlNodeType.EndElement && Reader.NodeType != XmlNodeType.None)
            {
                if (Reader.NodeType == XmlNodeType.Element)
                {
                    if (!array[0] && Reader.LocalName == id22_generateDataSet && Reader.NamespaceURI == id2_Item)
                    {
                        Read2_GenerateDataset(xsdParameters, false, true);
                        array[0] = true;
                    }
                    else if (!array[1] && Reader.LocalName == id5_generateSchemas && Reader.NamespaceURI == id2_Item)
                    {
                        Read3_GenerateSchemas(xsdParameters, false, true);
                        array[1] = true;
                    }
                    else if (!array[2] && Reader.LocalName == id23_generateClasses && Reader.NamespaceURI == id2_Item)
                    {
                        Read5_GenerateClasses(xsdParameters, false, true);
                        array[2] = true;
                    }
                    else
                    {
                        UnknownNode(xsdParameters);
                    }
                }
                else
                {
                    UnknownNode(xsdParameters);
                }
                Reader.MoveToContent();
                CheckReaderCount(ref num, ref readerCount);
            }
            ReadEndElement();
            return(xsdParameters);
        }
Exemplo n.º 2
0
        private XsdParameters Read2_GenerateDataset(XsdParameters xsd, bool isNullable, bool checkType)
        {
            xsd.Dataset = true;
            XmlQualifiedName xmlQualifiedName = checkType ? GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != id3_generateObjectModel || xmlQualifiedName.Namespace != id2_Item))
            {
                throw CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            StringCollection xsdSchemas = xsd.XsdSchemas;

            while (Reader.MoveToNextAttribute())
            {
                if (Reader.LocalName == id7_language && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Language = Reader.Value;
                }
                else if (Reader.LocalName == id8_namespace && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Namespace = Reader.Value;
                }
                else if (Reader.LocalName == id24_enableLinqDataSet && Reader.NamespaceURI == id4_Item)
                {
                    xsd.EnableLinqDataSet = XmlConvert.ToBoolean(Reader.Value);
                }
                else if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode(xsd);
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(xsd);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int num         = 0;
            int readerCount = ReaderCount;

            while (Reader.NodeType != XmlNodeType.EndElement && Reader.NodeType != XmlNodeType.None)
            {
                if (Reader.NodeType == XmlNodeType.Element)
                {
                    if (Reader.LocalName == id11_schema && Reader.NamespaceURI == id2_Item)
                    {
                        xsdSchemas.Add(Reader.ReadElementString());
                    }
                    else
                    {
                        UnknownNode(xsd);
                    }
                }
                else
                {
                    UnknownNode(xsd);
                }
                Reader.MoveToContent();
                CheckReaderCount(ref num, ref readerCount);
            }
            ReadEndElement();
            return(xsd);
        }
Exemplo n.º 3
0
        private XsdParameters Read5_GenerateClasses(XsdParameters xsd, bool isNullable, bool checkType)
        {
            xsd.Classes = true;
            XmlQualifiedName xmlQualifiedName = checkType ? GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != id6_GenerateClasses || xmlQualifiedName.Namespace != id2_Item))
            {
                throw CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            StringCollection xsdSchemas = xsd.XsdSchemas;
            StringCollection elements   = xsd.Elements;
            StringCollection arg_69_0   = xsd.SchemaImporterExtensions;

            while (Reader.MoveToNextAttribute())
            {
                if (Reader.LocalName == id7_language && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Language = Reader.Value;
                }
                else if (Reader.LocalName == id8_namespace && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Namespace = Reader.Value;
                }
                else if (Reader.LocalName == id9_options && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Options = Read4_CodeGenerationOptions(Reader.Value);
                }
                else if (Reader.LocalName == id10_uri && Reader.NamespaceURI == id4_Item)
                {
                    xsd.Uri = CollapseWhitespace(Reader.Value);
                }
                else if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode(xsd);
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(xsd);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int num         = 0;
            int readerCount = ReaderCount;

            while (Reader.NodeType != XmlNodeType.EndElement && Reader.NodeType != XmlNodeType.None)
            {
                if (Reader.NodeType == XmlNodeType.Element)
                {
                    if (Reader.LocalName == id11_schema && Reader.NamespaceURI == id2_Item)
                    {
                        xsdSchemas.Add(Reader.ReadElementString());
                    }
                    else if (Reader.LocalName == id12_element && Reader.NamespaceURI == id2_Item)
                    {
                        elements.Add(Reader.ReadElementString());
                    }
                    else if (Reader.LocalName == id13_schemaImporterExtensions && Reader.NamespaceURI == id2_Item)
                    {
                        if (!ReadNull())
                        {
                            StringCollection schemaImporterExtensions = xsd.SchemaImporterExtensions;
                            if (Reader.IsEmptyElement)
                            {
                                Reader.Skip();
                            }
                            else
                            {
                                Reader.ReadStartElement();
                                Reader.MoveToContent();
                                int num2         = 0;
                                int readerCount2 = ReaderCount;
                                while (Reader.NodeType != XmlNodeType.EndElement && Reader.NodeType != XmlNodeType.None)
                                {
                                    if (Reader.NodeType == XmlNodeType.Element)
                                    {
                                        if (Reader.LocalName == id14_type && Reader.NamespaceURI == id2_Item)
                                        {
                                            schemaImporterExtensions.Add(Reader.ReadElementString());
                                        }
                                        else
                                        {
                                            UnknownNode(null);
                                        }
                                    }
                                    else
                                    {
                                        UnknownNode(null);
                                    }
                                    Reader.MoveToContent();
                                    CheckReaderCount(ref num2, ref readerCount2);
                                }
                                ReadEndElement();
                            }
                        }
                    }
                    else
                    {
                        UnknownNode(xsd);
                    }
                }
                else
                {
                    UnknownNode(xsd);
                }
                Reader.MoveToContent();
                CheckReaderCount(ref num, ref readerCount);
            }
            ReadEndElement();
            return(xsd);
        }
Exemplo n.º 4
0
        private XsdParameters Read3_GenerateSchemas(XsdParameters xsd, bool isNullable, bool checkType)
        {
            XmlQualifiedName xmlQualifiedName = checkType ? GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != id5_generateSchemas || xmlQualifiedName.Namespace != id2_Item))
            {
                throw CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            StringCollection instances  = xsd.Instances;
            StringCollection xdrSchemas = xsd.XdrSchemas;
            StringCollection assemblies = xsd.Assemblies;
            StringCollection types      = xsd.Types;

            while (Reader.MoveToNextAttribute())
            {
                if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode(xsd);
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(xsd);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int num         = 0;
            int readerCount = ReaderCount;

            while (Reader.NodeType != XmlNodeType.EndElement && Reader.NodeType != XmlNodeType.None)
            {
                if (Reader.NodeType == XmlNodeType.Element)
                {
                    if (Reader.LocalName == id15_xml && Reader.NamespaceURI == id2_Item)
                    {
                        instances.Add(Reader.ReadElementString());
                    }
                    else if (Reader.LocalName == id16_xdr && Reader.NamespaceURI == id2_Item)
                    {
                        xdrSchemas.Add(Reader.ReadElementString());
                    }
                    else if (Reader.LocalName == id17_assembly && Reader.NamespaceURI == id2_Item)
                    {
                        assemblies.Add(Reader.ReadElementString());
                    }
                    else if (Reader.LocalName == id14_type && Reader.NamespaceURI == id2_Item)
                    {
                        types.Add(Reader.ReadElementString());
                    }
                    else
                    {
                        UnknownNode(xsd);
                    }
                }
                else
                {
                    UnknownNode(xsd);
                }
                Reader.MoveToContent();
                CheckReaderCount(ref num, ref readerCount);
            }
            ReadEndElement();
            return(xsd);
        }
Exemplo n.º 5
0
 internal XsdParameters Merge(XsdParameters parameters)
 {
     if (parameters.classes)
     {
         classes = parameters.classes;
     }
     if (parameters.dataset)
     {
         dataset = parameters.dataset;
     }
     if (parameters.language != null)
     {
         language = parameters.language;
     }
     if (parameters.ns != null)
     {
         ns = parameters.ns;
     }
     if (parameters.nologo)
     {
         nologo = parameters.nologo;
     }
     if (parameters.outputdir != null)
     {
         outputdir = parameters.outputdir;
     }
     if (!parameters.optionsDefault)
     {
         options = parameters.options;
     }
     if (parameters.uri != null)
     {
         uri = parameters.uri;
     }
     foreach (string current in parameters.XsdSchemas)
     {
         XsdSchemas.Add(current);
     }
     foreach (string current2 in parameters.XdrSchemas)
     {
         XdrSchemas.Add(current2);
     }
     foreach (string current3 in parameters.Instances)
     {
         Instances.Add(current3);
     }
     foreach (string current4 in parameters.Assemblies)
     {
         Assemblies.Add(current4);
     }
     foreach (string current5 in parameters.Elements)
     {
         Elements.Add(current5);
     }
     foreach (string current6 in parameters.Types)
     {
         Types.Add(current6);
     }
     foreach (string current7 in parameters.SchemaImporterExtensions)
     {
         SchemaImporterExtensions.Add(current7);
     }
     return(this);
 }