Exemple #1
0
        private NewPayLoad StartDriver(NewPayLoad pl)
        {
            try
            {
                List <NewPayLoad> FieldsandParams = pl.GetListPayLoad();

                Dictionary <string, string> InputParams = new Dictionary <string, string>();
                foreach (NewPayLoad Np in FieldsandParams)
                {
                    string Name = Np.GetValueString();

                    string Value = Np.GetValueString();
                    if (!InputParams.ContainsKey(Name))
                    {
                        InputParams.Add(Name, Value);
                    }
                }


                ConfigureServiceParams(mService, InputParams);
                Console.WriteLine("Payload - Start Session");
                ((IServiceSession)mService).StartSession();
                NewPayLoad PLRC = new NewPayLoad("OK");
                PLRC.ClosePackage();
                return(PLRC);
            }
            catch (Exception ex)
            {
                return(NewPayLoad.Error(ex.Message));
            }
        }
Exemple #2
0
        private NewPayLoad TakeScreenot(NewPayLoad ActionPayload)
        {
            if (mService is IScreenShotService ScreenshotService)
            {
                Dictionary <string, string> InputParams     = new Dictionary <string, string>();
                List <NewPayLoad>           FieldsandParams = ActionPayload.GetListPayLoad();


                foreach (NewPayLoad Np in FieldsandParams)
                {
                    string Name = Np.GetValueString();

                    string Value = Np.GetValueString();
                    if (!InputParams.ContainsKey(Name))
                    {
                        InputParams.Add(Name, Value);
                    }
                }
                NewPayLoad ResponsePL       = new NewPayLoad("ScreenShots");
                string     WindowsToCapture = InputParams["WindowsToCapture"];

                List <NewPayLoad> ScreenShots = new List <NewPayLoad>();

                switch (WindowsToCapture)
                {
                case "OnlyActiveWindow":
                    ScreenShots.Add(BitmapToPayload(ScreenshotService.GetActiveScreenImage()));

                    break;

                case "AllAvailableWindows":


                    foreach (Bitmap bmp in ScreenshotService.GetAllScreensImages())
                    {
                        ScreenShots.Add(BitmapToPayload(bmp));
                    }
                    break;

                default:
                    return(NewPayLoad.Error("Service is not supporting IScreenShotService cannot delegate to take screen shot"));
                }



                Bitmap img = ScreenshotService.GetActiveScreenImage();


                ResponsePL.AddListPayLoad(ScreenShots);
                ResponsePL.ClosePackage();
                return(ResponsePL);
            }

            NewPayLoad err2 = NewPayLoad.Error("Service is not supporting IScreenShotService cannot delegate to take screen shot");

            return(err2);
        }
Exemple #3
0
        private NewPayLoad Reserve(NewPayLoad pl)
        {
            Guid sessionID = pl.GetGuid();

            if (sessionID.Equals(mSessionID))
            {
                return(new NewPayLoad("Connected", "OK"));
            }
            return(NewPayLoad.Error("Bad Session ID: " + sessionID));
        }
Exemple #4
0
        private NewPayLoad RunPlatformAction(NewPayLoad payload)
        {
            // GingerNode needs to remain generic so we have one entry point and delagate the work to the platform handler
            if (mService is IPlatformService platformService)
            {
                NodePlatformAction nodePlatformAction = payload.GetJSONValue <NodePlatformAction>();
                nodePlatformAction.Output = new NodeActionOutput();
                // Verify platformActionData is valid !!!

                platformService.PlatformActionHandler.HandleRunAction(platformService, ref nodePlatformAction);

                NewPayLoad actionResult = CreateActionResult(nodePlatformAction.exInfo, nodePlatformAction.error, nodePlatformAction.Output.OutputValues);
                return(actionResult);
            }

            NewPayLoad err2 = NewPayLoad.Error("RunPlatformAction: service is not supporting IPlatformService cannot delegate to run action ");

            return(err2);
        }