From 0fcec4d9719662e4cc75c3147d22dc202bca3bd2 Mon Sep 17 00:00:00 2001 From: citizen Date: Tue, 21 Jan 2020 05:51:39 +0100 Subject: [PATCH] added fix preventing input of literal zero * ...as it is the termination character, by which we can tell the end of a message --- main_form.Designer.cs | 1 + main_form.cs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/main_form.Designer.cs b/main_form.Designer.cs index 5d0a34a..a8d3b2a 100644 --- a/main_form.Designer.cs +++ b/main_form.Designer.cs @@ -76,6 +76,7 @@ this.textBox1putm.Name = "textBox1putm"; this.textBox1putm.Size = new System.Drawing.Size(342, 66); this.textBox1putm.TabIndex = 3; + this.textBox1putm.TextChanged += new System.EventHandler(this.textBox1putm_TextChanged); // // label2 // diff --git a/main_form.cs b/main_form.cs index 0aaeec8..46259cd 100644 --- a/main_form.cs +++ b/main_form.cs @@ -187,7 +187,6 @@ namespace KRY_0x02 //{ // output = main_output; //} - MessageBox.Show("success!","done"); return output; } } @@ -218,6 +217,7 @@ namespace KRY_0x02 do_a_stego do_A_Stego = new do_a_stego(); Bitmap b = new Bitmap(pictureBox1.Image); textBox2getm.Text = do_A_Stego.gimme(b); + MessageBox.Show("success!", "done"); } @@ -315,5 +315,18 @@ namespace KRY_0x02 MessageBox.Show($"saved to {name}", "gj, file saved!"); } } + + private void textBox1putm_TextChanged(object sender, EventArgs e) + { + if (Regex.IsMatch(textBox1putm.Text, "0")) + { + textBox1putm.BackColor = Color.PaleVioletRed; + MessageBox.Show("null character is forbidden, sorry..\nmeaning it's going to be replaced", "just a note"); + textBox1putm.Text = Regex.Replace(textBox1putm.Text, "0", "nullchar"); + textBox1putm.Select(textBox1putm.Text.Length, 0); + textBox1putm.BackColor = Color.White; + return; + } + } } }