static void Main(string[] args) { String bitPath; int width, height; Console.WriteLine("Image path:"); bitPath = Console.ReadLine(); /* * Console.WriteLine("Enter size in form (width(enter)height)"); * width = Convert.ToInt32(Console.ReadLine()); * height = Convert.ToInt32(Console.ReadLine()); */ Bitmap safeBit = new Bitmap(bitPath); width = safeBit.Width; height = safeBit.Height; IList <PointData> dotArray = new List <PointData>(); UnsafeBitmap fastBit = new UnsafeBitmap(safeBit); fastBit.LockBitmap(); for (int x = 0; x < width; x += 5) { for (int y = 0; y < height; y += 5) { PixelData pixel = fastBit.GetPixel(x, y); // int[] temparr = new int[] { pixel.red, pixel.blue, pixel.green, x, y }; // for(int z=0; z<5; z++) { dotArray.Add(new PointData((int)pixel.red, (int)pixel.blue, (int)pixel.green, x, y)); // } // dotArray[x,y] = new int[] {pixel.red, pixel.blue, pixel.green, x, y}; Console.WriteLine("Dot at " + x + " " + y + " is " + pixel.red + " " + pixel.green + " " + pixel.blue); } } //Shape send data bullshit: {page=theurl, add=t, r=red, g=green, b=blue, a=alpha(1), t=20, p=base64points} //URL shit: http://goggles.sneakygcr.net/page?jsonp=jQuery#######_#####&page=http://shit.com/&add=t&title=bullshit&r=0&g=0&b=0&a=1&t=20&p=gDfrtSagb&_=somebigIDnumber _ is actually just to circumvent browsers cacheing it int scale = 1; int yoffset = 0; int xoffset = 0; int dotdiameter = 7; //sort of good formula for this: 7 * scale + (scale-1) for (int i = 0; i < dotArray.Count; i++) { PointData dot = dotArray[i]; // if(dot == null) { Console.WriteLine("EOF"); break; } String pointSerialized = numToB64(dot.x * scale + xoffset) + numToB64(dot.y * scale + yoffset); //note: after the TLD in URLs, the shitty javascript app appends a second /. ex: http://google.com/maps/myHouse would be http://google.com//maps/myHouse according to goggles String fullURL = "http://goggles.sneakygcr.net/page?callback=fuckoff&page=" + HttpUtility.UrlEncode("http://www.minecraftforum.net//topic/730306-my-little-pony-fim-all-pony-related-things-go-here/") + "&add=t&title=" + HttpUtility.UrlEncode("dongs dongs dongs") + "&r=" + dot.red + "&g=" + dot.green + "&b=" + dot.blue + "&a=1&t=" + dotdiameter + "&p=" + HttpUtility.UrlEncode(pointSerialized) + "&_=1420891562000"; //+ HttpUtility.UrlEncode(pointSerialized) + "&_=99999999"; Console.WriteLine(i + "/" + dotArray.Count + ": Doing URL " + fullURL); WebRequest req = WebRequest.Create(fullURL); req.Method = "GET"; WebResponse resp = req.GetResponse(); Console.WriteLine(((HttpWebResponse)resp).StatusDescription); // Stream dataStream = resp.GetResponseStream(); // StreamReader reader = new StreamReader(dataStream); // Console.WriteLine(reader.ReadToEnd()); // reader.Close(); // dataStream.Close(); resp.Close(); //this is because windows is a shitty operating system and at least on 7 x64 you'll run out of sockets too quickly, f**k over your internet, and then the request will time out //so windows takes something like 30 seconds to close a socket apparently System.Threading.Thread.Sleep(80); //50-80 works best, 50 has some throttling due to socket waiting so I'm not sure if it's actually faster //apparently sockets that have already been told to close don't finish closing if you pause this thread. huh!! // if(i%200 == 0) { // System.Threading.Thread.Sleep(20000); // } } Console.ReadLine(); }
static void Main(string[] args) { String bitPath; int width, height; Console.WriteLine("Image path:"); bitPath = Console.ReadLine();/* Console.WriteLine("Enter size in form (width(enter)height)"); width = Convert.ToInt32(Console.ReadLine()); height = Convert.ToInt32(Console.ReadLine()); */ Bitmap safeBit = new Bitmap(bitPath); width = safeBit.Width; height = safeBit.Height; IList<PointData> dotArray = new List<PointData>(); UnsafeBitmap fastBit = new UnsafeBitmap(safeBit); fastBit.LockBitmap(); for(int x=0; x<width; x+=5) { for(int y=0; y<height; y+=5) { PixelData pixel = fastBit.GetPixel(x, y); // int[] temparr = new int[] { pixel.red, pixel.blue, pixel.green, x, y }; // for(int z=0; z<5; z++) { dotArray.Add(new PointData((int)pixel.red, (int)pixel.blue, (int)pixel.green, x, y)); // } // dotArray[x,y] = new int[] {pixel.red, pixel.blue, pixel.green, x, y}; Console.WriteLine("Dot at " + x + " " + y + " is " + pixel.red + " " + pixel.green + " " + pixel.blue); } } //Shape send data bullshit: {page=theurl, add=t, r=red, g=green, b=blue, a=alpha(1), t=20, p=base64points} //URL shit: http://goggles.sneakygcr.net/page?jsonp=jQuery#######_#####&page=http://shit.com/&add=t&title=bullshit&r=0&g=0&b=0&a=1&t=20&p=gDfrtSagb&_=somebigIDnumber _ is actually just to circumvent browsers cacheing it int scale = 1; int yoffset = 0; int xoffset = 0; int dotdiameter = 7; //sort of good formula for this: 7 * scale + (scale-1) for(int i=0; i<dotArray.Count;i++) { PointData dot = dotArray[i]; // if(dot == null) { Console.WriteLine("EOF"); break; } String pointSerialized = numToB64(dot.x * scale + xoffset) + numToB64(dot.y * scale + yoffset); //note: after the TLD in URLs, the shitty javascript app appends a second /. ex: http://google.com/maps/myHouse would be http://google.com//maps/myHouse according to goggles String fullURL = "http://goggles.sneakygcr.net/page?callback=fuckoff&page=" + HttpUtility.UrlEncode("http://www.minecraftforum.net//topic/730306-my-little-pony-fim-all-pony-related-things-go-here/") + "&add=t&title=" + HttpUtility.UrlEncode("dongs dongs dongs") + "&r=" + dot.red + "&g=" + dot.green + "&b=" + dot.blue + "&a=1&t=" + dotdiameter + "&p=" + HttpUtility.UrlEncode(pointSerialized) + "&_=1420891562000"; //+ HttpUtility.UrlEncode(pointSerialized) + "&_=99999999"; Console.WriteLine(i + "/" + dotArray.Count + ": Doing URL " + fullURL); WebRequest req = WebRequest.Create(fullURL); req.Method = "GET"; WebResponse resp = req.GetResponse(); Console.WriteLine(((HttpWebResponse)resp).StatusDescription); // Stream dataStream = resp.GetResponseStream(); // StreamReader reader = new StreamReader(dataStream); // Console.WriteLine(reader.ReadToEnd()); // reader.Close(); // dataStream.Close(); resp.Close(); //this is because windows is a shitty operating system and at least on 7 x64 you'll run out of sockets too quickly, f**k over your internet, and then the request will time out //so windows takes something like 30 seconds to close a socket apparently System.Threading.Thread.Sleep(80); //50-80 works best, 50 has some throttling due to socket waiting so I'm not sure if it's actually faster //apparently sockets that have already been told to close don't finish closing if you pause this thread. huh!! // if(i%200 == 0) { // System.Threading.Thread.Sleep(20000); // } } Console.ReadLine(); }