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
- NamedPipeAppDomainProtocolHandler.cs
- EventArgs.cs
- MeasureItemEvent.cs
- _IPv6Address.cs
- Nodes.cs
- AccessedThroughPropertyAttribute.cs
- DataError.cs
- ErrorHandler.cs
- AttachedAnnotationChangedEventArgs.cs
- MergePropertyDescriptor.cs
- StateRuntime.cs
- ToolStripManager.cs
- SatelliteContractVersionAttribute.cs
- ConfigDefinitionUpdates.cs
- StylusPlugInCollection.cs
- SqlMetaData.cs
- TextRenderer.cs
- TagPrefixCollection.cs
- AssociationEndMember.cs
- PathGeometry.cs
- HashCoreRequest.cs
- precedingquery.cs
- StyleCollectionEditor.cs
- TreeViewEvent.cs
- Int64.cs
- DesignerRegionCollection.cs
- TextElementCollectionHelper.cs
- CodePageUtils.cs
- DocumentGrid.cs
- NetTcpSecurity.cs
- SQLDecimalStorage.cs
- XmlNavigatorStack.cs
- PropertyNames.cs
- ConfigXmlElement.cs
- ContentOperations.cs
- Subset.cs
- RolePrincipal.cs
- WorkflowRequestContext.cs
- TextSelectionHighlightLayer.cs
- FixedBufferAttribute.cs
- HtmlForm.cs
- FixedHyperLink.cs
- IteratorDescriptor.cs
- LowerCaseStringConverter.cs
- dataobject.cs
- X509RecipientCertificateServiceElement.cs
- QilReference.cs
- ConfigurationStrings.cs
- RayHitTestParameters.cs
- UrlPath.cs
- RelatedView.cs
- ObjectSet.cs
- QueryOutputWriter.cs
- RuntimeHelpers.cs
- ConsoleCancelEventArgs.cs
- CmsUtils.cs
- LoadedOrUnloadedOperation.cs
- _IPv4Address.cs
- PipelineModuleStepContainer.cs
- ScrollPattern.cs
- MsmqInputSessionChannel.cs
- StopRoutingHandler.cs
- PersonalizationStateQuery.cs
- RTLAwareMessageBox.cs
- RtfToXamlReader.cs
- DeviceContext.cs
- SamlSecurityTokenAuthenticator.cs
- HtmlToClrEventProxy.cs
- PerformanceCounterManager.cs
- DataGridViewDataConnection.cs
- CursorConverter.cs
- StateInitializationDesigner.cs
- BroadcastEventHelper.cs
- BindingsCollection.cs
- ComplexBindingPropertiesAttribute.cs
- OneOfTypeConst.cs
- WebEncodingValidatorAttribute.cs
- wgx_exports.cs
- MetadataItemSerializer.cs
- ParameterCollection.cs
- FieldDescriptor.cs
- CodeIdentifier.cs
- ThemeDirectoryCompiler.cs
- ExpandSegment.cs
- Signature.cs
- DataSourceXmlSerializationAttribute.cs
- GlobalProxySelection.cs
- SqlClientWrapperSmiStreamChars.cs
- EntityDesignPluralizationHandler.cs
- AxisAngleRotation3D.cs
- TextUtf8RawTextWriter.cs
- MenuItemStyleCollection.cs
- WebPartEditorApplyVerb.cs
- Formatter.cs
- HtmlInputButton.cs
- UndoManager.cs
- FixedDSBuilder.cs
- CaseCqlBlock.cs
- LocalizableResourceBuilder.cs
- RepeaterItemEventArgs.cs