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
- CompiledWorkflowDefinitionContext.cs
- ExpandCollapseProviderWrapper.cs
- ConfigurationConverterBase.cs
- ControlCollection.cs
- TimelineGroup.cs
- WsdlHelpGeneratorElement.cs
- CultureInfo.cs
- EntityDataSourceUtil.cs
- EntitySetBase.cs
- ModelService.cs
- SqlTriggerContext.cs
- ColumnHeaderCollectionEditor.cs
- TableLayoutPanel.cs
- TypeConverterValueSerializer.cs
- PrtCap_Public_Simple.cs
- FusionWrap.cs
- XmlWrappingReader.cs
- NativeActivityMetadata.cs
- Win32.cs
- CodeMemberMethod.cs
- SqlBuilder.cs
- RoleService.cs
- OleDbMetaDataFactory.cs
- Image.cs
- ResolveCriteriaApril2005.cs
- FormsAuthenticationCredentials.cs
- EventEntry.cs
- SerializableAttribute.cs
- XmlCharType.cs
- BamlLocalizabilityResolver.cs
- DefaultHttpHandler.cs
- ToolConsole.cs
- ConfigurationManagerHelperFactory.cs
- CodePageEncoding.cs
- Pen.cs
- SiteMapNodeCollection.cs
- SystemIPInterfaceProperties.cs
- PathFigureCollectionConverter.cs
- OutputScopeManager.cs
- XomlSerializationHelpers.cs
- Calendar.cs
- TreeIterator.cs
- InkCanvas.cs
- SchemaLookupTable.cs
- XPathAncestorIterator.cs
- ExceptionValidationRule.cs
- JavaScriptSerializer.cs
- Wildcard.cs
- OutputCacheProfileCollection.cs
- DataGridTextBoxColumn.cs
- Timer.cs
- HttpHostedTransportConfiguration.cs
- OciLobLocator.cs
- DesignerForm.cs
- HttpsTransportElement.cs
- TaskScheduler.cs
- CloudCollection.cs
- AssemblyHash.cs
- TagPrefixAttribute.cs
- DiscoveryVersion.cs
- CommandLibraryHelper.cs
- ColorTransformHelper.cs
- SizeAnimation.cs
- UInt16Storage.cs
- ByteStreamGeometryContext.cs
- ToolStripSettings.cs
- BCryptNative.cs
- DataProviderNameConverter.cs
- ListControlDesigner.cs
- PerspectiveCamera.cs
- XNodeNavigator.cs
- MaterialGroup.cs
- CodeExporter.cs
- ChannelRequirements.cs
- RelatedView.cs
- CodeBinaryOperatorExpression.cs
- SimpleTextLine.cs
- CqlQuery.cs
- WebReferenceCollection.cs
- KoreanLunisolarCalendar.cs
- CheckBox.cs
- BinaryNode.cs
- HeaderFilter.cs
- SqlOuterApplyReducer.cs
- NumberEdit.cs
- CodePageEncoding.cs
- Odbc32.cs
- HtmlTable.cs
- ValidationHelper.cs
- ReferenceService.cs
- SQLBoolean.cs
- SQLByte.cs
- ClientTargetCollection.cs
- DelegatingTypeDescriptionProvider.cs
- FrameworkPropertyMetadata.cs
- UrlAuthorizationModule.cs
- GC.cs
- DateTimeEditor.cs
- SessionStateUtil.cs
- NCryptNative.cs