// Methods /// <summary> /// Override implementaiton of <see cref="DoSyncFinalize"/>. /// </summary> protected override void DoSyncFinalize() { // Call the base method base.DoSyncFinalize(); if (IsSuccessful == true) { // Load the assembly into the domain loadedAssembly = domain.LoadAssembly(assemblyData); } }
/// <summary> /// Attempts to load a managed assembly from the raw assembly data. /// Any exceptions thrown while loading will be caught. /// </summary> /// <param name="data">The raw data representing the file structure of the managed assembly, The result of <see cref="File.ReadAllBytes(string)"/> for example.</param> /// <param name="result">An instance of <see cref="ScriptAssembly"/> representing the loaded assembly or null if the load failed</param> /// <returns>True if the assembly was loaded successfully or false if an error occured</returns> public bool TryLoadAssembly(byte[] data, out ScriptAssembly result) { try { // Call through result = LoadAssembly(data); return(true); } catch (Exception) { result = null; return(false); } }
/// <summary> /// Attempts to load a managed assembly with the specified name. /// Any exceptions thrown while loading will be caught. /// </summary> /// <param name="name">The <see cref="AssemblyName"/> of the assembly to load</param> /// <param name="result">An instance of <see cref="ScriptAssembly"/> representing the loaded assembly or null if the load failed</param> /// <returns>True if the assembly was loaded successfully or false if an error occurred</returns> public bool TryLoadAssembly(AssemblyName name, out ScriptAssembly result) { try { // Call through result = LoadAssembly(name); return(true); } catch (Exception) { result = null; return(false); } }
/// <summary> /// Attempts to load the managed assembly at the specified location. /// Any exceptions throw while loading will be caught. /// </summary> /// <param name="fullPath">The full path to the .dll file</param> /// <param name="result">An instance of <see cref="ScriptAssembly"/> representing the loaded assembly or null if the load failed</param> /// <returns>True if the assembly was loaded successfully or false if an error occurred</returns> public bool TryLoadAssembly(string fullPath, out ScriptAssembly result) { try { // Call through result = LoadAssembly(fullPath); return(true); } catch (Exception) { result = null; return(false); } }
internal ScriptType(ScriptAssembly assembly, Type type) { this.assembly = assembly; this.rawType = type; }
// Constructor /// <summary> /// Create a <see cref="ScriptType"/> from a <see cref="Type"/>. /// </summary> /// <param name="type">The <see cref="Type"/> to create the <see cref="ScriptType"/> from</param> public ScriptType(Type type) { this.assembly = null; this.rawType = type; }