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
- _FixedSizeReader.cs
- HtmlMeta.cs
- DbCommandTree.cs
- SqlDataSourceCustomCommandPanel.cs
- WindowsSysHeader.cs
- ImmutableAssemblyCacheEntry.cs
- ExternalException.cs
- ReadWriteObjectLock.cs
- ASCIIEncoding.cs
- ActivityStateRecord.cs
- Descriptor.cs
- Timer.cs
- QueryAsyncResult.cs
- StackSpiller.Generated.cs
- ReversePositionQuery.cs
- DebuggerService.cs
- BezierSegment.cs
- SystemIcons.cs
- Visitor.cs
- TextElement.cs
- PropertyExpression.cs
- Membership.cs
- CorrelationManager.cs
- WebPartHeaderCloseVerb.cs
- DbConnectionPool.cs
- ActivityXRefPropertyEditor.cs
- TimeEnumHelper.cs
- WorkflowWebService.cs
- OleDbConnectionInternal.cs
- DeferrableContentConverter.cs
- FormViewCommandEventArgs.cs
- DocobjHost.cs
- ContextMenu.cs
- OdbcCommand.cs
- PointAnimationUsingKeyFrames.cs
- ManifestSignedXml.cs
- WebPartZoneCollection.cs
- ElementAction.cs
- XPathSelectionIterator.cs
- CollaborationHelperFunctions.cs
- CollectionEditVerbManager.cs
- WorkflowServiceInstance.cs
- SessionEndedEventArgs.cs
- MLangCodePageEncoding.cs
- TemplateBindingExtensionConverter.cs
- HtmlInputPassword.cs
- WebSysDefaultValueAttribute.cs
- Claim.cs
- TreeNodeClickEventArgs.cs
- CompilerCollection.cs
- FormatVersion.cs
- StretchValidation.cs
- TailPinnedEventArgs.cs
- Subtree.cs
- FixedSOMTableRow.cs
- DataServiceRequestException.cs
- HtmlDocument.cs
- XhtmlBasicLiteralTextAdapter.cs
- InvokePattern.cs
- RoutedCommand.cs
- DesignerForm.cs
- WebEvents.cs
- DataServiceKeyAttribute.cs
- Storyboard.cs
- DeferrableContent.cs
- XmlILAnnotation.cs
- RequestCachePolicyConverter.cs
- Page.cs
- PrintPreviewControl.cs
- TrackingExtract.cs
- ToolboxCategoryItems.cs
- ResolveDuplexCD1AsyncResult.cs
- CriticalExceptions.cs
- TextParagraphProperties.cs
- ClientSettings.cs
- TeredoHelper.cs
- SerializationFieldInfo.cs
- XamlRtfConverter.cs
- DataSourceExpressionCollection.cs
- WebPartEventArgs.cs
- __ConsoleStream.cs
- AnimationClockResource.cs
- GeneratedCodeAttribute.cs
- ModifiableIteratorCollection.cs
- TileBrush.cs
- ProjectionQueryOptionExpression.cs
- ListMarkerLine.cs
- OdbcInfoMessageEvent.cs
- TimeSpanConverter.cs
- ExecutedRoutedEventArgs.cs
- LinkedResource.cs
- SqlUserDefinedTypeAttribute.cs
- SoapReflector.cs
- CommentAction.cs
- DataSourceComponent.cs
- WindowsPen.cs
- COAUTHINFO.cs
- WebPartTransformer.cs
- UniqueContractNameValidationBehavior.cs
- IPPacketInformation.cs