Pastebin PRO Accounts SPRING SPECIAL! For a limited time only get 50% discount on a LIFETIME PRO account! Offer Ends April 8th!
SHARE
TWEET
Cushypen Patcher
a guest
Jan 25th, 2015
935
Never
- // Usage: Command Line only, put all your cushypen rips into a folder, give it that folder's path and then it will patch all files in that folder.
- // For example: CushyPatch.exe "C:\AllMyWeirdPorno" will take ALL files in "AllMyWeirdPorno" and patch them. If they aren't an image it will crash most likely, there is NO error checking and it's quick and dirty, works if used properly.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Drawing;
- namespace BitPlaneDecomp
- {
- class Program
- {
- static DirectoryInfo workingDirectory;
- static List<string> fileList;
- static void Main(string[] args)
- {
- workingDirectory = new DirectoryInfo(args[0]);
- fileList = Directory.GetFiles(workingDirectory.ToString(), "*.*", SearchOption.AllDirectories).ToList();
- foreach (var file in fileList)
- {
- var filePath = @file;
- Bitmap bitmap = null;
- // Create from a stream so we don't keep a lock on the file.
- using (var stream = File.OpenRead(filePath))
- {
- bitmap = (Bitmap)Bitmap.FromStream(stream);
- }
- using (bitmap)
- using (var graphics = Graphics.FromImage(bitmap))
- {
- for (int x = 0; x < bitmap.Width; x++)
- {
- for (int y = 0; y < bitmap.Height; y++)
- {
- // Get the color of a pixel within myBitmap.
- Color pixelColor = bitmap.GetPixel(x, y);
- int B = Convert.ToInt32(pixelColor.B.ToString("D3"));
- if (B % 2 != 0)
- continue;
- B += 1;
- int A = Convert.ToInt32(pixelColor.A.ToString("D3"));
- int R = Convert.ToInt32(pixelColor.R.ToString("D3"));
- int G = Convert.ToInt32(pixelColor.G.ToString("D3"));
- bitmap.SetPixel(x, y, Color.FromArgb(A,R,G,B));
- }
- }
- // Important part!
- bitmap.Save(filePath);
- }
- }
- }
- }
- }
RAW Paste Data
