Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ConfigurationFileMap.cs / 1305376 / ConfigurationFileMap.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Specialized; using System.Security; using System.Security.Permissions; using System.IO; namespace System.Configuration { // // Holds the configuration file mapping for // machine.config. It is the base class for // ExeConfigurationFileMap and WebConfigurationFileMap. // public class ConfigurationFileMap : ICloneable { string _machineConfigFilename; bool _requirePathDiscovery; public ConfigurationFileMap() { _machineConfigFilename = ClientConfigurationHost.MachineConfigFilePath; _requirePathDiscovery = true; } public ConfigurationFileMap(string machineConfigFilename) { if (string.IsNullOrEmpty(machineConfigFilename)) throw new ArgumentNullException("machineConfigFilename"); if (!File.Exists(machineConfigFilename)) throw new ArgumentException(SR.GetString(SR.Machine_config_file_not_found, machineConfigFilename), "machineConfigFilename"); _machineConfigFilename = machineConfigFilename; } public virtual object Clone() { return new ConfigurationFileMap(_machineConfigFilename); } // // The name of machine.config. // public string MachineConfigFilename { get { // // Ensure that we use the same string to issue the demand that we use to // return to the caller. // string filename = _machineConfigFilename; if (_requirePathDiscovery) { new FileIOPermission(FileIOPermissionAccess.PathDiscovery, filename).Demand(); } return filename; } set { _requirePathDiscovery = false; _machineConfigFilename = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Specialized; using System.Security; using System.Security.Permissions; using System.IO; namespace System.Configuration { // // Holds the configuration file mapping for // machine.config. It is the base class for // ExeConfigurationFileMap and WebConfigurationFileMap. // public class ConfigurationFileMap : ICloneable { string _machineConfigFilename; bool _requirePathDiscovery; public ConfigurationFileMap() { _machineConfigFilename = ClientConfigurationHost.MachineConfigFilePath; _requirePathDiscovery = true; } public ConfigurationFileMap(string machineConfigFilename) { if (string.IsNullOrEmpty(machineConfigFilename)) throw new ArgumentNullException("machineConfigFilename"); if (!File.Exists(machineConfigFilename)) throw new ArgumentException(SR.GetString(SR.Machine_config_file_not_found, machineConfigFilename), "machineConfigFilename"); _machineConfigFilename = machineConfigFilename; } public virtual object Clone() { return new ConfigurationFileMap(_machineConfigFilename); } // // The name of machine.config. // public string MachineConfigFilename { get { // // Ensure that we use the same string to issue the demand that we use to // return to the caller. // string filename = _machineConfigFilename; if (_requirePathDiscovery) { new FileIOPermission(FileIOPermissionAccess.PathDiscovery, filename).Demand(); } return filename; } set { _requirePathDiscovery = false; _machineConfigFilename = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AttributeCollection.cs
- StringAnimationUsingKeyFrames.cs
- ModelTreeEnumerator.cs
- ReadContentAsBinaryHelper.cs
- NamespaceList.cs
- RedistVersionInfo.cs
- DomainConstraint.cs
- OrderPreservingPipeliningSpoolingTask.cs
- x509store.cs
- InvalidBodyAccessException.cs
- ValueType.cs
- X509Utils.cs
- ToolStripItemTextRenderEventArgs.cs
- InfiniteTimeSpanConverter.cs
- EntityStoreSchemaFilterEntry.cs
- MenuCommand.cs
- StrokeNodeOperations2.cs
- WebPartHelpVerb.cs
- SchemaTypeEmitter.cs
- XmlArrayItemAttribute.cs
- TypeSource.cs
- ControlUtil.cs
- XmlNodeList.cs
- ClientTarget.cs
- NumericExpr.cs
- Ports.cs
- LicenseException.cs
- BoundColumn.cs
- UserControlBuildProvider.cs
- BinaryReader.cs
- RemoteX509AsymmetricSecurityKey.cs
- FunctionDefinition.cs
- AuthenticationService.cs
- XamlClipboardData.cs
- Panel.cs
- DataGridColumnHeaderAutomationPeer.cs
- EncryptedType.cs
- TemplatePropertyEntry.cs
- Preprocessor.cs
- AnnotationAdorner.cs
- MultipleViewPattern.cs
- CollaborationHelperFunctions.cs
- SmiGettersStream.cs
- BinaryObjectInfo.cs
- X509ChainElement.cs
- HtmlContainerControl.cs
- WebEventTraceProvider.cs
- SerialErrors.cs
- Point3DValueSerializer.cs
- CursorInteropHelper.cs
- SqlDataSourceCommandParser.cs
- CriticalHandle.cs
- MissingManifestResourceException.cs
- SqlNamer.cs
- XmlBoundElement.cs
- TypeLibraryHelper.cs
- ScrollBarRenderer.cs
- CoTaskMemHandle.cs
- FilterElement.cs
- FixUp.cs
- ThreadAttributes.cs
- TypeListConverter.cs
- CompositeDataBoundControl.cs
- ItemCollection.cs
- ClientBase.cs
- AnnotationObservableCollection.cs
- CallbackValidatorAttribute.cs
- FontFamily.cs
- DBBindings.cs
- SqlReorderer.cs
- ToolStripProgressBar.cs
- PrintDialogException.cs
- IssuanceLicense.cs
- FileUtil.cs
- Stream.cs
- ImageList.cs
- BamlBinaryReader.cs
- InfoCard.cs
- CssStyleCollection.cs
- dbdatarecord.cs
- XmlSerializableServices.cs
- ObjectNotFoundException.cs
- WorkflowOperationErrorHandler.cs
- MenuItem.cs
- ErrorTableItemStyle.cs
- CodeSnippetStatement.cs
- PaintValueEventArgs.cs
- ClaimTypes.cs
- DBCommandBuilder.cs
- ConfigurationStrings.cs
- InternalsVisibleToAttribute.cs
- PeerNameRecordCollection.cs
- FlowDocumentPaginator.cs
- SecurityResources.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- ViewStateException.cs
- TypeUnloadedException.cs
- JavaScriptSerializer.cs
- SessionStateUtil.cs
- SchemaNotation.cs