示例#1
0
 private Strobe128(byte[] state, StrobeFlags flags, byte beginPosition, byte position)
 {
     Buffer.BlockCopy(state, 0, State, 0, State.Length);
     _currentFlags  = flags;
     _beginPosition = beginPosition;
     _position      = position;
 }
示例#2
0
        private void BeginOperation(StrobeFlags flags, bool more)
        {
            if (more)
            {
                if (flags != _currentFlags)
                {
                    throw new InvalidOperationException($"Attempt to continue operation '{_currentFlags}' with new flags '{flags}' is not allowed.");
                }
                _currentFlags = flags;
                return;
            }

            // Skip adjusting direction information (we just use AD, PRF)
            if (_currentFlags.HasFlag(StrobeFlags.T))
            {
                throw new NotImplementedException("Transport operations are not implemented.");
            }

            var oldBeginPosition = _beginPosition;

            _currentFlags  = flags;
            _beginPosition = (byte)(_position + 1);

            Absorb(new[] { oldBeginPosition, (byte)flags });

            // Force running F if C or K is set
            var forceF = flags.HasFlag(StrobeFlags.C) || flags.HasFlag(StrobeFlags.K);

            if (forceF && _position != 0)
            {
                RunF();
            }
        }