diff --git a/main_form.cs b/main_form.cs index c90fde9..f076e77 100644 --- a/main_form.cs +++ b/main_form.cs @@ -29,7 +29,16 @@ namespace KRY_0x01_ng public string restore_order(string str) { string alpha_str = Regex.Replace(str, "SPACEBRO", " "); - return alpha_str; + Regex.Replace(alpha_str, "COMMABRO", ","); + return Regex.Replace(alpha_str, "DOTBRO", "."); + } + + string introduce_chaos(string str) + { + string nustr = Regex.Replace(str, " ", "SPACEBRO"); + Regex.Replace(nustr, "W", "V"); + Regex.Replace(nustr, ",", "COMMABRO"); + return Regex.Replace(nustr, ".", "DOTBRO"); } public string pad(string str) @@ -155,14 +164,13 @@ namespace KRY_0x01_ng MessageBox.Show("Empty message, nothing to do.", "Warning"); return; } - string msg = Regex.Replace(tb_m.Text.ToUpper(), " ", "SPACEBRO"); + string msg = introduce_chaos(tb_m.Text.ToUpper()); Match match = Regex.Match(msg, @"\d|\s+"); if (match.Success) { - MessageBox.Show("Only alphabetic characters and spaces are allowed.\nCheck the message for numbers, symbols or tab whitespace and remove them before continuing.\nAlso, \"W\" will be replaced by \"V\".", "Error: invalid chars in message"); + MessageBox.Show("Only alphabetic characters, spaces, commas (,) and dots (.) are allowed.\nCheck the message for numbers, symbols or tab whitespace and remove them before continuing.\nAlso, \"W\" will be replaced by \"V\".", "Error: invalid chars in message"); return; } - msg = msg.Replace("W", "V"); textBox5.Text = msg; return; }