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
- XmlDataCollection.cs
- HtmlInputHidden.cs
- Table.cs
- JoinCqlBlock.cs
- ErrorRuntimeConfig.cs
- CheckBoxRenderer.cs
- VisualProxy.cs
- TreeBuilderBamlTranslator.cs
- SqlParameterizer.cs
- DeviceContext.cs
- SynchronizingStream.cs
- HttpPostClientProtocol.cs
- DisplayMemberTemplateSelector.cs
- EntityDataSourceMemberPath.cs
- FixedStringLookup.cs
- TextStore.cs
- SqlConnectionManager.cs
- OpCodes.cs
- ContainerUIElement3D.cs
- DecimalAnimationBase.cs
- ReadOnlyPropertyMetadata.cs
- BaseComponentEditor.cs
- StaticFileHandler.cs
- XmlHierarchicalDataSourceView.cs
- ColorDialog.cs
- IPAddress.cs
- TableRowCollection.cs
- ProfileParameter.cs
- UpdateCommandGenerator.cs
- PasswordTextNavigator.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- MetadataItemEmitter.cs
- AuthenticationException.cs
- PriorityItem.cs
- MatchingStyle.cs
- ColumnResizeUndoUnit.cs
- DefaultShape.cs
- TabControlAutomationPeer.cs
- MessagePropertyAttribute.cs
- Viewport2DVisual3D.cs
- Italic.cs
- UntypedNullExpression.cs
- ToolStripItemClickedEventArgs.cs
- AuthenticationService.cs
- EqualityComparer.cs
- TemplatePropertyEntry.cs
- TextTreeInsertUndoUnit.cs
- LocatorPartList.cs
- AttributeInfo.cs
- AutomationFocusChangedEventArgs.cs
- PathFigureCollectionValueSerializer.cs
- MultitargetingHelpers.cs
- EditorPartChrome.cs
- CheckPair.cs
- Matrix.cs
- SchemaManager.cs
- UriTemplateClientFormatter.cs
- BindingCompleteEventArgs.cs
- HtmlForm.cs
- GetResponse.cs
- ResourceKey.cs
- CodeCommentStatement.cs
- UriWriter.cs
- InvokePatternIdentifiers.cs
- VisualStyleRenderer.cs
- ResourceBinder.cs
- BackgroundWorker.cs
- _CacheStreams.cs
- ContentPosition.cs
- LOSFormatter.cs
- ObjectQueryState.cs
- WebConfigurationHostFileChange.cs
- MaterialGroup.cs
- ErrorStyle.cs
- ForwardPositionQuery.cs
- ErrorHandler.cs
- FormatterConverter.cs
- TextEditorSelection.cs
- RoutedEventHandlerInfo.cs
- TabControlAutomationPeer.cs
- LogicalExpressionEditor.cs
- LambdaCompiler.ControlFlow.cs
- StatusCommandUI.cs
- ArgumentsParser.cs
- Logging.cs
- ReceiveDesigner.xaml.cs
- SpecialNameAttribute.cs
- SqlBooleanizer.cs
- PersonalizationAdministration.cs
- Int32Converter.cs
- ToolBarTray.cs
- NameScope.cs
- CutCopyPasteHelper.cs
- WrappedReader.cs
- PageThemeBuildProvider.cs
- cookiecollection.cs
- HttpPostProtocolReflector.cs
- KeyboardDevice.cs
- RuleInfoComparer.cs
- UpWmlMobileTextWriter.cs