Пример #1
0
        /// <summary>Testing mainframe for the CRC_Handler class.</summary>

        /*
         * static public void Main(String[] args)
         * {
         * CRC_Handler handler = new CRC_Handler(CRC_Modes.CRC_32);
         *
         * Console.WriteLine("What are the CRC values?:");
         * for (int i = 0; i < 256; i++)
         * {
         *    ulong crc = handler.get_CRC(new byte[1] { (byte)i });
         *    Console.WriteLine("\t#{0})\t{1}", i + 1, crc);
         *    Console.WriteLine("\t\tHex: {0}", Hexadecimal.ToHex((uint)crc));
         * }
         *
         * Console.ReadKey();
         * Console.ReadKey();
         * }
         */

        /// <summary>
        /// AREAS OF IMPROVEMENT: Expand the class to include all the CRC
        /// calculation methods. </summary>
        /// <param name="mode">The CRC calculation mode.</param>
        public CRC_Handler(CRC_Modes mode)
        {
            // Calculate the CRCs for the given CRC mode.
            // For the time being, it can only be CRC32
            this.mode = mode;
            CRC_32();
        }
        /// <summary>Testing mainframe for the CRC_Handler class.</summary>
        /*
          static public void Main(String[] args)
          {
         CRC_Handler handler = new CRC_Handler(CRC_Modes.CRC_32);

         Console.WriteLine("What are the CRC values?:");
         for (int i = 0; i < 256; i++)
         {
            ulong crc = handler.get_CRC(new byte[1] { (byte)i });
            Console.WriteLine("\t#{0})\t{1}", i + 1, crc);
            Console.WriteLine("\t\tHex: {0}", Hexadecimal.ToHex((uint)crc));
         }

         Console.ReadKey();
         Console.ReadKey();
          }
          */
        /// <summary>
        /// AREAS OF IMPROVEMENT: Expand the class to include all the CRC
        /// calculation methods. </summary>
        /// <param name="mode">The CRC calculation mode.</param>
        public CRC_Handler(CRC_Modes mode)
        {
            // Calculate the CRCs for the given CRC mode.
             // For the time being, it can only be CRC32
             this.mode = mode;
             CRC_32();
        }