📄 entrypointcontrol.cs
字号:
}
return true;
}
private void Child_KeyPress(object sender, KeyPressEventArgs e)
{
this.InnerOnKeyPress(e);
}
private void cmbId_TextChanged(object sender, EventArgs e)
{
if (!this._suspendIdChanged)
{
try
{
this.TryFillRelatedInfo();
this.EnableControls(this.cmbId.Enabled);
}
catch
{
}
}
}
private static int CompareIds(string id1, string id2)
{
if (id1.Length < 11)
{
if (id2.Length == 11)
{
return 1;
}
}
else if (id2.Length < 11)
{
return -1;
}
return string.Compare(id1, id2);
}
private bool CompareWithOldPassword()
{
bool flag;
XPasswordEdit.DlgtEncryptString doEncrypt = this.tbPassword.DoEncrypt;
try
{
this.tbPassword.DoEncrypt = new XPasswordEdit.DlgtEncryptString(this.HashWithOldNonce);
string b = this.tbPassword.GetHashPassword();
flag = string.Equals(this.currentAd.Password, b);
}
catch
{
flag = false;
}
finally
{
this.tbPassword.DoEncrypt = doEncrypt;
}
return flag;
}
private void CurrentUser_AutoLoginFailed(object sender, ImpsErrorEventArgs e)
{
if (this.btnLogin.Text == StringTable.EP_BtnCancel)
{
this.StartReconnect();
}
}
private void CurrentUser_LoginStepChanged(object sender, EventArgs e)
{
try
{
this.UpdateStepLabelText(this._manager.CurrentUser.LoginStep);
}
catch
{
}
}
private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
{
try
{
switch (e.NewStatus)
{
case UserAccountStatus.Initialized:
this.btnLogin.Text = StringTable.EP_BtnLogin;
this.EnableControls(true);
this.ShowNetworkSetting(true);
goto Label_0198;
case UserAccountStatus.Loginning:
this.btnLogin.Text = StringTable.EP_BtnCancel;
this.EnableControls(false);
this.ShowNetworkSetting(true);
goto Label_0198;
case UserAccountStatus.Logon:
this.autoReconnect.StopTimer(true);
if (!this.rbPublic.Checked && this.cbSaveAccount.Checked)
{
break;
}
this.cmbId.Text = string.Empty;
this.tbPassword.Text = string.Empty;
goto Label_0141;
case UserAccountStatus.Logouting:
this.TryLoadPortrait(this.cmbId.Text);
this.ShowNetworkSetting(true);
this.UpdateStepLabelText(string.Empty);
goto Label_0198;
case UserAccountStatus.Disconnected:
this.btnLogin.Text = StringTable.EP_BtnCancel;
this.EnableControls(false);
this.ShowNetworkSetting(false);
this.StartReconnect();
goto Label_0198;
case UserAccountStatus.WaitReconnect:
this.EnableControls(false);
this.ShowNetworkSetting(false);
this.btnLogin.Text = StringTable.EP_BtnCancel;
this.AR_OnTick(this, null);
goto Label_0198;
default:
this.btnLogin.Text = StringTable.EP_BtnLogin;
this.UpdateStepLabelText(string.Empty);
this.EnableControls(true);
this.ShowNetworkSetting(true);
goto Label_0198;
}
if (!this.cbSavePassword.Checked)
{
this.tbPassword.Text = string.Empty;
}
else
{
this.cbAutoLogin.Checked = UserAccounts.LatestAccountAutoLogin;
}
Label_0141:
this.ShowNetworkSetting(true);
Label_0198:
this._suspendIdChanged = false;
}
catch (Exception exception)
{
UiErrorHelper.HandExceptionSafely(this._manager.FrameworkWnd, exception);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void DoLocalize()
{
this.btnLogin.Text = StringTable.EP_BtnLogin;
}
internal bool DoLogin()
{
return this.DoLogin(false);
}
private bool DoLogin(bool auto)
{
try
{
long id;
string password;
if (!this.CheckInput(out id, out password))
{
return false;
}
NotifyWindowManager.Clear();
this.btnLogin.Focus();
this.cmbId.Select(0, 0);
if (this._initPresence == MainPresence.OfflineLogin)
{
try
{
this.currentAd = UserAccounts.GetAccount(id.ToString());
if (this.currentAd == null)
{
this._manager.FrameworkWnd.UnifiedMessageBox.ShowWarning(StringTable.User.MsgConnectSeverValidate);
return false;
}
if (!string.Equals(password, this.currentAd.Password) && !this.CompareWithOldPassword())
{
this._manager.FrameworkWnd.UnifiedMessageBox.ShowWarning(StringTable.User.MsgUnauthorization);
return false;
}
}
catch
{
return false;
}
finally
{
this.currentAd = null;
}
}
this._manager.LoginAs(id, password, this._initPresence, auto);
string text = this.cmbId.Text;
bool flag = this.rbPrivate.Checked && this.cbSaveAccount.Checked;
this._manager.CurrentUser.Configuration.UserSetting.SaveMyInfo = flag;
if (flag)
{
string pass = this.cbSavePassword.Checked ? this.tbPassword.Text : string.Empty;
UserAccounts.AccountData data = new UserAccounts.AccountData(text, pass, this.cbAutoLogin.Checked, this._initPresence);
UserAccounts.LastestAccount = data;
if (!this.cmbId.Items.Contains(text))
{
int index = this.FindInsertIndexOfId(text);
if (index < 0)
{
this.cmbId.Items.Add(text);
}
else
{
this.cmbId.Items.Insert(index, text);
}
}
}
else
{
UserAccounts.LastestAccount = null;
UserAccounts.EraseAccountElement(text);
UserAccounts.LatestId = string.Empty;
UserAccounts.SaveToLocal();
this._suspendIdChanged = true;
this.cmbId.Items.Remove(text);
if (this.cmbId.Text.Length <= 0)
{
this.cmbId.Text = text;
}
this._suspendIdChanged = false;
}
return true;
}
catch (Exception exception)
{
this._manager.FrameworkWnd.UnifiedMessageBox.ShowException(exception);
ClientLogger.WriteException(exception);
return false;
}
}
private void DoLoginOrCancel()
{
if (this.btnLogin.Text == StringTable.EP_BtnLogin)
{
this.DoLogin();
}
else
{
this.CancelLogin();
this.ShowNetworkSetting(true);
}
}
private void EnableControls(bool enabled)
{
this.pbProgress.Visible = !enabled;
this.cmbId.Enabled = enabled;
this.tbPassword.Enabled = enabled;
this.llForgetPass.Enabled = enabled;
this.llNetSetting.Enabled = enabled;
this.llProvisioning.Enabled = enabled;
this.rbPrivate.Enabled = enabled;
this.rbPublic.Enabled = enabled;
enabled = enabled && this.rbPrivate.Checked;
this.cbSaveAccount.Enabled = enabled;
this.llEraseInfo.Enabled = enabled;
this.cbSavePassword.Enabled = enabled;
this.cbAutoLogin.Enabled = enabled;
this.InitStatus.Enabled = this.tbPassword.Enabled;
this.bDisplayHelp.Enabled = enabled;
}
private void EntryPointControl_SizeChanged(object sender, EventArgs e)
{
this.RearrangeControls();
}
internal void FillUserIdAndPassword(string id, string pass)
{
if (!FuncLimitedSetting.SSIEncryptLoginLimited)
{
this.cmbId.Text = id;
this.tbPassword.Text = this._manager.CurrentUser.HashPassword(Encoding.UTF8.GetBytes(pass));
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -