Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PasswordBoxAutomationPeer.cs
- RightsManagementPermission.cs
- ExtensionQuery.cs
- ADMembershipUser.cs
- LineServices.cs
- CompositeFontFamily.cs
- DataGridViewComboBoxCell.cs
- SiteMapNodeCollection.cs
- DebugTracing.cs
- InputLanguageSource.cs
- SourceSwitch.cs
- MenuItem.cs
- CollectionBuilder.cs
- ResourceKey.cs
- COSERVERINFO.cs
- HttpSessionStateBase.cs
- Column.cs
- ConnectionOrientedTransportChannelFactory.cs
- LiteralControl.cs
- MultiViewDesigner.cs
- VolatileEnlistmentState.cs
- MetadataArtifactLoaderComposite.cs
- RowType.cs
- SecurityHelper.cs
- TraversalRequest.cs
- AccessDataSourceView.cs
- CodeArgumentReferenceExpression.cs
- ResXBuildProvider.cs
- HttpConfigurationSystem.cs
- SqlDuplicator.cs
- ContentDefinition.cs
- GiveFeedbackEvent.cs
- ConstructorExpr.cs
- VectorCollectionConverter.cs
- ToolStripRendererSwitcher.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- FormsIdentity.cs
- ConstructorBuilder.cs
- ProviderMetadata.cs
- PropertyExpression.cs
- QuotedPairReader.cs
- SchemaComplexType.cs
- Frame.cs
- GPPOINTF.cs
- XmlDocumentSurrogate.cs
- FixedSOMLineRanges.cs
- DropShadowEffect.cs
- MatrixIndependentAnimationStorage.cs
- SelectionBorderGlyph.cs
- BufferAllocator.cs
- XmlSchemaSimpleTypeRestriction.cs
- Win32.cs
- EditorZone.cs
- Executor.cs
- WindowsStatic.cs
- Style.cs
- FreezableCollection.cs
- FontFamilyValueSerializer.cs
- DataObjectPastingEventArgs.cs
- SystemIPv6InterfaceProperties.cs
- CodeTypeMember.cs
- SessionStateSection.cs
- SamlSubjectStatement.cs
- HwndSubclass.cs
- MethodRental.cs
- MDIControlStrip.cs
- XmlSchemaDatatype.cs
- CngUIPolicy.cs
- StrongNameIdentityPermission.cs
- GrabHandleGlyph.cs
- TempFiles.cs
- SqlLiftWhereClauses.cs
- Registry.cs
- ListBindingConverter.cs
- RepeatButton.cs
- _NestedSingleAsyncResult.cs
- CaretElement.cs
- ScriptMethodAttribute.cs
- ConfigurationManagerInternalFactory.cs
- TraceHandlerErrorFormatter.cs
- MetadataArtifactLoaderCompositeFile.cs
- EventSinkActivity.cs
- DecimalAnimationBase.cs
- PromptStyle.cs
- AppDomainGrammarProxy.cs
- TransactedBatchingElement.cs
- ScrollableControl.cs
- ClientUrlResolverWrapper.cs
- EpmCustomContentSerializer.cs
- GridViewHeaderRowPresenter.cs
- ErrorHandler.cs
- Flowchart.cs
- StrongName.cs
- AccessorTable.cs
- GridLength.cs
- ImageFormatConverter.cs
- WebPartVerbCollection.cs
- HtmlInputButton.cs
- XmlText.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs