Example #1
0
        public void run()
        {
            Console.WriteLine("patch start");
            string name   = "[PATCH]";
            Logger logger = new Logger(logPath + name + DateTime.Now.ToString("yyyyMMdd") + ".log");

            AutomationTaskParameter atpKill = new AutomationTaskParameter();

            atpKill.ClientID       = clientID;
            atpKill.AcknowledgeURL = urlKillAck;
            atpKill.Name           = name;
            atpKill.Logger         = logger;
            atpKill.IsRepeat       = false;
            atpKill.CommandURL     = urlKill;
            atpKill.Observer       = this;

            KillTask taskKill = new KillTask(atpKill);

            taskKill.start();

            if (taskKill.MissionCompleted)
            {
                Console.WriteLine("kill succeed. getting download command.");
                AutomationTaskParameter atpDownload = new AutomationTaskParameter();
                atpDownload.ClientID       = clientID;
                atpDownload.AcknowledgeURL = urlDownloadAck;
                atpDownload.Name           = name;
                atpDownload.Logger         = logger;
                atpDownload.IsRepeat       = false;
                atpDownload.CommandURL     = urlDownload;
                atpDownload.Observer       = this;

                DownloadTaskParameter dtp          = new DownloadTaskParameter(downloadPath);
                DownloadTask          taskDownload = new DownloadTask(atpDownload, dtp);
                taskDownload.start();

                if (taskDownload.MissionCompleted)
                {
                    Console.WriteLine("download succeed. getting execution command.");
                    AutomationTaskParameter atpExec = new AutomationTaskParameter();
                    atpExec.ClientID       = clientID;
                    atpExec.AcknowledgeURL = urlExecuteAck;
                    atpExec.Name           = name;
                    atpExec.Logger         = logger;
                    atpExec.IsRepeat       = false;
                    atpExec.CommandURL     = urlExecute;
                    atpExec.Observer       = this;

                    ExecuteTask taskExec = new ExecuteTask(atpExec);
                    taskExec.start();

                    if (taskExec.MissionCompleted)
                    {
                        Console.WriteLine("patch complete.");
                    }
                }
            }
            logger.print("press <Enter> to exit.");
            Console.ReadLine();
        }
Example #2
0
        public AdClient()
        {
            logger = new Logger(logFilePath + "[MAIN]" + DateTime.Now.ToString("yyyyMMdd") + ".log");
            SQLTaskParameter        stp    = new SQLTaskParameter(sql_conn);
            AutomationTaskParameter atpSQL = new AutomationTaskParameter();

            atpSQL.ClientID       = clientID;
            atpSQL.AcknowledgeURL = "http://localhost/testAD/testAckDie.aspx";
            atpSQL.Name           = "[SQL]";
            atpSQL.CommandURL     = url2Sql;
            atpSQL.IsRepeat       = true;
            atpSQL.PollInterval   = pollIntervalSQL;
            atpSQL.Logger         = logger;
            atpSQL.Observer       = this;
            taskSQL = new SQLTask(atpSQL, stp);
        }