private static void getPixelsetPixel() { Image jpg = Image.FromFile("C:/Users/danila/skkribl/testScreenShot/image.jpg"); Bitmap img = new Bitmap(jpg); Bitmap nbmp = ResizeBitmap(img, 100, 100); int[] pxlColors = new int[100]; for (int i = 0; i < nbmp.Width; i++) { for (int j = 0; j < nbmp.Height; j++) { Color pixel = nbmp.GetPixel(i, j); pxlColors[j] = pixel.ToArgb(); } } for (int v = 0; v < 100; v++) { if (pxlColors[v] / 2 != 0) { int x = 10000 + v; int y = 10000 + v; VirtualMouse.MoveTo(x, y); VirtualMouse.LeftClick(); } else { } } }
public Task ParseMessageReceived(WebSocketReceiveResult result) { string messageReceived = Encoding.Default.GetString(new ArraySegment <byte>(buffer, 0, result.Count)); VirtualMouse.MouseCommand mc = VirtualMouse.JsonToMouseCommand(messageReceived); //Console.WriteLine("Parsing Command: " + mc); if (mc.command == "move") { mouse.Move(mc.x, mc.y); } else if (mc.command == "right_click") { mouse.RightClick(); } else if (mc.command == "left_click") { mouse.LeftClick(); } else if (mc.command == "left_down") { mouse.LeftDown(); } else if (mc.command == "left_up") { mouse.LeftUp(); } else if (mc.command == "right_down") { mouse.RightDown(); } else if (mc.command == "right_up") { mouse.RightUp(); } else if (mc.command == "touchpad_start") { mouse.TouchpadStart(mc.x, mc.y); } else if (mc.command == "touchpad_move") { mouse.TouchpadMove(mc.x, mc.y, (int)mc.extra); } else if (mc.command == "set_volume") { audio.SetVolume(mc.x); } else { return(Error()); } return(Success()); }
private void Operation() { ScreenCapture sc = new ScreenCapture(); sc.CaptureScreenToFile(Parameter._screenshotImagePath, ImageFormat.Png); Search4Pattern(); if (pattern_location.Width != 0) { Cursor.Position = new Point(Parameter._location_Click1_X + pattern_location.X, Parameter._location_Click1_Y + +pattern_location.Y); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2000); Cursor.Position = new Point(Parameter._location_Click2_X + pattern_location.X, Parameter._location_Click2_Y + +pattern_location.Y); VirtualMouse.LeftClick(); } try { File.Delete(Parameter._screenshotImagePath); } catch (IOException ex) { Debug.WriteLine(ex.Message); } //if (CaptureScreen.CaptureFullScreen()) //{ //} //else //{ // MessageBox.Show("Capture screen failed."); //} }
private void button1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(2999); int count = File.ReadAllLines("proxy.txt").Length; // number of line in file //System.Diagnostics.Process.Start("www.instagram.com"); for (int i = 0; i < 2; i++) { ParsingProxy(); //m.Close(); /*OperationsWithFile.DeleteFirstLineFromFile("proxy.txt");*/ // delete first line from file System.Diagnostics.Process.Start("www.instagram.com"); System.Threading.Thread.Sleep(5000); Cursor.Position = new Point(1325, 95); //"свойства:интернет" System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(320, 510); //"настройка сети" System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); Cursor.Position = new Point(150, 355); //input proxy System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); SendKeys.Send("^{a}"); //VirtualMouse.DoubleLeftClick(); System.Threading.Thread.Sleep(2999); Clipboard.SetText(proxy); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); //input port Cursor.Position = new Point(240, 355); System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); SendKeys.Send("^{a}"); System.Threading.Thread.Sleep(2999); Clipboard.SetText(port); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(240, 427); System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(75, 45); //refersh System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Clipboard.SetText(proxyLogin); //insert proxyName SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(660, 245); //insert proxyPass System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Clipboard.SetText(proxyPass); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(680, 320); System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); //click Cursor.Position = new Point(1250, 45); //coockie System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); //delete coockie Cursor.Position = new Point(750, 75); System.Threading.Thread.Sleep(4000); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(75, 45); //refersh System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(1250, 45); //coockie System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); Cursor.Position = new Point(850, 250); System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); //doubleclick in "Значение" SendKeys.Send("^{a}"); System.Threading.Thread.Sleep(2999); Clipboard.SetText(midCoockie); //insert into buffer midCoockie value SendKeys.Send("^{v}"); //ctrl+v into "Значение" in plaggin Cursor.Position = new Point(980, 505); //save midCoockie System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(75, 45); //refersh System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(850, 435); //name field System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); GetNameFromFile(); Clipboard.SetText(name); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(850, 400); //email field VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); GetEmailFromFile(); Clipboard.SetText(email); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(850, 510); System.Threading.Thread.Sleep(2999); //pass field VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); GetPassFromFile(); Clipboard.SetText(pass); System.Threading.Thread.Sleep(2999); SendKeys.Send("^{v}"); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(850, 470); //copy nickname in file VirtualMouse.LeftClick(); SendKeys.Send("^{a}"); System.Threading.Thread.Sleep(2999); SendKeys.Send("^{c}"); nickname = Clipboard.GetText(TextDataFormat.Text); WriteFinalInfoInFile(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(850, 555); //registration click VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(3000); VirtualMouse.LeftClick(); Cursor.Position = new Point(1250, 45); //coockie System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); //delete coockie Cursor.Position = new Point(750, 75); System.Threading.Thread.Sleep(4000); VirtualMouse.LeftClick(); System.Threading.Thread.Sleep(2999); Cursor.Position = new Point(200, 200); System.Threading.Thread.Sleep(2999); VirtualMouse.LeftClick(); SendKeys.Send("^{w}"); } }
private void WindowScreenshot(String filepath, String filename, ImageFormat format) { if (bmp != null) { bmp.Dispose(); bmp = null; } string basePath = filepath + "\\temp\\"; bool exists = System.IO.Directory.Exists(basePath); if (!exists) { System.IO.Directory.CreateDirectory(basePath); } string fullpath = basePath + filename; string fullpath2 = basePath + "scaled_" + filename; string testPath = basePath + "test1.jpg"; string tempPath = filepath + "\\temp\\temp.jpg"; string success = basePath + "succeed"; string[] result = new string[50]; var ps = Process.GetProcessesByName("AtlasGame"); if (ps.Length == 0) { colors.Text = "ATLAS ISNT OPEN YET"; return; } Process p = ps[0]; if (!isSetup()) { colors.Text = "Need to find the skillshot region of screen!"; setupEnv(); doSearch(true); } Graphics g; Rectangle screenshotBounds = searchMode ? useOffset : offset; if (screenshotBounds.Width <= 0 || screenshotBounds.Height <= 0) { return; } bmp = new Bitmap(screenshotBounds.Width, screenshotBounds.Height); g = Graphics.FromImage(bmp); g.CopyFromScreen(screenshotBounds.X, screenshotBounds.Y, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; g.Dispose(); if (bmp != null) { var doingSkillShot = IsProgressPresent(bmp); Rectangle[] coords = new Rectangle[] { }; if (doingSkillShot.Height != 0 && doingSkillShot.X >= 0) { Rectangle rounded = new Rectangle(RoundOff(doingSkillShot.X), RoundOff(doingSkillShot.Y), RoundOff(doingSkillShot.Width), RoundOff(doingSkillShot.Height)); var ratio = RoundOff(doingSkillShot.Width / doingSkillShot.Height, 1); var screenRatio = RoundOff(screenshotBounds.Height / doingSkillShot.Height, 1); Point skillPos = new Point((int)(100.0 * doingSkillShot.X / screenshotBounds.Width), (int)(100.0 * doingSkillShot.Y / screenshotBounds.Height)); var seemsRight = rounded.Height != 0 && rounded.Width != 0 && ratio >= 10 && ratio <= 14 && (!searchMode || (searchMode && skillPos.X > 25 && skillPos.X < 40 && skillPos.Y > 70 && skillPos.Y < 85)); doingSkillshotCheck.Checked = seemsRight; if (seemsRight) { coords = getGoal(bmp, doingSkillShot); if (searchMode && coords.Length == 3 && coords[1].Width > 0) { seeGoalCheck.Checked = true; resultBox.Items.Insert(0, "MaybeOffset (" + rounded + ") ratio = " + ratio + ", positioning = " + (skillPos) + "%"); resultBox.Items.Insert(0, "Seems right, lets go with it."); var unscaledOffset = new Rectangle( (int)(doingSkillShot.X / widthScale), (int)(doingSkillShot.Y / heightScale), (int)(doingSkillShot.Width / widthScale), (int)(doingSkillShot.Height / heightScale) ); offset = doingSkillShot; Properties.Settings.Default.Offset = offset; Properties.Settings.Default.Save(); doSearch(false); running = true; RefreshTimer.Enabled = true; setupEnv(); resultBox.Items.Insert(0, "Offset set to " + offset + ", (scaled: " + scaledOffset + ")"); } if (coords.Length == 3 && coords[2].Width > 200 * heightScale && coords[1].X > 5 && coords[1].Width > 5) { seeGoalCheck.Checked = true; var goal = coords[1]; var current = coords[0]; var wiggleRoom = (coords[2].Width / goal.Width - 5) * 3; var currentMid = current.Left + current.Width / 2; var shouldClick = currentMid > (goal.Left - wiggleRoom) && currentMid < (goal.Right + wiggleRoom); var goalStart = (int)(1000.0 * (coords[1].X - coords[2].X) / coords[2].Width) / 10.0; var goalEnd = (int)((1000.0 * (coords[1].X + coords[1].Width) - coords[2].X) / coords[2].Width) / 10.0; var currentPrecent = (int)((1000.0 * (current.X + (current.Width / 2.0)) - coords[2].X) / coords[2].Width) / 10.0; var coordsString = System.DateTime.Now.ToLongTimeString() + ", " + widthScale + ": Current: " + current.Left + ", " + "Goal: [" + coords[1].X + " - " + (coords[1].X + coords[1].Width) + "] +/- " + (int)(wiggleRoom) + " " + "Total: [" + coords[2].X + " - " + (coords[2].X + coords[2].Width) + "] Shot at (" + currentPrecent + "%) going for (" + goalStart + "% - " + goalEnd + "%)"; if (shouldClick && !clicked) { status.Text = "Status: At (" + currentPrecent + "%) going for (" + goalStart + "% - " + goalEnd + "%)"; previousMsg = coordsString; VirtualMouse.LeftClick(); clicked = true; waitCount = 0; } if (clicked && previousMsg != "" && (centerColor == "RED" || centerColor == "GREEN")) { if (waitCount == 5) { var hitRate = Properties.Settings.Default.hitRate; hitRate.X += (centerColor == "RED") ? 0 : 1; hitRate.Y += (centerColor == "RED") ? 1 : 0; Properties.Settings.Default.hitRate = hitRate; Properties.Settings.Default.Save(); updateStats(); if (centerColor == "RED") { var savePath = basePath + "miss-" + System.DateTime.Now.ToFileTimeUtc() + ".png"; var rate = (int)(hitRate.X * 1000.0 / (hitRate.X + hitRate.Y)) / 10.0; resultBox.Items.Insert(0, "MISSED, Saving SS (" + savePath + ")."); resultBox.Items.Insert(0, "Bot Status: Hits " + hitRate.X + "; Misses " + hitRate.Y + "; SuccessRate: (" + rate + "%)"); bmp.Save(savePath, format); pictureBox1.ImageLocation = savePath; } frameCount = -50; resultBox.Items.Remove(previousMsg); resultBox.Items.Insert(0, previousMsg + " Result: " + (centerColor == "RED" ? "Missed!" : "Nailed It!")); previousMsg = ""; status.Text = "Status: See a SkillShot, Already Clicked (" + (centerColor == "RED" ? "Miss" : "Hit") + ")"; doSearch(false); } else { waitCount++; } } } else { seeGoalCheck.Checked = false; } } } else { status.Text = "Status: Waiting for SkillShot"; clicked = false; seeGoalCheck.Checked = false; doingSkillshotCheck.Checked = false; waitCount = 0; } frameCount++; if (frameCount == 2 && waitCount != 10) { bmp.Save(tempPath, format); pictureBox1.ImageLocation = tempPath; frameCount = 0; } } bmp.Dispose(); }