Пример #1
0
        /// <summary>
        /// DEC Format or Text files of form: Amount Name
        /// </summary>
        /// <param name="path"></param>
        /// <param name="cards"></param>
        private void ParseFormatDEC(string path, ref SortableBindingList <Card> cards)
        {
            using (StreamReader sr = new StreamReader(path))
            {
                string    line;
                MagicCard card;

                while (!sr.EndOfStream)
                {
                    line = sr.ReadLine().Trim();
                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }

                    card = null;

                    if (line.StartsWith("//"))                     // Comment, may contain "Name:"
                    {
                    }
                    else if (line.StartsWith("SB:"))
                    {
                        card = GetCardFromText(line.Replace("SB:", "").Trim());
                        card.IsInSideboard = true;
                    }
                    else
                    {
                        card = GetCardFromText(line);
                    }

                    if (card != null)
                    {
                        cards.Add(card);
                    }
                }
            }
        }
Пример #2
0
        private void bwUpdateLibrary_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            cardsLibrary = e.Result as SortableBindingList <Archivist.MagicObjects.MagicCard>;

            dgLibrary.BindDatasource(cardsLibrary);
        }