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
- SchemaImporterExtensionElement.cs
- PagesSection.cs
- FilteredAttributeCollection.cs
- SystemIPInterfaceStatistics.cs
- NameValueConfigurationCollection.cs
- PlainXmlDeserializer.cs
- TypeLoadException.cs
- HwndSourceKeyboardInputSite.cs
- SecurityDescriptor.cs
- WizardDesigner.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- Row.cs
- MsmqTransportBindingElement.cs
- GridEntryCollection.cs
- XamlStream.cs
- ConfigurationPropertyCollection.cs
- ServiceNotStartedException.cs
- RowParagraph.cs
- Compiler.cs
- AssemblyCache.cs
- TrackingAnnotationCollection.cs
- Canvas.cs
- TextElementAutomationPeer.cs
- ClientSettings.cs
- PlainXmlWriter.cs
- SslStream.cs
- XmlSchemaSimpleTypeList.cs
- InputLanguageSource.cs
- FrameworkContextData.cs
- FlowDocumentPage.cs
- AdornerLayer.cs
- TypographyProperties.cs
- WebPartDisplayMode.cs
- ErrorHandler.cs
- AnchoredBlock.cs
- XamlInt32CollectionSerializer.cs
- StylusLogic.cs
- Wildcard.cs
- Matrix3D.cs
- SoapDocumentServiceAttribute.cs
- TextModifier.cs
- MultiByteCodec.cs
- Processor.cs
- TemplatePropertyEntry.cs
- VectorAnimationUsingKeyFrames.cs
- SelectionEditor.cs
- MediaContext.cs
- DbConnectionClosed.cs
- ExtendedPropertyInfo.cs
- DataObjectCopyingEventArgs.cs
- TextRunTypographyProperties.cs
- CommonDialog.cs
- ConfigUtil.cs
- RefreshEventArgs.cs
- PenLineCapValidation.cs
- CodeGroup.cs
- FirstMatchCodeGroup.cs
- PropertiesTab.cs
- SelectQueryOperator.cs
- HtmlMeta.cs
- CompilerScope.cs
- CompilerWrapper.cs
- Keyboard.cs
- GenerateScriptTypeAttribute.cs
- TemplatePartAttribute.cs
- DBConcurrencyException.cs
- ListViewTableRow.cs
- StylusPointPropertyInfoDefaults.cs
- ISFClipboardData.cs
- JsonFormatReaderGenerator.cs
- BaseTypeViewSchema.cs
- ThumbButtonInfo.cs
- GetIsBrowserClientRequest.cs
- BulletChrome.cs
- DataGridBoolColumn.cs
- EntityDataSourceView.cs
- AutomationProperties.cs
- DoubleStorage.cs
- SimpleTypeResolver.cs
- ScrollContentPresenter.cs
- codemethodreferenceexpression.cs
- ProviderIncompatibleException.cs
- xmlglyphRunInfo.cs
- HandlerBase.cs
- InheritedPropertyChangedEventArgs.cs
- RadioButton.cs
- EmptyElement.cs
- TextEditorParagraphs.cs
- MetabaseSettings.cs
- BaseCodePageEncoding.cs
- AddressUtility.cs
- RemoteWebConfigurationHostServer.cs
- HighlightComponent.cs
- TaskHelper.cs
- X509SecurityTokenAuthenticator.cs
- TailCallAnalyzer.cs
- wmiprovider.cs
- FormViewInsertEventArgs.cs
- PathFigure.cs
- TimeoutException.cs