Převodník do/z Morseovky v C# editovat

using System;

namespace x30x12x2021
{
    internal class Program
    {
        static void Main()
        {
            while (true)
            {
                Console.WriteLine("Zadejte text určený pro převod:");
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) break;
                else
                {
                    Console.WriteLine();

                    if (line[0] == '.' || line[0] == '-') //detekce jestli je zadáním Morseovka
                    {
                        string[] vs = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); //mezerami oddělené Morseovy kódy

                        for (int i = 0; i < vs.Length; i++)
                        {
                            Console.Write(Morse.DecodeMorseCode(vs[i]));
                        }
                    }
                    else //zadání nejsou Morseovy kódy, takže se bude kódovat text do Morseovky
                    {
                        for (int i = 0; i < line.Length; i++)
                        {
                            Console.Write(Morse.EncodeToMorseCode(line[i]));
                            Console.Write(" "); //oddělovač kódu
                        }
                    }

                    Console.WriteLine();
                }
            }
        }
    }

    static class Morse
    {
        #region ONLY READ
        private static readonly string[,] MorseCodes = new string[,]
            {
                {"A" , ".-"},
                {"B" , "-..."},
                {"C" , "-.-."},
                {"D" , "-.."},
                {"E" , "."},
                {"F" , "..-."},
                {"G" , "--."},
                {"H" , "...."},
                {"I" , ".."},
                {"J" , ".---"},
                {"K" , "-.-"},
                {"L" , ".-.."},
                {"M" , "--"},
                {"N" , "-."},
                {"O" , "---"},
                {"P" , ".--."},
                {"Q" , "--.-"},
                {"R" , ".-."},
                {"S" , "..."},
                {"T" , "-"},
                {"U" , "..-"},
                {"V" , "...-"},
                {"W" , ".--"},
                {"X" , "-..-"},
                {"Y" , "-.--"},
                {"Z" , "--.."},
                {"0" , "-----"},
                {"1" , ".----"},
                {"2" , "..---"},
                {"3" , "...--"},
                {"4" , "....-"},
                {"5" , "....."},
                {"6" , "-...."},
                {"7" , "--..."},
                {"8" , "---.."},
                {"9" , "----."}
            };
        #endregion
        public static string EncodeToMorseCode(char c)
        {
            var uc = char.ToUpper(c);
            int len = MorseCodes.GetLength(0);
            for (int i = 0; i < len; i++)
            {
                if (uc == MorseCodes[i, 0][0]) return MorseCodes[i, 1];
            }
            return uc.ToString();
        }

        public static string DecodeMorseCode(string m)
        {
            int len = MorseCodes.GetLength(0);
            for (int i = 0; i < len; i++)
            {
                if (m == MorseCodes[i, 1]) return MorseCodes[i, 0];
            }
            return "?";
        }
    }
}