added fix preventing input of literal zero

* ...as it is the termination character, by which we can tell the end of a message
This commit is contained in:
citizen 2020-01-21 05:51:39 +01:00
parent c82f88393d
commit 0fcec4d971
Signed by: wanderer
GPG Key ID: A6FA3CA298BA2223
2 changed files with 15 additions and 1 deletions

1
main_form.Designer.cs generated
View File

@ -76,6 +76,7 @@
this.textBox1putm.Name = "textBox1putm"; this.textBox1putm.Name = "textBox1putm";
this.textBox1putm.Size = new System.Drawing.Size(342, 66); this.textBox1putm.Size = new System.Drawing.Size(342, 66);
this.textBox1putm.TabIndex = 3; this.textBox1putm.TabIndex = 3;
this.textBox1putm.TextChanged += new System.EventHandler(this.textBox1putm_TextChanged);
// //
// label2 // label2
// //

View File

@ -187,7 +187,6 @@ namespace KRY_0x02
//{ //{
// output = main_output; // output = main_output;
//} //}
MessageBox.Show("success!","done");
return output; return output;
} }
} }
@ -218,6 +217,7 @@ namespace KRY_0x02
do_a_stego do_A_Stego = new do_a_stego(); do_a_stego do_A_Stego = new do_a_stego();
Bitmap b = new Bitmap(pictureBox1.Image); Bitmap b = new Bitmap(pictureBox1.Image);
textBox2getm.Text = do_A_Stego.gimme(b); 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!"); 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;
}
}
} }
} }