Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SafeSecurityHelper.cs
- OptimizedTemplateContentHelper.cs
- Substitution.cs
- PerfCounters.cs
- ToolStripTextBox.cs
- Control.cs
- MonitorWrapper.cs
- XPathDocumentIterator.cs
- GeneralTransform3D.cs
- WmlValidationSummaryAdapter.cs
- ToolStripRenderer.cs
- RegexWorker.cs
- RC2.cs
- BaseInfoTable.cs
- CurrencyManager.cs
- Schema.cs
- TextBoxAutoCompleteSourceConverter.cs
- BamlRecordWriter.cs
- PrimitiveSchema.cs
- Transactions.cs
- EdmType.cs
- X509Utils.cs
- CroppedBitmap.cs
- WorkflowMarkupSerializerMapping.cs
- LogicalExpressionTypeConverter.cs
- InfoCardService.cs
- WebPartVerbsEventArgs.cs
- ZipIOBlockManager.cs
- SectionUpdates.cs
- MetadataItem_Static.cs
- BitArray.cs
- columnmapkeybuilder.cs
- UnsafePeerToPeerMethods.cs
- ContentType.cs
- XamlHostingSection.cs
- InfiniteIntConverter.cs
- ToolStripRendererSwitcher.cs
- DefaultExpressionVisitor.cs
- SiteOfOriginPart.cs
- wmiprovider.cs
- FunctionCommandText.cs
- ListItemConverter.cs
- MenuCommand.cs
- SystemWebExtensionsSectionGroup.cs
- GradientBrush.cs
- ObjectParameterCollection.cs
- XmlSchemaGroup.cs
- FontResourceCache.cs
- FormatConvertedBitmap.cs
- XmlSchema.cs
- KnownColorTable.cs
- UInt16.cs
- ImportCatalogPart.cs
- TemplateControlCodeDomTreeGenerator.cs
- Rotation3DAnimation.cs
- ClientBuildManager.cs
- ConcurrencyMode.cs
- Activator.cs
- CheckBoxDesigner.cs
- DataGridColumnCollection.cs
- HtmlTableRow.cs
- CompatibleComparer.cs
- TypeLoader.cs
- Vector3DAnimationUsingKeyFrames.cs
- WorkflowExecutor.cs
- TriggerActionCollection.cs
- BookmarkCallbackWrapper.cs
- DocumentPageTextView.cs
- ColorTransformHelper.cs
- BreakRecordTable.cs
- UInt64.cs
- ServicePointManagerElement.cs
- ServiceXNameTypeConverter.cs
- SqlIdentifier.cs
- GeometryHitTestResult.cs
- UITypeEditor.cs
- ImageButton.cs
- IssuedTokenParametersEndpointAddressElement.cs
- MemoryStream.cs
- CodeTypeParameter.cs
- StorageScalarPropertyMapping.cs
- Error.cs
- ToolStrip.cs
- TextUtf8RawTextWriter.cs
- PageTheme.cs
- ScaleTransform3D.cs
- Internal.cs
- EventLogPermissionHolder.cs
- SiteMapProvider.cs
- CodeGeneratorAttribute.cs
- IsolatedStorageException.cs
- MSAANativeProvider.cs
- DataGridViewRowEventArgs.cs
- ExpressionBuilderCollection.cs
- SqlTransaction.cs
- DetailsViewRowCollection.cs
- SqlNode.cs
- ComAdminWrapper.cs
- _SslStream.cs
- UriExt.cs