private static UriSectionInternal LoadUsingCustomParser(string appConfigFilePath) { string runtimeDirectory = null; new FileIOPermission(PermissionState.Unrestricted).Assert(); try { runtimeDirectory = RuntimeEnvironment.GetRuntimeDirectory(); } finally { CodeAccessPermission.RevertAssert(); } UriSectionData parentData = UriSectionReader.Read(Path.Combine(Path.Combine(runtimeDirectory, "Config"), "machine.config")); UriSectionData data2 = UriSectionReader.Read(appConfigFilePath, parentData); UriSectionData data3 = null; if (data2 != null) { data3 = data2; } else if (parentData != null) { data3 = parentData; } if (data3 != null) { UriIdnScope?idnScope = data3.IdnScope; UriIdnScope scope = idnScope.HasValue ? idnScope.GetValueOrDefault() : UriIdnScope.None; bool? iriParsing = data3.IriParsing; bool flag = iriParsing.HasValue ? iriParsing.GetValueOrDefault() : false; return(new UriSectionInternal(scope, flag, data3.SchemeSettings.Values)); } return(null); }
private UriSectionReader(string configFilePath, UriSectionData parentData) { this.configFilePath = configFilePath; this.sectionData = new UriSectionData(); if (parentData != null) { this.sectionData.IriParsing = parentData.IriParsing; this.sectionData.IdnScope = parentData.IdnScope; foreach (KeyValuePair <string, SchemeSettingInternal> pair in parentData.SchemeSettings) { this.sectionData.SchemeSettings.Add(pair.Key, pair.Value); } } }
private UriSectionReader(string configFilePath, UriSectionData parentData) { this.configFilePath = configFilePath; this.sectionData = new UriSectionData(); if (parentData != null) { this.sectionData.IriParsing = parentData.IriParsing; this.sectionData.IdnScope = parentData.IdnScope; foreach (KeyValuePair<string, SchemeSettingInternal> pair in parentData.SchemeSettings) { this.sectionData.SchemeSettings.Add(pair.Key, pair.Value); } } }
private UriSectionReader(string configFilePath, UriSectionData parentData) { Debug.Assert(configFilePath != null, "'configFilePath' must not be null"); this.configFilePath = configFilePath; this.sectionData = new UriSectionData(); if (parentData != null) { sectionData.IriParsing = parentData.IriParsing; sectionData.IdnScope = parentData.IdnScope; foreach (KeyValuePair<string, SchemeSettingInternal> schemeSetting in parentData.SchemeSettings) { sectionData.SchemeSettings.Add(schemeSetting.Key, schemeSetting.Value); } } }
private UriSectionReader(string configFilePath, UriSectionData parentData) { Debug.Assert(configFilePath != null, "'configFilePath' must not be null"); this.configFilePath = configFilePath; this.sectionData = new UriSectionData(); if (parentData != null) { sectionData.IriParsing = parentData.IriParsing; sectionData.IdnScope = parentData.IdnScope; foreach (KeyValuePair <string, SchemeSettingInternal> schemeSetting in parentData.SchemeSettings) { sectionData.SchemeSettings.Add(schemeSetting.Key, schemeSetting.Value); } } }
private static UriSectionInternal LoadUsingCustomParser(string appConfigFilePath) { // Already have the application config file path in scope. // Get the path of the machine config file. string runtimeDir = null; // Must Assert unrestricted FileIOPermission to get the machine config path. new FileIOPermission(PermissionState.Unrestricted).Assert(); try { runtimeDir = RuntimeEnvironment.GetRuntimeDirectory(); } finally { FileIOPermission.RevertAssert(); } string machineConfigFilePath = Path.Combine(Path.Combine(runtimeDir, "Config"), "machine.config"); UriSectionData machineSettings = UriSectionReader.Read(machineConfigFilePath); // pass machineSettings to ctor: appSettings will use the values of machineSettings as init values. UriSectionData appSettings = UriSectionReader.Read(appConfigFilePath, machineSettings); UriSectionData resultSectionData = null; if (appSettings != null) { resultSectionData = appSettings; } else if (machineSettings != null) { resultSectionData = machineSettings; } if (resultSectionData != null) { UriIdnScope idnScope = resultSectionData.IdnScope ?? IdnElement.EnabledDefaultValue; bool iriParsing = resultSectionData.IriParsing ?? IriParsingElement.EnabledDefaultValue; IEnumerable <SchemeSettingInternal> schemeSettings = resultSectionData.SchemeSettings.Values as IEnumerable <SchemeSettingInternal>; return(new UriSectionInternal(idnScope, iriParsing, schemeSettings)); } return(null); }
public static UriSectionData Read(string configFilePath, UriSectionData parentData) { UriSectionReader reader = new UriSectionReader(configFilePath, parentData); return reader.GetSectionData(); }
public static UriSectionData Read(string configFilePath, UriSectionData parentData) { UriSectionReader reader = new UriSectionReader(configFilePath, parentData); return(reader.GetSectionData()); }