Beispiel #1
0
        public List <string> GetDrivers()
        {
            if (!Isloaded)
            {
                ScanPackage();
            }
            if (drivers == null)
            {
                drivers = new List <string>();
                foreach (PluginAssemblyInfo PAI in mAssembliesInfo)
                {
                    var list = from type in PAI.Assembly.GetTypes()
                               where typeof(PluginDriverBase).IsAssignableFrom(type) && type.IsAbstract == false
                               select type;

                    foreach (Type t in list)
                    {
                        PluginDriverBase driver = (PluginDriverBase)PAI.Assembly.CreateInstance(t.FullName);

                        //TODO: get driver info from annotation on the class

                        drivers.Add(driver.Name);
                    }
                }
            }
            return(drivers);
        }
Beispiel #2
0
        public PluginDriverBase GetDriver(string driverName)
        {
            if (!Isloaded)
            {
                ScanPackage();
            }

            // TODO: fix make more efficent and load only what needed
            foreach (PluginAssemblyInfo PAI in mAssembliesInfo)
            {
                var list = from type in PAI.Assembly.GetTypes()
                           where typeof(PluginDriverBase).IsAssignableFrom(type) && type.IsAbstract == false
                           select type;

                foreach (Type t in list)
                {
                    PluginDriverBase driver = (PluginDriverBase)PAI.Assembly.CreateInstance(t.FullName);   // TODO: fix me find the driver without creating instance
                    if (driver.Name == driverName)
                    {
                        return(driver);
                    }
                }
            }
            throw new Exception("Driver not found in Plugin Package - " + driverName);
        }
Beispiel #3
0
        public List <GingerAction> GetDriverActions(DriverInfo DI)
        {
            List <GingerAction> actions = new List <GingerAction>();
            PluginPackage       p       = (from x in mPluginPackages where x.Folder == DI.PluginPackageFolder select x).FirstOrDefault();
            PluginDriverBase    driver  = p.GetDriver(DI.Name);

            foreach (ActionHandler AH in driver.ActionHandlers)
            {
                GingerAction GA = new GingerAction(AH.ID);
                UpdateActionParamTypes(GA, AH.MethodInfo);
                actions.Add(GA);
            }
            return(actions);
        }
Beispiel #4
0
        // ================================================================

        private GingerNode StartDriverOnGingerNode(PluginDriverBase driver, string NodeName, string GingerGridHost = "127.0.0.1", int GingerGridPort = 15001)
        {
            Console.WriteLine("Driver Name: " + driver.Name);
            DriverCapabilities DC = new DriverCapabilities();

            //TODO: add info about the driver and machine
            DC.Platform = "Web";   // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            DC.OS       = "Win 7"; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            GingerNode GN = new GingerNode(DC, driver);

            GN.StartGingerNode(NodeName, GingerGridHost, GingerGridPort);

            Console.WriteLine("Ginger Node started - " + NodeName);  // Add ports and GingerGrid details
            return(GN);
        }
Beispiel #5
0
        public void StartNode(string Name, string ID, string GingerGridHost = "127.0.0.1", int GingerGridPort = 15001)
        {
            Console.WriteLine("* StartNode - " + Name);

            bNodest = true;
            bool bReady = false;
            //start node on task as we might have several running in parallel + we want the script to continue
            Task t = new Task(() =>
            {
                PluginDriverBase d    = P.GetDriver(Name);
                GingerNode GN         = StartDriverOnGingerNode(d, ID, GingerGridHost, GingerGridPort);
                GN.GingerNodeMessage += GingerNodeMessage;
                GingerNodes.Add(GN);
                bReady = true;
            });

            t.Start();
            while (!bReady) // TODO: add timeout or use ManualResetEvent with timeout
            {
                Console.WriteLine("Waiting for Node to be ready");
                Thread.Sleep(500);
            }
        }
Beispiel #6
0
        //TODO: check what we can hide from here and move to GingerCore  -- all the communcation Payload stuff move from here

        public GingerNode(DriverCapabilities DriverCapabilities, PluginDriverBase driver)
        {
            this.mDriver = driver;
        }