// Token: 0x06000166 RID: 358 RVA: 0x00006518 File Offset: 0x00004718
        protected void LoadDetailSchemaMappings(MasterSchemaMappingEntry masterSchemaMappingEntry)
        {
            ExTraceGlobals.SchemaManagerTracer.Information <string>((long)this.GetHashCode(), "SchemaManager::LoadDetailSchemaMappings - retrieving info from detail schema mapping XML file {0}.", (masterSchemaMappingEntry == null) ? "null" : masterSchemaMappingEntry.SchemaFileName);
            string schemaFileName = masterSchemaMappingEntry.SchemaFileName;

            this.schemaMappingEntryArray = (SchemaMappingEntry[])SchemaManager.schemaMappingEntryArrayHashTable[schemaFileName];
            if (this.schemaMappingEntryArray == null)
            {
                lock (typeof(SchemaManager))
                {
                    string   dataSourceManagerAssemblyName = masterSchemaMappingEntry.DataSourceManagerAssemblyName;
                    Assembly assembly = (Assembly)SchemaManager.dsmAssemblyHashTable[dataSourceManagerAssemblyName];
                    if (null == assembly)
                    {
                        string assemblyString = dataSourceManagerAssemblyName;
                        if (Path.GetExtension(dataSourceManagerAssemblyName).ToLower() == ".dll")
                        {
                            assemblyString = Path.GetFileNameWithoutExtension(dataSourceManagerAssemblyName);
                        }
                        try
                        {
                            assembly = Assembly.Load(assemblyString);
                        }
                        catch (FileNotFoundException)
                        {
                        }
                        if (assembly == null)
                        {
                            string assemblyFile = Path.Combine(ConfigurationContext.Setup.BinPath, dataSourceManagerAssemblyName);
                            assembly = Assembly.LoadFrom(assemblyFile);
                        }
                        SchemaManager.dsmAssemblyHashTable[dataSourceManagerAssemblyName] = assembly;
                    }
                    List <Type> list = new List <Type>();
                    foreach (Type type in assembly.GetTypes())
                    {
                        if (type.IsSubclassOf(typeof(SchemaMappingEntry)))
                        {
                            list.Add(type);
                        }
                    }
                    Assembly executingAssembly = Assembly.GetExecutingAssembly();
                    foreach (Type type2 in executingAssembly.GetTypes())
                    {
                        if (type2.IsSubclassOf(typeof(SchemaMappingEntry)))
                        {
                            list.Add(type2);
                        }
                    }
                    Type[]            extraTypes        = list.ToArray();
                    SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(SchemaMappingEntry[]), extraTypes);
                    Stream            schemaXmlDocument = SchemaManager.GetSchemaXmlDocument(masterSchemaMappingEntry.SchemaFileName);
                    using (schemaXmlDocument)
                    {
                        this.schemaMappingEntryArray = (SchemaMappingEntry[])safeXmlSerializer.Deserialize(schemaXmlDocument);
                        SchemaManager.schemaMappingEntryArrayHashTable[masterSchemaMappingEntry.SchemaFileName] = this.schemaMappingEntryArray;
                    }
                }
            }
        }
        private AutoDiscoverResponseXML GetResponse(WebResponse response)
        {
            this.TraceHeaders(response.Headers);
            AutoDiscoverResponseXML result;

            using (Stream responseStream = response.GetResponseStream())
            {
                try
                {
                    SafeXmlSerializer       safeXmlSerializer       = new SafeXmlSerializer(typeof(AutoDiscoverResponseXML));
                    AutoDiscoverResponseXML autoDiscoverResponseXML = safeXmlSerializer.Deserialize(responseStream) as AutoDiscoverResponseXML;
                    if (this.url.StartsWith("http:", StringComparison.OrdinalIgnoreCase))
                    {
                        this.TraceVerbose(Strings.TowsDomainNotSsl(this.url));
                    }
                    result = autoDiscoverResponseXML;
                }
                catch (InvalidOperationException ex)
                {
                    if (ex.InnerException == null || !(ex.InnerException is XmlException))
                    {
                        throw;
                    }
                    result = null;
                }
            }
            return(result);
        }
 // Token: 0x0600001D RID: 29 RVA: 0x000022B4 File Offset: 0x000004B4
 public object XmlToObject(string xmlText, Type objType, out Exception ex)
 {
     ex = null;
     if (xmlText == null || xmlText.Length == 0)
     {
         return(null);
     }
     try
     {
         using (StringReader stringReader = new StringReader(xmlText))
         {
             XmlSerializer xmlSerializer = new SafeXmlSerializer(objType);
             return(xmlSerializer.Deserialize(stringReader));
         }
     }
     catch (InvalidOperationException ex2)
     {
         ex = ex2;
     }
     catch (IOException ex3)
     {
         ex = ex3;
     }
     return(null);
 }
Example #4
0
        public static SharedFolderData DeserializeFromXmlELement(XmlElement xmlElement)
        {
            new SharedFolderData();
            XmlNodeReader     reader            = new XmlNodeReader(xmlElement);
            SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(SharedFolderData));

            return(safeXmlSerializer.Deserialize(reader) as SharedFolderData);
        }
