Пример #1
0
        private void InitialiseCRCProvider()
        {
            var factory = new CRCFactory();

            _crcProvider            = factory.CreateProvider(_fieldConfig.CRCProvider);
            _crcProvider.Endianness = _fieldConfig.Endianness;
        }
 private void InitialiseCRCProvider()
 {
     if (_crcProvider == null)
     {
         var factory = new CRCFactory();
         _crcProvider = factory.CreateProvider(CRCProviderMode.CRC32);
     }
 }
Пример #3
0
        public void CRC16CCITT_0x0000_Test()
        {
            var provider = _factory.CreateProvider(CRCProviderMode.CRC16_CCITT_XModem);
            var source   = "1234567890";

            provider.Endianness = Endianness.LE;
            var leCRC  = "21D3";
            var actual = provider.CRCheck(Encoding.ASCII.GetBytes(source));

            Assert.Equal(leCRC, actual.ToHexString());

            provider.Endianness = Endianness.BE;
            var beCRC = "D321";

            actual = provider.CRCheck(Encoding.ASCII.GetBytes(source));
            Assert.Equal(beCRC, actual.ToHexString());
        }