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
- Rect3D.cs
- SystemIPv6InterfaceProperties.cs
- DataObjectAttribute.cs
- ObjectAnimationUsingKeyFrames.cs
- EntityRecordInfo.cs
- XmlSecureResolver.cs
- PrintDialogDesigner.cs
- GrammarBuilderPhrase.cs
- XmlReflectionMember.cs
- Int64.cs
- ThreadSafeList.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- ConfigsHelper.cs
- MediaCommands.cs
- PersonalizablePropertyEntry.cs
- SapiRecoContext.cs
- TypeLibConverter.cs
- DSASignatureDeformatter.cs
- RoleServiceManager.cs
- ReflectPropertyDescriptor.cs
- InvalidateEvent.cs
- COM2IDispatchConverter.cs
- XmlNamedNodeMap.cs
- NGCSerializer.cs
- ObjectDataSourceView.cs
- ClientTarget.cs
- WindowsFormsSynchronizationContext.cs
- MetadataFile.cs
- XPathDocumentNavigator.cs
- MembershipSection.cs
- StylusPointProperties.cs
- APCustomTypeDescriptor.cs
- SystemIPInterfaceProperties.cs
- XPathMessageFilterTable.cs
- ObjectDataSource.cs
- IconBitmapDecoder.cs
- PagePropertiesChangingEventArgs.cs
- InputReportEventArgs.cs
- Stopwatch.cs
- EventHandlerList.cs
- WebEventCodes.cs
- ArraySubsetEnumerator.cs
- ConsoleKeyInfo.cs
- SchemaNames.cs
- SemaphoreSecurity.cs
- CodeObject.cs
- Point3DCollection.cs
- invalidudtexception.cs
- FloaterBaseParagraph.cs
- CheckedPointers.cs
- XpsSerializationManager.cs
- ConstraintStruct.cs
- IpcServerChannel.cs
- SamlAudienceRestrictionCondition.cs
- TraceUtils.cs
- ValueType.cs
- SuppressIldasmAttribute.cs
- DebugView.cs
- BinaryCommonClasses.cs
- LinqToSqlWrapper.cs
- TreeViewCancelEvent.cs
- TextShapeableCharacters.cs
- DisableDpiAwarenessAttribute.cs
- FocusManager.cs
- IteratorDescriptor.cs
- PathSegmentCollection.cs
- GifBitmapEncoder.cs
- AccessibleObject.cs
- LambdaCompiler.Unary.cs
- SocketPermission.cs
- HttpConfigurationSystem.cs
- DisplayNameAttribute.cs
- TableLayoutRowStyleCollection.cs
- Vars.cs
- ChildDocumentBlock.cs
- xsdvalidator.cs
- ModelMemberCollection.cs
- SettingsProperty.cs
- TemplateComponentConnector.cs
- NullReferenceException.cs
- HelpEvent.cs
- ProcessModelSection.cs
- ConfigurationPropertyCollection.cs
- SafeMemoryMappedFileHandle.cs
- BuildTopDownAttribute.cs
- FrameworkElementFactory.cs
- StorageTypeMapping.cs
- nulltextcontainer.cs
- DesignerVerb.cs
- HScrollBar.cs
- DesignerView.Commands.cs
- XPathArrayIterator.cs
- ObjectAnimationBase.cs
- TextWriterTraceListener.cs
- AutomationPeer.cs
- DataGridViewTextBoxEditingControl.cs
- SafeMILHandle.cs
- StringFreezingAttribute.cs
- DesignerSerializerAttribute.cs
- BufferedGraphics.cs