C# Class Terrarium.Game.PrivateAssemblyCache

Datei anzeigen Open project: eugeniomiro/Terrarium Class Usage Examples

Private Properties

Property Type Description
Initialize void
PrivateAssemblyCache System
ResolveAssembly System.Reflection.Assembly
checkAssemblyWithReporting int
getAssemblyWithTerrariumBindingPolicy System.Reflection.Assembly

Public Methods

Method Description
BlacklistAssemblies ( string assemblies ) : void

Blacklist a series of assemblies by setting their assemblies to zero length files. This is a way of ensuring that we don't load them again, or replace them with fresh working copies because the file name gets reserved with an invalid assembly.

Close ( ) : void

Handles controlled shut-down of the PAC and unhooking the assembly resolving events.

Exists ( string fullName ) : System.Boolean

Determine if the assembly with the given full name exists within the PAC.

GetAssemblies ( ) : Terrarium.Game.OrganismAssemblyInfo[]

Gets a full listing of all of the assemblies in the cache. This can be used to populate dropdowns or lists.

GetAssemblyShortName ( string fullName ) : string

Given an assembly full name, generates an assembly short name.

GetAssemblyVersion ( string fullName ) : string

Given an assembly full name, generates an assembly version string.

GetBaseAssemblyDirectory ( string dataPath, string dataFile ) : string

Creates a base assembly directory without obfuscation from a path and file name.

GetBlacklistedAssemblies ( ) : string[]

Get a list of all assemblies in the cache that have 0 bytes. A 0 byte assembly fails to load.

GetFileName ( string fullName ) : string

Given an assembly full name, generates a library file name for an assembly.

GetSafeTempFileName ( ) : string

Creates a temp file that can't be guessed for security reasons.

HookAssemblyResolve ( ) : void

Hooks the assembly resolving events for the current app domain.

LoadOrganismAssembly ( string fullName ) : Assembly

Load an organism assembly. Calculate the size of the PAC based on the assemblies loaded.

PrivateAssemblyCache ( string dataPath, string dataFile ) : System

Creates a new private assembly cache initialized with a data path and data file.

PrivateAssemblyCache ( string dataPath, string dataFile, bool hookAssemblyResolve, bool trackLastRun ) : System

Creates a new private assembly cache initialized with a data path, data file, and controls whether assemblies are resolved, and organism tracking is in effect.

SaveOrganismAssembly ( string assemblyPath, string fullName ) : void

Save an assembly given a full path to the assembly and the full name of the assembly to the cache.

SaveOrganismAssembly ( string assemblyPath, string symbolPath, string fullName ) : void

Save an assembly along with symbols given a full path to the assembly and symbols to the cache.

SaveOrganismBytes ( byte bytes, string fullName ) : void

Saves the array of bytes given an assembly full name to the private assembly cache.

Protected Methods

Method Description
OnPacAssembliesChanged ( EventArgs e ) : void

Helper function for calling the PacAssembliesChanged event.

Private Methods

Method Description
Initialize ( string dataPath, string dataFile, bool hookAssemblyResolve, bool trackLastRun ) : void

Helper function for initializing the PAC constructors.

PrivateAssemblyCache ( ) : System

Initializes a versioned directory preamble used to create versioned assembly directories.

ResolveAssembly ( Object sender, ResolveEventArgs args ) : Assembly

Called whenever assemblies are being resolved for use.

checkAssemblyWithReporting ( string assemblyName, string xmlFile ) : int

Used for assembly validation with XML reporting in AsmCheck

getAssemblyWithTerrariumBindingPolicy ( string testAssemblyName, Assembly potentialMatchAssembly ) : Assembly

Check to see if an assembly can be found that matches a reduced set of fusion version requirements. We ignore the revision.

Method Details

BlacklistAssemblies() public method

Blacklist a series of assemblies by setting their assemblies to zero length files. This is a way of ensuring that we don't load them again, or replace them with fresh working copies because the file name gets reserved with an invalid assembly.
public BlacklistAssemblies ( string assemblies ) : void
assemblies string The assemblies to be blacklisted.
return void

