Techblox Mod Manager / Launcher
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

65 satır
2.0KB

  1. using GCMM.Properties;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Text.RegularExpressions;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace GCMM
  14. {
  15. public partial class SettingsForm : Form
  16. {
  17. private MainForm mainForm;
  18. private bool autopatchingEnabled;
  19. public SettingsForm()
  20. {
  21. InitializeComponent();
  22. }
  23. private void Form1_Load(object sender, EventArgs e)
  24. {
  25. gamelocation.Text = Settings.Default.GamePath;
  26. useProxy.Checked = Settings.Default.UseProxy;
  27. mainForm = Owner as MainForm;
  28. autopatchingEnabled = Settings.Default.SteamUserID != 0 && mainForm.UpdateOrGetSteamConfigToAutoStart(null);
  29. autopatching.Checked = autopatchingEnabled;
  30. }
  31. private void browsebtn_Click(object sender, EventArgs e)
  32. {
  33. gamelocation.Text = mainForm.SelectGameFolder() ?? gamelocation.Text;
  34. }
  35. private void savebtn_Click(object sender, EventArgs e)
  36. {
  37. Settings.Default.GamePath = gamelocation.Text;
  38. Settings.Default.UseProxy = useProxy.Checked;
  39. if (autopatching.Checked != autopatchingEnabled)
  40. {
  41. if (autopatching.Checked && Settings.Default.SteamUserID == 0)
  42. {
  43. var (steamPath, user) = mainForm.GetSteamLocationAndUser();
  44. if (user != 0)
  45. mainForm.DetectConfigLocationAndAutoStart(steamPath, ref user);
  46. Settings.Default.SteamUserID = user; //If it's 0 then it's no change
  47. }
  48. else
  49. mainForm.UpdateOrGetSteamConfigToAutoStart(autopatching.Checked);
  50. }
  51. Settings.Default.Save();
  52. Close();
  53. }
  54. private void cancelbtn_Click(object sender, EventArgs e)
  55. {
  56. Close();
  57. }
  58. }
  59. }