Exemplo n.º 1
0
 public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
 {
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     TemplateDS templateDS = new TemplateDS();
     XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();
     xmlSchemaAny.Namespace = "http://www.w3.org/2001/XMLSchema";
     xmlSchemaAny.MinOccurs = 0m;
     xmlSchemaAny.MaxOccurs = 79228162514264337593543950335m;
     xmlSchemaAny.ProcessContents = XmlSchemaContentProcessing.Lax;
     xmlSchemaSequence.Items.Add(xmlSchemaAny);
     XmlSchemaAny xmlSchemaAny2 = new XmlSchemaAny();
     xmlSchemaAny2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     xmlSchemaAny2.MinOccurs = 1m;
     xmlSchemaAny2.ProcessContents = XmlSchemaContentProcessing.Lax;
     xmlSchemaSequence.Items.Add(xmlSchemaAny2);
     XmlSchemaAttribute xmlSchemaAttribute = new XmlSchemaAttribute();
     xmlSchemaAttribute.Name = "namespace";
     xmlSchemaAttribute.FixedValue = templateDS.Namespace;
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute);
     XmlSchemaAttribute xmlSchemaAttribute2 = new XmlSchemaAttribute();
     xmlSchemaAttribute2.Name = "tableTypeName";
     xmlSchemaAttribute2.FixedValue = "FormInfoDataTable";
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute2);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = templateDS.GetSchemaSerializable();
     XmlSchemaComplexType result;
     if (xs.Contains(schemaSerializable.TargetNamespace))
     {
         MemoryStream memoryStream = new MemoryStream();
         MemoryStream memoryStream2 = new MemoryStream();
         try
         {
             schemaSerializable.Write(memoryStream);
             IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 XmlSchema xmlSchema = (XmlSchema)enumerator.Current;
                 memoryStream2.SetLength(0L);
                 xmlSchema.Write(memoryStream2);
                 if (memoryStream.Length == memoryStream2.Length)
                 {
                     memoryStream.Position = 0L;
                     memoryStream2.Position = 0L;
                     while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte())
                     {
                     }
                     if (memoryStream.Position == memoryStream.Length)
                     {
                         result = xmlSchemaComplexType;
                         return result;
                     }
                 }
             }
         }
         finally
         {
             if (memoryStream != null)
             {
                 memoryStream.Close();
             }
             if (memoryStream2 != null)
             {
                 memoryStream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     result = xmlSchemaComplexType;
     return result;
 }
Exemplo n.º 2
0
 public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
 {
     TemplateDS templateDS = new TemplateDS();
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();
     xmlSchemaAny.Namespace = templateDS.Namespace;
     xmlSchemaSequence.Items.Add(xmlSchemaAny);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = templateDS.GetSchemaSerializable();
     XmlSchemaComplexType result;
     if (xs.Contains(schemaSerializable.TargetNamespace))
     {
         MemoryStream memoryStream = new MemoryStream();
         MemoryStream memoryStream2 = new MemoryStream();
         try
         {
             schemaSerializable.Write(memoryStream);
             IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 XmlSchema xmlSchema = (XmlSchema)enumerator.Current;
                 memoryStream2.SetLength(0L);
                 xmlSchema.Write(memoryStream2);
                 if (memoryStream.Length == memoryStream2.Length)
                 {
                     memoryStream.Position = 0L;
                     memoryStream2.Position = 0L;
                     while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte())
                     {
                     }
                     if (memoryStream.Position == memoryStream.Length)
                     {
                         result = xmlSchemaComplexType;
                         return result;
                     }
                 }
             }
         }
         finally
         {
             if (memoryStream != null)
             {
                 memoryStream.Close();
             }
             if (memoryStream2 != null)
             {
                 memoryStream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     result = xmlSchemaComplexType;
     return result;
 }