Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Configuration / System / Configuration / PropertySourceInfo.cs / 1 / 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
- FormsAuthenticationUser.cs
- Rules.cs
- EntityDataSourceWizardForm.cs
- OciEnlistContext.cs
- InvalidPipelineStoreException.cs
- PrivilegeNotHeldException.cs
- XmlDataImplementation.cs
- sqlnorm.cs
- AssemblyAttributes.cs
- ProgressBarBrushConverter.cs
- TemplateEditingService.cs
- DmlSqlGenerator.cs
- sqlpipe.cs
- FileLogRecordStream.cs
- DataGridViewCellLinkedList.cs
- Point4D.cs
- SectionInformation.cs
- GraphicsContainer.cs
- WebPartCollection.cs
- DataTableNameHandler.cs
- InstanceHandleConflictException.cs
- HttpCapabilitiesEvaluator.cs
- UMPAttributes.cs
- NumberAction.cs
- DiscoveryService.cs
- Typography.cs
- ChannelManager.cs
- FontFamilyIdentifier.cs
- XmlQueryRuntime.cs
- XPathMultyIterator.cs
- DispatcherObject.cs
- ToolboxComponentsCreatingEventArgs.cs
- KeyboardNavigation.cs
- ObjectDataSourceSelectingEventArgs.cs
- PackageDigitalSignature.cs
- VirtualPath.cs
- ModulesEntry.cs
- SqlBulkCopyColumnMappingCollection.cs
- WebPartCloseVerb.cs
- XmlElement.cs
- Label.cs
- mda.cs
- CommandValueSerializer.cs
- TypeUtil.cs
- ObjectAnimationUsingKeyFrames.cs
- ComponentConverter.cs
- EncodedStreamFactory.cs
- HttpFileCollectionBase.cs
- DataProtection.cs
- Native.cs
- ListBindingHelper.cs
- QilXmlWriter.cs
- TextPatternIdentifiers.cs
- MobileControlPersister.cs
- StackSpiller.Bindings.cs
- Transactions.cs
- Base64Decoder.cs
- PackageController.cs
- GrammarBuilderRuleRef.cs
- WebPartMenu.cs
- CustomErrorsSectionWrapper.cs
- StatusBarDrawItemEvent.cs
- UpDownEvent.cs
- GroupLabel.cs
- Activation.cs
- UInt16Storage.cs
- WeakRefEnumerator.cs
- ResourceReferenceExpressionConverter.cs
- TerminatorSinks.cs
- TypedTableHandler.cs
- DocumentReferenceCollection.cs
- XLinq.cs
- SafeTimerHandle.cs
- DSACryptoServiceProvider.cs
- ClientTargetSection.cs
- StreamInfo.cs
- DBConcurrencyException.cs
- FileSystemEventArgs.cs
- ProcessStartInfo.cs
- ExpressionBuilderContext.cs
- SmiMetaDataProperty.cs
- RowType.cs
- ProviderMetadataCachedInformation.cs
- IEnumerable.cs
- SoapFaultCodes.cs
- ToolStripAdornerWindowService.cs
- PageSettings.cs
- ControlBuilder.cs
- TimeSpanValidator.cs
- PublishLicense.cs
- TimeSpanHelper.cs
- FlowDocumentReader.cs
- CodeParameterDeclarationExpression.cs
- GroupBoxRenderer.cs
- Image.cs
- TextElementEnumerator.cs
- QuerySettings.cs
- CodeNamespace.cs
- Token.cs
- SqlDataAdapter.cs