예제 #1
0
        public DeckList(string path, Dispatcher disp, DeckList parent = null, bool isRoot = false)
        {
            Parent = parent;
            Path   = path;
            Name   = new DirectoryInfo(path).Name;

            if (isRoot)
            {
                IsRootFolder = true;
            }

            DeckLists = new ObservableCollection <DeckList>();
            Decks     = new ObservableCollection <MetaDeck>();

            foreach (var f in Directory.GetDirectories(path).Select(x => new DirectoryInfo(x)))
            {
                if (isRoot)
                {
                    if (DataNew
                        .DbContext.Get()
                        .Games
                        .Any(x => x.Name.Equals(f.Name, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        var dl = new DeckList(f.FullName, disp, this);
                        dl.IsGameFolder = true;
                        disp.Invoke(new Action(() => DeckLists.Add(dl)));
                    }
                }
                else
                {
                    var dl = new DeckList(f.FullName, disp, this);
                    disp.Invoke(new Action(() => DeckLists.Add(dl)));
                }
            }

            foreach (var f in Directory.GetFiles(Path, "*.o8d"))
            {
                var deck = new MetaDeck(f);
                disp.Invoke(new Action(() => Decks.Add(deck)));
            }
            foreach (var d in DeckLists.SelectMany(x => x.Decks))
            {
                MetaDeck d1 = d;
                disp.Invoke(new Action(() => Decks.Add(d1)));
            }
        }
예제 #2
0
        public DeckList(string path, Dispatcher disp, DeckList parent = null, bool isRoot = false)
        {
            Parent = parent;
            Path = path;
            Name = new DirectoryInfo(path).Name;

            if (isRoot) IsRootFolder = true;

            DeckLists = new ObservableCollection<DeckList>();
            Decks = new ObservableCollection<MetaDeck>();

            foreach (var f in Directory.GetDirectories(path).Select(x => new DirectoryInfo(x)))
            {
                if (isRoot)
                {
                    if (DataNew
                        .DbContext.Get()
                        .Games
                        .Any(x => x.Name.Equals(f.Name, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        var dl = new DeckList(f.FullName, disp, this);
                        dl.IsGameFolder = true;
                        disp.Invoke(new Action(() => DeckLists.Add(dl)));
                    }
                }
                else
                {
                    var dl = new DeckList(f.FullName, disp, this);
                    disp.Invoke(new Action(() => DeckLists.Add(dl)));
                }
            }

            foreach (var f in Directory.GetFiles(Path, "*.o8d"))
            {
                var deck = new MetaDeck(f);
                disp.Invoke(new Action(() => Decks.Add(deck)));
            }
            foreach (var d in DeckLists.SelectMany(x => x.Decks))
            {
                MetaDeck d1 = d;
                disp.Invoke(new Action(() => Decks.Add(d1)));
            }
        }