internal void FireLolClientInjectedEvent(LolClient client) { if (LolClientInjected != null) { LolClientInjected(this, client); } }
public void Init(ExtensionManager extensionManager, UiManager uiManager, System.Windows.Threading.Dispatcher dispatcher) { extensionManager.LolClientInjected += (sender, e) => client = e; extensionManager.LolClientConnected += (sender, e) => ui.Client = client; extensionManager.LolClientDisconnected += (sender, e) => ui.Client = null; extensionManager.LolClientClosed += (sender, e) => client = null; uiManager.RegisterView(this, new View(this, "Call Lcds", "CallLcds:Main", ui)); }
void ProcessInjector_ProcessFound(object sender, Process e) { ProcessInjector pi = sender as ProcessInjector; if (pi == null) { return; } Thread.Sleep(1000); string loldir = null; try { loldir = Path.GetDirectoryName(e.MainModule.FileName) ?? string.Empty; } catch (Win32Exception) { MessageBox.Show("Cannot access the lolclient process. If this error persists try runnig as an administrator.", "Error"); return; } _lolProperties = new YamlFile(Path.Combine(loldir, LolPropertiesFilename)); _lcuSettings = new YamlFile(Path.Combine(loldir, LcuSettingsPath, LcuSettingsFilename)); //string host = ((dynamic)_lolProperties)["region_data"][((dynamic)_lcuSettings)["install"]["globals"]["region"]]["servers"]["lcds"]["lcds_host"]; _rtmpAddress = ((dynamic)_lolProperties)["region_data"][((dynamic)_lcuSettings)["install"]["globals"]["region"]]["servers"]["lcds"]["lcds_host"]; if (_rtmpAddress == null) { return; } _certificate = GetCertificate(_rtmpAddress); if (_certificate == null) { Dispatcher.Invoke(() => MessageBox.Show(this, "This program is not compatible with your region: " + _lolProperties["platformId"] + ".\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)); return; } if (!IsInstalled(_certificate)) { MessageBoxResult res = MessageBoxResult.None; Dispatcher.Invoke(() => res = MessageBox.Show(this, "A certificate needs to be installed.\n\n" + "You can see which certificates are installed under Views->FinalesFunkeln->Certificates and uninstall them at any time.\n\nInstall the certificate now?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Information)); if (res != MessageBoxResult.Yes) { return; } InstallCertificate(_certificate); } InitProxy(); _lolClient = new LolClient(loldir, _lolProperties, _proxy, e, _extensionManager); _extensionManager.FireLolClientInjectedEvent(_lolClient); try { pi.Inject(); _lolClientProcess = e; } catch (WarningException ex) { //I think this only happens when we try to inject into an already redirected app. } catch (AccessViolationException ex) { //Not sure what to do if that happens if (Debugger.IsAttached) { Debugger.Break(); } } }
public EnglishLobby(LolClient lolClient) : base(lolClient) { }
private void pm_LolClientInjected(object sender, LolClient e) { _dispatcher.InvokeAsync(() => _clientStatus.Status = ClientStates.Injected); }
void ProcessInjector_ProcessFound(object sender, Process e) { ProcessInjector pi = sender as ProcessInjector; if (pi == null) { return; } #if !LCU //The new lol client has a separate process for the UI //sometimes it takes a while for the main module to be loaded... while (e.MainWindowHandle == IntPtr.Zero) #endif Thread.Sleep(1000); string loldir = null; try { #if AIRDEBUG && DEBUG string wmiQuery = string.Format("select CommandLine from Win32_Process where Name='{0}'", "adl.exe"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery); ManagementObjectCollection retObjectCollection = searcher.Get(); foreach (ManagementObject retObject in retObjectCollection) { loldir = ProcessHelper.SplitCommandLineArgs((string)retObject["CommandLine"])[2]; } #elif LCU loldir = Path.GetDirectoryName(e.MainModule.FileName) ?? string.Empty; loldir = Path.Combine(loldir, @"../../../../lol_air_client/releases/0.0.4.147/deploy"); //TODO this directory is just a placeholder #else loldir = Path.GetDirectoryName(e.MainModule.FileName) ?? string.Empty; #endif } catch (Win32Exception) { MessageBox.Show("Cannot access the lolclient process. If this error persists try runnig as an administrator.", "Error"); return; } _lolProperties = new PropertiesFile(Path.Combine(loldir, LolPropertiesFilename)); var host = _lolProperties["host"]; _rtmpAddress = host.Contains(",") ? host.Substring(0, host.IndexOf(',')) : host; if (_rtmpAddress == null) { return; } _certificate = GetCertificate(_rtmpAddress); if (_certificate == null) { Dispatcher.Invoke(() => MessageBox.Show(this, "This program is not compatible with your region: " + _lolProperties["platformId"] + ".\n", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning)); return; } if (!IsInstalled(_certificate)) { MessageBoxResult res = MessageBoxResult.None; Dispatcher.Invoke(() => res = MessageBox.Show(this, "A certificate needs to be installed.\n\n" + "You can see which certificates are installed under Views->FinalesFunkeln->Certificates and uninstall them at any time.\n\nInstall the certificate now?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Information)); if (res != MessageBoxResult.Yes) { return; } InstallCertificate(_certificate); } InitProxy(); _lolClient = new LolClient(loldir, _lolProperties, _proxy, e, _extensionManager); _extensionManager.FireLolClientInjectedEvent(_lolClient); try { pi.Inject(); _lolClientProcess = e; } catch (WarningException ex) { //I think this only happens when we try to inject into an already redirected app. } catch (AccessViolationException ex) { //Not sure what to do if that happens if (Debugger.IsAttached) { Debugger.Break(); } } }
private async void MainWindow_Loaded(object sender, RoutedEventArgs e) { LolClient.Initialize(); await LolClient.InitializeClientAsync(); }