Created
May 3, 2012 05:46
-
-
Save Vbitz/2583593 to your computer and use it in GitHub Desktop.
0x10c arg thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by vbitz | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Web; | |
using System.Net; | |
using System.IO; | |
using System.Drawing; | |
namespace _0x10cthing | |
{ | |
class Program | |
{ | |
const int width = 192; | |
static int pos = 0; | |
static int y = 0; | |
static Bitmap rImg; | |
static Bitmap gImg; | |
static Bitmap bImg; | |
static Bitmap aImg; | |
static void PlotPixel(Bitmap img, Color col) | |
{ | |
img.SetPixel(pos, y, col); | |
} | |
static void Main(string[] args) | |
{ | |
WebClient client = new WebClient(); | |
string data = client.DownloadString("http://trilby.48b.it/hex.txt").Replace(" ", "").Replace("\n", ""); | |
rImg = new Bitmap(width + 1, (int)Math.Ceiling((decimal)data.Length / (width * 8))); | |
gImg = new Bitmap(width + 1, (int)Math.Ceiling((decimal)data.Length / (width * 8))); | |
bImg = new Bitmap(width + 1, (int)Math.Ceiling((decimal)data.Length / (width * 8))); | |
aImg = new Bitmap(width + 1, (int)Math.Ceiling((decimal)data.Length / (width * 8))); | |
for (int i = 0; i < data.Length; i += 8) | |
{ | |
string hex = data[i].ToString() + data[i + 1] + data[i + 2] + data[i + 3] + data[i + 4] + data[i + 5] + data[i + 6] + data[i + 7]; | |
int col = int.Parse(hex, System.Globalization.NumberStyles.HexNumber); | |
Color col2 = Color.FromArgb(col); | |
PlotPixel(rImg, Color.FromArgb((int)col2.R, (int)col2.R, (int)col2.R)); | |
PlotPixel(gImg, Color.FromArgb((int)col2.G, (int)col2.G, (int)col2.G)); | |
PlotPixel(bImg, Color.FromArgb((int)col2.B, (int)col2.B, (int)col2.B)); | |
PlotPixel(aImg, Color.FromArgb((int)col2.A, (int)col2.A, (int)col2.A)); | |
if (pos++ == width) | |
{ | |
pos = 0; | |
y++; | |
} | |
} | |
rImg.Save(@"C:\Users\Joshua\dev\scripts\rImg.bmp"); | |
gImg.Save(@"C:\Users\Joshua\dev\scripts\gImg.bmp"); | |
bImg.Save(@"C:\Users\Joshua\dev\scripts\bImg.bmp"); | |
aImg.Save(@"C:\Users\Joshua\dev\scripts\aImg.bmp"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment