improved app layout, un/loading pics

* renamed Form1 to main_form
* added functionality to un/load pictures
* added button  for default picture
* added some informational labels
This commit is contained in:
citizen 2019-12-16 05:24:03 +01:00
parent dca395e615
commit b5586740a1
Signed by: wanderer
GPG Key ID: A6FA3CA298BA2223
6 changed files with 518 additions and 6 deletions

View File

@ -46,16 +46,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<Compile Include="main_form.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="main_form.Designer.cs">
<DependentUpon>main_form.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="main_form.resx">
<DependentUpon>main_form.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

View File

@ -16,7 +16,7 @@ namespace KRY_0x02
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new main_form());
}
}
}

288
main_form.Designer.cs generated Normal file
View File

@ -0,0 +1,288 @@
namespace KRY_0x02
{
partial class main_form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5pathtopic = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4height = new System.Windows.Forms.TextBox();
this.textBox5width = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.button6 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(19, 78);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(108, 13);
this.label1.TabIndex = 0;
this.label1.Text = "enter secret message";
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(22, 94);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(342, 66);
this.textBox1.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(19, 210);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(117, 13);
this.label2.TabIndex = 2;
this.label2.Text = "get the secret message";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(22, 226);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(342, 59);
this.textBox2.TabIndex = 3;
//
// button1
//
this.button1.Location = new System.Drawing.Point(22, 166);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 5;
this.button1.Text = "put";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(22, 291);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 6;
this.button2.Text = "get";
this.button2.UseVisualStyleBackColor = true;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(383, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(621, 419);
this.pictureBox1.TabIndex = 8;
this.pictureBox1.TabStop = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(380, 512);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(36, 13);
this.label3.TabIndex = 9;
this.label3.Text = "height";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(380, 535);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 13);
this.label4.TabIndex = 10;
this.label4.Text = "width";
//
// label5pathtopic
//
this.label5pathtopic.AutoSize = true;
this.label5pathtopic.Location = new System.Drawing.Point(380, 453);
this.label5pathtopic.Name = "label5pathtopic";
this.label5pathtopic.Size = new System.Drawing.Size(66, 13);
this.label5pathtopic.TabIndex = 11;
this.label5pathtopic.Text = "/path/to/pic";
//
// button3
//
this.button3.Location = new System.Drawing.Point(196, 472);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 12;
this.button3.Text = "export";
this.button3.UseVisualStyleBackColor = true;
//
// button4
//
this.button4.Location = new System.Drawing.Point(196, 443);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 13;
this.button4.Text = "import";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(289, 443);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 14;
this.button5.Text = "use default";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(193, 418);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(39, 13);
this.label6.TabIndex = 15;
this.label6.Text = "picture";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(383, 469);
this.textBox3.Name = "textBox3";
this.textBox3.ReadOnly = true;
this.textBox3.Size = new System.Drawing.Size(552, 20);
this.textBox3.TabIndex = 16;
//
// textBox4height
//
this.textBox4height.Location = new System.Drawing.Point(421, 509);
this.textBox4height.Name = "textBox4height";
this.textBox4height.ReadOnly = true;
this.textBox4height.Size = new System.Drawing.Size(60, 20);
this.textBox4height.TabIndex = 17;
//
// textBox5width
//
this.textBox5width.Location = new System.Drawing.Point(421, 535);
this.textBox5width.Name = "textBox5width";
this.textBox5width.ReadOnly = true;
this.textBox5width.Size = new System.Drawing.Size(60, 20);
this.textBox5width.TabIndex = 18;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(487, 522);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(22, 16);
this.label5.TabIndex = 19;
this.label5.Text = "px";
//
// button6
//
this.button6.Location = new System.Drawing.Point(289, 472);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(75, 23);
this.button6.TabIndex = 20;
this.button6.Text = "clear";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// main_form
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1041, 584);
this.Controls.Add(this.button6);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox5width);
this.Controls.Add(this.textBox4height);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.label5pathtopic);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "main_form";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "0x02 stego";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5pathtopic;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4height;
private System.Windows.Forms.TextBox textBox5width;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button6;
}
}

101
main_form.cs Normal file
View File

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KRY_0x02
{
public partial class main_form : Form
{
public main_form()
{
InitializeComponent();
}
public string getpath(TextBox t)
{
string path = t.Text;
return path;
}
//Bitmap my_bitmap = new Bitmap(getpath(textBox1));
Color pixel;
int int_value;
//for (int i = 0; i<my_bitmap.Witdh - 1; i++)
//{
//}
class do_a_stego
{
public string putthere()
{
return "";
}
public string gimme()
{
return "";
}
}
private void button1_Click(object sender, EventArgs e)
{
// put
}
private void button4_Click(object sender, EventArgs e)
{
/*
* Wrap the creation of the OpenFileDialog instance in a using statement,
* rather than manually calling the Dispose method to ensure proper disposal
*/
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = "pick a pic";
dlg.Filter = "png (*.png)|*.png";
if (dlg.ShowDialog() == DialogResult.OK)
{
label5pathtopic.Text = @"path/to/pic";
pictureBox1.Image = new Bitmap(dlg.FileName);
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
textBox3.Text = dlg.FileName;
textBox4height.Text = pictureBox1.Image.Height.ToString();
textBox5width.Text = pictureBox1.Image.Width.ToString();
}
}
}
private void button5_Click(object sender, EventArgs e)
{
/*/* use-default-pic button */
string filename = @"C:\Users\citizen\source\repos\KRY-0x02\security.png";
pictureBox1.Image = new Bitmap(filename);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
label5pathtopic.Text = $"Security: Actual actual reality: nobody cares about his secrets."
+ " (Also, I would be hard-pressed to find that wrench for $5.)";
textBox3.Text = filename + "\t\t by randall ... https://xkcd.com/538";
textBox4height.Text = pictureBox1.Image.Height.ToString();
textBox5width.Text = pictureBox1.Image.Width.ToString();
}
private void button6_Click(object sender, EventArgs e)
{
/* clear pic selection */
label5pathtopic.Text = @"path/to/pic";
pictureBox1.Image = null;
textBox3.Text = "";
textBox4height.Text = "";
textBox5width.Text = "";
}
}
}

123
main_form.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

BIN
security.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB