コード例 #1
0
        /// <summary>
        /// Sets up the previous book properties.
        /// </summary>
        /// <param name="previousBook">
        /// The previous book.
        /// </param>
        public void SetupPreviousBook(BookReadFromGmail previousBook)
        {
            PreviousTotalRead   = previousBook.TotalRead;
            PreviousTotalBooks  = previousBook.TotalBooks;
            PreviousTotalComics = previousBook.TotalComics;
            PreviousTotalAudio  = previousBook.TotalAudio;
            PreviousTotalPages  = previousBook.TotalPages;

            if (TotalComics - PreviousTotalComics == 1)
            {
                IsComic = true;
            }
            else if (TotalAudio - PreviousTotalAudio == 1)
            {
                IsComic = true;
            }
            else
            {
                IsBook = true;
            }
        }
コード例 #2
0
        /// <summary>
        /// The get emailed book from text block.
        /// </summary>
        /// <param name="bookReadText">The book read text.</param>
        /// <returns>The book read.</returns>
        private BookReadFromGmail GetEmailedBookFromEntry(string bookReadText)
        {
            BookReadFromGmail newBook = new BookReadFromGmail();

            string date   = string.Empty;
            string author = string.Empty;
            string title  = string.Empty;
            string pages  = string.Empty;
            string counts = string.Empty;

            if (IsBookReadLine(bookReadText, ref date, ref author, ref title, ref pages, ref counts))
            {
                newBook.Date       = GetDateFromString(date);
                newBook.DateString = date;
                newBook.Author     = author;
                newBook.Title      = title;
                ushort numPages;
                if (ushort.TryParse(pages, out numPages))
                {
                    newBook.Pages = numPages;
                }

                ulong  ttlPages;
                ushort ttlAudio, ttlComics, ttlBooks, ttlRead;

                if (GetTotalsFromCounts(counts, out ttlPages, out ttlAudio, out ttlComics, out ttlBooks, out ttlRead))
                {
                    newBook.TotalPages = ttlPages;

                    newBook.TotalRead   = ttlRead;
                    newBook.TotalBooks  = ttlBooks;
                    newBook.TotalComics = ttlComics;
                    newBook.TotalAudio  = ttlAudio;
                }
            }

            return(newBook);
        }