Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- EntityConnection.cs
- HostProtectionException.cs
- ReadOnlyDataSource.cs
- FreezableCollection.cs
- exports.cs
- DataGridViewRowEventArgs.cs
- COM2TypeInfoProcessor.cs
- LogSwitch.cs
- StaticTextPointer.cs
- ForeignKeyConstraint.cs
- ServiceOperationUIEditor.cs
- TextFragmentEngine.cs
- CqlLexer.cs
- ConfigurationPropertyCollection.cs
- SrgsOneOf.cs
- XsltOutput.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- SoapObjectInfo.cs
- ScriptingProfileServiceSection.cs
- AnnotationAuthorChangedEventArgs.cs
- FileSystemWatcher.cs
- DataBindingsDialog.cs
- MimeImporter.cs
- TiffBitmapEncoder.cs
- XPathItem.cs
- IntegerValidatorAttribute.cs
- EntityViewGenerator.cs
- ISO2022Encoding.cs
- Image.cs
- ResourceAssociationSetEnd.cs
- RelatedImageListAttribute.cs
- UrlPath.cs
- ShaperBuffers.cs
- HtmlHistory.cs
- FormatConvertedBitmap.cs
- ButtonChrome.cs
- XmlAttributeAttribute.cs
- DataReceivedEventArgs.cs
- SqlGatherProducedAliases.cs
- TypeReference.cs
- ReverseInheritProperty.cs
- SessionSwitchEventArgs.cs
- IMembershipProvider.cs
- XamlTreeBuilderBamlRecordWriter.cs
- ITextView.cs
- SqlStream.cs
- __ConsoleStream.cs
- ComPlusAuthorization.cs
- HttpPostProtocolImporter.cs
- ContentHostHelper.cs
- SubqueryRules.cs
- SqlDataSourceEnumerator.cs
- XmlWriter.cs
- AjaxFrameworkAssemblyAttribute.cs
- TaskFormBase.cs
- DataGridViewElement.cs
- CategoryNameCollection.cs
- DataServiceExpressionVisitor.cs
- CAGDesigner.cs
- CheckBoxRenderer.cs
- _ShellExpression.cs
- XPathAxisIterator.cs
- AncestorChangedEventArgs.cs
- SolidColorBrush.cs
- EntityModelSchemaGenerator.cs
- TreeViewDesigner.cs
- SkinBuilder.cs
- ExpressionBuilder.cs
- NativeMethods.cs
- CodeTypeConstructor.cs
- BigInt.cs
- WithParamAction.cs
- CacheChildrenQuery.cs
- TargetParameterCountException.cs
- DragDeltaEventArgs.cs
- ModifierKeysValueSerializer.cs
- InstanceDataCollectionCollection.cs
- SkinBuilder.cs
- ToolStripItemRenderEventArgs.cs
- StreamResourceInfo.cs
- ServiceModelEnumValidatorAttribute.cs
- RequestBringIntoViewEventArgs.cs
- EncoderParameters.cs
- mda.cs
- Logging.cs
- RectAnimationUsingKeyFrames.cs
- XamlSerializerUtil.cs
- IntPtr.cs
- BinaryMessageEncodingElement.cs
- ObjectView.cs
- ResourcesBuildProvider.cs
- MemberRestriction.cs
- SizeConverter.cs
- AdjustableArrowCap.cs
- CqlLexer.cs
- GridViewCancelEditEventArgs.cs
- TextShapeableCharacters.cs
- Drawing.cs
- TreeNodeCollection.cs
- RecognizedWordUnit.cs