public override void Write(byte[] buffer, int offset, int count)
 {
     ValidateSize(count);
     if (count != 0)
     {
         ulong currentSector = base.CurrentSector;
         if (_encryptor == null)
         {
             _encryptor = _xts.CreateEncryptor();
         }
         int count2 = _encryptor.TransformBlock(buffer, offset, count, _tempBuffer, 0, currentSector);
         base.Write(_tempBuffer, 0, count2);
     }
 }
        public override int Read(byte[] buffer, int offset, int count)
        {
            ValidateSize(count);
            ulong currentSector = base.CurrentSector;
            int   num           = base.Read(_tempBuffer, 0, count);

            if (num == 0)
            {
                return(0);
            }
            if (_decryptor == null)
            {
                _decryptor = _xts.CreateDecryptor();
            }
            return(_decryptor.TransformBlock(_tempBuffer, 0, num, buffer, offset, currentSector));
        }