public bool isDinoInventoryVisible() { if (ScreenCaptureProcess == null) { Process[] p = Process.GetProcessesByName(screenCaptureApplicationName); if (p.Length > 0) { ScreenCaptureProcess = p[0]; } else { return(false); } } float[] finalValues = new float[1] { 0 }; Bitmap screenshotbmp = null;// = (Bitmap)Bitmap.FromFile(@"D:\ScreenshotsArk\Clipboard12.png"); if (Win32Stuff.GetForegroundWindow() != ScreenCaptureProcess.MainWindowHandle) { return(false); } screenshotbmp = Win32Stuff.GetSreenshotOfProcess(screenCaptureApplicationName, waitBeforeScreenCapture); if (screenshotbmp == null) { return(false); } if (!setResolution(screenshotbmp)) { return(false); } string statName = "Level"; Rectangle rec = ocrConfig.labelRectangles[ocrConfig.labelNameIndices[statName]]; Bitmap testbmp = SubImage(screenshotbmp, rec.X, rec.Y, rec.Width, rec.Height); string statOCR = readImage(testbmp, true, true); Regex r = new Regex(@":\d+$"); MatchCollection mc = r.Matches(statOCR); if (mc.Count != 0) { return(true); } return(false); }
public bool isDinoInventoryVisible() { if (ARKProcess == null) { return(false); } float[] finalValues = new float[1] { 0 }; Bitmap screenshotbmp = null;// = (Bitmap)Bitmap.FromFile(@"D:\ScreenshotsArk\Clipboard12.png"); Bitmap testbmp; if (Win32Stuff.GetForegroundWindow() != ARKProcess.MainWindowHandle) { return(false); } screenshotbmp = Win32Stuff.GetSreenshotOfProcess("ShooterGame"); if (screenshotbmp == null) { return(false); } if (!calibrate(screenshotbmp)) { return(false); } string statName = "NameAndLevel"; testbmp = SubImage(screenshotbmp, statPositions[statName].X, statPositions[statName].Y, 500, 30); string statOCR = readImage(currentResolution, testbmp, true, false); Regex r = new Regex(@"(.*)-?Lv[liI](\d*)Eq"); MatchCollection mc = r.Matches(statOCR); if (mc.Count != 0) { return(true); } return(false); }