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
- InputProviderSite.cs
- ErrorRuntimeConfig.cs
- DataGridRowAutomationPeer.cs
- XmlParser.cs
- MgmtResManager.cs
- TypeInformation.cs
- BinaryReader.cs
- SerializationAttributes.cs
- EventRouteFactory.cs
- BaseDataBoundControl.cs
- EFTableProvider.cs
- Encoder.cs
- ListViewGroupItemCollection.cs
- CompilationRelaxations.cs
- InfoCardCryptoHelper.cs
- InputScopeAttribute.cs
- Double.cs
- FormViewCommandEventArgs.cs
- MimeTypeAttribute.cs
- LineUtil.cs
- Set.cs
- CompensatableTransactionScopeActivity.cs
- TraceLevelStore.cs
- Mappings.cs
- CodeComment.cs
- SerializationInfo.cs
- OrderingExpression.cs
- ClientSideQueueItem.cs
- ProvidersHelper.cs
- XomlCompilerParameters.cs
- DesignerDataRelationship.cs
- OrCondition.cs
- XmlSchemaObjectCollection.cs
- ColorConverter.cs
- input.cs
- errorpatternmatcher.cs
- ContextStack.cs
- QueryableDataSource.cs
- XmlAttributeCache.cs
- XamlWriter.cs
- InputQueueChannelAcceptor.cs
- StreamWithDictionary.cs
- RemotingSurrogateSelector.cs
- MultipleViewProviderWrapper.cs
- SqlInfoMessageEvent.cs
- ClosableStream.cs
- CounterCreationData.cs
- InvalidDataException.cs
- SafeRightsManagementEnvironmentHandle.cs
- FindCompletedEventArgs.cs
- SemanticKeyElement.cs
- BoolExpressionVisitors.cs
- AttachedPropertyInfo.cs
- CommunicationObjectAbortedException.cs
- TransformerInfoCollection.cs
- XmlEncoding.cs
- FlowPosition.cs
- BookmarkInfo.cs
- ThicknessAnimationUsingKeyFrames.cs
- TemplateInstanceAttribute.cs
- RuntimeCompatibilityAttribute.cs
- LayoutEvent.cs
- ReadOnlyMetadataCollection.cs
- TextSimpleMarkerProperties.cs
- SiteMap.cs
- IntPtr.cs
- TaskFormBase.cs
- XmlSchemaSimpleTypeUnion.cs
- DataTableCollection.cs
- CompilerResults.cs
- SettingsPropertyCollection.cs
- XslTransformFileEditor.cs
- XmlTypeMapping.cs
- MultiBinding.cs
- BulletedListEventArgs.cs
- InvokeHandlers.cs
- SchemaNotation.cs
- GeometryGroup.cs
- TokenBasedSetEnumerator.cs
- CacheMemory.cs
- PrePrepareMethodAttribute.cs
- Label.cs
- RegexMatchCollection.cs
- DateTime.cs
- NativeMethods.cs
- DrawingContextWalker.cs
- TextRangeProviderWrapper.cs
- WeakHashtable.cs
- XmlMessageFormatter.cs
- ProtectedProviderSettings.cs
- MeasureData.cs
- UnmanagedMarshal.cs
- DictionaryItemsCollection.cs
- PrintPageEvent.cs
- _KerberosClient.cs
- TypeFieldSchema.cs
- StringHelper.cs
- GACIdentityPermission.cs
- NetSectionGroup.cs
- LineServicesRun.cs