Beispiel #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Setting(Setting setting)
        {
            // コピーを作成
            this.MaxReadSize        = setting.MaxReadSize;
            this.MaxCharacterLength = setting.MaxCharacterLength;
            this.MaxLineLength      = setting.MaxLineLength;
            this.FontColor          = setting.FontColor;
            this.BackColor          = setting.BackColor;
            this.TextBoxFont        = setting.TextBoxFont;

            this.AutoCharacterEncoding   = setting.AutoCharacterEncoding;
            this.ManualCharacterEncoding = setting.ManualCharacterEncoding;
            this.OnlyPostscriptMode      = setting.OnlyPostscriptMode;

            this.IsSaveHistory   = setting.IsSaveHistory;
            this.IsShowStatusBar = setting.IsShowStatusBar;

            // カラーパターン
            this.IsUseColor    = setting.IsUseColor;
            this.ColorPatterns = new List <ColorPattern>(setting.ColorPatterns);

            // フィルタ
            this.IsUseFilter    = setting.IsUseFilter;
            this.FilterPatterns = new List <FilterPattern>(setting.FilterPatterns);

            // アラートメール
            this.IsUseAlertMail = setting.IsUseAlertMail;
            this.MailPatterns   = new List <MailPattern>(setting.MailPatterns);
            // SMTPの設定のコピー (NULLならNULLになる)
            this.smtpSetting = SmtpMailProvider.GetSmtpMailProvider(setting.smtpSetting);
        }
Beispiel #2
0
        /// <summary>
        /// インスタンスのコピー
        /// </summary>
        /// <param name="provider"></param>
        /// <returns></returns>
        public static SmtpMailProvider GetSmtpMailProvider(SmtpMailProvider provider)
        {
            if (provider == null)
            {
                return(null);
            }

            return(new SmtpMailProvider(provider.Server, provider.Port, provider.Userid, provider.Password, provider.SSL, provider.EmailAddress));
        }
Beispiel #3
0
        /// <summary>
        /// 設定を読み込む
        /// </summary>
        /// <returns></returns>
        public static Setting LoadSetting()
        {
            Setting setting = new Setting();

            try
            {
                setting.MaxReadSize        = Properties.Settings.Default.MaxReadSize;
                setting.MaxCharacterLength = Properties.Settings.Default.MaxCharacterLength;
                setting.MaxLineLength      = Properties.Settings.Default.MaxLineLength;

                setting.FontColor   = Properties.Settings.Default.FontColor;
                setting.BackColor   = Properties.Settings.Default.BackColor;
                setting.TextBoxFont = Properties.Settings.Default.TextBoxFont;

                int codepage = Properties.Settings.Default.ManualCharacterEncoding;
                setting.ManualCharacterEncoding = codepage != 0 ? Encoding.GetEncoding(codepage) : null;
                setting.OnlyPostscriptMode      = Properties.Settings.Default.OnlyPostscriptMode;

                setting.IsSaveHistory   = Properties.Settings.Default.SaveHistory;
                setting.IsShowStatusBar = Properties.Settings.Default.ShowStatusBar;

                // 正規表現色塗り
                setting.IsUseColor = Properties.Settings.Default.IsUseColorPattern;
                string colorxml = Properties.Settings.Default.ColorPatterns;
                setting.ColorPatterns = DeserializeList <List <ColorPattern> >(colorxml);

                // 正規表現フィルター
                setting.IsUseFilter = Properties.Settings.Default.IsUseFilterPattern;
                string filterxml = Properties.Settings.Default.FilterPatterns;
                setting.FilterPatterns = DeserializeList <List <FilterPattern> >(filterxml);

                // 正規表現アラートメール
                setting.IsUseAlertMail = Properties.Settings.Default.IsUseAlertMail;
                string mailxml = Properties.Settings.Default.MailPatterns;
                setting.MailPatterns = DeserializeList <List <MailPattern> >(mailxml);

                // メールサーバ設定の読込
                string server   = Properties.Settings.Default.MailServer;
                int    port     = Properties.Settings.Default.MailPort;
                bool   ssl      = Properties.Settings.Default.MailServerSSL;
                string userid   = Properties.Settings.Default.MailUserID;
                string password = Properties.Settings.Default.MailPassword;
                string email    = Properties.Settings.Default.EmailAddress;
                setting.smtpSetting = SmtpMailProvider.GetSmtpMailProvider(server, port, userid, password, ssl, email);

                return(setting);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(setting);
            }
        }
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="mailPattern"></param>
 /// <param name="smtp"></param>
 public AlertMailTask(List <MailPattern> mailPattern, SmtpMailProvider smtp)
 {
     this.mailPatterns = mailPattern;
     this.smtp         = smtp;
 }