using System; using System.Diagnostics; using System.Windows.Forms; using VictusLauncher.Properties; namespace VictusLauncher { public partial class LauncherForm : Form { public LauncherForm() { InitializeComponent(); UserNameTextBox.TextBox.KeyPress += UserNameTextBox_KeyPress; PasswordTextBox.TextBox.KeyPress += PasswordTextBox_KeyPress; } public void UserNameTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Int32)Keys.Enter && UserNameTextBox.Text != "") { object PasswordTextBox = null; PasswordTextBox.Focus(); e.Handled = true; } } public void PasswordTextBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Int32)Keys.Enter) { if (UserNameTextBox.Text == "") { UserNameTextBox.Focus(); e.Handled = true; return; } if (PasswordTextBox.Text != "") { if (StartButton.Enabled) { StartButton_Click(this, new EventArgs()); } e.Handled = true; } } } protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button != MouseButtons.Left) return; Program.ReleaseCapture(); Program.SendMessage(Handle, 0xA1, 0x2, 0); } protected override void OnShown(EventArgs e) { base.OnShown(e); /* UserNameTextBox.Focus(); */ Int64 tStamp = Timing.GetTimestamp(); while (Timing.DeltaMilliseconds(tStamp, Timing.GetTimestamp()) < 1500) { Application.DoEvents(); } if (!Patch.Start()) { Environment.Exit(0); } } private void StartButton_Click(object sender, EventArgs e) { foreach (Control c in Controls) { c.Enabled = false; } /* String token = WebAuth.GetToken(UserNameTextBox.Text, PasswordTextBox.Text); if (token != null) { */ Patch.PatchHashes(); ProcessStartInfo sInfo = new ProcessStartInfo(".\\Victus.exe"/* , String.Format(Resources.Game_Launch_Arguments, token) */); Process dProcess = new Process { StartInfo = sInfo }; try { if (dProcess.Start()) { Application.Exit(); } else { throw new ApplicationException(); } } catch (Exception ex) { MessageBox.Show(String.Format("{0}{1}{2}", Resources.MessageBox_Message_Error_Launching, Environment.NewLine, ex.Message), Resources.MessageBox_Title_Launcher, MessageBoxButtons.OK, MessageBoxIcon.Error); } /* } */ foreach (Control c in Controls) { c.Enabled = true; } } private void ExitLabel_Click(object sender, EventArgs e) { if (Patch.Web.IsBusy) { DialogResult result = MessageBox.Show(Resources.MessageBox_Message_Exit_Confirm, Resources.MessageBox_Title_Launcher, MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (result) { case DialogResult.No: { return; } } } Environment.Exit(0); } private void Browser_FileDownload(object sender, EventArgs e) { Browser.Visible = true; } } }