private void Bw_DoWork(object sender, DoWorkEventArgs e) { while (true) { directXOverlay.Update(); } }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; var _wpfoverlay = (WPFOverlay)_overlay; Application.Current.Dispatcher.Invoke(delegate { _wpfoverlay.Enable(); }); while (!worker.CancellationPending) { Application.Current.Dispatcher.Invoke(delegate { _overlay.Update(); }); } #if DEBUG Console.WriteLine("Worker Exiting"); #endif Application.Current.Dispatcher.Invoke(delegate { _wpfoverlay.Disable(); }); return; }
/// <summary> /// Starts the demo. /// </summary> public void StartDemo() { var processName = "PathOfExile"; var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); if (process == null) { return; } _processSharp = new ProcessSharp(process, MemoryType.Remote); _overlay = new WpfOverlayDemoExample(); var wpfOverlay = (WpfOverlayDemoExample)_overlay; wpfOverlay.Initialize(_processSharp.WindowFactory.MainWindow); wpfOverlay.Enable(); _work = true; var info = wpfOverlay.Settings.Current; wpfOverlay.OverlayWindow.Draw += OnDraw; while (_work) { _overlay.Update(); } }
/// <summary> /// Starts the demo. /// </summary> public void StartDemo() { Log.Debug(@"Please type the process name of the window you want to attach to, e.g 'notepad."); Log.Debug("Note: If there is more than one process found, the first will be used."); // Set up objects/overlay var processName = Console.ReadLine(); var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); if (process == null) { Log.Warn($"No process by the name of {processName} was found."); Log.Warn("Please open one or use a different name and restart the demo."); Console.ReadLine(); return; } _processSharp = new ProcessSharp(process, MemoryType.Remote); _overlay = new WpfOverlayDemoExample(); var wpfOverlay = (WpfOverlayDemoExample)_overlay; // This is done to focus on the fact the Init method // is overriden in the wpf overlay demo in order to set the // wpf overlay window instance wpfOverlay.Initialize(_processSharp.WindowFactory.MainWindow); wpfOverlay.Enable(); _work = true; // Log some info about the overlay. Log.Debug("Starting update loop (open the process you specified and drag around)"); Log.Debug("Update rate: " + wpfOverlay.Settings.Current.UpdateRate.Milliseconds()); var info = wpfOverlay.Settings.Current; Log.Debug($"Author: {info.Author}"); Log.Debug($"Description: {info.Description}"); Log.Debug($"Name: {info.Name}"); Log.Debug($"Identifier: {info.Identifier}"); Log.Debug($"Version: {info.Version}"); Log.Info("Note: Settings are saved to a settings folder in your main app folder."); Log.Info("Give your window focus to enable the overlay (and unfocus to disable..)"); Log.Info("Close the console to end the demo."); wpfOverlay.OverlayWindow.Draw += OnDraw; // Do work while (_work) { _overlay.Update(); } Log.Debug("Demo complete."); }
public void StartDemo() { Console.Title = @"Âđĺě˙ çŕęŕçîâ äë˙ Äŕëüíîáîéůčęŕ"; //var processName = "notepad"; //čě˙ ďđîöĺńńŕ var processName = "GTA5"; //čě˙ ďđîöĺńńŕ var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); if (process == null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Čăđŕ íĺ íŕéäĺíŕ."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Îćčäŕíčĺ çŕďóńęŕ čăđű..."); System.Threading.Thread.Sleep(5000); Console.Clear(); StartDemo(); } _directXoverlayPluginExample = new DirectxOverlayPluginExample(); _processSharp = new ProcessSharp(process, MemoryType.Remote); var result = "30"; var fpsValid = int.TryParse(Convert.ToString(result, CultureInfo.InvariantCulture), NumberStyles.Any, NumberFormatInfo.InvariantInfo, out int fps); var d3DOverlay = (DirectxOverlayPluginExample)_directXoverlayPluginExample; d3DOverlay.Settings.Current.UpdateRate = 1000 / fps; _directXoverlayPluginExample.Initialize(_processSharp.WindowFactory.MainWindow); _directXoverlayPluginExample.Enable(); // Log some info about the overlay. var info = d3DOverlay.Settings.Current; Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"Ŕâňîđ: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{ info.Author}"); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"Îâĺđëĺé: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{ info.Identifier}"); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"Âĺđńč˙: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{ info.Version}"); Console.WriteLine(""); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("×ňîáű âűęëţ÷čňü îâĺđëĺé - çŕęđîéňĺ ęîíńîëü."); while (true) { _directXoverlayPluginExample.Update(); } }
public void StartDemo() { Log.Debug(@"Please type the process name of the window you want to attach to, e.g 'notepad."); Log.Debug("Note: If there is more than one process found, the first will be used."); var processName = Console.ReadLine(); var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); if (process == null) { Log.Warn($"No process by the name of {processName} was found."); Log.Warn("Please open one or use a different name and restart the demo."); Console.ReadLine(); return; } _directXoverlayPluginExample = new DirectxOverlayPluginExample(); _processSharp = new ProcessSharp(process, MemoryType.Remote); _directXoverlayPluginExample.Initialize(_processSharp.WindowFactory.MainWindow); _directXoverlayPluginExample.Enable(); var d3DOverlay = (DirectxOverlayPluginExample)_directXoverlayPluginExample; // Log some info about the overlay. Log.Debug("Starting update loop (open the process you specified and drag around)"); Log.Debug("Update rate: " + d3DOverlay.Settings.Current.UpdateRate.Milliseconds()); var info = d3DOverlay.Settings.Current; Log.Debug($"Author: {info.Author}"); Log.Debug($"Description: {info.Description}"); Log.Debug($"Name: {info.Name}"); Log.Debug($"Identifier: {info.Identifier}"); Log.Debug($"Version: {info.Version}"); Log.Info("Note: Settings are saved to a settings folder in your main app folder."); Log.Info("Give your window focus to enable the overlay (and unfocus to disable..)"); Log.Info("Close the console to end the demo."); while (true) { _directXoverlayPluginExample.Update(); } }
/// <summary> /// Starts the demo. /// </summary> public void StartDemo() { Log.Debug(@"Please type the process name of the window you want to attach to, e.g 'notepad."); Log.Debug("Note: If there is more than one process found, the first will be used."); //Set up objects / overlay //var processName = Console.ReadLine(); //var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); //if (process == null) //{ // Log.Warn($"No process by the name of {processName} was found."); // Log.Warn("Please open one or use a different name and restart the demo."); // Console.ReadLine(); // return; //} var process = System.Diagnostics.Process.Start("notepad.exe"); Thread.Sleep(1000); //await Task.Delay(500); _processSharp = new ProcessSharp(process, MemoryType.Remote); _overlay = new WpfOverlayDemoExample(); var wpfOverlay = (WpfOverlayDemoExample)_overlay; wpfOverlay.Initialize(_processSharp.WindowFactory.MainWindow); wpfOverlay.Enable(); _work = true; var info = wpfOverlay.Settings.Current; wpfOverlay.OverlayWindow.Draw += OnDraw; var task = new Task(() => { while (_work) { _overlay.Update(); } }); task.Start(); Log.Debug("Demo complete."); }
public void StartDirectX() { _logger.logInfo("Process name {0} using for application.", AppConstant.ProcessName); _process = System.Diagnostics.Process.GetProcessesByName(AppConstant.ProcessName).FirstOrDefault(); if (_process == null) { _logger.logError("No process found with name {0}", AppConstant.ProcessName); Console.ReadLine(); return; } _directXoverlayPlugin = new AppDirectXOverlay(_process); _processSharp = new ProcessSharp(_process, MemoryType.Remote); _logger.logInfo("Application using frame rate : {0}", AppConstant.Fps); var d3DOverlay = (AppDirectXOverlay)_directXoverlayPlugin; d3DOverlay.Settings.Current.UpdateRate = 1000 / AppConstant.Fps; _directXoverlayPlugin.Initialize(_processSharp.WindowFactory.MainWindow); _directXoverlayPlugin.Enable(); // Log some info about the overlay. _logger.logInfo("Starting update loop (open the process you specified and drag around)"); _logger.logInfo("Update rate: {0}", d3DOverlay.Settings.Current.UpdateRate); var info = d3DOverlay.Settings.Current; _logger.logInfo($"Author: {info.Author}"); _logger.logInfo($"Description: {info.Description}"); _logger.logInfo($"Name: {info.Name}"); _logger.logInfo($"Identifier: {info.Identifier}"); _logger.logInfo($"Version: {info.Version}"); _logger.logInfo("Note: Settings are saved to a settings folder in your main app folder."); _logger.logInfo("Give your window focus to enable the overlay (and unfocus to disable..)"); while (true) { _directXoverlayPlugin.Update(); } }
public void Start(System.Diagnostics.Process process) { if (process == null) { return; } Thread.Sleep(3000); var update = new Thread(() => { try { _processSharp = new ProcessSharp(process, MemoryType.Remote); _overlay = new OverlayLayer(); var wpfOverlay = (OverlayLayer)_overlay; wpfOverlay.Initialize(_processSharp.WindowFactory.MainWindow); wpfOverlay.Enable(); _work = true; var info = wpfOverlay.Settings.Current; wpfOverlay.OverlayWindow.Draw += OnDraw; Ex.Log($"Overlay Started Successfully = {process.MainWindowTitle}({process.ProcessName})"); while (_work) { _overlay.Update(); Thread.Sleep(5); _work = wpfOverlay.OverlayWindow.isExist; } Ex.Log($"Overlay Finished = {process.MainWindowTitle}({process.ProcessName})"); } catch (Exception ex) { ex.Log("Overlay Finished with Ex"); } }); update.SetApartmentState(ApartmentState.STA); update.Start(); }
public void Initialize() { Console.WriteLine($"Starting overlay..."); SC2Proc = System.Diagnostics.Process.GetProcessesByName(SC2ProcName).FirstOrDefault(); SC1Proc = System.Diagnostics.Process.GetProcessesByName(SC1ProcName).FirstOrDefault(); WC3Proc = System.Diagnostics.Process.GetProcessesByName(WC3ProcName).FirstOrDefault(); while (SC2Proc == null && SC1Proc == null && WC3Proc == null) { Console.WriteLine($"No processes by the names of {SC1ProcName}, {SC2ProcName} or {WC3ProcName} were found."); System.Threading.Thread.Sleep(1000); SC2Proc = System.Diagnostics.Process.GetProcessesByName(SC2ProcName).FirstOrDefault(); SC1Proc = System.Diagnostics.Process.GetProcessesByName(SC1ProcName).FirstOrDefault(); WC3Proc = System.Diagnostics.Process.GetProcessesByName(WC3ProcName).FirstOrDefault(); } Console.WriteLine($"Starting overlay in 5..."); System.Threading.Thread.Sleep(1000); Console.WriteLine($"Starting overlay in 4..."); System.Threading.Thread.Sleep(1000); Console.WriteLine($"Starting overlay in 3..."); System.Threading.Thread.Sleep(1000); Console.WriteLine($"Starting overlay in 2..."); System.Threading.Thread.Sleep(1000); Console.WriteLine($"Starting overlay in 1..."); System.Threading.Thread.Sleep(1000); _directXoverlayPluginExample = new DirectxOverlayPluginExample(); if (SC2Proc != null) { _processSharp = new ProcessSharp(SC2Proc, MemoryType.Remote); } else if (SC1Proc != null) { _processSharp = new ProcessSharp(SC1Proc, MemoryType.Remote); } else if (WC3Proc != null) { _processSharp = new ProcessSharp(WC3Proc, MemoryType.Remote); } var fpsValid = int.TryParse(Convert.ToString("60", CultureInfo.InvariantCulture), NumberStyles.Any, NumberFormatInfo.InvariantInfo, out int fps); var d3DOverlay = (DirectxOverlayPluginExample)_directXoverlayPluginExample; d3DOverlay.Settings.Current.UpdateRate = 1000 / fps; _directXoverlayPluginExample.Initialize(_processSharp.WindowFactory.MainWindow); _directXoverlayPluginExample.Enable(); var info = d3DOverlay.Settings.Current; Console.WriteLine($"Overlay Started."); while (true) { _directXoverlayPluginExample.Update(); // check if game died. SC2Proc = System.Diagnostics.Process.GetProcessesByName(SC2ProcName).FirstOrDefault(); SC1Proc = System.Diagnostics.Process.GetProcessesByName(SC1ProcName).FirstOrDefault(); WC3Proc = System.Diagnostics.Process.GetProcessesByName(WC3ProcName).FirstOrDefault(); if (SC2Proc == null && SC1Proc == null && WC3Proc == null) { Console.WriteLine("Game has exited..."); Initialize(); break; } } }
public void StartDemo() { Log.Debug(@"Please type the process name of the window you want to attach to, e.g 'notepad."); Log.Debug("Note: If there is more than one process found, the first will be used."); var processName = Console.ReadLine(); var process = System.Diagnostics.Process.GetProcessesByName(processName).FirstOrDefault(); if (process == null) { Log.Warn($"No process by the name of {processName} was found."); Log.Warn("Please open one or use a different name and restart the demo."); Console.ReadLine(); return; } _directXoverlayPluginExample = new DirectxOverlayPluginExample(); _processSharp = new ProcessSharp(process, MemoryType.Remote); Log.Debug("Enter the frame rate the overlay should render at. e.g '60'"); var result = Console.ReadLine(); var fpsValid = int.TryParse(Convert.ToString(result, CultureInfo.InvariantCulture), NumberStyles.Any, NumberFormatInfo.InvariantInfo, out int fps); if (!fpsValid) { Log.Debug($"{result} is not valid. Please reload and try again by entering an integer such as '30' or '60' "); return; } var d3DOverlay = (DirectxOverlayPluginExample)_directXoverlayPluginExample; d3DOverlay.Settings.Current.UpdateRate = 1000 / fps; _directXoverlayPluginExample.Initialize(_processSharp.WindowFactory.MainWindow); _directXoverlayPluginExample.Enable(); // Log some info about the overlay. Log.Debug("Starting update loop (open the process you specified and drag around)"); Log.Debug("Update rate: " + d3DOverlay.Settings.Current.UpdateRate.Milliseconds()); var info = d3DOverlay.Settings.Current; Log.Debug($"Author: {info.Author}"); Log.Debug($"Description: {info.Description}"); Log.Debug($"Name: {info.Name}"); Log.Debug($"Identifier: {info.Identifier}"); Log.Debug($"Version: {info.Version}"); Log.Info("Note: Settings are saved to a settings folder in your main app folder."); Log.Info("Give your window focus to enable the overlay (and unfocus to disable..)"); Log.Info("Close the console to end the demo."); while (true) { _directXoverlayPluginExample.Update(); } }