Beispiel #1
0
        /// <summary>
        /// Get input options to echar.
        /// </summary>
        /// <returns>Input options.</returns>
        private static oParams GetOpt(string[] args)
        {
            oParams o = new oParams();

            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-a":
                case "--ascii":
                    o.ascii = true;
                    break;

                case "-v":
                case "--verbose":
                    o.verbose = true;
                    break;

                case "-i":
                case "--input":
                    o.input = args[++i];
                    break;
                }
            }
            return(o);
        }
Beispiel #2
0
        /// <summary>
        /// Harness lightning.
        /// </summary>
        /// <param name="args">Input arguments.</param>
        static void Main(string[] args)
        {
            oParams    p   = GetOpt(args);
            TextReader cin = p.input == null ? Console.In : new StringReader(p.input);

            if (p.ascii)
            {
                ToAscii(cin, p.verbose);
            }
            else
            {
                ToChar(cin, p.verbose);
            }
        }