private void InternalImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName> typeNames, ICollection <XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames)
 {
     if (DiagnosticUtility.ShouldTraceInformation)
     {
         TraceUtility.Trace(TraceEventType.Information, 0x3000a, System.Runtime.Serialization.SR.GetString("TraceCodeXsdImportBegin"));
     }
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         new SchemaImporter(schemas, typeNames, elements, elementTypeNames, this.DataContractSet, this.ImportXmlDataType).Import();
         new CodeExporter(this.DataContractSet, this.Options, this.GetCodeCompileUnit()).Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceImportError(exception);
         throw;
     }
     if (DiagnosticUtility.ShouldTraceInformation)
     {
         TraceUtility.Trace(TraceEventType.Information, 0x3000b, System.Runtime.Serialization.SR.GetString("TraceCodeXsdImportEnd"));
     }
 }
 public void Export(Type type)
 {
     if (type == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
     }
     this.TraceExportBegin();
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         this.AddType(type);
         this.Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     this.TraceExportEnd();
 }
        private bool InternalCanImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName> typeNames, ICollection <XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames)
        {
            bool flag;

            System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
            try
            {
                new SchemaImporter(schemas, typeNames, elements, elementTypeNames, this.DataContractSet, this.ImportXmlDataType).Import();
                flag = true;
            }
            catch (InvalidDataContractException)
            {
                this.dataContractSet = set;
                flag = false;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                this.dataContractSet = set;
                this.TraceImportError(exception);
                throw;
            }
            return(flag);
        }
        public bool CanExport(Type type)
        {
            bool flag;

            if (type == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
            }
            System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
            try
            {
                this.AddType(type);
                this.AddKnownTypes();
                flag = true;
            }
            catch (InvalidDataContractException)
            {
                this.dataContractSet = set;
                flag = false;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                this.dataContractSet = set;
                this.TraceExportError(exception);
                throw;
            }
            return(flag);
        }
 public void Export(ICollection <Type> types)
 {
     if (types == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("types"));
     }
     this.TraceExportBegin();
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         foreach (Type type in types)
         {
             if (type == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullType", new object[] { "types" })));
             }
             this.AddType(type);
         }
         this.Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     this.TraceExportEnd();
 }
        public bool CanExport(ICollection <Assembly> assemblies)
        {
            bool flag;

            if (assemblies == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("assemblies"));
            }
            System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
            try
            {
                foreach (Assembly assembly in assemblies)
                {
                    if (assembly == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullAssembly", new object[] { "assemblies" })));
                    }
                    Type[] types = assembly.GetTypes();
                    for (int i = 0; i < types.Length; i++)
                    {
                        this.CheckAndAddType(types[i]);
                    }
                }
                this.AddKnownTypes();
                flag = true;
            }
            catch (InvalidDataContractException)
            {
                this.dataContractSet = set;
                flag = false;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                this.dataContractSet = set;
                this.TraceExportError(exception);
                throw;
            }
            return(flag);
        }
 public bool CanExport(ICollection<Assembly> assemblies)
 {
     bool flag;
     if (assemblies == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("assemblies"));
     }
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         foreach (Assembly assembly in assemblies)
         {
             if (assembly == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullAssembly", new object[] { "assemblies" })));
             }
             Type[] types = assembly.GetTypes();
             for (int i = 0; i < types.Length; i++)
             {
                 this.CheckAndAddType(types[i]);
             }
         }
         this.AddKnownTypes();
         flag = true;
     }
     catch (InvalidDataContractException)
     {
         this.dataContractSet = set;
         flag = false;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     return flag;
 }
        public bool CanExport(ICollection <Type> types)
        {
            bool flag;

            if (types == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("types"));
            }
            System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
            try
            {
                foreach (Type type in types)
                {
                    if (type == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullType", new object[] { "types" })));
                    }
                    this.AddType(type);
                }
                this.AddKnownTypes();
                flag = true;
            }
            catch (InvalidDataContractException)
            {
                this.dataContractSet = set;
                flag = false;
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                this.dataContractSet = set;
                this.TraceExportError(exception);
                throw;
            }
            return(flag);
        }
 public bool CanExport(ICollection<Type> types)
 {
     bool flag;
     if (types == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("types"));
     }
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         foreach (Type type in types)
         {
             if (type == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullType", new object[] { "types" })));
             }
             this.AddType(type);
         }
         this.AddKnownTypes();
         flag = true;
     }
     catch (InvalidDataContractException)
     {
         this.dataContractSet = set;
         flag = false;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     return flag;
 }
 public void Export(Type type)
 {
     if (type == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
     }
     this.TraceExportBegin();
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         this.AddType(type);
         this.Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     this.TraceExportEnd();
 }
 public void Export(ICollection<Type> types)
 {
     if (types == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("types"));
     }
     this.TraceExportBegin();
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         foreach (Type type in types)
         {
             if (type == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.Runtime.Serialization.SR.GetString("CannotExportNullType", new object[] { "types" })));
             }
             this.AddType(type);
         }
         this.Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     this.TraceExportEnd();
 }
 public bool CanExport(Type type)
 {
     bool flag;
     if (type == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
     }
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         this.AddType(type);
         this.AddKnownTypes();
         flag = true;
     }
     catch (InvalidDataContractException)
     {
         this.dataContractSet = set;
         flag = false;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceExportError(exception);
         throw;
     }
     return flag;
 }
 private void InternalImport(XmlSchemaSet schemas, ICollection<XmlQualifiedName> typeNames, ICollection<XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames)
 {
     if (DiagnosticUtility.ShouldTraceInformation)
     {
         TraceUtility.Trace(TraceEventType.Information, 0x3000a, System.Runtime.Serialization.SR.GetString("TraceCodeXsdImportBegin"));
     }
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         new SchemaImporter(schemas, typeNames, elements, elementTypeNames, this.DataContractSet, this.ImportXmlDataType).Import();
         new CodeExporter(this.DataContractSet, this.Options, this.GetCodeCompileUnit()).Export();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceImportError(exception);
         throw;
     }
     if (DiagnosticUtility.ShouldTraceInformation)
     {
         TraceUtility.Trace(TraceEventType.Information, 0x3000b, System.Runtime.Serialization.SR.GetString("TraceCodeXsdImportEnd"));
     }
 }
 private bool InternalCanImport(XmlSchemaSet schemas, ICollection<XmlQualifiedName> typeNames, ICollection<XmlSchemaElement> elements, XmlQualifiedName[] elementTypeNames)
 {
     bool flag;
     System.Runtime.Serialization.DataContractSet set = (this.dataContractSet == null) ? null : new System.Runtime.Serialization.DataContractSet(this.dataContractSet);
     try
     {
         new SchemaImporter(schemas, typeNames, elements, elementTypeNames, this.DataContractSet, this.ImportXmlDataType).Import();
         flag = true;
     }
     catch (InvalidDataContractException)
     {
         this.dataContractSet = set;
         flag = false;
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         this.dataContractSet = set;
         this.TraceImportError(exception);
         throw;
     }
     return flag;
 }