Exemple #1
0
        /// <summary>
        /// ログファイルを開く
        /// </summary>
        /// <param name="file"></param>
        private void readLogFile(string file)
        {
            // コントロール初期化
            this.initControl();

            // ファイルチェック
            if (File.Exists(file))
            {
                // カウント数
                long size = new FileInfo(file).Length;

                if (size < 0)
                {
                    MessageBox.Show(Properties.Resources.ErrorMessageFileReadError, Properties.Resources.ErrorMessageBoxTitle,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // ファイル履歴処理
                if (this.setting.IsSaveHistory)
                {
                    this.historyCntrol.IntoHistory(file);
                    this.initHistoryMenu();
                }

                // アラートメール有効の場合警告
                if (this.setting.IsUseAlertMail)
                {
                    if (MessageBox.Show(Properties.Resources.noticeAlertMailStart, Properties.Resources.QuestionMessageBoxTitle,
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }

                // エンコーディング判定
                this.setting.AutoCharacterEncoding = ReadTextBinary.GetEncoding(file);
                this.setEncodingStatus();

                this.file          = file;
                this.textBox1.Text = "";

                // 読み込んだファイル名をタイトルに
                this.Text = Path.GetFileName(file) + " - LogLogViewer";

                // 中断ボタンにし、有効にする
                this.isPause = false;
                this.changeReloadMenuIcon(false);
                this.reloadRToolStripMenuItem.Enabled = true;

                // 監視タスクの起動
                this.threadTask();
            }
            else
            {
                MessageBox.Show(Properties.Resources.ErrorMessageFileNotFound, Properties.Resources.ErrorMessageBoxTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }