SHARE
TWEET

Cushypen Patcher

a guest Jan 25th, 2015 935 Never
  1. // 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.
  2. // 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.
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.IO;
  9. using System.Drawing;
  10.  
  11. namespace BitPlaneDecomp
  12. {
  13.     class Program
  14.     {
  15.         static DirectoryInfo workingDirectory;
  16.         static List<string> fileList;
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.             workingDirectory = new DirectoryInfo(args[0]);
  21.  
  22.             fileList = Directory.GetFiles(workingDirectory.ToString(), "*.*", SearchOption.AllDirectories).ToList();
  23.  
  24.             foreach (var file in fileList)
  25.             {
  26.                 var filePath = @file;
  27.                 Bitmap bitmap = null;
  28.  
  29.                 // Create from a stream so we don't keep a lock on the file.
  30.                 using (var stream = File.OpenRead(filePath))
  31.                 {
  32.                     bitmap = (Bitmap)Bitmap.FromStream(stream);
  33.                 }
  34.  
  35.                 using (bitmap)
  36.                 using (var graphics = Graphics.FromImage(bitmap))
  37.                 {
  38.                     for (int x = 0; x < bitmap.Width; x++)
  39.                     {
  40.                         for (int y = 0; y < bitmap.Height; y++)
  41.                         {
  42.                             // Get the color of a pixel within myBitmap.
  43.                             Color pixelColor = bitmap.GetPixel(x, y);
  44.  
  45.                             int B = Convert.ToInt32(pixelColor.B.ToString("D3"));
  46.  
  47.                             if (B % 2 != 0)
  48.                                 continue;
  49.  
  50.                             B += 1;
  51.                             int A = Convert.ToInt32(pixelColor.A.ToString("D3"));
  52.                             int R = Convert.ToInt32(pixelColor.R.ToString("D3"));
  53.                             int G = Convert.ToInt32(pixelColor.G.ToString("D3"));
  54.  
  55.                             bitmap.SetPixel(x, y, Color.FromArgb(A,R,G,B));
  56.                         }
  57.                     }
  58.  
  59.                     // Important part!
  60.                     bitmap.Save(filePath);
  61.                 }
  62.             }
  63.         }
  64.     }
  65. }
RAW Paste Data
Top