Ejemplo n.º 1
0
        private static SerialInfo GetSerial(string tdbLine, string platformId)
        {
            var    line   = tdbLine.Split('=').Select(x => x.Trim()).ToList();
            string serial = line[0];

            string region = "ZZ";

            if (platformId.StartsWith("NINTENDO"))
            {
                region = GameTdbParser.GetNintendoRegionCode(serial);
            }

            if (platformId.StartsWith("SONY"))
            {
                region = GameTdbParser.GetSonyRegionCode(serial);
            }

            string name = line[1];

            return(new SerialInfo(platformId, name, region, serial));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parse gametdb dat files
        /// </summary>
        /// <param name="datFile">Path to dat file</param>
        /// <param name="platformId">Platform of dat file</param>
        /// <returns>The information records contained in the file</returns>
        internal static IEnumerable <SerialInfo> ParseSerials(string datFile, string platformId)
        {
            var lines = File.ReadAllLines(datFile);

            return(from line in lines.AsParallel() select GameTdbParser.GetSerial(line, platformId));
        }