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
- NavigationService.cs
- LogReservationCollection.cs
- OptionUsage.cs
- ColumnHeader.cs
- DispatcherSynchronizationContext.cs
- DataPagerFieldCollection.cs
- Source.cs
- MetadataSource.cs
- MouseGestureValueSerializer.cs
- ConfigurationPermission.cs
- XmlText.cs
- DataGridViewComboBoxColumn.cs
- TextSerializer.cs
- ClientSideProviderDescription.cs
- SqlClientMetaDataCollectionNames.cs
- DispatchChannelSink.cs
- DependencyStoreSurrogate.cs
- RequestCache.cs
- SqlTrackingQuery.cs
- XPathSingletonIterator.cs
- BuilderPropertyEntry.cs
- ImageDrawing.cs
- ApplicationProxyInternal.cs
- StatusStrip.cs
- UserControlCodeDomTreeGenerator.cs
- ApplicationInfo.cs
- DataObjectEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- RangeContentEnumerator.cs
- PolicyStatement.cs
- ContractMapping.cs
- StrokeCollectionDefaultValueFactory.cs
- AccessedThroughPropertyAttribute.cs
- COAUTHINFO.cs
- CryptoSession.cs
- OdbcFactory.cs
- BamlRecordReader.cs
- DomainConstraint.cs
- LinkClickEvent.cs
- HttpValueCollection.cs
- XamlReaderHelper.cs
- SoapFault.cs
- DBPropSet.cs
- WebBrowserDocumentCompletedEventHandler.cs
- Zone.cs
- ConnectionsZoneDesigner.cs
- StorageComplexPropertyMapping.cs
- categoryentry.cs
- AsyncResult.cs
- UpdateCompiler.cs
- NestPullup.cs
- CannotUnloadAppDomainException.cs
- BaseValidator.cs
- ToolStripDropDownClosingEventArgs.cs
- ComponentChangedEvent.cs
- ServiceSecurityAuditBehavior.cs
- CoTaskMemHandle.cs
- SiteMapSection.cs
- XmlElement.cs
- SrgsOneOf.cs
- GridSplitterAutomationPeer.cs
- SQLInt32.cs
- InheritanceContextHelper.cs
- JsonXmlDataContract.cs
- MethodRental.cs
- IFlowDocumentViewer.cs
- AppDomainUnloadedException.cs
- MimeImporter.cs
- MailDefinition.cs
- NestPullup.cs
- MessageFault.cs
- ResourceCategoryAttribute.cs
- VirtualizedItemProviderWrapper.cs
- PolicyManager.cs
- InternalTransaction.cs
- mediaeventargs.cs
- BitmapMetadataEnumerator.cs
- BamlRecords.cs
- BitmapEffect.cs
- Renderer.cs
- WebPartConnectionsConnectVerb.cs
- CodeDelegateCreateExpression.cs
- ListItemsCollectionEditor.cs
- DispatcherHookEventArgs.cs
- RegexWriter.cs
- DataControlPagerLinkButton.cs
- UserControl.cs
- LoginView.cs
- OdbcErrorCollection.cs
- CallTemplateAction.cs
- XmlBaseReader.cs
- ValidationHelpers.cs
- _ConnectStream.cs
- WebPartManager.cs
- CodeTypeParameterCollection.cs
- TypeUtil.cs
- DbSource.cs
- DataContract.cs
- MessageQueueConverter.cs
- NavigationProperty.cs