Close() public method

Handles controlled shut-down of the PAC and unhooking the assembly resolving events.
public Close ( ) : void
return void

Exists() public method

Determine if the assembly with the given full name exists within the PAC.
public Exists ( string fullName ) : System.Boolean
fullName string The full name of the assembly to check for.
return System.Boolean

GetAssemblies() public method

Gets a full listing of all of the assemblies in the cache. This can be used to populate dropdowns or lists.
public GetAssemblies ( ) : Terrarium.Game.OrganismAssemblyInfo[]
return Terrarium.Game.OrganismAssemblyInfo[]

GetAssemblyShortName() public static method

Given an assembly full name, generates an assembly short name.
public static GetAssemblyShortName ( string fullName ) : string
fullName string The assembly full name.
return string

GetAssemblyVersion() public static method

Given an assembly full name, generates an assembly version string.
public static GetAssemblyVersion ( string fullName ) : string
fullName string The assembly full name.
return string

GetBaseAssemblyDirectory() public static method

Creates a base assembly directory without obfuscation from a path and file name.
public static GetBaseAssemblyDirectory ( string dataPath, string dataFile ) : string
dataPath string The base path of the data file.
dataFile string The name of the datafile for creating a cache directory.
return string

GetBlacklistedAssemblies() public method

Get a list of all assemblies in the cache that have 0 bytes. A 0 byte assembly fails to load.
public GetBlacklistedAssemblies ( ) : string[]
return string[]

GetFileName() public method

Given an assembly full name, generates a library file name for an assembly.
public GetFileName ( string fullName ) : string
fullName string The assembly full name.
return string

GetSafeTempFileName() public static method

Creates a temp file that can't be guessed for security reasons.
public static GetSafeTempFileName ( ) : string
return string

HookAssemblyResolve() public method

Hooks the assembly resolving events for the current app domain.
public HookAssemblyResolve ( ) : void
return void

LoadOrganismAssembly() public method

Load an organism assembly. Calculate the size of the PAC based on the assemblies loaded.
public LoadOrganismAssembly ( string fullName ) : Assembly
fullName string The name of the assembly to load.
return System.Reflection.Assembly

OnPacAssembliesChanged() protected method

Helper function for calling the PacAssembliesChanged event.
protected OnPacAssembliesChanged ( EventArgs e ) : void
e System.EventArgs Null
return void

PrivateAssemblyCache() public method

Creates a new private assembly cache initialized with a data path and data file.
public PrivateAssemblyCache ( string dataPath, string dataFile ) : System
dataPath string Path where the data will be stored.
dataFile string Path to a tracking data file.
return System

PrivateAssemblyCache() public method

Creates a new private assembly cache initialized with a data path, data file, and controls whether assemblies are resolved, and organism tracking is in effect.
public PrivateAssemblyCache ( string dataPath, string dataFile, bool hookAssemblyResolve, bool trackLastRun ) : System
dataPath string Path to where the cache will be stored.
dataFile string Path to the tracking data file.
hookAssemblyResolve bool Determines if the assembly resolving events are hooked.
trackLastRun bool Determines if organism tracking is senabled.
return System

SaveOrganismAssembly() public method

Save an assembly given a full path to the assembly and the full name of the assembly to the cache.
public SaveOrganismAssembly ( string assemblyPath, string fullName ) : void
assemblyPath string A local path to the assembly.
fullName string The full name of the assembly.
return void

SaveOrganismAssembly() public method

Save an assembly along with symbols given a full path to the assembly and symbols to the cache.
public SaveOrganismAssembly ( string assemblyPath, string symbolPath, string fullName ) : void
assemblyPath string A local path to the assembly.
symbolPath string A local path to the symbols.
fullName string The full name of the assembly.
return void

SaveOrganismBytes() public method

Saves the array of bytes given an assembly full name to the private assembly cache.
public SaveOrganismBytes ( byte bytes, string fullName ) : void
bytes byte The bytes of the assembly.
fullName string The full name of the original assembly.
return void