Skip to content

Commit

Permalink
Fixed checkbox inconsistency error
Browse files Browse the repository at this point in the history
I was just confusing some variables
  • Loading branch information
organizedgrime committed Feb 12, 2016
1 parent 28de5d7 commit 84ceaca
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 57 deletions.
Binary file modified .vs/Steg/v14/.suo
Binary file not shown.
3 changes: 2 additions & 1 deletion Steg/DisplayOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ public partial class DisplayOutput : Form
string mime;
byte[] outputData;

public DisplayOutput(string outputStr = null, byte[] _outputData = null, bool trim = false)
public DisplayOutput(string outputStr = null, byte[] _outputData = null, bool trim = false, bool cut = false)
{
InitializeComponent();
MessageBox.Show("" + cut);

// Transfer the temporary variable into the class level one.
outputData = _outputData;
Expand Down
76 changes: 34 additions & 42 deletions Steg/LSBForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Steg/LSBForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public LSBForm()
filename2.Text = initialPath + "\\output.png";
outputDirectory.Text = initialPath;
fileInputFilename.Text = initialPath;

}


Expand Down Expand Up @@ -91,7 +90,7 @@ private void retrieveInput_Click(object sender, EventArgs e)

private void selectFileButton_Click(object sender, EventArgs e)
{
LSBFunctions.readLSB(filename2.Text, Convert.ToInt32(bitCountRead.Value), concatBool.Checked, fileOutputBool.Checked, trimBool.Checked);
LSBFunctions.readLSB(filename2.Text, Convert.ToInt32(bitCountRead.Value), concatBool.Checked, fileOutputBool.Checked, concatBool.Checked, trimBool.Checked);
}

private void fileChooser2_Click(object sender, EventArgs e)
Expand Down
28 changes: 16 additions & 12 deletions Steg/LSBFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;

namespace Steg
Expand Down Expand Up @@ -74,7 +75,7 @@ public static void writeLSB(string filename, string outputDir, int bitCount, str
bmp.Dispose();
}

public static void readLSB(string filename, int bitCount, bool concat, bool fileout, bool trim)
public static void readLSB(string filename, int bitCount, bool concat, bool fileout, bool cut, bool trim)
{

openImg(filename);
Expand Down Expand Up @@ -102,7 +103,7 @@ public static void readLSB(string filename, int bitCount, bool concat, bool file

if (fileout)
{
dispOutput = new DisplayOutput(null, messageBytes, trim);
dispOutput = new DisplayOutput(null, messageBytes, trim, cut);
}
else
{
Expand All @@ -127,7 +128,7 @@ public static void readLSB(string filename, int bitCount, bool concat, bool file
}

// Show the message
dispOutput = new DisplayOutput(str);
dispOutput = new DisplayOutput(str, null, false, cut);
}
dispOutput.Show();
}
Expand All @@ -142,18 +143,21 @@ public static void readLSB(string filename, int bitCount, bool concat, bool file

public static void openImg(string filename)
{
bmp = new Bitmap(filename);
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, bmp.PixelFormat);
if (File.Exists(filename))
{
bmp = new Bitmap(filename);
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, bmp.PixelFormat);

// Get the address of the first line.
ptr = bmpData.Scan0;
// Get the address of the first line.
ptr = bmpData.Scan0;

bytes = Math.Abs(bmpData.Stride) * bmp.Height;
rgbValues = new byte[bytes];
bytes = Math.Abs(bmpData.Stride) * bmp.Height;
rgbValues = new byte[bytes];

System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
}
}

public static void closeImg()
Expand Down

0 comments on commit 84ceaca

Please sign in to comment.