Example #1
0
        /// <summary>
        /// This takes care of executing any operation received by the server.
        /// </summary>
        /// <param name="operation"></param>
        public void RunOperation(ISofOperation operation)
        {
            var rvOperation = new RvSofOperation(operation.RawOperation);

            switch (rvOperation.Type)
            {
            case OperationValue.InstallWindowsUpdate:
                rvOperation.Api  = ApiCalls.RvInstallWinUpdateResults();
                rvOperation.Type = OperationValue.InstallWindowsUpdate;
                InstallWindowsUpdate(rvOperation);
                break;

            case OperationValue.InstallSupportedApp:
                rvOperation.Api  = ApiCalls.RvInstallSupportedAppsResults();
                rvOperation.Type = OperationValue.InstallSupportedApp;
                InstallSupportedApplication(rvOperation);
                break;

            case OperationValue.InstallCustomApp:
                rvOperation.Api  = ApiCalls.RvInstallCustomAppsResults();
                rvOperation.Type = OperationValue.InstallCustomApp;
                InstallCustomApplication(rvOperation);
                break;

            case OperationValue.InstallAgentUpdate:
                rvOperation.Api  = ApiCalls.RvInstallAgentUpdateResults();
                rvOperation.Type = OperationValue.InstallAgentUpdate;
                InstallAgentUpdate(rvOperation);
                break;

            case OperationValue.Uninstall:
                rvOperation.Api  = ApiCalls.RvUninstallOperation();
                rvOperation.Type = OperationValue.Uninstall;
                UninstallOperation(rvOperation);
                break;

            case OperationValue.AgentUninstall:
                rvOperation.Type = OperationValue.AgentUninstall;
                UninstallRvAgentOperation();
                break;

            case RvOperationValue.UpdatesAndApplications:
                rvOperation.Type      = RvOperationValue.UpdatesAndApplications;
                rvOperation           = UpdatesApplicationsOperation(rvOperation);
                rvOperation.RawResult = RvFormatter.Applications(rvOperation);
                rvOperation.Api       = ApiCalls.RvUpdatesApplications();
                SendResults(rvOperation);
                break;

            case OperationValue.ResumeOp:
                ResumeOperations();
                break;

            default:
                Logger.Log("Received unrecognized operation. Ignoring.");
                break;
            }
        }
Example #2
0
        /// <summary>
        /// On every agent startup, this method runs to send the first data collection to the server.
        /// </summary>
        /// <returns></returns>
        public ISofOperation InitialData()
        {
            var operation = new RvSofOperation();

            //If some operations are left over, do not send UpdatesApplications.
            if (Operations.OperationsRemaining())
            {
                return(null);
            }

            Logger.Log("Preparing initial data.", LogLevel.Debug);

            operation.Type         = RvOperationValue.UpdatesAndApplications;
            operation.Applications = NewUpdatesAndApplications();
            operation.RawResult    = RvFormatter.Applications(operation);
            Logger.Log("Done.", LogLevel.Debug);
            return(operation);
        }