示例#1
0
 public bool Equals(DbStats?other)
 {
     return(other != null &&
            Id.Equals(other.Id) &&
            ProfileId.Equals(other.ProfileId) &&
            ChapterId.Equals(other.ChapterId) &&
            Completed == other.Completed &&
            Tips.SequenceEqual(other.Tips) &&
            Submits.SequenceEqual(other.Submits) &&
            Failures.SequenceEqual(other.Failures));
 }
示例#2
0
        /// <summary>
        /// Updates the <see cref="Completed"/> property according to the current
        /// state of <see cref="Submits"/> and <see cref="Failures"/>.
        /// </summary>
        /// <returns>The same <see cref="DbStats"/> instance with updated <see cref="Completed"/>
        /// property value.</returns>
        public DbStats WithUpdatedCompleted()
        {
            bool PageCompleted(byte submits, int index)
            {
                var failures = Failures != null ? Failures[index] : 0;

                return(submits > failures || submits == byte.MaxValue);
            }

            Completed = Submits != null && Submits.All(PageCompleted);
            return(this);
        }
示例#3
0
 public DbStats WithSubmit(int pageIndex)
 {
     Submits ??= new byte[pageIndex + 1];
     Submits.Increment(pageIndex);
     return(this);
 }