public static string FullTextToMorse(String NText) { string MText = ""; for (int i = 0; i < NText.Length; i++) { if (IsNumb(NText[i])) { Diffrence = 48; DiffrenceAdd = 1; } else { Diffrence = 65; DiffrenceAdd = 13; } if ((int)NText.ToUpper()[i] == 32) { MText += "/"; } else { MText += MorseCode.ToMorseCode(MorseCode.ToCodeValue((int)NText.ToUpper()[i] - Diffrence + DiffrenceAdd)); } } return(MText); }
private void Mors_Code_TextChanged(object sender, EventArgs e) { if (!ToText.Enabled) { NormalText.Text = MorseCode.MorseToNormalText(Mors_Code.Text); } }
private void NormalText_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyCode == Keys.V) && e.Control) { Mors_Code.Text += MorseCode.FullTextToMorse(Clipboard.GetText()); PastePressed = true; } }
private void NormalText_TextChanged(object sender, EventArgs e) { if (NormalText.Text.Length != 0 && !PastePressed && !ToMorse.Enabled) { Mors_Code.Text += MorseCode.NormalTextToMorse(NormalText.Text); } PastePressed = false; }