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
- ListControl.cs
- DbReferenceCollection.cs
- ProcessStartInfo.cs
- DesignTimeVisibleAttribute.cs
- UriWriter.cs
- formatstringdialog.cs
- TextEditorDragDrop.cs
- Stack.cs
- OdbcUtils.cs
- MetabaseSettings.cs
- AccessViolationException.cs
- DBSqlParserTable.cs
- UserPreference.cs
- DefaultBinder.cs
- ExtenderProvidedPropertyAttribute.cs
- EventToken.cs
- AbstractSvcMapFileLoader.cs
- ExtendedProtectionPolicy.cs
- CollectionChangedEventManager.cs
- DispatcherOperation.cs
- StreamWriter.cs
- DbgUtil.cs
- WindowsListViewGroupHelper.cs
- Math.cs
- NullPackagingPolicy.cs
- PostBackOptions.cs
- DefaultValueConverter.cs
- DateTimeConverter2.cs
- WebPartActionVerb.cs
- EditingMode.cs
- IISUnsafeMethods.cs
- DesignConnection.cs
- IsolatedStoragePermission.cs
- ToolStripLocationCancelEventArgs.cs
- XmlReflectionMember.cs
- HttpRuntimeSection.cs
- ScrollViewerAutomationPeer.cs
- DataGridColumnHeadersPresenter.cs
- ContainerAction.cs
- CatalogPartCollection.cs
- LongMinMaxAggregationOperator.cs
- InstanceLockQueryResult.cs
- UnicastIPAddressInformationCollection.cs
- ByteAnimationBase.cs
- ValidatorUtils.cs
- ProtocolsConfiguration.cs
- DrawListViewItemEventArgs.cs
- SocketAddress.cs
- GeneralTransform2DTo3D.cs
- MemberDomainMap.cs
- KeyValueSerializer.cs
- DBSqlParserTable.cs
- StartFileNameEditor.cs
- NamedPipeAppDomainProtocolHandler.cs
- ButtonBase.cs
- LayoutEditorPart.cs
- odbcmetadatafactory.cs
- CellConstantDomain.cs
- BitmapEffectState.cs
- BindingObserver.cs
- TextElementEnumerator.cs
- IndexerNameAttribute.cs
- ItemType.cs
- ScriptManagerProxy.cs
- InkCanvasInnerCanvas.cs
- EntityDesignerDataSourceView.cs
- Adorner.cs
- SizeFConverter.cs
- Thumb.cs
- PrivilegeNotHeldException.cs
- EntityParameter.cs
- TextTreeUndo.cs
- Pens.cs
- CategoryGridEntry.cs
- StylusPointPropertyUnit.cs
- MessageSecurityOverTcpElement.cs
- DrawingGroup.cs
- DataBoundControlHelper.cs
- XmlCustomFormatter.cs
- UnmanagedMemoryStreamWrapper.cs
- MsmqIntegrationBindingCollectionElement.cs
- StrokeSerializer.cs
- BuildProvider.cs
- QilPatternFactory.cs
- NamedPipeActivation.cs
- GenericAuthenticationEventArgs.cs
- HttpStreamXmlDictionaryReader.cs
- MatrixTransform3D.cs
- ContentElementAutomationPeer.cs
- HitTestWithGeometryDrawingContextWalker.cs
- DataRecordObjectView.cs
- WhitespaceRule.cs
- RequestQueryProcessor.cs
- HopperCache.cs
- ErrorHandler.cs
- DialogDivider.cs
- WriteTimeStream.cs
- SamlAdvice.cs
- TextFormatterImp.cs
- PostBackOptions.cs