private void SunfrogUploader_Load(object sender, EventArgs e) { string filePath = Directory.GetCurrentDirectory() + Settings.Default.SunfrogConfig; if (File.Exists(filePath)) { SunfrogConfig config = SettingUtil.LoadSunfrogInfo <SunfrogConfig>(filePath); if (config != null) { sunfrogConfig = config; tbVpsName.Text = config.SFAcc; tbPass.Text = FileUtil.Decrypt(config.SFPass); numStart.Value = config.StartRange; numEnd.Value = config.EndRange; tbContent.Text = config.Content; tbLogo.Text = config.Logo; } } }
private void btnSaveAcc_Click(object sender, EventArgs e) { btnSaveAcc.Enabled = false; try { string filePath = Directory.GetCurrentDirectory() + Settings.Default.SunfrogConfig; if (!Directory.Exists(Path.GetDirectoryName(filePath))) { Directory.CreateDirectory(Path.GetDirectoryName(filePath)); } SunfrogConfig config = new SunfrogConfig(tbVpsName.Text.Trim(), FileUtil.Encrypt(tbPass.Text.Trim()), (int)numStart.Value, (int)numEnd.Value, tbLogo.Text.Trim(), tbContent.Text.Trim(), chbAutologo.Checked, chbSaveDb.Checked); SettingUtil.SaveSunfrogInfo(filePath, config); sunfrogConfig = config; MessageBox.Show("Saved!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } btnSaveAcc.Enabled = true; }