Beispiel #1
0
        public static void Construct()
        {
            try
            {
                ModuleN.InitN();

                JNIEnv env = JNIEnv.ThreadEnv;
                JniGlobalHandle hmHandle = env.NewGlobalRef((JniHandle)domain.GetData("hostManager"));
                JniGlobalHandle peerHandle = env.NewGlobalRef((JniHandle)domain.GetData("peer"));
                JniGlobalHandle itemHandle = env.NewGlobalRef((JniHandle)domain.GetData("item"));
                hostManager = Bridge.CreateProxy<IHostManager>(hmHandle);
                robotPeer = Bridge.CreateProxy<IRobotPeer>(peerHandle);
                specification = Bridge.CreateProxy<IRobotItem>(itemHandle);

                statics = ((RobotStatics)domain.GetData("statics"));
                CreateProxy();

                Assembly assembly = Assembly.LoadFrom(robotAssemblyShadowFileName);
                Reflection.CheckAssembly(assembly);
                string robotFullName = specification.getFullClassName();
                robotType = assembly.GetType(robotFullName, false);
                robotProxy.setRobotType(robotType);
            }
            catch (Exception ex)
            {
                LoggerN.logError(ex);
                throw;
            }
        }
Beispiel #2
0
        public static void Construct()
        {
            try
            {
                ModuleN.InitN();

                JNIEnv          env        = JNIEnv.ThreadEnv;
                JniGlobalHandle hmHandle   = env.NewGlobalRef((JniHandle)domain.GetData("hostManager"));
                JniGlobalHandle peerHandle = env.NewGlobalRef((JniHandle)domain.GetData("peer"));
                JniGlobalHandle itemHandle = env.NewGlobalRef((JniHandle)domain.GetData("item"));
                hostManager   = Bridge.CreateProxy <IHostManager>(hmHandle);
                robotPeer     = Bridge.CreateProxy <IRobotPeer>(peerHandle);
                specification = Bridge.CreateProxy <IRobotItem>(itemHandle);

                statics = ((RobotStatics)domain.GetData("statics"));
                CreateProxy();

                Assembly assembly = Assembly.LoadFrom(robotAssemblyShadowFileName);
                Reflection.CheckAssembly(assembly);
                string robotFullName = specification.getFullClassName();
                robotType = assembly.GetType(robotFullName, false);
                robotProxy.setRobotType(robotType);
            }
            catch (Exception ex)
            {
                LoggerN.logError(ex);
                throw;
            }
        }
Beispiel #3
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());
     }
 }
Beispiel #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()));
            }
        }