Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Compensation.cs
- InvalidWMPVersionException.cs
- FixedPageAutomationPeer.cs
- WindowClosedEventArgs.cs
- RectKeyFrameCollection.cs
- SimpleTypeResolver.cs
- TextContainerChangeEventArgs.cs
- CodeDirectiveCollection.cs
- BrowserDefinitionCollection.cs
- IQueryable.cs
- EncodingTable.cs
- MdImport.cs
- CacheOutputQuery.cs
- MethodCallConverter.cs
- XamlSerializerUtil.cs
- TCEAdapterGenerator.cs
- DataTemplateKey.cs
- AllMembershipCondition.cs
- XmlSchemaObjectCollection.cs
- DelegatingChannelListener.cs
- CompositeTypefaceMetrics.cs
- DrawingContextDrawingContextWalker.cs
- ApplicationCommands.cs
- HandlerBase.cs
- AddInBase.cs
- TogglePatternIdentifiers.cs
- SqlNode.cs
- UnsafeNativeMethodsCLR.cs
- MinMaxParagraphWidth.cs
- TreeBuilderXamlTranslator.cs
- AutoGeneratedField.cs
- SQLInt32.cs
- Stackframe.cs
- ThreadSafeList.cs
- RijndaelManagedTransform.cs
- XmlAtomicValue.cs
- ContractType.cs
- EpmCustomContentWriterNodeData.cs
- FullTextState.cs
- RoutedEventArgs.cs
- DesigntimeLicenseContext.cs
- IriParsingElement.cs
- DecimalKeyFrameCollection.cs
- MDIClient.cs
- SurrogateSelector.cs
- AuthorizationRuleCollection.cs
- XmlUtilWriter.cs
- TreeChangeInfo.cs
- SyntaxCheck.cs
- RequestCache.cs
- base64Transforms.cs
- autovalidator.cs
- SQLCharsStorage.cs
- SchemaElementLookUpTable.cs
- HttpModuleActionCollection.cs
- ExpressionDumper.cs
- ConfigurationManagerHelperFactory.cs
- GatewayIPAddressInformationCollection.cs
- ImpersonationContext.cs
- Track.cs
- ContractListAdapter.cs
- XmlStreamStore.cs
- WrappedReader.cs
- HttpAsyncResult.cs
- XPathNodeIterator.cs
- AdditionalEntityFunctions.cs
- Win32PrintDialog.cs
- storepermissionattribute.cs
- RegexRunnerFactory.cs
- XamlTreeBuilderBamlRecordWriter.cs
- PerfService.cs
- GifBitmapDecoder.cs
- GetPageNumberCompletedEventArgs.cs
- OrderedDictionary.cs
- ToolStripRendererSwitcher.cs
- EntityDesignerDataSourceView.cs
- WebPartConnection.cs
- Rights.cs
- FontResourceCache.cs
- WebPartChrome.cs
- _FtpDataStream.cs
- AuthenticationConfig.cs
- XsdBuilder.cs
- DebuggerAttributes.cs
- ResourceDescriptionAttribute.cs
- TypeLibConverter.cs
- HealthMonitoringSection.cs
- ProcessManager.cs
- CancellationHandler.cs
- AsymmetricAlgorithm.cs
- TextMetrics.cs
- RealProxy.cs
- DesignerOptions.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- TextTrailingCharacterEllipsis.cs
- CircleHotSpot.cs
- ClientEventManager.cs
- SelectionItemPattern.cs
- Unit.cs
- _UncName.cs