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
- QuaternionKeyFrameCollection.cs
- SchemaLookupTable.cs
- DebugHandleTracker.cs
- ClipboardProcessor.cs
- PackageStore.cs
- TextCompositionManager.cs
- RootBrowserWindow.cs
- LayoutTableCell.cs
- GridViewEditEventArgs.cs
- KeyedCollection.cs
- ClientCredentialsElement.cs
- DataDocumentXPathNavigator.cs
- FrameworkElementAutomationPeer.cs
- Grant.cs
- UnlockInstanceCommand.cs
- FontDialog.cs
- DescendantQuery.cs
- XhtmlBasicCalendarAdapter.cs
- DataGridTextBox.cs
- TypeConstant.cs
- CollectionViewProxy.cs
- basecomparevalidator.cs
- QueryableFilterRepeater.cs
- arc.cs
- ImageAutomationPeer.cs
- SwitchAttribute.cs
- WebBrowser.cs
- ContentOperations.cs
- TextBoxBase.cs
- ParameterCollectionEditor.cs
- HTTPNotFoundHandler.cs
- BufferedWebEventProvider.cs
- XmlArrayItemAttributes.cs
- OracleParameter.cs
- PackWebResponse.cs
- ComboBoxHelper.cs
- EdmType.cs
- DesignerVerb.cs
- EastAsianLunisolarCalendar.cs
- HtmlMobileTextWriter.cs
- ModelTypeConverter.cs
- StringAnimationUsingKeyFrames.cs
- StylusCaptureWithinProperty.cs
- SignerInfo.cs
- CurrentTimeZone.cs
- Frame.cs
- CatalogPartChrome.cs
- GregorianCalendarHelper.cs
- DataChangedEventManager.cs
- CachedCompositeFamily.cs
- SerializerWriterEventHandlers.cs
- AppDomainManager.cs
- ColorTransformHelper.cs
- ComboBoxRenderer.cs
- DataGridViewIntLinkedList.cs
- DoubleIndependentAnimationStorage.cs
- ResXBuildProvider.cs
- ImageListUtils.cs
- IOException.cs
- CategoryAttribute.cs
- XslException.cs
- ContentWrapperAttribute.cs
- HtmlLink.cs
- TypeResolvingOptionsAttribute.cs
- BitmapEffectGeneralTransform.cs
- DesignerTransactionCloseEvent.cs
- EntityDesignPluralizationHandler.cs
- DbDataRecord.cs
- Tokenizer.cs
- MultiView.cs
- VectorValueSerializer.cs
- EllipseGeometry.cs
- Point3DIndependentAnimationStorage.cs
- LinqDataSourceHelper.cs
- ConstructorBuilder.cs
- ToolStripContainer.cs
- BridgeDataRecord.cs
- CommandID.cs
- Matrix.cs
- WebPartHeaderCloseVerb.cs
- WindowsListBox.cs
- HandlerFactoryWrapper.cs
- XmlSchemaSimpleType.cs
- RepeaterItem.cs
- ProvidersHelper.cs
- CollectionConverter.cs
- RuntimeVariableList.cs
- ReferenceSchema.cs
- StylusButton.cs
- ServiceNameCollection.cs
- PolyBezierSegment.cs
- DragDeltaEventArgs.cs
- ComPlusInstanceContextInitializer.cs
- PathSegmentCollection.cs
- NGCPageContentCollectionSerializerAsync.cs
- ConvertersCollection.cs
- InvalidWMPVersionException.cs
- RefExpr.cs
- PartManifestEntry.cs
- OpenTypeLayoutCache.cs