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
- ProcessModuleCollection.cs
- VisualStyleTypesAndProperties.cs
- ColorMap.cs
- DefaultPropertiesToSend.cs
- WebConfigurationManager.cs
- HttpCachePolicyElement.cs
- AsyncSerializedWorker.cs
- OAVariantLib.cs
- ComponentResourceKey.cs
- SqlRecordBuffer.cs
- Root.cs
- XmlUtil.cs
- Pkcs9Attribute.cs
- DescendantQuery.cs
- TypeDescriptionProvider.cs
- ConfigurationConverterBase.cs
- PointHitTestResult.cs
- WebServiceData.cs
- Matrix.cs
- OleDbConnectionInternal.cs
- DataGridItem.cs
- OleDbDataReader.cs
- ConfigurationFileMap.cs
- PackagePartCollection.cs
- GregorianCalendar.cs
- DateTimePicker.cs
- RuleCache.cs
- ThemeableAttribute.cs
- PrintDocument.cs
- EntityDesignerUtils.cs
- MetadataCache.cs
- WinFormsUtils.cs
- WindowsSolidBrush.cs
- AsyncOperationManager.cs
- AuthorizationRule.cs
- BitmapEffectDrawingContextState.cs
- RepeatBehaviorConverter.cs
- DataGridHelper.cs
- StoreAnnotationsMap.cs
- WebPartTransformer.cs
- GridItemPattern.cs
- Sql8ExpressionRewriter.cs
- TypeSemantics.cs
- BufferedWebEventProvider.cs
- MeshGeometry3D.cs
- SelectedGridItemChangedEvent.cs
- ConcatQueryOperator.cs
- SQLSingle.cs
- TextParagraphView.cs
- MasterPageCodeDomTreeGenerator.cs
- UrlParameterWriter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- TransportSecurityProtocolFactory.cs
- PlainXmlDeserializer.cs
- SimpleTypeResolver.cs
- DataGridItemCollection.cs
- ParagraphVisual.cs
- ToolStripContainer.cs
- Vector3dCollection.cs
- CompilerWrapper.cs
- UdpDiscoveryEndpoint.cs
- StorageMappingItemLoader.cs
- TypeDescriptionProvider.cs
- PageContentAsyncResult.cs
- DependencyPropertyAttribute.cs
- TextServicesLoader.cs
- HashMembershipCondition.cs
- DashStyles.cs
- GridViewRow.cs
- DataSourceIDConverter.cs
- Win32MouseDevice.cs
- WebPartConnectionsConnectVerb.cs
- SerializableAttribute.cs
- CodeMemberEvent.cs
- SafeEventLogWriteHandle.cs
- XmlLangPropertyAttribute.cs
- ViewCellRelation.cs
- ScrollBar.cs
- RequestNavigateEventArgs.cs
- XmlUnspecifiedAttribute.cs
- JsonFormatGeneratorStatics.cs
- SchemaImporterExtensionsSection.cs
- complextypematerializer.cs
- arc.cs
- Header.cs
- FrameworkTextComposition.cs
- ReferenceEqualityComparer.cs
- BindableAttribute.cs
- FilteredReadOnlyMetadataCollection.cs
- GeneralTransform.cs
- BitmapEffectGroup.cs
- EmulateRecognizeCompletedEventArgs.cs
- PropertyGroupDescription.cs
- UpdatePanelTrigger.cs
- XsdBuildProvider.cs
- UrlMappingsModule.cs
- MasterPageCodeDomTreeGenerator.cs
- SqlEnums.cs
- Parameter.cs
- TransformProviderWrapper.cs