Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ThumbAutomationPeer.cs
- DictionaryEditChange.cs
- KnownColorTable.cs
- RuntimeResourceSet.cs
- RowParagraph.cs
- InheritanceContextHelper.cs
- WebPartDisplayModeEventArgs.cs
- ObjectQuery.cs
- InputReportEventArgs.cs
- ServiceManager.cs
- ContextMenu.cs
- WindowsProgressbar.cs
- AuthorizationRuleCollection.cs
- XmlAttributeProperties.cs
- SqlRetyper.cs
- TextEditorCopyPaste.cs
- ValidationResult.cs
- TablePattern.cs
- NavigatingCancelEventArgs.cs
- AppSecurityManager.cs
- SafeThreadHandle.cs
- ParameterElement.cs
- brushes.cs
- SessionStateUtil.cs
- Selection.cs
- DataGridItemEventArgs.cs
- DataGridViewComponentPropertyGridSite.cs
- QueryPageSettingsEventArgs.cs
- PersonalizableTypeEntry.cs
- OracleFactory.cs
- DockPanel.cs
- PrintDocument.cs
- CommunicationObjectAbortedException.cs
- SigningCredentials.cs
- Pair.cs
- SessionParameter.cs
- HwndSourceKeyboardInputSite.cs
- WinEventQueueItem.cs
- _ProxyRegBlob.cs
- CopyCodeAction.cs
- _StreamFramer.cs
- OTFRasterizer.cs
- ClientTargetSection.cs
- DllNotFoundException.cs
- PrtTicket_Editor.cs
- PageAdapter.cs
- TickBar.cs
- ZipIOExtraFieldZip64Element.cs
- UnionCqlBlock.cs
- XmlUrlEditor.cs
- LinqDataSourceHelper.cs
- RequestSecurityTokenResponse.cs
- CheckPair.cs
- XamlInterfaces.cs
- ScriptReference.cs
- StreamGeometry.cs
- WebConfigurationManager.cs
- DataError.cs
- WhitespaceRuleLookup.cs
- Ppl.cs
- ComplusEndpointConfigContainer.cs
- SweepDirectionValidation.cs
- SignatureHelper.cs
- NestPullup.cs
- XsdCachingReader.cs
- SettingsAttributeDictionary.cs
- DocumentPageTextView.cs
- QilExpression.cs
- FixedSOMTableRow.cs
- ImageInfo.cs
- SizeAnimationUsingKeyFrames.cs
- Assembly.cs
- ReferencedAssembly.cs
- PkcsMisc.cs
- PeerToPeerException.cs
- ComponentGlyph.cs
- RuntimeEnvironment.cs
- ConfigurationManagerInternalFactory.cs
- InputScope.cs
- Thread.cs
- KeyTime.cs
- IgnoreSection.cs
- XmlChildEnumerator.cs
- XamlBuildTaskServices.cs
- Hex.cs
- SpecularMaterial.cs
- OciHandle.cs
- DataGridPagingPage.cs
- TemplateBindingExtension.cs
- SystemDiagnosticsSection.cs
- EntityDataSourceContextCreatedEventArgs.cs
- TextOutput.cs
- CodeTypeDeclarationCollection.cs
- ProxyAttribute.cs
- RelationshipNavigation.cs
- BaseServiceProvider.cs
- DataTableTypeConverter.cs
- Environment.cs
- DropShadowBitmapEffect.cs
- CompilerInfo.cs