Exemplo n.º 1
0
 private static void RvGameReadFromReader(DbDataReader dr, RvGame game)
 {
     game.GameId             = Convert.ToUInt32(dr["GameId"]);
     game.DatId              = Convert.ToUInt32(dr["DatId"]);
     game.Name               = dr["name"].ToString();
     game.Description        = dr["description"].ToString();
     game.Manufacturer       = dr["manufacturer"].ToString();
     game.CloneOf            = dr["cloneOf"].ToString();
     game.RomOf              = dr["romof"].ToString();
     game.SourceFile         = dr["sourcefile"].ToString();
     game.IsBios             = dr["isbios"].ToString();
     game.Board              = dr["board"].ToString();
     game.Year               = dr["year"].ToString();
     game.IsTrurip           = Convert.ToBoolean(dr["istrurip"]);
     game.Publisher          = dr["publisher"].ToString();
     game.Developer          = dr["developer"].ToString();
     game.Edition            = dr["edition"].ToString();
     game.Version            = dr["version"].ToString();
     game.Type               = dr["type"].ToString();
     game.Media              = dr["media"].ToString();
     game.Language           = dr["language"].ToString();
     game.Players            = dr["players"].ToString();
     game.Ratings            = dr["ratings"].ToString();
     game.Genre              = dr["genre"].ToString();
     game.Peripheral         = dr["peripheral"].ToString();
     game.BarCode            = dr["barcode"].ToString();
     game.MediaCatalogNumber = dr["mediacatalognumber"].ToString();
 }
Exemplo n.º 2
0
        public static List <RvGame> ReadGames(uint datId, bool readRoms = false)
        {
            if (_commandRvGameReadDatGames == null)
            {
                _commandRvGameReadDatGames = new SQLiteCommand(@"
                SELECT GameId, DatId, name, description, manufacturer, cloneof, romof, sourcefile, isbios, board, year, istrurip, publisher, developer, edition, version, type, media, language, players, ratings, genre, peripheral, barcode, mediacatalognumber
                    FROM GAME WHERE DatId=@DatId ORDER BY name", DBSqlite.db.Connection);
                _commandRvGameReadDatGames.Parameters.Add(new SQLiteParameter("DatId"));
            }

            List <RvGame> games = new List <RvGame>();

            _commandRvGameReadDatGames.Parameters["DatId"].Value = datId;

            using (DbDataReader dr = _commandRvGameReadDatGames.ExecuteReader())
            {
                while (dr.Read())
                {
                    RvGame rvGame = new RvGame();
                    RvGameReadFromReader(dr, rvGame);
                    games.Add(rvGame);
                }
                dr.Close();
            }

            if (readRoms)
            {
                foreach (RvGame game in games)
                {
                    game.Roms = RvRom.ReadRoms(game.GameId);
                }
            }

            return(games);
        }
Exemplo n.º 3
0
        public void AddGame(RvGame rvGame)
        {
            if (Games == null)
            {
                Games = new List <RvGame>();
            }

            int index;

            ChildNameSearch(rvGame.Name, out index);
            Games.Insert(index, rvGame);
        }
Exemplo n.º 4
0
        private void MakeDB()
        {
            /******** Create Tables ***********/

            ExecuteNonQuery(@"
                CREATE TABLE IF NOT EXISTS [VERSION] (
                    [Version] INTEGER NOT NULL);
                INSERT INTO VERSION (version) VALUES (@Version);",
                            "version", DBVersion);


            RvDir.CreateTable();
            RvDat.CreateTable();
            RvGame.CreateTable();
            RvFile.CreateTable();
            RvRom.CreateTable();
        }
Exemplo n.º 5
0
        public void DbRead(uint datId, bool readGames = false)
        {
            if (_commandRvDatRead == null)
            {
                _commandRvDatRead = new SQLiteCommand(@"
                SELECT DirId,Filename,name,rootdir,description,category,version,date,author,email,homepage,url,comment,mergetype
                FROM DAT WHERE DatId=@datId ORDER BY Filename", DBSqlite.db.Connection);
                _commandRvDatRead.Parameters.Add(new SQLiteParameter("datId"));
            }


            _commandRvDatRead.Parameters["DatID"].Value = datId;

            using (DbDataReader dr = _commandRvDatRead.ExecuteReader())
            {
                if (dr.Read())
                {
                    DatId       = datId;
                    DirId       = Convert.ToUInt32(dr["DirId"]);
                    Filename    = dr["filename"].ToString();
                    Name        = dr["name"].ToString();
                    RootDir     = dr["rootdir"].ToString();
                    Description = dr["description"].ToString();
                    Category    = dr["category"].ToString();
                    Version     = dr["version"].ToString();
                    Date        = dr["date"].ToString();
                    Author      = dr["author"].ToString();
                    Email       = dr["email"].ToString();
                    Homepage    = dr["homepage"].ToString();
                    URL         = dr["url"].ToString();
                    Comment     = dr["comment"].ToString();
                    MergeType   = dr["mergetype"].ToString();
                }
                dr.Close();
            }

            if (readGames)
            {
                Games = RvGame.ReadGames(DatId, true);
            }
        }
Exemplo n.º 6
0
        private static void CopyDir(DatDir datD, HeaderFileType headerFileType, RvDat retDat = null, RvGame retGame = null)
        {
            DatBase[] datB = datD.ToArray();
            if (datB == null)
            {
                return;
            }
            foreach (DatBase b in datB)
            {
                switch (b)
                {
                case DatDir nDir:
                    if (nDir.DGame == null)
                    {
                        break;
                    }

                    DatGame dGame = nDir.DGame;
                    RvGame  cGame = new RvGame();

                    cGame.Name         = b.Name;
                    cGame.Description  = dGame.Description;
                    cGame.Manufacturer = dGame.Manufacturer;
                    cGame.CloneOf      = dGame.CloneOf;
                    cGame.RomOf        = dGame.RomOf;
                    cGame.SampleOf     = dGame.SampleOf;
                    cGame.SourceFile   = dGame.SourceFile;
                    cGame.IsBios       = dGame.IsBios;
                    cGame.Board        = dGame.Board;
                    cGame.Year         = dGame.Year;

                    if (dGame.IsEmuArc)
                    {
                        cGame.IsTrurip  = true;
                        cGame.Publisher = dGame.Publisher;
                        cGame.Developer = dGame.Developer;
                        //cGame.Edition
                        //cGame.Version
                        //cGame.Type
                        //cGame.Media
                        //cGame.Language
                        cGame.Players = dGame.Players;
                        cGame.Ratings = dGame.Ratings;
                        cGame.Genre   = dGame.Genre;
                        //cGame.Peripheral
                        //cGame.BarCode
                        //cGame.MediaCatalogNumber
                    }
                    retDat?.AddGame(cGame);
                    CopyDir(nDir, headerFileType, null, cGame);

                    break;

                case DatFile nFile:
                    if (nFile.isDisk)
                    {
                        break;
                    }

                    RvRom nf = new RvRom()
                    {
                        Name    = nFile.Name,
                        Size    = nFile.Size,
                        CRC     = nFile.CRC,
                        SHA1    = nFile.SHA1,
                        MD5     = nFile.MD5,
                        Merge   = nFile.Merge,
                        Status  = nFile.Status,
                        AltType = headerFileType
                    };

                    retGame?.AddRom(nf);
                    break;
                }
            }
        }