Esempio n. 1
0
 /// <summary>
 /// return a list with all gamesdb.net platforms
 /// </summary>
 /// <returns></returns>
 public static List <DAT_System> GetSystems()
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_System
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 2
0
 /// <summary>
 /// return all entries
 /// </summary>
 /// <returns></returns>
 public static List <DATMerge> GetDATs()
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DATMerge
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 3
0
 // <summary>
 /// return a list with all providers
 /// </summary>
 /// <returns></returns>
 public static List <DAT_Provider> GetProviders()
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Provider
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 4
0
 /// <summary>
 /// return dat_game based on gid
 /// </summary>
 /// <returns></returns>
 public static DAT_Game GetGame(int gid)
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Game
                      where g.gid == gid
                      select g).FirstOrDefault();
         return(cData);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// return list of all top level games based on platformid
 /// </summary>
 /// <returns></returns>
 public static List <DAT_Game> GetGames(int pid)
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Game
                      where g.pid == pid
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 6
0
 public static List <DAT_Rom> GetRoms(string md5)
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Rom
                      where g.md5.ToUpper() == md5.ToUpper()
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 7
0
 /// <summary>
 /// return rom based on md5 hash
 /// </summary>
 /// <returns></returns>
 public static DAT_Rom GetRom(string md5)
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Rom
                      where g.md5.ToUpper() == md5.ToUpper()
                      select g);
         return(cData.FirstOrDefault());
     }
 }
Esempio n. 8
0
 /// <summary>
 /// return list of all roms based on platform that have no game set
 /// </summary>
 /// <returns></returns>
 public static List <DAT_Rom> GetRomsWithNoGameId(int pid)
 {
     using (var context = new AsniDATDbContext())
     {
         var cData = (from g in context.DAT_Rom
                      where g.pid == pid && g.gid == null
                      select g);
         return(cData.ToList());
     }
 }
Esempio n. 9
0
        /// <summary>
        /// return dat_game based on gid
        /// </summary>
        /// <returns></returns>
        public static DAT_Game GetGameByMD5(string md5)
        {
            DAT_Rom dr = DAT_Rom.GetRom(md5);

            if (dr == null)
            {
                return(null);
            }

            using (var context = new AsniDATDbContext())
            {
                var cData = (from g in context.DAT_Game
                             where g.gid == dr.gid
                             select g).FirstOrDefault();
                return(cData);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// return a list of entries based on systemid and extraflags (serial number)
        /// </summary>
        /// <param name="inputList"></param>
        /// <param name="systemId"></param>
        /// <param name="md5Hash"></param>
        /// <returns></returns>
        public static DATMerge GetDATsBySN(int systemId, string serialNumber)
        {
            using (var context = new AsniDATDbContext())
            {
                if (serialNumber != null)
                {
                    var cData = (from g in context.DATMerge
                                 where g.OtherFlags != null && g.OtherFlags.ToUpper().Trim() == serialNumber.ToUpper().Trim()
                                 select g).FirstOrDefault();
                    return(cData);
                }

                else
                {
                    return(null);
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// return the first entry where the MD5 hash matches
        /// </summary>
        /// <param name="md5"></param>
        /// <returns></returns>
        public static DATMerge GetDAT(string hash)
        {
            using (var context = new AsniDATDbContext())
            {
                var aData = (from a in context.DATMerge
                             where a.MD5 != null || a.CRC != null | a.SHA1 != null
                             select a).ToList();

                if (hash != null)
                {
                    var cData = (from g in aData
                                 where (g.MD5 != null && g.MD5.ToUpper().Trim() == hash.ToUpper().Trim()) ||
                                 (g.CRC != null && g.CRC.ToUpper().Trim() == hash.ToUpper().Trim())
                                 select g).FirstOrDefault();
                    return(cData);
                }

                return(null);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// return list where md5 matches
        /// </summary>
        /// <param name="md5"></param>
        /// <returns></returns>
        public static List <DATMerge> GetDATs(string hash)
        {
            using (var context = new AsniDATDbContext())
            {
                var aData = (from a in context.DATMerge
                             where a.MD5 != null
                             select a).ToList();

                if (hash != null)
                {
                    var cData = (from g in aData
                                 where (g.MD5 != null && g.MD5.ToUpper().Trim() == hash.ToUpper().Trim()) ||
                                 (g.CRC != null && g.CRC.ToUpper().Trim() == hash.ToUpper().Trim())
                                 select g);


                    return(cData.ToList());
                }

                return(new List <DATMerge>());
            }
        }