public static void Open() { if (shell!=null) { shell.Dispose(); } shell = new AppDomainShell(); shell.Init(false); }
public void testType() { var shell = new AppDomainShell(); shell.Init(false); shell.Open(typeof(ThreadAttack).Assembly.Location); RobotType type = shell.GetRobotType(typeof(ThreadAttack).FullName); Assert.AreEqual(RobotType.ADVANCED, type); shell.Open(typeof(MyFirstRobot).Assembly.Location); type = shell.GetRobotType(typeof(MyFirstRobot).FullName); Assert.AreEqual(RobotType.STANDARD, type); shell.Dispose(); }
public void testType() { var shell = new AppDomainShell(); shell.Init(false); shell.Open(typeof(ThreadAttack).Assembly.Location); RobotType robotType = shell.GetRobotType(typeof(ThreadAttack).FullName); Assert.IsTrue(robotType.isAdvancedRobot()); shell.Open(typeof(MyFirstRobot).Assembly.Location); robotType = shell.GetRobotType(typeof(MyFirstRobot).FullName); Assert.IsTrue(robotType.isStandardRobot()); shell.Dispose(); }
public static RobotType GetRobotType(IRobotItem robotItem) { string file = GetDllFileName(robotItem); if (!File.Exists(file)) { return RobotType.Invalid; } if (shell != null) { shell.Open(file); return shell.GetRobotType(robotItem.getFullClassName()); } using (AppDomainShell localshell = new AppDomainShell()) { localshell.Init(false); localshell.Open(file); return localshell.GetRobotType(robotItem.getFullClassName()); } }
public static string[] findItems(string dllPath) { string file = new Uri(dllPath).LocalPath; if (!File.Exists(file)) { throw new ArgumentException(); } if (shell != null) { shell.Open(file); return shell.FindRobots(); } using (AppDomainShell localshell = new AppDomainShell()) { localshell.Init(false); localshell.Open(file); return localshell.FindRobots(); } }
public static string[] findItems(string dllPath) { string uriPath = dllPath.Replace("#", "%23"); // All '#' occurrences must be replaced string file = new Uri(uriPath).LocalPath; if (!File.Exists(file)) { throw new FileNotFoundException("File not found: " + dllPath); } if (shell != null) { shell.Open(file); return shell.FindRobots(); } using (AppDomainShell localshell = new AppDomainShell()) { localshell.Init(false); localshell.Open(file); return localshell.FindRobots(); } }