コード例 #1
0
        public void SendStatus(object sender, System.Timers.ElapsedEventArgs args)
        {
            eventLog.WriteEntry("Tick started", EventLogEntryType.Information);
            try {
                dynamic result = SendStatus();
                if (result == null)
                {
                    return;
                }
                if (result.command == null)
                {
                    return;
                }

                string message = result.message != null ? $"-m {result.message}" : "";

                eventLog.WriteEntry($"Starting process for {result.command}\n-c {result.command} {message}");

                ProcessCreator processCreator = new ProcessCreator();
                processCreator.createProcess(WORKING_DIR + WORKER_EXECUTABLE_NAME, $"-c {result.command} {message}");
            } catch (Exception ex) {
                eventLog.WriteEntry($"Tick failed: {ex.Message} {ex.StackTrace}", EventLogEntryType.Error);
            }
            eventLog.WriteEntry("Tick finished", EventLogEntryType.Information);
        }