예제 #1
0
        public override DataSet Clone()
        {
            labtechDataSet schemaSerializationMode = (labtechDataSet)base.Clone();

            schemaSerializationMode.InitVars();
            schemaSerializationMode.SchemaSerializationMode = this.SchemaSerializationMode;
            return(schemaSerializationMode);
        }
예제 #2
0
            public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
            {
                XmlSchemaComplexType xmlSchemaComplexType;
                XmlSchemaComplexType xmlSchemaComplexType1 = new XmlSchemaComplexType();
                XmlSchemaSequence    xmlSchemaSequence     = new XmlSchemaSequence();
                labtechDataSet       _labtechDataSet       = new labtechDataSet();
                XmlSchemaAny         xmlSchemaAny          = new XmlSchemaAny()
                {
                    Namespace       = "http://www.w3.org/2001/XMLSchema",
                    MinOccurs       = new decimal(0),
                    MaxOccurs       = new decimal(-1, -1, -1, false, 0),
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };

                xmlSchemaSequence.Items.Add(xmlSchemaAny);
                XmlSchemaAny xmlSchemaAny1 = new XmlSchemaAny()
                {
                    Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1",
                    MinOccurs       = new decimal(1),
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };

                xmlSchemaSequence.Items.Add(xmlSchemaAny1);
                XmlSchemaAttribute xmlSchemaAttribute = new XmlSchemaAttribute()
                {
                    Name       = "namespace",
                    FixedValue = _labtechDataSet.Namespace
                };

                xmlSchemaComplexType1.Attributes.Add(xmlSchemaAttribute);
                XmlSchemaAttribute xmlSchemaAttribute1 = new XmlSchemaAttribute()
                {
                    Name       = "tableTypeName",
                    FixedValue = "computersDataTable"
                };

                xmlSchemaComplexType1.Attributes.Add(xmlSchemaAttribute1);
                xmlSchemaComplexType1.Particle = xmlSchemaSequence;
                XmlSchema schemaSerializable = _labtechDataSet.GetSchemaSerializable();

                if (xs.Contains(schemaSerializable.TargetNamespace))
                {
                    MemoryStream memoryStream  = new MemoryStream();
                    MemoryStream memoryStream1 = new MemoryStream();
                    try
                    {
                        XmlSchema current = null;
                        schemaSerializable.Write(memoryStream);
                        IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            current = (XmlSchema)enumerator.Current;
                            memoryStream1.SetLength((long)0);
                            current.Write(memoryStream1);
                            if (memoryStream.Length == memoryStream1.Length)
                            {
                                memoryStream.Position  = (long)0;
                                memoryStream1.Position = (long)0;
                                while (true)
                                {
                                    if ((memoryStream.Position == memoryStream.Length ? true : memoryStream.ReadByte() != memoryStream1.ReadByte()))
                                    {
                                        break;
                                    }
                                }
                                if (memoryStream.Position == memoryStream.Length)
                                {
                                    xmlSchemaComplexType = xmlSchemaComplexType1;
                                    return(xmlSchemaComplexType);
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (memoryStream != null)
                        {
                            memoryStream.Close();
                        }
                        if (memoryStream1 != null)
                        {
                            memoryStream1.Close();
                        }
                    }
                }
                xs.Add(schemaSerializable);
                xmlSchemaComplexType = xmlSchemaComplexType1;
                return(xmlSchemaComplexType);
            }
예제 #3
0
        public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
        {
            XmlSchemaComplexType xmlSchemaComplexType;
            labtechDataSet       _labtechDataSet       = new labtechDataSet();
            XmlSchemaComplexType xmlSchemaComplexType1 = new XmlSchemaComplexType();
            XmlSchemaSequence    xmlSchemaSequence     = new XmlSchemaSequence();
            XmlSchemaAny         xmlSchemaAny          = new XmlSchemaAny()
            {
                Namespace = _labtechDataSet.Namespace
            };

            xmlSchemaSequence.Items.Add(xmlSchemaAny);
            xmlSchemaComplexType1.Particle = xmlSchemaSequence;
            XmlSchema schemaSerializable = _labtechDataSet.GetSchemaSerializable();

            if (xs.Contains(schemaSerializable.TargetNamespace))
            {
                MemoryStream memoryStream  = new MemoryStream();
                MemoryStream memoryStream1 = new MemoryStream();
                try
                {
                    XmlSchema current = null;
                    schemaSerializable.Write(memoryStream);
                    IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        current = (XmlSchema)enumerator.Current;
                        memoryStream1.SetLength((long)0);
                        current.Write(memoryStream1);
                        if (memoryStream.Length == memoryStream1.Length)
                        {
                            memoryStream.Position  = (long)0;
                            memoryStream1.Position = (long)0;
                            while (true)
                            {
                                if ((memoryStream.Position == memoryStream.Length ? true : memoryStream.ReadByte() != memoryStream1.ReadByte()))
                                {
                                    break;
                                }
                            }
                            if (memoryStream.Position == memoryStream.Length)
                            {
                                xmlSchemaComplexType = xmlSchemaComplexType1;
                                return(xmlSchemaComplexType);
                            }
                        }
                    }
                }
                finally
                {
                    if (memoryStream != null)
                    {
                        memoryStream.Close();
                    }
                    if (memoryStream1 != null)
                    {
                        memoryStream1.Close();
                    }
                }
            }
            xs.Add(schemaSerializable);
            xmlSchemaComplexType = xmlSchemaComplexType1;
            return(xmlSchemaComplexType);
        }