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
- FileLogRecordStream.cs
- Evidence.cs
- EnumerableRowCollection.cs
- ReaderWriterLockWrapper.cs
- SqlComparer.cs
- PipelineModuleStepContainer.cs
- EdmRelationshipRoleAttribute.cs
- HashAlgorithm.cs
- StateRuntime.cs
- TextServicesContext.cs
- Range.cs
- DependencyPropertyConverter.cs
- CleanUpVirtualizedItemEventArgs.cs
- VariableElement.cs
- BaseCodePageEncoding.cs
- DependencyObjectProvider.cs
- Rights.cs
- MexTcpBindingElement.cs
- diagnosticsswitches.cs
- SecurityTimestamp.cs
- SignerInfo.cs
- TagPrefixCollection.cs
- Message.cs
- SettingsAttributes.cs
- OdbcUtils.cs
- InfoCardArgumentException.cs
- FromReply.cs
- TargetException.cs
- SplitterPanel.cs
- MemberRestriction.cs
- DataBoundControl.cs
- HttpCapabilitiesBase.cs
- ToolStripContentPanelDesigner.cs
- GridViewEditEventArgs.cs
- StylusPointPropertyUnit.cs
- AddDataControlFieldDialog.cs
- XmlTextReaderImplHelpers.cs
- NamedElement.cs
- IconConverter.cs
- StorageEntityTypeMapping.cs
- UnconditionalPolicy.cs
- XmlWrappingWriter.cs
- UnsafeNativeMethods.cs
- ProcessThreadCollection.cs
- HttpStreams.cs
- Stylesheet.cs
- EpmTargetPathSegment.cs
- DoubleAnimationBase.cs
- BuildProvidersCompiler.cs
- PolyBezierSegment.cs
- EqualityArray.cs
- StreamResourceInfo.cs
- Update.cs
- XPathSelfQuery.cs
- IntSecurity.cs
- HuffmanTree.cs
- RotationValidation.cs
- ToggleButtonAutomationPeer.cs
- MultilineStringEditor.cs
- NavigationPropertyEmitter.cs
- BooleanKeyFrameCollection.cs
- PkcsUtils.cs
- FontFamily.cs
- DoubleCollectionValueSerializer.cs
- IndependentAnimationStorage.cs
- MailSettingsSection.cs
- x509utils.cs
- figurelengthconverter.cs
- messageonlyhwndwrapper.cs
- WebPartZoneDesigner.cs
- EntityDataSourceViewSchema.cs
- XmlNodeComparer.cs
- ParenthesizePropertyNameAttribute.cs
- SafeRightsManagementHandle.cs
- HostingEnvironmentException.cs
- BooleanProjectedSlot.cs
- CompilationUnit.cs
- ElementUtil.cs
- Point4D.cs
- SecurityTokenRequirement.cs
- HwndSourceParameters.cs
- XPathSelectionIterator.cs
- GotoExpression.cs
- NgenServicingAttributes.cs
- MissingManifestResourceException.cs
- IDQuery.cs
- EntityDesignerUtils.cs
- SchemaImporter.cs
- MDIControlStrip.cs
- DataServiceProcessingPipeline.cs
- ProcessRequestArgs.cs
- Misc.cs
- DictionaryKeyPropertyAttribute.cs
- TextDpi.cs
- ModuleBuilder.cs
- ObjectHelper.cs
- AppDomainEvidenceFactory.cs
- HttpRequestCacheValidator.cs
- RecordsAffectedEventArgs.cs
- WebPartVerbsEventArgs.cs