Example #1
0
        /// <summary>
        /// エントリーポイント
        /// </summary>
        /// <param name="args">コマンドライン引数配列</param>
        //******************************************************************************
        public void Start(string[] args)
        {
            // ログ用メソッド名
            string strMethodName = "Start";
            bool   bRet          = true;

            try
            {
                // 処理開始ログ出力
                this._comLgc.WriteLog(strMethodName + "開始");

                // パラメータが無い場合
                if (args.Length == 0)
                {
                    // 画面起動
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1(this._comLgc));
                    return;
                }

                // ロボコピー実行クラス
                ExecRobocopy execRobocopy = new ExecRobocopy(this._comLgc, args);
                bRet = execRobocopy.ExecMain();
                if (!bRet)
                {
                    // 処理なし
                }
            }
            catch (Exception ex)
            {
                this._comLgc.WriteLog(ex.Message + ex.StackTrace);
            }
            finally
            {
                this._comLgc.WriteLog(strMethodName + "終了");
            }
        }
Example #2
0
        /// <summary>
        /// 実行ボタン押下イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btExec_Click(object sender, EventArgs e)
        {
            // ログ用メソッド名
            string strMethodName = "btExec_Click";
            bool   bRet          = true;

            this._comLgc.WriteLog(strMethodName + "開始");

            lbStatus.Text = "処理中";

            try
            {
                // テキストボックス設定値取得
                execRbcpy.ColSrcPathAry  = tbColSrcPathList.Text.Split(',');
                execRbcpy.ColDstPathAry  = tbColDstPathList.Text.Split(',');
                execRbcpy.RbcpyOpt       = tbRobocopyOpt.Text;
                execRbcpy.IsOutDetailLog = cbIsOutDetailLog.Checked;

                // 実行メインメソッド使用
                bRet = execRbcpy.ExecMain();
                if (!bRet)
                {
                    MessageBox.Show(string.Format("エラーが発生しました{0}ログを確認してください", Environment.NewLine));
                }
            }
            catch (Exception ex)
            {
                this._comLgc.WriteLog(ex.Message + ex.StackTrace);
                MessageBox.Show(string.Format("【エラー】{0}{1}", Environment.NewLine, ex.Message + ex.StackTrace));
            }
            finally
            {
                this._comLgc.WriteLog(strMethodName + "終了");
                lbStatus.Text = "処理終了";
            }
        }