private bool StartRenderOverlayPrimes() { if (_overlay == null) { _overlay = new WPFOverlay(); } if (_processSharp == null) { _processSharp = new ProcessSharp(Warframe.GetProcess(), MemoryType.Remote); } var process = Warframe.GetProcess(); if (process != null) { var _wpfoverlay = (WPFOverlay)_overlay; if (!_wpfoverlay.Initialized) { _wpfoverlay.Initialize(_processSharp.WindowFactory.MainWindow); } _wpfoverlay.UpdatePrimesData(displayPrimes); return(true); } return(false); }
public static void SaveScreenshot(Stream stream, FormatImage format) { System.Diagnostics.Process p = Warframe.GetProcess(); if (p == null) { throw new Exception(); } IntPtr ptr = p.MainWindowHandle; User32.Rect rect = new User32.Rect(); User32.GetWindowRect(ptr, ref rect); int width = rect.Right - rect.Left; int height = rect.Bottom - rect.Top; if (height == 0 || width == 0) { return; } using (Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb)) { using (var graphics = Graphics.FromImage(bitmap)) { graphics.CopyFromScreen(rect.Left, rect.Top, 0, 0, new Size(width, height)); graphics.Save(); graphics.Dispose(); Bitmap bit; switch (format) { case FormatImage.TIFF: bit = MakeGrayscale3(bitmap); bit.Save(stream, System.Drawing.Imaging.ImageFormat.Tiff); bit.Dispose(); break; case FormatImage.PNG: default: bit = MakeGrayscale3(bitmap); bit.Save(stream, System.Drawing.Imaging.ImageFormat.Png); bit.Dispose(); #if DEBUG //using (FileStream file = new FileStream("shot_" + DateTime.Now.ToString("HH_mm_ss") + ".png", FileMode.Create, FileAccess.Write)) //{ // ((MemoryStream)stream).WriteTo(file); //} #endif break; } } } }
private bool IsOnFocus() { System.Diagnostics.Process warframeProcess = Warframe.GetProcess(); if (warframeProcess == null) { return(false); // Warframe not running } IntPtr activatedHandle = GetForegroundWindow(); if (activatedHandle == IntPtr.Zero) { return(false); // No window is currently activated } GetWindowThreadProcessId(activatedHandle, out int activeProcId); return(activeProcId == warframeProcess.Id); }
private void StartRenderOverlayPrimes() { if (overlay == null) { overlay = new WPFOverlay(); } if (WarframeProcess == null) { WarframeProcess = new ProcessSharp(Warframe.GetProcess(), MemoryType.Remote); } if (WarframeProcess != null) { WPFOverlay wpfoverlay = (WPFOverlay)overlay; if (!wpfoverlay.Initialized) { wpfoverlay.Initialize(WarframeProcess.WindowFactory.MainWindow); } wpfoverlay.UpdatePrimesData(detectedPrimePartsList); } }