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
- DataGridRelationshipRow.cs
- DataSpaceManager.cs
- ToolStripStatusLabel.cs
- ActivityInstance.cs
- Int32Collection.cs
- LinqDataSourceDeleteEventArgs.cs
- Menu.cs
- ScrollableControl.cs
- ToolStripItemClickedEventArgs.cs
- CacheMode.cs
- HashRepartitionEnumerator.cs
- DataGridViewMethods.cs
- LinearGradientBrush.cs
- DataGridViewTextBoxEditingControl.cs
- BufferedWebEventProvider.cs
- RemotingSurrogateSelector.cs
- XmlChoiceIdentifierAttribute.cs
- TreeNodeStyle.cs
- RotateTransform.cs
- ConfigXmlDocument.cs
- XmlSchemaInclude.cs
- ExpressionPrefixAttribute.cs
- SoapMessage.cs
- XmlDocumentFragment.cs
- CallbackValidator.cs
- ReadOnlyCollectionBase.cs
- StatusStrip.cs
- WebPartVerbsEventArgs.cs
- ObjectListSelectEventArgs.cs
- NavigatorInput.cs
- VectorConverter.cs
- GridLength.cs
- Add.cs
- WebReferencesBuildProvider.cs
- TypefaceMetricsCache.cs
- HtmlInputRadioButton.cs
- BoolExpressionVisitors.cs
- Exceptions.cs
- MetadataExchangeBindings.cs
- _PooledStream.cs
- TypeConverterValueSerializer.cs
- COM2ExtendedBrowsingHandler.cs
- WebColorConverter.cs
- FormViewModeEventArgs.cs
- DataGridGeneralPage.cs
- StringArrayConverter.cs
- OrderedDictionaryStateHelper.cs
- AnimatedTypeHelpers.cs
- GifBitmapEncoder.cs
- Help.cs
- DragDropHelper.cs
- AccessibleObject.cs
- BaseTemplateCodeDomTreeGenerator.cs
- WebRequestModulesSection.cs
- BitmapEditor.cs
- SqlNode.cs
- CollectionConverter.cs
- SqlRecordBuffer.cs
- DateTimeConverter.cs
- Matrix3DStack.cs
- DataKeyCollection.cs
- BaseCollection.cs
- ToolStripGripRenderEventArgs.cs
- ProfileBuildProvider.cs
- UniqueID.cs
- CodeLabeledStatement.cs
- ObjectDisposedException.cs
- ListControl.cs
- ConstraintEnumerator.cs
- TagPrefixInfo.cs
- AttachedPropertyMethodSelector.cs
- SystemIPGlobalStatistics.cs
- OpacityConverter.cs
- DataSourceControl.cs
- MachineSettingsSection.cs
- DashStyle.cs
- diagnosticsswitches.cs
- TreeNodeCollection.cs
- ImageAttributes.cs
- RelationshipEndMember.cs
- UserControl.cs
- FontEmbeddingManager.cs
- PackWebResponse.cs
- CompositeFontInfo.cs
- BaseComponentEditor.cs
- TextLineResult.cs
- MetadataItem_Static.cs
- ContentDesigner.cs
- SafeLocalMemHandle.cs
- Win32.cs
- TypeDependencyAttribute.cs
- OptimizedTemplateContent.cs
- XsdBuilder.cs
- CollectionViewGroupRoot.cs
- UnsafeNativeMethods.cs
- SerialErrors.cs
- DataGridItemCollection.cs
- HttpRequestContext.cs
- ExpressionBuilder.cs
- TerminateSequence.cs