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
- FamilyTypeface.cs
- PageThemeParser.cs
- EntitySqlQueryState.cs
- ThaiBuddhistCalendar.cs
- VectorAnimationUsingKeyFrames.cs
- ColorInterpolationModeValidation.cs
- LiteralLink.cs
- GeometryGroup.cs
- UpdatePanelControlTrigger.cs
- ExceptionRoutedEventArgs.cs
- KeyGestureValueSerializer.cs
- ListViewHitTestInfo.cs
- ComboBoxRenderer.cs
- X509CertificateClaimSet.cs
- ScrollProperties.cs
- RoleBoolean.cs
- SafeTimerHandle.cs
- KnownBoxes.cs
- OdbcConnection.cs
- UInt64.cs
- TranslateTransform.cs
- ADConnectionHelper.cs
- UITypeEditor.cs
- QuadraticBezierSegment.cs
- Icon.cs
- MultiPropertyDescriptorGridEntry.cs
- CustomAssemblyResolver.cs
- RangeExpression.cs
- PropertyDescriptorCollection.cs
- SplineQuaternionKeyFrame.cs
- EntityDataSourceWizardForm.cs
- IndexOutOfRangeException.cs
- CharUnicodeInfo.cs
- Dictionary.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- TextServicesDisplayAttribute.cs
- MetricEntry.cs
- DateTimeStorage.cs
- LinearGradientBrush.cs
- LinkButton.cs
- CodeDelegateCreateExpression.cs
- DbProviderConfigurationHandler.cs
- MultiBindingExpression.cs
- DataControlFieldTypeEditor.cs
- WriteFileContext.cs
- RtfFormatStack.cs
- Comparer.cs
- NumberAction.cs
- TreeNodeCollection.cs
- SystemIcmpV4Statistics.cs
- RadioButtonDesigner.cs
- GridViewRow.cs
- Int16AnimationBase.cs
- DynamicMethod.cs
- CornerRadiusConverter.cs
- SystemWebSectionGroup.cs
- PropertySourceInfo.cs
- ProtocolsInstallComponent.cs
- ModulesEntry.cs
- LogWriteRestartAreaState.cs
- LayoutEditorPart.cs
- UserMapPath.cs
- HttpResponse.cs
- DataGridCell.cs
- MsdtcWrapper.cs
- ProxyFragment.cs
- DiscardableAttribute.cs
- WmpBitmapDecoder.cs
- CellConstant.cs
- ImmComposition.cs
- ExceptionCollection.cs
- WindowsAuthenticationEventArgs.cs
- DocumentGrid.cs
- NativeMethods.cs
- SubMenuStyle.cs
- EventHandlerList.cs
- PngBitmapEncoder.cs
- PrintDialogDesigner.cs
- InstanceOwnerQueryResult.cs
- MarkupCompilePass2.cs
- DictationGrammar.cs
- ByteRangeDownloader.cs
- CLRBindingWorker.cs
- ProfileGroupSettingsCollection.cs
- RedBlackList.cs
- TextProperties.cs
- TypeInitializationException.cs
- SafeNativeMethods.cs
- Rectangle.cs
- _AutoWebProxyScriptEngine.cs
- ObjectView.cs
- ProfessionalColorTable.cs
- StorageEntityTypeMapping.cs
- BezierSegment.cs
- PersonalizableTypeEntry.cs
- X509Certificate2.cs
- ConfigurationSectionGroupCollection.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- Transactions.cs
- BrowserCapabilitiesCodeGenerator.cs