コード例 #1
0
 /// <summary>
 /// Disposes the enumerator.
 /// </summary>
 /// <param name="disposing">Indicates whether this was called during disposal
 ///     (<see langword="true"/>) or finalization (<see langword="false"/>).</param>
 protected void Dispose(bool disposing)
 {
     if (disposing)
     {
         BytesEnumerator?.Dispose();
     }
 }
コード例 #2
0
            /// <summary>
            /// Resets the state of the enumerator.
            /// </summary>
            /// <exception cref="ObjectDisposedException">The enumerator has been disposed.</exception>
            public virtual void Reset()
            {
                if (IsDisposed)
                {
                    throw new ObjectDisposedException(null);
                }

                BytesEnumerator.Reset();
                _current          = default;
                CurrentByteOffset = 0;
            }
コード例 #3
0
            /// <summary>
            /// Ensures that there are bits left to be read from the byte enumerator, moving to the next
            /// byte if necessary/possible. If we move to another byte, <see cref="CurrentByteOffset"/>
            /// is changed accordingly.
            /// </summary>
            /// <returns>True if there are bits left, false if not.</returns>
            protected virtual bool EnsureBitsLeft()
            {
                while (CurrentByteOffset >= 8)
                {
                    if (BytesEnumerator.MoveNext())
                    {
                        CurrentByteOffset -= BitsInByte;
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(true);
            }