C# Class JPGCorrupt.JPGCorruptForm

显示文件 Open project: tig/JPG-Corruptor

Private Properties

Property Type Description
CorruptBitmap void
CorruptImageBytesRandom void
CorruptImageBytesSequential void
CorruptImageFile void
FileCorruptBackgroundWorker_DoWork void
FileCorruptBackgroundWorker_ProgressChanged void
FileCorruptBackgroundWorker_RunWorkerCompleted void
GetDrawRectangle Rectangle
GetFileBytes byte[]
GetImageRectangle Rectangle
GetWords List
Go void
InitializeComponent void
JPGCorruptForm_FormClosing void
JPGCorruptForm_KeyUp void
JPGCorruptForm_Paint void
JPGCorruptForm_SizeChanged void
PaintBitmap Image
Stop void
WndProc void
toolStripButtonAbout_Click void
toolStripButtonChooseImage_Click void
toolStripButtonChooseText_Click void
toolStripButtonGoFullscreen_Click void
toolStripButtonGo_Click void
toolStripButtonLoop_Click void
toolStripButtonSave_Click void
toolStripButtonStop_Click void

Public Methods

Method Description
JPGCorruptForm ( ) : System

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

Private Methods

Method Description
CorruptBitmap ( Bitmap image, String corruptText ) : void

Corrupts a Bitmap in memory by randomly inserting corruptText into the RGB data

CorruptImageBytesRandom ( byte bytes, String corruptText ) : void

Corrupts an image in memory by overwriting data with corruptText at a random place

CorruptImageBytesSequential ( byte bytes, String corruptText ) : void

Corrupts an image in memory by overwriting data with corruptText at a random place

CorruptImageFile ( String fileName, String corruptText ) : void

Corrupts a image file by inserting corruptText at a random place within the image data.

FileCorruptBackgroundWorker_DoWork ( object sender, DoWorkEventArgs e ) : void

Worker method for the background worker.

FileCorruptBackgroundWorker_ProgressChanged ( object sender, ProgressChangedEventArgs e ) : void

Called by the background worker each time a corrupted image is created

FileCorruptBackgroundWorker_RunWorkerCompleted ( object sender, RunWorkerCompletedEventArgs e ) : void

Called by the background worker upon completion or cancellation.

GetDrawRectangle ( ) : Rectangle

Get the rectangle representing the client area.

GetFileBytes ( String fileName ) : byte[]

Returns an array of bytes with the contents of a file.

GetImageRectangle ( Image image ) : Rectangle

Scale the Image area to the window client.

GetWords ( String file ) : List

Given a text file, return a list of words. Will throw an exception if file is not found etc...

Go ( ) : void

Starts a corruption session

InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

JPGCorruptForm_FormClosing ( object sender, FormClosingEventArgs e ) : void
JPGCorruptForm_KeyUp ( object sender, KeyEventArgs e ) : void
JPGCorruptForm_Paint ( object sender, PaintEventArgs e ) : void
JPGCorruptForm_SizeChanged ( object sender, EventArgs e ) : void
PaintBitmap ( byte bytes ) : Image

Paints our JPG image onto an (offscreen) bitmap sized for the current client area. Since the scaling of a JPG can take a while, while running this is called on the worker thread. This way the UI stays responsive and most corrupt images get displayed.

Stop ( ) : void

Stop a corruption session

WndProc ( Message &m ) : void
toolStripButtonAbout_Click ( object sender, EventArgs e ) : void
toolStripButtonChooseImage_Click ( object sender, EventArgs e ) : void
toolStripButtonChooseText_Click ( object sender, EventArgs e ) : void
toolStripButtonGoFullscreen_Click ( object sender, EventArgs e ) : void
toolStripButtonGo_Click ( object sender, EventArgs e ) : void
toolStripButtonLoop_Click ( object sender, EventArgs e ) : void
toolStripButtonSave_Click ( object sender, EventArgs e ) : void
toolStripButtonStop_Click ( object sender, EventArgs e ) : void

Method Details

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void

JPGCorruptForm() public method

public JPGCorruptForm ( ) : System
return System