예제 #1
0
        private void LoadAllAvailableDecks()
        {
            DirectoryInfo info = new DirectoryInfo(DeckFileHelper.ZippedDecksPath);

            // if the decks directory is not created then create it.
            if (!info.Exists)
            {
                info.Create();
            }

            string searchPattern = string.Format("*{0}", ZippedDeckExtension);

            FileInfo[] decks = info.GetFiles(searchPattern, SearchOption.TopDirectoryOnly);

            foreach (FileInfo deck in decks)
            {
                try
                {
                    string outputPath = DeckPackagingHelper.ExtractFromZip(deck.FullName);
                    if (!string.IsNullOrEmpty(outputPath))
                    {
                        LoadUnzippedDeck(deck.FullName, outputPath);
                    }
                }
                catch (Exception e)
                {
                    Utils.LogException(MethodBase.GetCurrentMethod(), e);
                }
            }

            CurrentView = this.Decks;
        }