// Token: 0x06000A7A RID: 2682 RVA: 0x00028ED0 File Offset: 0x000270D0 internal static SafeXmlDocument GetManifest(SafeXmlDocument xmlDoc) { if (ExtensionDataHelper.xmlSchemaSet.Count == 0) { ExtensionDataHelper.xmlSchemaSet = new XmlSchemaSet(); foreach (string text in SchemaConstants.SchemaNamespaceUriToFile.Keys) { string schemaUri = Path.Combine(ExchangeSetupContext.InstallPath, "bin", SchemaConstants.SchemaNamespaceUriToFile[text]); ExtensionDataHelper.xmlSchemaSet.Add(text, schemaUri); } } xmlDoc.Schemas = ExtensionDataHelper.xmlSchemaSet; xmlDoc.Validate(new ValidationEventHandler(ExtensionDataHelper.InvalidManifestEventHandler)); string uri; string text2; if (!ExtensionDataHelper.TryGetOfficeAppSchemaInfo(xmlDoc, "http://schemas.microsoft.com/office/appforoffice/", out uri, out text2)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonManifestSchemaUnknown)); } XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); xmlNamespaceManager.AddNamespace("owe", uri); SafeXmlDocument safeXmlDocument = null; string xpath = "//owe:OfficeApp"; XmlNode xmlNode = xmlDoc.SelectSingleNode(xpath, xmlNamespaceManager); if (xmlNode != null) { safeXmlDocument = new SafeXmlDocument(); safeXmlDocument.PreserveWhitespace = true; safeXmlDocument.LoadXml(xmlNode.OuterXml); } return(safeXmlDocument); }
private void LoadPublicAgents(string filePath, out List <AgentInfo> publicAgents) { int num = 20; if (string.IsNullOrEmpty(filePath)) { publicAgents = new List <AgentInfo>(); return; } for (;;) { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.Schemas = MExConfiguration.Schemas; try { using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { xmlDocument.Load(fileStream); xmlDocument.Validate(delegate(object sender, ValidationEventArgs args) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), args.Exception); }); this.LoadSettings(xmlDocument.SelectSingleNode("/configuration/mexRuntime/settings")); this.LoadMonitoringOptions(xmlDocument.SelectSingleNode("/configuration/mexRuntime/monitoring")); publicAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/configuration/mexRuntime/agentList"), false); } } catch (XmlException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException); } catch (FormatException innerException2) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException2); } catch (UnauthorizedAccessException innerException3) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException3); } catch (IOException innerException4) { if (num <= 0) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException4); } num--; Thread.Sleep(50); continue; } break; } }
private void LoadInternalAgents(out List <AgentInfo> preExecutionInternalAgents, out List <AgentInfo> postExecutionInternalAgents) { preExecutionInternalAgents = new List <AgentInfo>(); postExecutionInternalAgents = new List <AgentInfo>(); try { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.Schemas = MExConfiguration.InternalSchemas; Assembly executingAssembly = Assembly.GetExecutingAssembly(); using (Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("internalAgents.config")) { xmlDocument.Load(manifestResourceStream); xmlDocument.Validate(delegate(object sender, ValidationEventArgs args) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), args.Exception); }); string xmlMarkups = this.GetXmlMarkups(this.exchangeSku, this.transportProcessRole); if (xmlMarkups != null) { preExecutionInternalAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/internalConfiguration/internalMexRuntime/" + xmlMarkups + "/preExecution"), true); postExecutionInternalAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/internalConfiguration/internalMexRuntime/" + xmlMarkups + "/postExecution"), true); } } } catch (XmlException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException); } catch (UnauthorizedAccessException innerException2) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException2); } catch (IOException innerException3) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException3); } }
internal void Load(Dictionary <string, StoreDriverParameterHandler> keyHandlerCollection) { if (keyHandlerCollection == null) { return; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = Path.Combine(Path.GetDirectoryName(executingAssembly.Location), "StoreDriver.config"); if (!File.Exists(text)) { StoreDriverParameters.diag.TraceError <string>(0L, "The config file {0} does not exist.", text); return; } XmlSchemaSet xmlSchemaSet = new XmlSchemaSet(); try { using (Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("StoreDriverParameters.xsd")) { if (manifestResourceStream == null) { StoreDriverParameters.diag.TraceDebug <string>(0L, "The schema resource {0} does not exist.", "StoreDriverParameters.xsd"); return; } xmlSchemaSet.Add(null, SafeXmlFactory.CreateSafeXmlTextReader(manifestResourceStream)); } } catch (FileLoadException arg) { StoreDriverParameters.diag.TraceError <string, FileLoadException>(0L, "Failed to load the manifest resource stream {0}. Error {1}", "StoreDriverParameters.xsd", arg); return; } catch (FileNotFoundException arg2) { StoreDriverParameters.diag.TraceError <string, FileNotFoundException>(0L, "Failed to find the manifest resource stream {0}.Error: {1}", text, arg2); return; } Exception ex = null; try { xmlSchemaSet.Compile(); XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.Schemas = xmlSchemaSet; using (FileStream fileStream = new FileStream(text, FileMode.Open, FileAccess.Read, FileShare.Read)) { xmlDocument.Load(fileStream); XmlNodeList xmlNodeList = xmlDocument.SelectNodes("/configuration/storeDriver/parameters/add"); foreach (object obj in xmlNodeList) { XmlNode xmlNode = (XmlNode)obj; if (xmlNode != null && xmlNode is XmlElement) { this.currentNodeValid = true; xmlDocument.Validate(delegate(object sender, ValidationEventArgs args) { StoreDriverParameters.diag.TraceDebug <string>(0L, "The parameter or value is invalid: {0}.", args.Message); this.currentNodeValid = false; }, xmlNode); if (this.currentNodeValid) { string value = xmlNode.Attributes.GetNamedItem("key").Value; string value2 = xmlNode.Attributes.GetNamedItem("value").Value; if (value != null && value2 != null && keyHandlerCollection.ContainsKey(value)) { keyHandlerCollection[value](value, value2); } } } } } } catch (XmlSchemaException ex2) { ex = ex2; } catch (SecurityException ex3) { ex = ex3; } catch (IOException ex4) { ex = ex4; } catch (XmlException ex5) { ex = ex5; } catch (XPathException ex6) { ex = ex6; } if (ex != null) { StoreDriverParameters.diag.TraceError <Exception>(0L, "Failed to load parameters from storedriver config. Will use default values. Error: {0}", ex); } }