Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Security / Policy / ApplicationDirectory.cs / 1 / ApplicationDirectory.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // ApplicationDirectory.cs // // ApplicationDirectory is an evidence type representing the directory the assembly // was loaded from. // namespace System.Security.Policy { using System; using System.IO; using System.Security.Util; using System.Collections; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] sealed public class ApplicationDirectory : IBuiltInEvidence { private URLString m_appDirectory; internal ApplicationDirectory() { m_appDirectory = null; } public ApplicationDirectory( String name ) { if (name == null) throw new ArgumentNullException( "name" ); m_appDirectory = new URLString( name ); } public String Directory { get { return m_appDirectory.ToString(); } } public override bool Equals(Object o) { if (o == null) return false; if (o is ApplicationDirectory) { ApplicationDirectory appDir = (ApplicationDirectory) o; if (this.m_appDirectory == null) { return appDir.m_appDirectory == null; } else if (appDir.m_appDirectory == null) { return false; } else { return this.m_appDirectory.IsSubsetOf( appDir.m_appDirectory ) && appDir.m_appDirectory.IsSubsetOf( this.m_appDirectory ); } } return false; } public override int GetHashCode() { return this.Directory.GetHashCode(); } public Object Copy() { ApplicationDirectory appDir = new ApplicationDirectory(); appDir.m_appDirectory = this.m_appDirectory; return appDir; } internal SecurityElement ToXml() { SecurityElement root = new SecurityElement( "System.Security.Policy.ApplicationDirectory" ); // If you hit this assert then most likely you are trying to change the name of this class. // This is ok as long as you change the hard coded string above and change the assert below. BCLDebug.Assert( this.GetType().FullName.Equals( "System.Security.Policy.ApplicationDirectory" ), "Class name changed!" ); root.AddAttribute( "version", "1" ); if (m_appDirectory != null) root.AddChild( new SecurityElement( "Directory", m_appDirectory.ToString() ) ); return root; } ///int IBuiltInEvidence.OutputToBuffer( char[] buffer, int position, bool verbose ) { buffer[position++] = BuiltInEvidenceHelper.idApplicationDirectory; String directory = this.Directory; int length = directory.Length; if (verbose) { BuiltInEvidenceHelper.CopyIntToCharArray(length, buffer, position); position += 2; } directory.CopyTo( 0, buffer, position, length ); return length + position; } /// int IBuiltInEvidence.InitFromBuffer( char[] buffer, int position) { int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_appDirectory = new URLString( new String(buffer, position, length )); return position + length; } /// int IBuiltInEvidence.GetRequiredSize(bool verbose) { if (verbose) return this.Directory.Length + 3; // Directory + identifier + length else return this.Directory.Length + 1; // Directory + identifier } public override String ToString() { return ToXml().ToString(); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Events.cs
- ObjectToken.cs
- HitTestFilterBehavior.cs
- BamlLocalizer.cs
- TrustLevelCollection.cs
- Transform.cs
- ExpressionsCollectionEditor.cs
- FacetValueContainer.cs
- ExtensionSimplifierMarkupObject.cs
- SignatureDescription.cs
- CacheOutputQuery.cs
- Translator.cs
- Section.cs
- ObjectDataSourceEventArgs.cs
- DocumentScope.cs
- DataGridViewUtilities.cs
- NamedPipeAppDomainProtocolHandler.cs
- wgx_sdk_version.cs
- UnhandledExceptionEventArgs.cs
- CapacityStreamGeometryContext.cs
- CleanUpVirtualizedItemEventArgs.cs
- DoubleUtil.cs
- TabItem.cs
- AggregateException.cs
- DiscardableAttribute.cs
- InvalidComObjectException.cs
- AuthenticationSection.cs
- GeneralTransform2DTo3D.cs
- Connector.cs
- SymmetricSecurityProtocol.cs
- BitFlagsGenerator.cs
- ConstructorExpr.cs
- GridProviderWrapper.cs
- XmlKeywords.cs
- XmlEncodedRawTextWriter.cs
- Model3DGroup.cs
- TaskExtensions.cs
- Grid.cs
- PropertyTabAttribute.cs
- ResourceReferenceKeyNotFoundException.cs
- Validator.cs
- WebSysDefaultValueAttribute.cs
- NetworkCredential.cs
- PersistenceProviderDirectory.cs
- BooleanExpr.cs
- CompositeActivityDesigner.cs
- GridSplitter.cs
- ModuleElement.cs
- Switch.cs
- TransformedBitmap.cs
- TreeIterator.cs
- Type.cs
- ConnectionsZone.cs
- ToolStripContentPanelRenderEventArgs.cs
- DataServiceSaveChangesEventArgs.cs
- DataGridViewColumnEventArgs.cs
- TableLayoutPanelCellPosition.cs
- XmlNodeChangedEventArgs.cs
- DeviceFiltersSection.cs
- dataSvcMapFileLoader.cs
- HtmlTableCell.cs
- Soap.cs
- ComAdminInterfaces.cs
- CachedTypeface.cs
- AppDomainGrammarProxy.cs
- ComplusEndpointConfigContainer.cs
- ProgressBarHighlightConverter.cs
- PositiveTimeSpanValidatorAttribute.cs
- PlatformNotSupportedException.cs
- StdRegProviderWrapper.cs
- QueryInterceptorAttribute.cs
- TriggerActionCollection.cs
- ReadOnlyDictionary.cs
- GC.cs
- NetworkInformationException.cs
- UniformGrid.cs
- RoleGroupCollectionEditor.cs
- IsolationInterop.cs
- BamlLocalizabilityResolver.cs
- PropertyKey.cs
- GradientSpreadMethodValidation.cs
- TextEncodedRawTextWriter.cs
- TreeNodeStyleCollection.cs
- RowToParametersTransformer.cs
- MetafileHeader.cs
- Accessible.cs
- WindowsProgressbar.cs
- DynamicRendererThreadManager.cs
- StaticExtension.cs
- ProcessManager.cs
- URLEditor.cs
- DataExchangeServiceBinder.cs
- MemberBinding.cs
- XmlException.cs
- Tool.cs
- TextRange.cs
- PrintDocument.cs
- ReachDocumentReferenceSerializer.cs
- RelationshipConverter.cs
- ExpressionBuilder.cs