Example #5
0
        public static RpcAssociationReplicatorRunNowParameters Parse(string input, IRecipientSession adSession)
        {
            SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(List <MailboxLocatorType>));
            RpcAssociationReplicatorRunNowParameters result;

            using (StringReader stringReader = new StringReader(input))
            {
                List <MailboxLocatorType> locators = safeXmlSerializer.Deserialize(stringReader) as List <MailboxLocatorType>;
                result = RpcAssociationReplicatorRunNowParameters.Instantiate(locators, adSession);
            }
            return(result);
        }
        private static TrustedDocDomain DecryptTrustedDocDomainData(EncryptedTrustedDocDomain encryptedData, SecureString password)
        {
            IPrivateKeyDecryptor privateKeyDecryptor = new OnPremisePrivateKeyDecryptor(password);

            byte[] buffer = null;
            try
            {
                buffer = privateKeyDecryptor.Decrypt(encryptedData.m_strTrustedDocDomainInfo);
            }
            catch (PrivateKeyDecryptionFailedException innerException)
            {
                throw new TrustedPublishingDomainParser.ParseFailedException("OnPremisePrivateKeyDecryptor.Decrypt() failed", innerException);
            }
            TrustedDocDomain result;

            using (MemoryStream memoryStream = new MemoryStream(buffer))
            {
                try
                {
                    SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(ArrayList), new Type[]
                    {
                        typeof(TrustedDocDomain[])
                    });
                    ArrayList arrayList = safeXmlSerializer.Deserialize(memoryStream) as ArrayList;
                    if (arrayList == null || arrayList.Count != 1)
                    {
                        throw new TrustedPublishingDomainParser.ParseFailedException("DecryptedTPD_NoORMoreThanOneElements");
                    }
                    TrustedDocDomain trustedDocDomain = arrayList[0] as TrustedDocDomain;
                    if (trustedDocDomain == null)
                    {
                        throw new TrustedPublishingDomainParser.ParseFailedException("DecryptedTPD_NotOfType_TrustedDocDomain");
                    }
                    trustedDocDomain.m_ttdki.strEncryptedPrivateKey = encryptedData.m_strKeyData;
                    result = trustedDocDomain;
                }
                catch (InvalidOperationException innerException2)
                {
                    throw new TrustedPublishingDomainParser.ParseFailedException("DecryptedTPD_XmlDeserializationFailed", innerException2);
                }
                catch (XmlException innerException3)
                {
                    throw new TrustedPublishingDomainParser.ParseFailedException("DecryptedTPD_XmlDeserializationFailed", innerException3);
                }
            }
            return(result);
        }
        public static TrustedDocDomain Parse(SecureString password, byte[] rawData)
        {
            if (password == null)
            {
                throw new ArgumentNullException("password");
            }
            if (rawData == null || rawData.Length == 0)
            {
                throw new ArgumentNullException("rawData");
            }
            EncryptedTrustedDocDomain encryptedTrustedDocDomain = null;

            using (MemoryStream memoryStream = new MemoryStream(rawData))
            {
                try
                {
                    SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(ArrayList), new Type[]
                    {
                        typeof(EncryptedTrustedDocDomain[])
                    });
                    ArrayList arrayList = safeXmlSerializer.Deserialize(memoryStream) as ArrayList;
                    if (arrayList == null || arrayList.Count != 1)
                    {
                        throw new TrustedPublishingDomainParser.ParseFailedException("EncryptedTPD_NoOrMoreThanOneElementsIn");
                    }
                    encryptedTrustedDocDomain = (arrayList[0] as EncryptedTrustedDocDomain);
                    if (encryptedTrustedDocDomain == null)
                    {
                        throw new TrustedPublishingDomainParser.ParseFailedException("EncryptedTPD_NotOfType_EncryptedTrustedDocDomain");
                    }
                }
                catch (InvalidOperationException innerException)
                {
                    throw new TrustedPublishingDomainParser.ParseFailedException("EncryptedTPD_XmlDeserializationFailed", innerException);
                }
                catch (XmlException innerException2)
                {
                    throw new TrustedPublishingDomainParser.ParseFailedException("EncryptedTPD_XmlDeserializationFailed", innerException2);
                }
            }
            if (string.IsNullOrEmpty(encryptedTrustedDocDomain.m_strTrustedDocDomainInfo))
            {
                throw new TrustedPublishingDomainParser.ParseFailedException("EncryptedTPD_NoTrustedDocDomainInfo");
            }
            return(TrustedPublishingDomainParser.DecryptTrustedDocDomainData(encryptedTrustedDocDomain, password));
        }
            public override Exception ValidateResponse(Stream responseStream, out string ewsUrl, out string oabUrl)
            {
                ewsUrl = null;
                oabUrl = null;
                SafeXmlSerializer       safeXmlSerializer       = new SafeXmlSerializer(typeof(AutoDiscoverResponseXML));
                AutoDiscoverResponseXML autoDiscoverResponseXML = null;
                XDocument xdocument = null;

                try
                {
                    autoDiscoverResponseXML = (AutoDiscoverResponseXML)safeXmlSerializer.Deserialize(responseStream);
                    responseStream.Seek(0L, SeekOrigin.Begin);
                    using (StreamReader streamReader = new StreamReader(responseStream))
                    {
                        xdocument = XDocument.Load(streamReader);
                    }
                }
                catch (XmlException innerException)
                {
                    return(new ServiceValidatorException(Strings.ErrorInvalidResponseFormat, innerException));
                }
                if (autoDiscoverResponseXML.ErrorResponse != null)
                {
                    if (autoDiscoverResponseXML.ErrorResponse.Error == null)
                    {
                        return(new ServiceValidatorException(Strings.ErrorInvalidResponseXml(xdocument.ToString())));
                    }
                    return(new ServiceValidatorException(Strings.ErrorResponseContainsError(autoDiscoverResponseXML.ErrorResponse.Error.ErrorCode, autoDiscoverResponseXML.ErrorResponse.Error.Message)));
                }
                else
                {
                    if (autoDiscoverResponseXML.DataResponse == null || autoDiscoverResponseXML.DataResponse.Account == null || autoDiscoverResponseXML.DataResponse.Account.Action == null)
                    {
                        return(new ServiceValidatorException(Strings.ErrorInvalidResponseXml(xdocument.ToString())));
                    }
                    if (autoDiscoverResponseXML.DataResponse.Account.Action.Equals("redirectAddr", StringComparison.OrdinalIgnoreCase))
                    {
                        string redirectAddr = autoDiscoverResponseXML.DataResponse.Account.RedirectAddr;
                        return(new ServiceValidatorException(Strings.ErrorAutoDiscoverValidatorRequiresRedirection(redirectAddr)));
                    }
                    if (autoDiscoverResponseXML.DataResponse.Account.Protocol == null)
                    {
                        return(new ServiceValidatorException(Strings.ErrorInvalidResponseXml(xdocument.ToString())));
                    }
                    AutoDiscoverProtocol[] protocol = autoDiscoverResponseXML.DataResponse.Account.Protocol;
                    string[] array = new string[]
                    {
                        "EXCH",
                        "EXPR"
                    };
                    for (int i = 0; i < array.Length; i++)
                    {
                        string protocolType = array[i];
                        AutoDiscoverProtocol autoDiscoverProtocol = Array.Find <AutoDiscoverProtocol>(protocol, (AutoDiscoverProtocol p) => p.Type.Equals(protocolType, StringComparison.OrdinalIgnoreCase));
                        if (autoDiscoverProtocol != null)
                        {
                            if (!string.IsNullOrEmpty(autoDiscoverProtocol.EwsUrl))
                            {
                                ewsUrl = autoDiscoverProtocol.EwsUrl;
                            }
                            if (!string.IsNullOrEmpty(autoDiscoverProtocol.OABUrl))
                            {
                                oabUrl = autoDiscoverProtocol.OABUrl;
                            }
                        }
                    }
                    if (string.IsNullOrEmpty(ewsUrl))
                    {
                        return(new ServiceValidatorException(Strings.ErrorAutoDiscoverValidatorEwsNotFound(xdocument.ToString())));
                    }
                    if (string.IsNullOrEmpty(oabUrl))
                    {
                        return(new ServiceValidatorException(Strings.ErrorAutoDiscoverValidatorOabNotFound(xdocument.ToString())));
                    }
                    return(null);
                }
                Exception result;

                return(result);
            }
