Main.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using CommonTool;
  11. namespace SysConfigTool
  12. {
  13. public partial class XyhConfigTool : UserControl
  14. {
  15. private readonly string _fileName;
  16. private readonly string _fileCode;
  17. public XyhConfigTool()
  18. {
  19. InitializeComponent();
  20. _fileName = "RSDB.cfg";
  21. _fileCode = "qwertyuiopasdfgh";
  22. string path = Environment.CurrentDirectory;
  23. string filePath = path.Substring(0, path.IndexOf("\\bin", StringComparison.Ordinal));
  24. FileFuns.AddSeachingFolder(filePath);
  25. txt.Text = ReadConfig();
  26. }
  27. private void btn_read_Click(object sender, EventArgs e)
  28. {
  29. txt.Text = ReadConfig();
  30. }
  31. private void btn_save_Click(object sender, EventArgs e)
  32. {
  33. FileFuns.SaveConnectionString(txt.Text);
  34. }
  35. private string ReadConfig()
  36. {
  37. return FileFuns.ReadEncryptedFile(_fileName, _fileCode);
  38. }
  39. }
  40. }