Code:
/ DotNET / DotNET / 8.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
- MobileControl.cs
- AtomParser.cs
- SafeRightsManagementHandle.cs
- SharedStatics.cs
- XsdValidatingReader.cs
- TableCellCollection.cs
- MD5.cs
- FrameworkObject.cs
- BamlRecords.cs
- PropertyChangingEventArgs.cs
- XsdDuration.cs
- TableHeaderCell.cs
- ScriptDescriptor.cs
- Statements.cs
- InvalidEnumArgumentException.cs
- PeerFlooder.cs
- ContentElement.cs
- RC2.cs
- BufferedGraphics.cs
- ResourceAssociationTypeEnd.cs
- TextCompositionEventArgs.cs
- WebResponse.cs
- PartitionResolver.cs
- ResourceType.cs
- ResourceDisplayNameAttribute.cs
- _NTAuthentication.cs
- UIInitializationException.cs
- Visual3D.cs
- HtmlInputRadioButton.cs
- XsltException.cs
- printdlgexmarshaler.cs
- DocumentViewerBase.cs
- HMAC.cs
- WriteStateInfoBase.cs
- TripleDESCryptoServiceProvider.cs
- StringResourceManager.cs
- DetailsView.cs
- GenerateDerivedKeyRequest.cs
- CancellationToken.cs
- SingleResultAttribute.cs
- MemoryFailPoint.cs
- ConfigUtil.cs
- ResourceReader.cs
- Utils.cs
- ServiceNameCollection.cs
- AsyncDataRequest.cs
- AttributeProviderAttribute.cs
- CacheVirtualItemsEvent.cs
- Comparer.cs
- HistoryEventArgs.cs
- Proxy.cs
- FunctionMappingTranslator.cs
- JoinGraph.cs
- AuthenticationService.cs
- SqlDelegatedTransaction.cs
- PrtTicket_Public_Simple.cs
- AstTree.cs
- MemoryFailPoint.cs
- EntityDataSourceDataSelectionPanel.cs
- BindingElementExtensionElement.cs
- PageAsyncTask.cs
- Ports.cs
- AnimationStorage.cs
- ArraySortHelper.cs
- ScriptingScriptResourceHandlerSection.cs
- PageSettings.cs
- TypeConverterHelper.cs
- DynamicUpdateCommand.cs
- SerializationHelper.cs
- ImageDrawing.cs
- Internal.cs
- FileFormatException.cs
- XNodeNavigator.cs
- CodeTypeReference.cs
- X509Certificate2.cs
- ToolStripManager.cs
- LookupTables.cs
- EnumerableRowCollection.cs
- XmlWhitespace.cs
- CalendarDayButton.cs
- CompilationSection.cs
- AsyncOperation.cs
- FixedHyperLink.cs
- XmlCharCheckingReader.cs
- ResourceContainer.cs
- BrowserCapabilitiesFactory.cs
- HtmlButton.cs
- GridErrorDlg.cs
- SByteStorage.cs
- DataRelation.cs
- LogicalExpr.cs
- BufferedReceiveManager.cs
- ButtonBase.cs
- RoleExceptions.cs
- TranslateTransform3D.cs
- CharacterMetricsDictionary.cs
- ILGenerator.cs
- AutomationPropertyInfo.cs
- LinkButton.cs
- InputLanguageEventArgs.cs