Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / PropertySourceInfo.cs / 1305376 / PropertySourceInfo.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Configuration.Internal;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Security.Permissions;
using System.Xml;
using System.Globalization;
using System.ComponentModel;
using System.Security;
using System.Text;
namespace System.Configuration {
internal class PropertySourceInfo {
private string _fileName;
private int _lineNumber;
internal PropertySourceInfo(XmlReader reader) {
_fileName = GetFilename(reader);
_lineNumber = GetLineNumber(reader);
}
internal string FileName {
get {
//
// Ensure we return the same string to the caller as the one on which we issued the demand.
//
string filename = _fileName;
try {
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, filename).Demand();
}
catch (SecurityException) {
// don't expose the path to this user but show the filename
filename = Path.GetFileName(_fileName);
if (filename == null) {
filename = String.Empty;
}
}
return filename;
}
}
internal int LineNumber {
get {
return _lineNumber;
}
}
private string GetFilename(XmlReader reader) {
IConfigErrorInfo err = reader as IConfigErrorInfo;
if (err != null) {
return (string)err.Filename;
}
return "";
}
private int GetLineNumber(XmlReader reader) {
IConfigErrorInfo err = reader as IConfigErrorInfo;
if (err != null) {
return (int)err.LineNumber;
}
return 0;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Configuration.Internal;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Security.Permissions;
using System.Xml;
using System.Globalization;
using System.ComponentModel;
using System.Security;
using System.Text;
namespace System.Configuration {
internal class PropertySourceInfo {
private string _fileName;
private int _lineNumber;
internal PropertySourceInfo(XmlReader reader) {
_fileName = GetFilename(reader);
_lineNumber = GetLineNumber(reader);
}
internal string FileName {
get {
//
// Ensure we return the same string to the caller as the one on which we issued the demand.
//
string filename = _fileName;
try {
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, filename).Demand();
}
catch (SecurityException) {
// don't expose the path to this user but show the filename
filename = Path.GetFileName(_fileName);
if (filename == null) {
filename = String.Empty;
}
}
return filename;
}
}
internal int LineNumber {
get {
return _lineNumber;
}
}
private string GetFilename(XmlReader reader) {
IConfigErrorInfo err = reader as IConfigErrorInfo;
if (err != null) {
return (string)err.Filename;
}
return "";
}
private int GetLineNumber(XmlReader reader) {
IConfigErrorInfo err = reader as IConfigErrorInfo;
if (err != null) {
return (int)err.LineNumber;
}
return 0;
}
}
}
// 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
- WindowsListViewItem.cs
- NonSerializedAttribute.cs
- InvalidCastException.cs
- Win32SafeHandles.cs
- OperationAbortedException.cs
- EditorPartChrome.cs
- ModelProperty.cs
- KnownTypesHelper.cs
- ZipIOLocalFileHeader.cs
- ListViewPagedDataSource.cs
- ToolStripSystemRenderer.cs
- AliasGenerator.cs
- Color.cs
- COM2ExtendedUITypeEditor.cs
- SourceFileInfo.cs
- mediaclock.cs
- EtwProvider.cs
- ValidatingPropertiesEventArgs.cs
- ViewgenContext.cs
- DiagnosticsConfiguration.cs
- ScrollChrome.cs
- ClientSideQueueItem.cs
- Function.cs
- AssemblyInfo.cs
- ListChangedEventArgs.cs
- StructuredProperty.cs
- ComponentResourceKey.cs
- BooleanStorage.cs
- TextTreeTextBlock.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- DataGridRelationshipRow.cs
- NamedPipeTransportBindingElement.cs
- CatalogPartCollection.cs
- WebSysDefaultValueAttribute.cs
- XPathScanner.cs
- xamlnodes.cs
- cookiecontainer.cs
- ReversePositionQuery.cs
- ArrowControl.xaml.cs
- Preprocessor.cs
- DataGridViewCellCancelEventArgs.cs
- CreateUserWizardAutoFormat.cs
- GacUtil.cs
- DeclarationUpdate.cs
- ManagementOptions.cs
- VirtualPath.cs
- ObjectDataSource.cs
- EdmSchemaAttribute.cs
- PrePrepareMethodAttribute.cs
- MetadataArtifactLoaderCompositeResource.cs
- WmlValidatorAdapter.cs
- DataControlCommands.cs
- DataGridViewTextBoxCell.cs
- FacetDescription.cs
- WSSecureConversation.cs
- DrawingContext.cs
- AxHost.cs
- LineInfo.cs
- StateMachineWorkflow.cs
- EtwTrackingParticipant.cs
- xml.cs
- CollectionConverter.cs
- QueryStringConverter.cs
- Pair.cs
- PageContentCollection.cs
- FileSystemEventArgs.cs
- ComplexObject.cs
- ToolStripTemplateNode.cs
- ToolStripDropDownButton.cs
- LocatorPartList.cs
- AssemblyEvidenceFactory.cs
- HttpModuleAction.cs
- SecureUICommand.cs
- documentsequencetextpointer.cs
- TreeNodeCollection.cs
- GroupBox.cs
- NamedPipeChannelListener.cs
- XPathNavigatorReader.cs
- WebMethodAttribute.cs
- SchemaLookupTable.cs
- SettingsBindableAttribute.cs
- EntityContainerRelationshipSetEnd.cs
- UnsafeNativeMethods.cs
- MergeFilterQuery.cs
- BufferedOutputStream.cs
- GiveFeedbackEventArgs.cs
- VSWCFServiceContractGenerator.cs
- DeadCharTextComposition.cs
- EventsTab.cs
- UnmanagedMemoryStream.cs
- IconConverter.cs
- CodeExporter.cs
- StyleXamlParser.cs
- GetIsBrowserClientRequest.cs
- HttpClientCertificate.cs
- DoubleAnimationUsingKeyFrames.cs
- ResourceExpressionEditorSheet.cs
- PrintPreviewControl.cs
- SessionEndedEventArgs.cs
- IndexedString.cs