Exemple #1
0
        private void testButton_Click(object sender, EventArgs e)
        {
            Log.Logger.Info("テスト実行開始");
            PowerShellExec.Exec(filepathTextBox.Text, paramTextBox.Text);

            _ = MessageBox.Show("実行が完了しました", "結果", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Log.Logger.Info("テスト実行終了");
        }
Exemple #2
0
        private bool cronThread()
        {
            DateTime time = DateTime.Now;

            Log.Logger.Info("監視スレッド起動");

            while (!cancelToken.IsCancellationRequested)
            {
                DateTime now = DateTime.Now;

                if (time.Minute != now.Minute)
                {
                    time = now;

                    List <(string, string)> execList = new List <(string, string)>();

                    lock (configItems)
                    {
                        foreach (ConfigItem item in configItems)
                        {
                            if (item.Enable && CronPattern.IsMatch(item, time))
                            {
                                execList.Add((item.Path, item.Param));
                            }
                        }
                    }

                    foreach ((string, string)exec in execList)
                    {
                        PowerShellExec.Exec(exec.Item1, exec.Item2);
                    }
                }

                Thread.Yield();
                Thread.Sleep(100);
            }

            Log.Logger.Info("監視スレッド終了");
            return(true);
        }