private void TimerBatchLoadAccounts(Object obj, EventArgs args) { var acc = accounts[selectedItems[batch_index]]; listViewAccounts.Items[selectedItems[batch_index]].SubItems[1].Text = "Loading..."; procs[batch_index] = MulticlientPatch.LaunchClient(acc.gwpath, " -email " + acc.email + " -password " + acc.password + " -character \"" + acc.character + "\" " + acc.extraargs, acc.datfix); listViewAccounts.Items[selectedItems[batch_index]].SubItems[1].Text = "Active"; batch_index++; if (batch_index >= listViewAccounts.SelectedIndices.Count) { BatchLoader.Stop(); } }
private void launchGWInstanceToolStripMenuItem_Click(object sender, EventArgs e) { var pathdefault = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\ArenaNet\\Guild Wars", "Path", null); if (pathdefault == null) { pathdefault = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\ArenaNet\\Guild Wars", "Path", null); if (pathdefault == null) { MessageBox.Show("pathdefault = null, gw not installed?"); } } MulticlientPatch.LaunchClient(pathdefault, "", true, true); }
private void listViewAccounts_MouseDoubleClick(object sender, MouseEventArgs e) { var selectedItems = listViewAccounts.SelectedIndices; if (selectedItems.Count == 0) { return; } var acc = accounts[selectedItems[0]]; if (listViewAccounts.Items[selectedItems[0]].SubItems[1].Text == "Active") { return; } listViewAccounts.Items[selectedItems[0]].SubItems[1].Text = "Loading..."; procs[selectedItems[0]] = MulticlientPatch.LaunchClient(acc.gwpath, " -email " + acc.email + " -password " + acc.password + " -character \"" + acc.character + "\" " + acc.extraargs, acc.datfix); new GWCAMemory(procs[selectedItems[0]]).WriteWString(GW_Launcher.GWMem.WinTitle, acc.character + '\0'); listViewAccounts.Items[selectedItems[0]].SubItems[1].Text = "Active"; }
internal static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Mutex.TryOpenExisting(GwlMutexName, out gwlMutex)) { return; } gwlMutex = new Mutex(true, GwlMutexName); settings = GlobalSettings.Load(); accounts = new AccountManager("Accounts.json"); foreach (Account t in accounts) { t.active = false; } using (var mf = new MainForm()) { mf.Location = new System.Drawing.Point(-1000, -1000); mf.FormClosing += (object sender, FormClosingEventArgs e) => { Program.settings.Save(); }; mainthread = new Thread(() => { var mainClosed = false; mf.FormClosed += (s, a) => { mainClosed = true; }; while (!mainClosed) { var sleep = 5000; while (mf.needtolaunch.Count > 0) { int i = mf.needtolaunch.Dequeue(); var ok = true; Account a = accounts[i]; GWCAMemory m = MulticlientPatch.LaunchClient(a.gwpath, " -email \"" + a.email + "\" -password \"" + a.password + "\" -character \"" + a.character + "\" " + a.extraargs, a.datfix, false, a.elevated, a.mods); //uModTexClient client = new uModTexClient(); //TexBundle bundle = new TexBundle("C:\\Users\\m\\OneDrive\\Desktop\\programs\\gw1\\Minimalus_Dub.tpf"); //client.AddBundle(bundle); uint timelock = 0; while (m.process.MainWindowHandle == IntPtr.Zero) { Thread.Sleep(1000); timelock += 1; if (timelock <= 10) { continue; } ok = false; break; } if (!ok) { continue; } a.process = m; mf.SetActive(i, true); timelock = 0; GWMem.FindAddressesIfNeeded(m); while (m.Read <ushort>(GWMem.CharnamePtr) == 0 && timelock < 60) { Thread.Sleep(1000); timelock += 1; } Thread.Sleep(sleep); sleep += 5000; } mutex.WaitOne(); for (var i = 0; i < accounts.Length; ++i) { if (!accounts[i].active) { continue; } if (accounts[i].process.process.HasExited) { mf.SetActive(i, false); } } mutex.ReleaseMutex(); Thread.Sleep(150); } }); Application.Run(mf); mainthread.Abort(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Mutex.TryOpenExisting(gwlMutexName, out gwlMutex)) { return; } else { gwlMutex = new Mutex(true, gwlMutexName); } settings = GlobalSettings.Load(); accounts = new AccountManager("Accounts.json"); for (int i = 0; i < accounts.Length; ++i) { accounts[i].active = false; } MainForm mf = new MainForm(); mf.Location = new System.Drawing.Point(-1000, -1000); mf.FormClosing += (object sender, FormClosingEventArgs e) => { Program.settings.Save(); }; mainthread = new Thread(() => { bool main_closed = false; mf.FormClosed += (s, a) => { main_closed = true; }; while (!main_closed) { int sleep = 5000; while (mf.needtolaunch.Count > 0) { int i = mf.needtolaunch.Dequeue(); bool ok = true; Account a = accounts[i]; GWCAMemory m = MulticlientPatch.LaunchClient(a.gwpath, " -email \"" + a.email + "\" -password \"" + a.password + "\" -character \"" + a.character + "\" " + a.extraargs, a.datfix, false, a.mods); uint timelock = 0; while (ok && m.process.MainWindowHandle == IntPtr.Zero) { Thread.Sleep(1000); timelock += 1; if (timelock > 10) { ok = false; break; } } if (!ok) { continue; } a.process = m; //m.WriteWString(GWMem.WinTitle, a.character + '\0'); mf.SetActive(i, true); timelock = 0; GWMem.FindAddressesIfNeeded(m); while (ok && m.Read <ushort>(GWMem.CharnamePtr) == 0 && timelock < 60) { Thread.Sleep(1000); timelock += 1; } Thread.Sleep(sleep); sleep += 5000; } mutex.WaitOne(); for (int i = 0; i < accounts.Length; ++i) { if (accounts[i].active) { if (accounts[i].process.process.HasExited) { mf.SetActive(i, false); } } } mutex.ReleaseMutex(); Thread.Sleep(150); } }); Application.Run(mf); mainthread.Abort(); }
static void Main() { Process[] p = Process.GetProcessesByName("GW Launcher"); // if (p.Length > 0) // { // SetForegroundWindow(p[0].MainWindowHandle); // return; // } StreamReader file; try { file = new StreamReader("Accounts.json"); } catch (FileNotFoundException) { StreamWriter writerfile = File.CreateText("Accounts.json"); writerfile.Write("[]"); writerfile.Close(); file = new StreamReader("Accounts.json"); } JsonTextReader reader = new JsonTextReader(file); JsonSerializer serializer = new JsonSerializer(); accounts = serializer.Deserialize <Account[]>(reader); for (int i = 0; i < accounts.Length; ++i) { accounts[i].active = false; } file.Close(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mf = new MainForm(); mf.Location = new System.Drawing.Point(-1000, -1000); mainthread = new Thread(() => { bool main_closed = false; mf.FormClosed += (s, a) => { main_closed = true; }; while (!main_closed) { int sleep = 5000; while (mf.needtolaunch.Count > 0) { int i = mf.needtolaunch.Dequeue(); Account a = accounts[i]; GWCAMemory m = MulticlientPatch.LaunchClient(a.gwpath, " -email \"" + a.email + "\" -password \"" + a.password + "\" -character \"" + a.character + "\" " + a.extraargs, a.datfix); GWMem.FindAddressesIfNeeded(m); a.process = m; m.WriteWString(GWMem.WinTitle, a.character + '\0'); mf.SetActive(i, true); while (m.Read <ushort>(GWMem.CharnamePtr) == 0) { Thread.Sleep(1000); } Thread.Sleep(sleep); sleep += 5000; } mutex.WaitOne(); for (int i = 0; i < accounts.Length; ++i) { if (accounts[i].active) { if (accounts[i].process.process.HasExited) { mf.SetActive(i, false); } } } mutex.ReleaseMutex(); Thread.Sleep(150); } }); Application.Run(mf); mainthread.Abort(); }
static void Main() { if (Mutex.TryOpenExisting(gwlMutexName, out gwlMutex)) { return; } else { gwlMutex = new Mutex(true, gwlMutexName); } accounts = new AccountManager("Accounts.json"); for (int i = 0; i < accounts.Length; ++i) { accounts[i].active = false; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mf = new MainForm(); mf.Location = new System.Drawing.Point(-1000, -1000); mainthread = new Thread(() => { bool main_closed = false; mf.FormClosed += (s, a) => { main_closed = true; }; while (!main_closed) { int sleep = 5000; while (mf.needtolaunch.Count > 0) { int i = mf.needtolaunch.Dequeue(); Account a = accounts[i]; GWCAMemory m = MulticlientPatch.LaunchClient(a.gwpath, " -email \"" + a.email + "\" -password \"" + a.password + "\" -character \"" + a.character + "\" " + a.extraargs, a.datfix, false, a.mods); GWMem.FindAddressesIfNeeded(m); a.process = m; m.WriteWString(GWMem.WinTitle, a.character + '\0'); mf.SetActive(i, true); while (m.Read <ushort>(GWMem.CharnamePtr) == 0) { Thread.Sleep(1000); } Thread.Sleep(sleep); sleep += 5000; } mutex.WaitOne(); for (int i = 0; i < accounts.Length; ++i) { if (accounts[i].active) { if (accounts[i].process.process.HasExited) { mf.SetActive(i, false); } } } mutex.ReleaseMutex(); Thread.Sleep(150); } }); Application.Run(mf); mainthread.Abort(); }