} //end btnCheck_Click private void tmrCheckProcess_Tick(object sender, EventArgs e) { var revertResolution = this._revertResolution; lock (this._lockObject) { for (var i = Clients.Count - 1; i >= 0; i--) { try { var runningProcess = Process.GetProcessById(Clients[i].Process.Id); } catch (Exception) { Clients[i].ProxyServer.Stop(); User32.UnhookWindowsHookEx(Clients[i].Process.MainWindowHandle); Clients.RemoveAt(i); } } if (Clients.Count == 0) { this.tmrCheckProcess.Enabled = false; LineageClient.ChangeDisplaySettings(revertResolution); tmrCheckProcess.Stop(); tmrProxyStatus.Stop(); } } }
} //end btnCheck_Click private void tmrCheckProcess_Tick(object sender, EventArgs e) { var revertResolution = this._revertResolution; var settings = Helpers.LoadSettings(this._config.KeyName); lock (this._lockObject) { for (var i = Clients.Count - 1; i >= 0; i--) { try { var runningProcess = Process.GetProcessById(Clients[i].Process.Id); } catch (Exception) { Clients[i].Stop(); Clients.RemoveAt(i); } } if (Clients.Count == 0) { this.tmrCheckProcess.Enabled = false; if (settings.Windowed || settings.Resize) { LineageClient.ChangeDisplaySettings(revertResolution); } tmrCheckProcess.Stop(); } } }
private void SettingsForm_Load(object sender, EventArgs e) { var savedSettings = Helpers.LoadSettings(this._config.KeyName) ?? new Settings(this._windowDelay); var resolutions = LineageClient.GetResolutions(this._isWin8OrHigher); if (resolutions.Count > 0) { this.cmbResolution.Items.AddRange(resolutions.ToArray()); this.cmbResolution.SelectedIndex = savedSettings.Resolution == null ? 0 : this.cmbResolution.FindString(savedSettings.Resolution.ToString()); } else { MessageBox.Show("Unable to load screen resolutions. Screen resize is not available.", "No Resolutions Found", MessageBoxButtons.OK, MessageBoxIcon.Information); this.chkResize.Enabled = false; } this.chkResize.Checked = savedSettings.Resize; this.chkWindowed.Checked = savedSettings.Windowed; this.chkDisableDark.Checked = savedSettings.DisableDark; this.chkMobColours.Checked = savedSettings.EnableMobColours; this.chkDisableUnderwater.Checked = savedSettings.DisableUnderwater; this.chkUseProxy.Checked = savedSettings.UseProxy; FindBins(); if (!string.IsNullOrEmpty(savedSettings.ClientBin)) { this.cmbBin.Text = savedSettings.ClientBin; } else { if (this._isWin8OrHigher) { this.cmbBin.Text = "S3EP1U.bin"; } } if (string.IsNullOrEmpty(savedSettings.MusicType)) { this.cmbMusic.SelectedIndex = 0; } else { this.cmbMusic.SelectedIndex = this.cmbMusic.FindString(savedSettings.MusicType); } this.txtLoginInjectionTiming.Text = savedSettings.LoginDelay.ToString(); this.txtWinInjectionTiming.Text = savedSettings.WindowedDelay.ToString(); this.chkSyncServers.Checked = !savedSettings.DisableServerUpdate; this._initialLoad = false; }
private void Launch(ProxyServer proxyServer) { var settings = Helpers.LoadSettings(this._config.KeyName); var binFile = Path.GetFileNameWithoutExtension(settings.ClientBin); var ip = (uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(IPAddress.Parse("127.0.0.1").GetAddressBytes(), 0)); var revertResolution = new User32.DevMode(); if (settings.Resize) { revertResolution = LineageClient.ChangeDisplaySettings(settings.Resolution.Width, settings.Resolution.Height, settings.Resolution.Colour); } else if (settings.Windowed) { revertResolution = LineageClient.ChangeDisplayColour(this._isWin8OrHigher ? 32 : 16); } Lineage.Run(settings, this._config.InstallDir, settings.ClientBin, ip, (ushort)proxyServer.LocalPort); var client = new LineageClient(this._config.KeyName, binFile, this._config.InstallDir, proxyServer, Clients); client.Initialize(); if (settings.Centred) { var windowSize = Screen.PrimaryScreen.WorkingArea; client.SetCentred(windowSize.Width, windowSize.Height); } if (settings.CaptureMouse) { client.SetAllowCapture(); } lock (this._lockObject) Clients.Add(client); if (!tmrCheckProcess.Enabled) { this._revertResolution = revertResolution; this.tmrCheckProcess.Enabled = true; } if (!tmrProxyStatus.Enabled) { tmrProxyStatus.Enabled = true; } }
public static User32.DevMode ChangeDisplaySettings(User32.DevMode mode) { return(LineageClient.ChangeDisplaySettings(mode.dmPelsWidth, mode.dmPelsHeight, mode.dmBitsPerPel)); }
public static User32.DevMode ChangeDisplayColour(int bitCount) { return(LineageClient.ChangeDisplaySettings(-1, -1, bitCount)); }
private void SettingsForm_Load(object sender, EventArgs e) { var savedSettings = Helpers.LoadSettings(this._config.KeyName) ?? new Settings(); this.chkBlurAc.Checked = savedSettings.BlurAc; this.chkBlurChat.Checked = savedSettings.BlurChat; this.chkBlurHotKeys.Checked = savedSettings.BlurHotKeys; this.chkBlurHpMp.Checked = savedSettings.BlurHpMp; this.chkBlurLevel.Checked = savedSettings.BlurLevel; this.cmbBlurOptions.SelectedIndex = savedSettings.BlurSaveSetting == null ? 0 : this.cmbBlurOptions.FindString(savedSettings.BlurSaveSetting); this.chkCaptureMouse.Checked = savedSettings.CaptureMouse; var resolutions = LineageClient.GetResolutions(this._isWin8OrHigher); if (resolutions.Count > 0) { this.cmbResolution.Items.AddRange(resolutions.ToArray()); this.cmbResolution.SelectedIndex = savedSettings.Resolution == null ? 0 : this.cmbResolution.FindString(savedSettings.Resolution.ToString()); } else { MessageBox.Show("Unable to load screen resolutions. Screen resize is not available.", "No Resolutions Found", MessageBoxButtons.OK, MessageBoxIcon.Information); this.chkResize.Enabled = false; } this.chkResize.Checked = savedSettings.Resize; this.chkWindowed.Checked = savedSettings.Windowed; this.chkCentre.Checked = savedSettings.Centred; this.chkDisableDark.Checked = savedSettings.DisableDark; this.chkMobColours.Checked = savedSettings.EnableMobColours; if (!string.IsNullOrEmpty(savedSettings.ClientBin)) { FindBins(); this.cmbBin.Text = savedSettings.ClientBin; } else { FindBins(); } if (string.IsNullOrEmpty(savedSettings.MusicType)) { this.cmbMusic.SelectedIndex = 0; } else { this.cmbMusic.SelectedIndex = this.cmbMusic.FindString(savedSettings.MusicType); } this._initialLoad = false; }
private void Launch(Server server) { var settings = Helpers.LoadSettings(this._config.KeyName); var binFile = Path.GetFileNameWithoutExtension(settings.ClientBin); var binpath = Path.Combine(this._config.InstallDir, binFile); IPAddress[] ipOrDns; try { ipOrDns = Dns.GetHostAddresses(server.IpOrDns); } catch (SocketException) { MessageBox.Show(@"There was an error connecting to the server. Check the forums for any issues.", @"Error Connecting!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.CheckServerStatus(false); return; } var revertResolution = new Win32Api.DevMode(); if (settings.Resize) { revertResolution = LineageClient.ChangeDisplaySettings(settings.Resolution.Width, settings.Resolution.Height, settings.Resolution.Colour); } else if (settings.Windowed) { revertResolution = LineageClient.ChangeDisplayColour(this._isWin8OrHigher ? 32 : 16); } try { ProxyServer proxyServer = null; if (settings.UseProxy) { proxyServer = new ProxyServer(); proxyServer.LocalAddress = "127.0.0.1"; proxyServer.LocalPort = new Random().Next(1025, 50000); proxyServer.RemoteAddress = server.IpOrDns; proxyServer.RemotePort = server.Port; proxyServer.Start(); } if (Lineage.Run(settings, this._config.InstallDir, settings.ClientBin, (ushort)(settings.UseProxy ? proxyServer.LocalPort : server.Port), settings.UseProxy ? null : ipOrDns[0])) { var client = new LineageClient(this._config.KeyName, binFile, this._config.InstallDir, proxyServer, ipOrDns[0], server.Port, Clients); client.Initialize(); lock (this._lockObject) Clients.Add(client); if (!tmrCheckProcess.Enabled) { this._revertResolution = revertResolution; this.tmrCheckProcess.Enabled = true; } if (!settings.Windowed && this._isWin8OrHigher) { this.Win10SetClientFocus(); } } else { MessageBox.Show("There was an error injecting into the Lineage client. Try running it again!", "Error Launching!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { MessageBox.Show("An unknown error occurred launching the Lineage client. Try running it again!", "Error Launching!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
} //end ChangeDisplayColour public static Win32Api.DevMode ChangeDisplaySettings(Win32Api.DevMode mode) { return(LineageClient.ChangeDisplaySettings(mode.dmPelsWidth, mode.dmPelsHeight, mode.dmBitsPerPel)); } //end ChangeDisplaySettings
} //end constructor public static Win32Api.DevMode ChangeDisplayColour(int bitCount) { return(LineageClient.ChangeDisplaySettings(-1, -1, bitCount)); } //end ChangeDisplayColour