public SendForm(Config pcConfig) { InitializeComponent(); mcConfig = pcConfig; Location = mcConfig.LocationSendForm; Width = mcConfig.WidthSendForm; Height = mcConfig.HeightSendForm; }
public ConfigurationForm(Config pcConfig) { InitializeComponent(); mcConfig = pcConfig; Location = mcConfig.LocationConfiguration; GetConfig(mcConfig); buttonAccept.Enabled = false; }
internal static bool SaveConfig(Config pcConfig, byte[] pbKey) { if (pbKey.Length != 32) return false; try { Rijndael lrCrypto = Rijndael.Create(); lrCrypto.KeySize = 256; lrCrypto.IV = Encoding.ASCII.GetBytes("nepochalnepochal"); lrCrypto.Key = pbKey; string lsFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Memo-Mail"); if (!Directory.Exists(lsFilePath)) Directory.CreateDirectory(lsFilePath); lsFilePath = Path.Combine(lsFilePath, "Config.ini"); FileStream lfsFile = new FileStream(lsFilePath, FileMode.Create, FileAccess.Write); CryptoStream lcsEncrypt = new CryptoStream(lfsFile, lrCrypto.CreateEncryptor(), CryptoStreamMode.Write); StreamWriter lswWriter = new StreamWriter(lcsEncrypt, Encoding.Unicode); XmlSerializer lxsSerializer = new XmlSerializer(typeof(Config)); lxsSerializer.Serialize(lswWriter, pcConfig); lswWriter.Flush(); lswWriter.Close(); lswWriter.Dispose(); lfsFile.Dispose(); return true; } catch (Exception) { return false; } }
private void buttonAccept_Click(object sender, EventArgs e) { if (!CheckSettings()) System.Media.SystemSounds.Exclamation.Play(); else { byte[] lbKey = Common.CreateKey(); mcConfig = SetConfig(); if (Config.SaveConfig(mcConfig, lbKey)) { buttonAccept.Enabled = false; } } }
public ConfigurationForm() { InitializeComponent(); mcConfig = new Config(); Location = mcConfig.LocationConfiguration; }
private void GetConfig(Config pcConfig) { textBoxFrom.Text = pcConfig.From; textBoxHeader.Text = pcConfig.Header; textBoxPassword.Text = pcConfig.Password; numericUpDownSmtpPort.Value = pcConfig.Port; textBoxPopMail.Text = pcConfig.ReceiverAddress; textBoxSmtpMail.Text = pcConfig.SmtpAddress; textBoxServer.Text = pcConfig.SmtpServer; textBoxUsername.Text = pcConfig.Username; checkBoxAlwaysUseDefault.Checked = pcConfig.AlwaysUseDefaultheader; checkBoxSendformForeground.Checked = pcConfig.SendFormForeground; checkBoxSendDoubleEnter.Checked = pcConfig.SendMailOnDoubleEnter; checkBoxClipboard2Mail.Checked = pcConfig.Clipboard2Mail; }
private void ToolStripMenuItemConfigWizard_Click(object sender, EventArgs e) { ConfigWizard.Wizard lwWizard = new ConfigWizard.Wizard(); if (lwWizard.ShowDialog() == System.Windows.Forms.DialogResult.OK) mcConfig = lwWizard.Config; }
private void ToolStripMenuItemConfiguration_Click(object sender, EventArgs e) { ConfigurationForm lcConfiguration = new ConfigurationForm(mcConfig); lcConfiguration.ShowDialog(this); mcConfig = lcConfiguration.Config; TopMost = mcConfig.SendFormForeground; }
public Shortcuts(Config pcConfig) { InitializeComponent(); Location = pcConfig.LocationHelp; }