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
- UIElement.cs
- InternalBase.cs
- ArrayWithOffset.cs
- TrimSurroundingWhitespaceAttribute.cs
- ColorMatrix.cs
- DataContractSerializerFaultFormatter.cs
- SamlSubjectStatement.cs
- TableLayoutPanelResizeGlyph.cs
- X509Chain.cs
- XmlSequenceWriter.cs
- BuildDependencySet.cs
- MatrixConverter.cs
- ApplicationBuildProvider.cs
- PropertyTab.cs
- NotSupportedException.cs
- SoapAttributeOverrides.cs
- UrlMappingCollection.cs
- DuplexChannelBinder.cs
- XpsFontSubsetter.cs
- RegularExpressionValidator.cs
- HtmlLink.cs
- AttributedMetaModel.cs
- Rect3DConverter.cs
- BaseCodeDomTreeGenerator.cs
- FontFaceLayoutInfo.cs
- GlyphTypeface.cs
- StringInfo.cs
- TypeTypeConverter.cs
- FormatConvertedBitmap.cs
- DbDataRecord.cs
- MultipleViewPattern.cs
- PrimaryKeyTypeConverter.cs
- StringValidatorAttribute.cs
- StreamInfo.cs
- BitmapSizeOptions.cs
- ToolStripDropTargetManager.cs
- Padding.cs
- MethodBuilderInstantiation.cs
- tooltip.cs
- ToolStripComboBox.cs
- SymbolType.cs
- InfoCardCryptoHelper.cs
- XPathAxisIterator.cs
- SocketManager.cs
- FontClient.cs
- ContextStaticAttribute.cs
- TemplateControlParser.cs
- GeometryModel3D.cs
- RequestStatusBarUpdateEventArgs.cs
- AlternateView.cs
- JournalEntryListConverter.cs
- HttpChannelBindingToken.cs
- ErrorFormatterPage.cs
- HttpWebRequest.cs
- InputDevice.cs
- PageCache.cs
- X509Extension.cs
- CustomErrorsSection.cs
- DataGridViewRowHeaderCell.cs
- ByeMessageCD1.cs
- TextHidden.cs
- FacetEnabledSchemaElement.cs
- TreeNodeClickEventArgs.cs
- DbParameterCollection.cs
- VSDExceptions.cs
- EntityDescriptor.cs
- ProcessProtocolHandler.cs
- SendMailErrorEventArgs.cs
- XPathMultyIterator.cs
- RequestCacheManager.cs
- SmiEventSink_DeferedProcessing.cs
- RoleServiceManager.cs
- PropertyAccessVisitor.cs
- DispatcherEventArgs.cs
- InputScope.cs
- PagesSection.cs
- FrameworkElementFactory.cs
- ListViewGroupConverter.cs
- FactorySettingsElement.cs
- SecurityCriticalDataForSet.cs
- LineGeometry.cs
- ContainerActivationHelper.cs
- QilTernary.cs
- DCSafeHandle.cs
- DesignerDataSourceView.cs
- WindowsFormsHelpers.cs
- MaskPropertyEditor.cs
- x509store.cs
- AuthenticateEventArgs.cs
- FontFamilyConverter.cs
- WebBrowserPermission.cs
- PhysicalFontFamily.cs
- DataGridTableCollection.cs
- XmlUtilWriter.cs
- ConfigurationManagerHelper.cs
- ObjectHandle.cs
- ApplicationDirectoryMembershipCondition.cs
- HttpHandlersSection.cs
- TextSerializer.cs
- _ScatterGatherBuffers.cs