public static void Main(string[] args) { #if DEBUG //Debugger.Launch(); #endif Thread.Sleep(10000); AppDomain.CurrentDomain.AssemblyLoad += AssembliesManager.Loaded; AppDomain.CurrentDomain.AssemblyResolve += AssembliesManager.Resolve; AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException; var startParameters = new StartParameters(args); channelName = startParameters.ChannelName; AssembliesManager.LoadAssembly(startParameters.TesterAssembly); if (string.IsNullOrEmpty(channelName)) { SendError(new Exception("Channel name for interprocess communication was not set.")); return; } try { ExperimentScope.Start(startParameters); } catch (Exception ex) { SendError(ex); } }
/// <summary> /// This method is needed to create an instance of a generic type using the /// fully qualified name. /// <see cref="http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx"/> /// </summary> /// <param name="assemblyName">The name of the assembly</param> /// <param name="typeName">The full name of the type</param> /// <returns>A new instance of the specified type</returns> public static object CreateInstanceFullyQualifiedName(string assemblyName, string typeName) { if (string.IsNullOrWhiteSpace(assemblyName)) { throw new ArgumentNullException("assemblyName"); } if (string.IsNullOrWhiteSpace(typeName)) { throw new ArgumentNullException("typeName"); } var assembly = AssembliesManager.LoadAssembly(assemblyName); var type = Type.GetType(typeName + "," + assembly.FullName); var instance = type == null ? null : Activator.CreateInstance(type); if (instance != null) { Console.WriteLine(@"Instance of type {0} was created.", typeName); } else { Console.Error.WriteLine(@"Instance of type {0} was not created.", typeName); } return(instance); }
public Assembly LoadAssembly(string dialogTitle) { this.dialog.Title = dialogTitle; Assembly result = null; if (this.dialog.ShowDialog().Value) { var file = new FileInfo(this.dialog.FileName); result = AssembliesManager.LoadAssembly(this.dialog.FileName); } return(result); }