Exemple #1
0
        public string Run(Scripts.ICommunicator communicator)
        {
            try
            {
                objectFromAssembly = host.GetImplementation <Scripts.IScript>();
                if (objectFromAssembly != null)
                {
                    handle = objectFromAssembly.Instance as Scripts.Base;
                    if (handle == null)
                    {
                        return("Unable to create script object");
                    }
                }
                else
                {
                    return("Unable to find Script interface");
                }

                if (!host.InjectCommunicator(communicator))
                {
                    return("Unable to inject Communicator Object");
                }

                return(OnCreate());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Exemple #2
0
 private bool InjectCommunicator(Scripts.ICommunicator communicator)
 {
     /*Type t = assembly.GetType("Scripts.Main");
      * if (t != null)
      * {
      *      Type b = t.BaseType;
      *      MethodInfo info = b.GetMethod("InjectCommunicator");
      *      info.Invoke(null, new object[] { communicator });
      *      return true;
      * }*/
     return(false);
 }
Exemple #3
0
        private bool InjectCommunicator(Scripts.ICommunicator communicator)
        {
            Type t = assembly.GetType("Scripts.Main");

            if (t != null)
            {
                Type       b    = t.BaseType;
                MethodInfo info = b.GetMethod("InjectCommunicator");
                info.Invoke(null, new object[] { communicator });
                return(true);
            }
            return(false);
        }
Exemple #4
0
 public bool InjectCommunicator(Scripts.ICommunicator communicator)
 {
     foreach (var asm in Assemblies)
     {
         Type t = asm.GetType("Scripts.Main");
         if (t != null)
         {
             Type       b    = t.BaseType;
             MethodInfo info = b.GetMethod("InjectCommunicator");
             info.Invoke(null, new object[] { communicator });
             return(true);
         }
     }
     return(false);
 }
Exemple #5
0
        public string Run(Scripts.ICommunicator communicator)
        {
            try
            {
                Type type = assembly.GetType("Scripts.Main");
                var  obj  = Activator.CreateInstance(type);
                handle = (obj as Scripts.Base);

                if (!InjectCommunicator(communicator))
                {
                    return("Unable to inject Communicator Object");
                }

                return(OnCreate());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Exemple #6
0
 public bool InjectCommunicator(Scripts.ICommunicator communicator)
 {
     return(Loader.InjectCommunicator(communicator));
 }