Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SecurityCriticalDataForSet.cs
- DocumentSchemaValidator.cs
- XmlSerializerVersionAttribute.cs
- NativeObjectSecurity.cs
- ContentElement.cs
- SafeNativeMemoryHandle.cs
- SqlDataSourceCommandParser.cs
- TypeInitializationException.cs
- ConfigXmlCDataSection.cs
- XmlDataCollection.cs
- SystemEvents.cs
- LinearGradientBrush.cs
- XsdBuilder.cs
- IntegerValidatorAttribute.cs
- SubMenuStyle.cs
- EffectiveValueEntry.cs
- FieldToken.cs
- HostExecutionContextManager.cs
- arabicshape.cs
- OleCmdHelper.cs
- Paragraph.cs
- DataGridViewImageCell.cs
- TraceInternal.cs
- AddInPipelineAttributes.cs
- DrawingVisualDrawingContext.cs
- DataGridViewRowConverter.cs
- EncodingFallbackAwareXmlTextWriter.cs
- SizeAnimationClockResource.cs
- DefaultPropertiesToSend.cs
- ArithmeticException.cs
- StorageModelBuildProvider.cs
- TransportChannelListener.cs
- EncryptedReference.cs
- ColorTranslator.cs
- WindowShowOrOpenTracker.cs
- GridViewColumn.cs
- SqlHelper.cs
- OverlappedAsyncResult.cs
- DataTableClearEvent.cs
- _IPv4Address.cs
- SettingsProviderCollection.cs
- SimpleFileLog.cs
- IndexerNameAttribute.cs
- HttpCookie.cs
- VirtualPath.cs
- PageMediaType.cs
- HostSecurityManager.cs
- ProxyBuilder.cs
- Misc.cs
- PropertyOverridesDialog.cs
- DrawingBrush.cs
- followingquery.cs
- MemberCollection.cs
- SafeRightsManagementEnvironmentHandle.cs
- ToolStripInSituService.cs
- QueryPageSettingsEventArgs.cs
- TransactionManager.cs
- RotateTransform3D.cs
- loginstatus.cs
- CheckBox.cs
- MachineSettingsSection.cs
- SoapObjectInfo.cs
- XmlNode.cs
- SignedXml.cs
- TimeZone.cs
- IDictionary.cs
- WpfSharedXamlSchemaContext.cs
- EventProviderBase.cs
- Parameter.cs
- EdmRelationshipRoleAttribute.cs
- GetCertificateRequest.cs
- TextPenaltyModule.cs
- Variable.cs
- EntityRecordInfo.cs
- ObjectPersistData.cs
- DataGridViewButtonCell.cs
- OleDbErrorCollection.cs
- sqlnorm.cs
- XmlTextAttribute.cs
- DbConnectionFactory.cs
- PolyQuadraticBezierSegment.cs
- SecurityListenerSettingsLifetimeManager.cs
- ValidationRuleCollection.cs
- RPIdentityRequirement.cs
- ListViewContainer.cs
- SafeProcessHandle.cs
- MultipleViewPattern.cs
- XamlRtfConverter.cs
- DataBindingValueUIHandler.cs
- DesignerLoader.cs
- Table.cs
- XmlSchemaComplexType.cs
- Metadata.cs
- ConnectionsZone.cs
- Debugger.cs
- BaseCodePageEncoding.cs
- TypeRefElement.cs
- ParsedRoute.cs
- TypeUtil.cs
- MetafileHeader.cs