Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / PropertySourceInfo.cs / 1305376 / 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
- SqlMetaData.cs
- FormViewPageEventArgs.cs
- ElementAtQueryOperator.cs
- FixedSOMElement.cs
- WebHeaderCollection.cs
- DeploymentExceptionMapper.cs
- SecurityPermission.cs
- ListViewItem.cs
- SoapIgnoreAttribute.cs
- SqlDependencyListener.cs
- DetailsViewAutoFormat.cs
- autovalidator.cs
- AttributeAction.cs
- Debug.cs
- AuthenticatedStream.cs
- WebContext.cs
- XamlClipboardData.cs
- Ray3DHitTestResult.cs
- StateDesigner.TransitionInfo.cs
- FilterEventArgs.cs
- IndexOutOfRangeException.cs
- DesignerDataColumn.cs
- DelegateArgumentReference.cs
- ConfigPathUtility.cs
- SecurityTokenProvider.cs
- KeyGestureValueSerializer.cs
- CorrelationManager.cs
- RangeValueProviderWrapper.cs
- TrustManager.cs
- DefaultSection.cs
- HtmlInputButton.cs
- ToolStripContainerDesigner.cs
- ModifierKeysValueSerializer.cs
- Point3D.cs
- MemberProjectedSlot.cs
- IteratorFilter.cs
- SourceFileInfo.cs
- StringArrayConverter.cs
- DependencyPropertyConverter.cs
- remotingproxy.cs
- HMACRIPEMD160.cs
- TransformConverter.cs
- CompositeDesignerAccessibleObject.cs
- WebUtil.cs
- ImageField.cs
- Span.cs
- TextTreeFixupNode.cs
- QilCloneVisitor.cs
- BoundField.cs
- PathFigure.cs
- ObjectCacheSettings.cs
- ValuePattern.cs
- SimpleWorkerRequest.cs
- SqlUdtInfo.cs
- SoapCodeExporter.cs
- BindingExpressionBase.cs
- DesignerAutoFormatCollection.cs
- ListViewAutomationPeer.cs
- CollectionsUtil.cs
- PermissionToken.cs
- SqlXml.cs
- ButtonRenderer.cs
- ToolBarOverflowPanel.cs
- SemaphoreSecurity.cs
- DocumentEventArgs.cs
- AppDomainCompilerProxy.cs
- DataControlExtensions.cs
- CompiledQueryCacheEntry.cs
- XsltSettings.cs
- ZipPackagePart.cs
- NativeMethods.cs
- ListViewItem.cs
- EtwTrace.cs
- ColorContext.cs
- QilName.cs
- ToolStripContainer.cs
- BindingBase.cs
- SHA512Managed.cs
- EntityConnectionStringBuilder.cs
- ResourceSet.cs
- Ref.cs
- DynamicPropertyHolder.cs
- ThaiBuddhistCalendar.cs
- WrappedIUnknown.cs
- ImageAutomationPeer.cs
- RouteValueDictionary.cs
- BeginStoryboard.cs
- EntityCommandDefinition.cs
- CFGGrammar.cs
- SqlDataSourceSummaryPanel.cs
- SctClaimSerializer.cs
- SchemaNotation.cs
- Literal.cs
- XhtmlConformanceSection.cs
- BatchStream.cs
- ListView.cs
- HttpAsyncResult.cs
- PropertyDescriptorGridEntry.cs
- LocalBuilder.cs
- SaveWorkflowAsyncResult.cs