Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CustomErrorsSection.cs
- ColumnResult.cs
- TabControlEvent.cs
- FontConverter.cs
- EventPrivateKey.cs
- DataMisalignedException.cs
- DeobfuscatingStream.cs
- FilterElement.cs
- TextServicesContext.cs
- XpsS0ValidatingLoader.cs
- TrackingExtract.cs
- MissingManifestResourceException.cs
- DataSourceExpression.cs
- SizeAnimationClockResource.cs
- ToolStripArrowRenderEventArgs.cs
- RuntimeArgumentHandle.cs
- InvalidPipelineStoreException.cs
- Rules.cs
- BooleanAnimationUsingKeyFrames.cs
- Dictionary.cs
- MetaModel.cs
- MethodImplAttribute.cs
- _ProxyChain.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- SmiRecordBuffer.cs
- RadioButtonStandardAdapter.cs
- NonVisualControlAttribute.cs
- ObjectAnimationUsingKeyFrames.cs
- UriExt.cs
- GiveFeedbackEventArgs.cs
- TreePrinter.cs
- IIS7UserPrincipal.cs
- StateRuntime.cs
- ProxyElement.cs
- IndentedTextWriter.cs
- UxThemeWrapper.cs
- MexTcpBindingCollectionElement.cs
- ScrollableControl.cs
- AspNetSynchronizationContext.cs
- Regex.cs
- AsymmetricCryptoHandle.cs
- PropertyChangeTracker.cs
- WebConfigurationHost.cs
- XmlBinaryWriterSession.cs
- MetadataProperty.cs
- ColumnReorderedEventArgs.cs
- SqlServices.cs
- TextParaLineResult.cs
- ProcessManager.cs
- TextProviderWrapper.cs
- httpstaticobjectscollection.cs
- TableItemPatternIdentifiers.cs
- TraceUtility.cs
- XmlDocumentFragment.cs
- RequestCachingSection.cs
- CommandDevice.cs
- NotImplementedException.cs
- RetrieveVirtualItemEventArgs.cs
- ProcessHostMapPath.cs
- SqlInternalConnectionTds.cs
- SizeF.cs
- Pen.cs
- SnapshotChangeTrackingStrategy.cs
- ThrowHelper.cs
- HTMLTagNameToTypeMapper.cs
- CompiledIdentityConstraint.cs
- MexServiceChannelBuilder.cs
- Compiler.cs
- DataGridRowDetailsEventArgs.cs
- RemotingSurrogateSelector.cs
- VirtualPathProvider.cs
- ErrorFormatter.cs
- Rotation3DAnimationBase.cs
- SqlAggregateChecker.cs
- NativeMethodsCLR.cs
- UIntPtr.cs
- SqlDataAdapter.cs
- CodeGroup.cs
- PerformanceCounterPermissionEntry.cs
- FontCacheUtil.cs
- NavigateEvent.cs
- CollectionsUtil.cs
- ConfigXmlAttribute.cs
- CoTaskMemUnicodeSafeHandle.cs
- SurrogateEncoder.cs
- ObjectSet.cs
- CryptoKeySecurity.cs
- UInt16.cs
- DNS.cs
- LightweightCodeGenerator.cs
- InvalidDataException.cs
- ServiceReference.cs
- RequestQueue.cs
- SqlException.cs
- Geometry.cs
- IISMapPath.cs
- TraceHandlerErrorFormatter.cs
- NetDataContractSerializer.cs
- ScopelessEnumAttribute.cs
- XPathMultyIterator.cs