public void AddAllDecksOfQualifyingBookAndChapter(BookAndChapterNum bookAndChapterNum, ref List <Deck> deckListToAppend)
 {
     foreach (Deck deck in mChapterDecks)
     {
         if (bookAndChapterNum.IsEqualTo(deck.GetBookAndChapterNumber()))
         {
             deckListToAppend.Add(deck);
         }
     }
 }
 public int CompareTo(BookAndChapterNum other)
 {
     if (other == null)
     {
         return(1);
     }
     if (mBookNum == other.mBookNum)
     {
         return(mChapterNum.CompareTo(other.mChapterNum));
     }
     return(mBookNum.CompareTo(other.mBookNum));
 }
 public bool IsGreaterThan(BookAndChapterNum other)
 {
     if (mBookNum > other.mBookNum)
     {
         return(true);
     }
     if (mBookNum == other.mBookNum)
     {
         return(mChapterNum > other.mChapterNum);
     }
     return(false);
 }
 public bool IsEqualTo(BookAndChapterNum other)
 {
     return(mBookNum == other.mBookNum && mChapterNum == other.mChapterNum);
 }
        public void LoadDecks()
        {
            StreamReader file = new StreamReader(mSourceFileName, Encoding.UTF8);

            string        line;
            Deck          currentDeck       = null;
            AddCardResult lastCardAddResult = AddCardResult.kNoResult;

            while ((line = file.ReadLine()) != null)
            {
                // Ignore blank and effectively blank lines
                string strippedLine = "";
                foreach (char c in line)
                {
                    if (!char.IsWhiteSpace(c) && c != '—')
                    {
                        strippedLine += c;
                    }
                }

                if (strippedLine.Length == 0)
                {
                    continue;
                }

                // Stoppers between decks
                if (line.StartsWith("@"))
                {
                    AddDeck(currentDeck);
                    currentDeck = new Deck(this);
                    currentDeck.InitializeFromLine(SplitSourceFileLine(line));
                    lastCardAddResult = AddCardResult.kNoResult;
                }
                // Read in each line into its component parts
                else
                {
                    AddCardResult addCardResult = currentDeck.AddCardFromLine(SplitSourceFileLine(line));
                    if (lastCardAddResult == AddCardResult.kBlank && addCardResult != AddCardResult.kBlank)
                    {
                        currentDeck.MarkError("Has a line skip within the deck");
                    }
                    lastCardAddResult = addCardResult;
                }
            }

            file.Close();

            // Close out last deck
            AddDeck(currentDeck);

            // Track which book and chapter numbers are available for aggregating
            BookAndChapterNum lastBookAndChapterNumber = new BookAndChapterNum();

            foreach (Deck deck in mChapterDecks)
            {
                BookAndChapterNum thisBookAndChapterNumber = deck.GetBookAndChapterNumber();
                if (thisBookAndChapterNumber.IsValid() && thisBookAndChapterNumber.IsGreaterThan(lastBookAndChapterNumber))
                {
                    mBookAndChapterNumbers.Add(thisBookAndChapterNumber);
                    lastBookAndChapterNumber = thisBookAndChapterNumber;
                }
            }
        }