예제 #1
0
        static void LinesArg(CRC crc, Cli cli)
        {
            System.IO.StreamReader file = null;
            string filename             = cli.opt.Argument;

            try
            {
                file = new System.IO.StreamReader(filename);
            }
            catch (IOException e)
            {
                Console.WriteLine($"Error opening {filename}");
                Console.WriteLine(e.Message);
                return;
            }

            string line;
            int    linenum = 0;
            ushort linecrc;

            while ((line = file.ReadLine()) != null)
            {
                linenum++;
                if (cli.opt.HexString)
                {
                    linecrc = crc.HexStringChecksum(line);
                }
                else
                {
                    linecrc = crc.Checksum(line);
                }
                Console.Write($"{linenum} : ");
                ShowHex(linecrc);
            }
            file.Close();
        }
예제 #2
0
        static void StringArg(CRC crc, Cli cli)
        {
            ushort result = crc.Checksum(cli.opt.Argument);

            ShowHex(result);
        }
예제 #3
0
        static void FileArg(CRC crc, Cli cli)
        {
            ushort csum = crc.Checksum(cli.opt.Argument);

            ShowHex(csum);
        }