Browse Source

fix: 第一次启动不提示错误信息

master
niushuai233 3 years ago
parent
commit
bf178b4575
  1. 2
      MainForm.Designer.cs
  2. 3
      MainForm.cs
  3. 1
      Util/CommonUtil.cs
  4. 4
      Util/SteamTwoFactorToken.cs

2
MainForm.Designer.cs generated

@ -185,7 +185,7 @@ namespace steam_token
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Steam令牌计算器"; this.Text = "Steam令牌计算器 v1.0";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.mainForm_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.mainForm_FormClosed);
this.menuStrip.ResumeLayout(false); this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout(); this.menuStrip.PerformLayout();

3
MainForm.cs

@ -23,13 +23,12 @@ namespace steam_token
ConfigUtil.Init(new Config()); ConfigUtil.Init(new Config());
InitializeComponent(); InitializeComponent();
this.timer_time.Start();
while (!ConfigUtil.INIT_SUCCESS) while (!ConfigUtil.INIT_SUCCESS)
{ {
CheckConfig(); CheckConfig();
} }
this.timer_time.Start();
// 新开一个线程去初始化数据 // 新开一个线程去初始化数据
SteamGuardCalcThread.StartThread(this.label_guard, this.progressBar_refresh); SteamGuardCalcThread.StartThread(this.label_guard, this.progressBar_refresh);
} }

1
Util/CommonUtil.cs

@ -11,6 +11,7 @@ namespace steam_token.Util
public class CommonUtil public class CommonUtil
{ {
public static bool FIRST_ENABLE = true;
public static Config GetConfig() public static Config GetConfig()
{ {
return ConfigUtil.Read<Config>(); return ConfigUtil.Read<Config>();

4
Util/SteamTwoFactorToken.cs

@ -46,8 +46,12 @@ namespace steam_token.Util
return true; return true;
} }
catch (Exception) catch (Exception)
{
if (!CommonUtil.FIRST_ENABLE)
{ {
MessageBox.Show("shared_secret值校验失败, 请重新设置"); MessageBox.Show("shared_secret值校验失败, 请重新设置");
}
CommonUtil.FIRST_ENABLE = false;
return false; return false;
} }
} }

Loading…
Cancel
Save