public static void UpdateLocalDat(LocalDatFile file) { try { if (!file.IsUpToDate) { Apply(file); Process pro = new Process { StartInfo = new ProcessStartInfo { FileName = EnviromentManager.GwClientExePath } }; pro.Start(); pro.WaitForInputIdle(); Action waitforlaunch = () => ModuleReader.WaitForModule("WINNSI.DLL", pro); Helpers.BlockerInfo.Run("Loginfile Update", "Launchbuddy is updating an outdated Loginfile", waitforlaunch); pro.Kill(); Action waitforlock = () => WaitForLoginfileRelease(file); Helpers.BlockerInfo.Run("Loginfile Update", "Launchbuddy is waiting for Gw2 to save the updated loginfile.", waitforlock); WaitForFileAccess(); ToDefault(); file.gw2build = Api.ClientBuild; } } catch (Exception e) { throw new Exception("An error occured when Updating the Login file. " + e.Message); } }
public static void PressLoginButton(Account acc) { ModuleReader.WaitForModule("WINNSI.DLL", acc.Client.Process); Thread.Sleep(1500); PressKeyDown(Keys.Enter, acc.Client.Process); PressKeyUp(Keys.Enter, acc.Client.Process); }
public static void Login(string email, string passwd, Process pro, bool clearfields = false) { ModuleReader.WaitForModule("WINNSI.DLL", pro); //SetForegroundWindow(pro.MainWindowHandle); Thread.Sleep(1000); for (int i = 0; i < 100; i++) { PressKeyDown(Keys.Back, pro, false); //Very unclean method, but modifiers onyl work on focus } Thread.Sleep(50); TypeString(email, pro); PressKeyDown(Keys.Tab, pro); TypeString(passwd, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Enter, pro); }
public static void Login(Account acc, bool clearfields = false) { ModuleReader.WaitForModule("WINNSI.DLL", acc.Client.Process); Process pro = acc.Client.Process; //SetForegroundWindow(pro.MainWindowHandle); TypeString(acc.Settings.Email, pro); PressKeyDown(Keys.Tab, pro); TypeString(acc.Settings.Password, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Tab, pro); PressKeyDown(Keys.Enter, pro); Thread.Sleep(5000); PressKeyDown(Keys.Enter, pro); PressKeyUp(Keys.Enter, pro); }
public static LocalDatFile CreateNewFile(string filename) { LocalDatFile datfile = new LocalDatFile(); string filepath = EnviromentManager.LBLocaldatsPath + filename + ".dat"; datfile.gw2build = Api.ClientBuild; datfile.Path = filepath; Process pro = new Process { StartInfo = new ProcessStartInfo(EnviromentManager.GwClientExePath) }; pro.Start(); Action blockefunc = () => ModuleReader.WaitForModule("DPAPI.dll", pro, null); Helpers.BlockerInfo.Run("Loginfile Creation", "Please check remember email/password and press the login and play button. This window will be closed automatically on success.", blockefunc); if (!Helpers.BlockerInfo.Done) { MessageBox.Show("No Clean Login. Loginfile might be not set correctly! Proceed with caution."); } Thread.Sleep(100); int ct = 0; bool exists = true; while (exists && ct < 100) { try { pro.CloseMainWindow(); Process.GetProcessById(pro.Id); exists = true; Thread.Sleep(100); ct++; } catch { exists = false; } } try { pro.Kill(); } catch { } try { #if DEBUG Console.WriteLine("Login data Hash: " + filename + ": " + datfile.MD5HASH); #endif if (File.Exists(filepath)) { File.Delete(filepath); } File.Copy(EnviromentManager.GwLocaldatPath, filepath); datfile.Valid = true; return(datfile); } catch (Exception e) { MessageBox.Show("Error: The Gameclient did not create a valid Login data file. " + e.Message); datfile.Valid = false; return(datfile); } }
public static LocalDatFile CreateNewFileAutomated(string filename, string email, string passwd) { LocalDatFile datfile = new LocalDatFile(); string filepath = EnviromentManager.LBLocaldatsPath + filename + ".dat"; datfile.gw2build = Api.ClientBuild; datfile.Path = filepath; Process pro = new Process { StartInfo = new ProcessStartInfo(EnviromentManager.GwClientExePath) }; pro.Start(); Action blockefunc = () => ModuleReader.WaitForModule("WINNSI.DLL", pro, null); Helpers.BlockerInfo.Run("Loginfile Creation", "LB is recreating your loginfile", blockefunc); if (!Helpers.BlockerInfo.Done) { MessageBox.Show("No Clean Login. Loginfile might be not set correctly! Proceed with caution."); } Thread.Sleep(100); Loginfiller.Login(email, passwd, pro, true); Thread.Sleep(250); blockefunc = () => ModuleReader.WaitForModule("DPAPI.dll", pro, null); Helpers.BlockerInfo.Run("Loginfile Creation", "Please add additional Information if needed.", blockefunc); if (!Helpers.BlockerInfo.Done) { MessageBox.Show("No Clean Login. Loginfile might be not set correctly! Proceed with caution."); } int ct = 0; bool exists = true; while (exists && ct < 100) { try { pro.CloseMainWindow(); Process.GetProcessById(pro.Id); exists = true; Thread.Sleep(100); ct++; } catch { exists = false; } } try { pro.Kill(); } catch { } try { Console.WriteLine("Login data Hash: " + filename + ": " + datfile.MD5HASH); if (File.Exists(filepath)) { File.Delete(filepath); } File.Copy(EnviromentManager.GwLocaldatPath, filepath); datfile.Valid = true; return(datfile); } catch (Exception e) { MessageBox.Show("Error: The Gameclient did not create a valid Login data file. " + e.Message); datfile.Valid = false; return(datfile); } }