Esempio n. 1
0
		public static void Open()
		{
            if (shell!=null)
            {
                shell.Dispose();
            }
            shell = new AppDomainShell();
            shell.Init(false);
		}
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
 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());
     }
 }
Esempio n. 5
0
        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();
            }
        }
Esempio n. 6
0
        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();
            }
        }