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
- Walker.cs
- ContainerParagraph.cs
- CombinedGeometry.cs
- PageBuildProvider.cs
- CompiledQuery.cs
- CommonGetThemePartSize.cs
- ResolveCriteriaCD1.cs
- ObfuscateAssemblyAttribute.cs
- FileFormatException.cs
- FloaterBaseParagraph.cs
- IpcChannelHelper.cs
- RequiredAttributeAttribute.cs
- TraceContextRecord.cs
- WebPartsPersonalization.cs
- IsolatedStorageException.cs
- TextTreeRootTextBlock.cs
- TextTreeInsertUndoUnit.cs
- TransformGroup.cs
- WindowsListViewGroupHelper.cs
- PartitionResolver.cs
- TableCell.cs
- ListDesigner.cs
- ExpressionBindings.cs
- ExpressionEditorAttribute.cs
- TextBreakpoint.cs
- ReadOnlyDataSource.cs
- IncrementalCompileAnalyzer.cs
- WinFormsComponentEditor.cs
- CommonDialog.cs
- ControlCollection.cs
- PerformanceCountersElement.cs
- Action.cs
- DataGridViewCellStateChangedEventArgs.cs
- XmlFormatExtensionPointAttribute.cs
- PolygonHotSpot.cs
- CheckoutException.cs
- FileDialog_Vista.cs
- CapabilitiesPattern.cs
- DataGridViewSelectedCellCollection.cs
- CounterSampleCalculator.cs
- XmlSubtreeReader.cs
- GlobalizationAssembly.cs
- CssStyleCollection.cs
- WindowsRichEditRange.cs
- RuntimeResourceSet.cs
- FixedTextPointer.cs
- TimersDescriptionAttribute.cs
- SapiRecoContext.cs
- TypeDescriptorContext.cs
- DependencyPropertyChangedEventArgs.cs
- MetadataItem_Static.cs
- ToolStripContentPanel.cs
- ListView.cs
- UiaCoreApi.cs
- HandleCollector.cs
- ILGenerator.cs
- DPCustomTypeDescriptor.cs
- Accessors.cs
- SchemaAttDef.cs
- InkCanvasAutomationPeer.cs
- _ConnectStream.cs
- SupportsPreviewControlAttribute.cs
- Convert.cs
- BinaryMessageEncodingBindingElement.cs
- DBDataPermissionAttribute.cs
- NotificationContext.cs
- Filter.cs
- Literal.cs
- ObjectTag.cs
- BitmapEffectInputData.cs
- InternalBufferOverflowException.cs
- DataBinder.cs
- ArgumentException.cs
- MetadataArtifactLoader.cs
- NavigationService.cs
- SimpleType.cs
- RectAnimationClockResource.cs
- SqlRowUpdatedEvent.cs
- SectionRecord.cs
- TypeListConverter.cs
- CombinedGeometry.cs
- GeometryModel3D.cs
- PeerIPHelper.cs
- HtmlMeta.cs
- InvalidProgramException.cs
- Itemizer.cs
- EventLogPermissionEntry.cs
- PageContentCollection.cs
- RawTextInputReport.cs
- TextElementEnumerator.cs
- EastAsianLunisolarCalendar.cs
- OutputScope.cs
- ArgIterator.cs
- ContentDesigner.cs
- HashStream.cs
- InputReport.cs
- Clipboard.cs
- XmlParserContext.cs
- SchemaCollectionPreprocessor.cs
- TimerEventSubscription.cs