예제 #1
0
        public void Process(DtoHubAction action)
        {
            Logger.Debug("Received Hub Action");
            Logger.Debug(action.Action);
            switch (action.Action)
            {
            case "Collect_Inventory":
                var t = new Thread(RunInventory);
                t.Start();
                break;

            case "Message":
                var message         = JsonConvert.DeserializeObject <DtoMessage>(action.Message);
                var activeTrayPorts = new ServiceSetting().GetSetting("active_login_ports").Value;
                foreach (var port in activeTrayPorts.Split(','))
                {
                    var localPort = port;
                    var m         = new Thread(() => RunMessage(message.Message, message.Title, localPort, message.Timeout));
                    m.Start();
                }
                break;

            case "Force_Checkin":
                var f = new Thread(RunCheckin);
                f.Start();
                break;

            case "Reboot":
                Logger.Info("Server Issued Reboot Request.  Rebooting.");
                var r = new Thread(() => RunReboot(action.Message));
                r.Start();
                break;

            case "Shutdown":
                Logger.Info("Server Issued Shutdown Request.  Shutting Down.");
                var s = new Thread(() => RunShutdown(action.Message));
                s.Start();
                break;

            case "Start_Mesh":
                var sm = new Thread(() => RunStartMesh());
                sm.Start();
                break;

            case "Wol_Task":
                var wolTask = JsonConvert.DeserializeObject <DtoWolTask>(action.Message);
                var w       = new Thread(() => RunWakeup(wolTask));
                w.Start();
                break;

            default:
                Logger.Info("Action Was Not Recognized.");
                break;
            }
        }
예제 #2
0
        public void SendAction(DtoSocketRequest request)
        {
            var action = new DtoHubAction();

            action.Action  = request.action;
            action.Message = request.message;

            var context = GlobalHost.ConnectionManager.GetHubContext <ActionHub>();

            context.Clients.Clients(request.connectionIds).ClientAction(action);
        }
예제 #3
0
        public void Process(DtoHubAction action)
        {
            Logger.Debug("Received Hub Action");
            Logger.Debug(action.Action);
            switch (action.Action)
            {
            case "Collect_Inventory":
                var t = new Thread(RunInventory);
                t.Start();

                break;

            case "Current_Users":
                var cu = new Thread(GetLoggedInUsers);
                cu.Start();
                break;

            case "Get_Status":
                var gs = new Thread(GetStatus);
                gs.Start();
                break;

            case "Message":
                var message         = JsonConvert.DeserializeObject <DtoMessage>(action.Message);
                var activeTrayPorts = new ServiceSetting().GetSetting("active_login_ports").Value;
                foreach (var port in activeTrayPorts.Split(','))
                {
                    var localPort = port;
                    var m         = new Thread(() => RunMessage(message.Message, message.Title, localPort, message.Timeout));
                    m.Start();
                }
                new APICall().PolicyApi.UpdateLastSocketResult(new DtoStringResponse()
                {
                    Value = "Message Sent"
                });
                break;

            case "Force_Checkin":
                var f = new Thread(RunCheckin);
                f.Start();
                break;

            case "Reboot":
                Logger.Info("Server Issued Reboot Request.  Rebooting.");
                var r = new Thread(() => RunReboot(action.Message));
                r.Start();
                break;

            case "Shutdown":
                Logger.Info("Server Issued Shutdown Request.  Shutting Down.");
                var s = new Thread(() => RunShutdown(action.Message));
                s.Start();
                break;

            case "Start_Remote_Control":
                var sm = new Thread(() => RunStartRemoteControl());
                sm.Start();
                break;

            case "Wol_Task":
                var wolTask = JsonConvert.DeserializeObject <DtoWolTask>(action.Message);
                var w       = new Thread(() => RunWakeup(wolTask));
                w.Start();
                break;

            case "Run_Module":
                var policy = JsonConvert.DeserializeObject <DtoClientPolicy>(action.Message);
                var rsm    = new Thread(() => RunSingleModule(policy));
                rsm.Start();
                break;

            case "Logs":
                var logType = action.Message;
                var l       = new Thread(() => SendLog(logType));
                l.Start();
                break;

            default:
                Logger.Info("Action Was Not Recognized.");
                break;
            }
        }