Exemplo n.º 1
0
        private void LoadCards(string indexPath)
        {
            var reader = new LuceneCardsReader(indexPath);

            cards = reader.Read();
            htcards.Clear();
            for (int i = 0; i < cards.Length; i++)
            {
                htcards.Add(cards[i].Name, cards[i]);
            }
        }
Exemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new Microsoft.Win32.OpenFileDialog
            {
                DefaultExt = ".cdb",
                Filter     = "YGOPro数据库|*.cdb"
            };

            if (ofd.ShowDialog() == true)
            {
                var ygoReader = new YGOProCardsReader(ofd.FileName);
                var cards     = ygoReader.Read();

                var luceneSaver = new LuceneCardsSaver(Global.IndexPath);
                luceneSaver.Save(cards);

                var luceneReader = new LuceneCardsReader(Global.IndexPath);
                var cards2       = luceneReader.Read();


                ObservableCollection <Card> cardList = new ObservableCollection <Card>(cards2);
                listview1.ItemsSource = cardList;
            }
        }