Example #9
0
        // Token: 0x060001A0 RID: 416 RVA: 0x0000B7A0 File Offset: 0x000099A0
        public static object Deserialize(Type type, XmlReader xmlReader)
        {
            SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(type);

            return(safeXmlSerializer.Deserialize(xmlReader));
        }
        // Token: 0x060009C0 RID: 2496 RVA: 0x00025EF4 File Offset: 0x000240F4
        internal static EncryptionConfigurationData Deserialize(string serializedXML)
        {
            EncryptionConfigurationData result;

            using (StringReader stringReader = new StringReader(serializedXML))
            {
                SafeXmlSerializer           safeXmlSerializer           = new SafeXmlSerializer(typeof(EncryptionConfigurationData));
                EncryptionConfigurationData encryptionConfigurationData = (EncryptionConfigurationData)safeXmlSerializer.Deserialize(stringReader);
                result = encryptionConfigurationData;
            }
            return(result);
        }
Example #11
0
 public static string Initialize(TextReader reader)
 {
     if (!SuppressingPiiProperty.Initialized)
     {
         lock (SuppressingPiiProperty.syncObject)
         {
             if (!SuppressingPiiProperty.Initialized)
             {
                 SuppressingPiiProperty.Initialized = true;
                 SafeXmlSerializer safeXmlSerializer = new SafeXmlSerializer(typeof(SuppressingPiiConfig));
                 SuppressingPiiProperty.piiDataRedaction = (SuppressingPiiConfig)safeXmlSerializer.Deserialize(reader);
             }
         }
     }
     if (SuppressingPiiProperty.piiDataRedaction != null)
     {
         return(SuppressingPiiProperty.piiDataRedaction.DeserializationError);
     }
     return(null);
 }