예제 #1
0
        public Title[] GetTitles(params TitleRarity[] rarities)
        {
            if (rarities != null && rarities.Length > 0)
            {
                return(Titles.Where(t => rarities.Contains(t.Rarity)).ToArray());
            }

            return(Titles.ToArray());
        }
        public MainViewModel()
        {
            try
            {
                string json    = File.ReadAllText(dbName);
                var    _titles = new ObservableCollection <TitleModel>(JsonConvert.DeserializeObject <List <TitleModel> >(json).OrderBy(x => x.System).ThenBy(y => y.Title));
                foreach (var title in Titles.Where(t =>
                                                   string.IsNullOrWhiteSpace(t.CartImage) && !string.IsNullOrWhiteSpace(t.CartUrl)))
                {
                    title.CartImage = title.CartUrl;
                }

                Titles = _titles;
            }
            catch
            {
            }

            if (File.Exists("config.json"))
            {
                string configJson = File.ReadAllText("config.json");
                Config config     = JsonConvert.DeserializeObject <Config>(configJson);

                GameScannerPath = config.Path;
                UserName        = config.UserName;
                PassWord        = config.Password;
            }

            string scc = File.ReadAllText("systems.cfg");

            SystemConfigs = new ObservableCollection <ConsoleLabelConfig>(JsonConvert.DeserializeObject <List <ConsoleLabelConfig> >(scc));
            foreach (ConsoleLabelConfig consoleLabelConfig in SystemConfigs)
            {
                FoundSystems.Add(new System
                {
                    HasConfig = true,
                    Name      = consoleLabelConfig.EmuVRMedia,
                });
            }

            FoundSystems = new ObservableCollection <System>(FoundSystems.OrderBy(x => x.Name));
        }