Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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 assertt 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 assertt 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(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Collection.cs
- ToolStripPanelRenderEventArgs.cs
- NetworkAddressChange.cs
- typedescriptorpermissionattribute.cs
- FontDifferentiator.cs
- EntityDataSourceReferenceGroup.cs
- ItemCheckEvent.cs
- XmlSchemaSimpleTypeRestriction.cs
- EntityRecordInfo.cs
- DBProviderConfigurationHandler.cs
- ContentPlaceHolderDesigner.cs
- GridItemProviderWrapper.cs
- FillErrorEventArgs.cs
- PowerModeChangedEventArgs.cs
- TextViewBase.cs
- StyleSelector.cs
- QueryPageSettingsEventArgs.cs
- arabicshape.cs
- ImpersonateTokenRef.cs
- ActivityInterfaces.cs
- FileReader.cs
- FuncCompletionCallbackWrapper.cs
- NavigationExpr.cs
- ColorAnimationUsingKeyFrames.cs
- EmbeddedMailObject.cs
- LocatorManager.cs
- PropertyEmitterBase.cs
- TrustManagerMoreInformation.cs
- DataPagerFieldCommandEventArgs.cs
- GridViewCellAutomationPeer.cs
- XmlUtil.cs
- PopupRootAutomationPeer.cs
- DesignerActionTextItem.cs
- XmlConvert.cs
- SocketAddress.cs
- IPHostEntry.cs
- DaylightTime.cs
- ParseNumbers.cs
- SmtpFailedRecipientsException.cs
- Stackframe.cs
- HostedAspNetEnvironment.cs
- TripleDES.cs
- StylusPointCollection.cs
- ISO2022Encoding.cs
- WindowsScrollBarBits.cs
- TaskResultSetter.cs
- ComponentSerializationService.cs
- ClipboardProcessor.cs
- ScriptControlManager.cs
- IgnoreSectionHandler.cs
- ByteStorage.cs
- ScriptMethodAttribute.cs
- XamlInt32CollectionSerializer.cs
- TouchPoint.cs
- assertwrapper.cs
- TypeToken.cs
- SemanticKeyElement.cs
- SoapDocumentServiceAttribute.cs
- StreamGeometryContext.cs
- ObjectSet.cs
- StringUtil.cs
- FormsAuthenticationTicket.cs
- UseLicense.cs
- XPathEmptyIterator.cs
- MDIWindowDialog.cs
- InstanceDataCollectionCollection.cs
- ServiceDescriptionImporter.cs
- InertiaExpansionBehavior.cs
- ProcessModuleDesigner.cs
- configsystem.cs
- IPAddressCollection.cs
- CompoundFileReference.cs
- StateMachineDesignerPaint.cs
- Privilege.cs
- TableParaClient.cs
- GetPageCompletedEventArgs.cs
- MarkupExtensionParser.cs
- ScopelessEnumAttribute.cs
- DesignerActionGlyph.cs
- CodeActivity.cs
- ShapeTypeface.cs
- ListControl.cs
- WebPartVerb.cs
- WorkflowMarkupSerializationProvider.cs
- GrabHandleGlyph.cs
- JavaScriptString.cs
- PageHandlerFactory.cs
- CompilerScopeManager.cs
- PenThread.cs
- SafeNativeMethods.cs
- FormatVersion.cs
- ResourcesBuildProvider.cs
- Rfc2898DeriveBytes.cs
- DataGridTableCollection.cs
- ToolStripItemCollection.cs
- OracleRowUpdatedEventArgs.cs
- SqlConnectionString.cs
- CryptoStream.cs
- TakeOrSkipQueryOperator.cs
- Comparer.cs