コード例 #1
0
ファイル: Config.cs プロジェクト: kakapi/ShotLifeSln
        public Config()
        {
            InitializeComponent();
            BindFrequency();
            BindPixelFormat();
             cbxAutoRun.Checked = IsSubValueExist();

               // ControlCollection cols = new ControlCollection(this);
            GetChildControl(this);
            System.Collections.ArrayList excludedControls = new System.Collections.ArrayList();
            excludedControls.Add(cbxAutoRun);
            foreach (object o in array)
            {
                Control c = (Control)o;

                if (excludedControls.Contains(c))
                {
                    continue;
                }
                if (c.GetType().Equals(typeof(TextBox)))
                {
                    c.TextChanged +=new EventHandler(SaveControlValue);
                    string propValue=(string) Properties.Settings.Default[c.Name.TrimStart("tbx".ToCharArray())];
                    if (c.Name.ToLower().IndexOf("password") >= 0)
                    {
                        if (!string.IsNullOrEmpty(propValue))
                        {
                            PHComponents.SCCrypto scc = new PHComponents.SCCrypto();
                            propValue = scc.Decrypting(propValue);
                        }
                    }
                    c.Text = propValue;

                }
                if (c.GetType().Equals(typeof(CheckBox)))
                {
                    ((CheckBox)c).CheckedChanged += new EventHandler(SaveControlValue);
                    ((CheckBox)c).Checked=Convert.ToBoolean(Properties.Settings.Default[c.Name.TrimStart("cbx".ToCharArray())]);
                }

            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: kakapi/ShotLifeSln
 private void SaveSettings(string propName, string value, bool encrypt)
 {
     PHComponents.SCCrypto c=new PHComponents.SCCrypto();
     if (encrypt)
     {
         value = c.Encrypting(value);
     }
     Properties.Settings.Default[propName] = value;
     Properties.Settings.Default.Save();
 }
コード例 #3
0
ファイル: Main.cs プロジェクト: kakapi/ShotLifeSln
        private void SendMail(string wholeFileName)
        {
            SmtpClient smtp = new SmtpClient();

            smtp.Host = GetSettingsValue("SmtpServer");
            PHComponents.SCCrypto crypt = new PHComponents.SCCrypto();
            //
            smtp.Credentials = new NetworkCredential(GetSettingsValue("MailUserName"),crypt.Decrypting(GetSettingsValue("MailPassword")));
            //    smtp.Credentials = new NetworkCredential(GetSettingsValue("MailUserName"), GetSettingsValue("MailPassword"));

            MailMessage mail = new MailMessage(GetSettingsValue("MailTo"), GetSettingsValue("MailTo"), "ShotLife", "ShotLife");
            Attachment file = new Attachment(wholeFileName);
            mail.Attachments.Add(file);
            smtp.Send(mail);
        }