Ejemplo n.º 1
0
        // Constructor
        public LibrarySidebar(int gameId)
        {
            db = new MyDbContext();

            // populate public properties
            GameId = gameId;

            Game game = (from g in db.Game
                         where g.gameId == gameId
                         select g).SingleOrDefault();

            if (game == null)
            {
                return;
            }

            GameName   = game.gameName;
            GamePath   = game.gamePath;
            IsFavorite = game.isFavorite;

            LastPlayed    = game.gameLastPlayed;
            LastFinished  = game.gameLastFinished;
            TotalPlayTime = game.gameTime;
            TimesPlayed   = game.timesPlayed;

            SystemId          = game.systemId;
            SystemCode        = GSystem.GetSystemCode(SystemId);
            SystemName        = GSystem.GetSystemName(SystemId);
            SystemDescription = GSystem.GetSystemDesc(SystemId);

            if (game.gdbId != null)
            {
                gdbid = game.gdbId.Value;
            }

            AlternateTitles = game.AlternateTitles;
            Genres          = game.Genres;
            Coop            = game.Coop;
            Developer       = game.Developer;
            ESRB            = game.ESRB;
            Overview        = game.Overview;
            Players         = game.Players;
            Publisher       = game.Publisher;
            Year            = game.Year;

            Copyright         = game.Copyright;
            Country           = game.Country;
            DevelopmentStatus = game.DevelopmentStatus;
            Language          = game.Language;
            OtherFlags        = game.OtherFlags;

            if (game.ManualEditSet == true)
            {
                ManEdit = true;
            }
            else
            {
                ManEdit = false;
            }
        }
Ejemplo n.º 2
0
        public GSystem(string _systemCode)
        {
            // Set GSystem based on systemCode
            GSystem gsystem = (from g in GetSystems()
                               where g.systemCode == _systemCode
                               select g).FirstOrDefault();

            systemId                   = gsystem.systemId;
            systemCode                 = gsystem.systemCode;
            systemName                 = gsystem.systemName;
            systemDescription          = gsystem.systemDescription;
            supportedFileExtensions    = gsystem.supportedFileExtensions;
            supportedArchiveExtensions = gsystem.supportedArchiveExtensions;
        }
Ejemplo n.º 3
0
        public static HashSet <string> GetAllowedSubFileExtensions(int systemId)
        {
            var exts = (from g in GSystem.GetSubSystems()
                        where g.systemId == systemId
                        select g).SingleOrDefault();
            string archive    = exts.supportedArchiveExtensions;
            string nonArchive = exts.supportedFileExtensions;

            HashSet <string> supported = new HashSet <string>();
            char             c         = ',';

            string[] aSplit = archive.Split(c);
            string[] nSplit = nonArchive.Split(c);
            foreach (string s in aSplit)
            {
                supported.Add(s);
            }
            foreach (string s in nSplit)
            {
                supported.Add(s);
            }

            return(supported);
        }
Ejemplo n.º 4
0
        // remove all disk-based games from db for a certain system
        public static void RemoveDisks(int sysId)
        {
            MessageBoxResult result = MessageBox.Show("This operation will wipe out ALL the " + GSystem.GetSystemName(sysId) + " games in your library database (but they will not be deleted from disk)\n\nAre you sure you wish to continue?", "WARNING", MessageBoxButton.OKCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.OK)
            {
                // get all disks for specific system
                using (var context = new MyDbContext())
                {
                    List <Game> disks = (from a in context.Game
                                         where a.systemId == sysId
                                         select a).ToList();
                    Game.DeleteGames(disks);
                    // GameListBuilder.UpdateFlag();
                }
            }
        }