public void Start(TimeSpan interval) { new Thread(new ThreadStart(() => { _stop = false; _data.Clear(); while (_stop == false) { var image = Amongus.GetImage(); _data.Add(new RecordData { Image = image.ResizeImage(image.Width / 2, image.Height / 2), Time = DateTime.Now, }); while (true) { var first = _data[0]; if (DateTime.Now.Subtract(first.Time) > TimeSpan.FromMinutes(20)) { _data.Remove(first); } else { break; } } Thread.Sleep(interval); } })).Start(); }
public static void Move(int x, int y) { var p = Amongus.GetProcess(); var hWnd = p.MainWindowHandle; var rect = new User32.RECT(); User32.GetWindowRect(hWnd, ref rect); var windowX = rect.left; var windowY = rect.top; SetCursorPos(windowX + x, windowY + y); }
private void Capture_Click(object sender, EventArgs e) { var dir = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads\\amongus-captures\\missions")); var pngPath = new DirectoryInfo(Path.Combine(dir.FullName, "png")); var bmpPath = new DirectoryInfo(Path.Combine(dir.FullName, "bmp")); if (!pngPath.Exists) { Directory.CreateDirectory(dir.FullName); } if (!bmpPath.Exists) { Directory.CreateDirectory(dir.FullName); } Amongus.GetImage().Save(Path.Combine(pngPath.FullName, $"{Guid.NewGuid()}.png"), ImageFormat.Png); Amongus.GetImage().Save(Path.Combine(bmpPath.FullName, $"{Guid.NewGuid()}.bmp"), ImageFormat.Bmp); }
private void TestCapture_Click(object sender, EventArgs e) { var image = Amongus.GetImage(); image.Save($"{Guid.NewGuid()}.bmp", ImageFormat.Bmp); }