A lookup table which can be used to find a tag's equivalents in different game versions.
Example #1
0
        /// <summary>
        /// Parses a map from a CSV.
        /// </summary>
        /// <param name="reader">The reader to read from.</param>
        /// <returns>The map that was read.</returns>
        public static TagCacheMap ParseCsv(TextReader reader)
        {
            var result = new TagCacheMap();

            // Read the timestamp list and resolve each one
            var cacheFileLine = reader.ReadLine();

            if (cacheFileLine == null)
            {
                return(result);
            }

            var cacheFileNames = cacheFileLine.Split(',');

            // Read each line and store the tag indexes in the result map
            while (true)
            {
                var line = reader.ReadLine();
                if (line == null)
                {
                    break;
                }
                if (string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }

                // Parse each tag index as a hex number
                var tags       = line.Split(',');
                var tagIndexes = tags.Select(t =>
                {
                    int r;
                    if (int.TryParse(t, NumberStyles.HexNumber, null, out r))
                    {
                        return(r);
                    }
                    return(-1);
                }).ToArray();

                // Now connect all of them to the first tag
                for (var i = 1; i < tagIndexes.Length; i++)
                {
                    if (tagIndexes[i] >= 0)
                    {
                        result.Add(cacheFileNames[0], tagIndexes[0], cacheFileNames[i], tagIndexes[i]);
                    }
                }
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// Parses a map from a CSV.
        /// </summary>
        /// <param name="reader">The reader to read from.</param>
        /// <returns>The map that was read.</returns>
        public static TagCacheMap ParseCsv(TextReader reader)
        {
            var result = new TagCacheMap();

            // Read the timestamp list and resolve each one
            var cacheFileLine = reader.ReadLine();
            if (cacheFileLine == null)
                return result;

            var cacheFileNames = cacheFileLine.Split(',');

            // Read each line and store the tag indexes in the result map
            while (true)
            {
                var line = reader.ReadLine();
                if (line == null)
                    break;
                if (string.IsNullOrWhiteSpace(line))
                    continue;

                // Parse each tag index as a hex number
                var tags = line.Split(',');
                var tagIndexes = tags.Select(t =>
                {
                    int r;
                    if (int.TryParse(t, NumberStyles.HexNumber, null, out r))
                        return r;
                    return -1;
                }).ToArray();

                // Now connect all of them to the first tag
                for (var i = 1; i < tagIndexes.Length; i++)
                {
                    if (tagIndexes[i] >= 0)
                        result.Add(cacheFileNames[0], tagIndexes[0], cacheFileNames[i], tagIndexes[i]);
                }
            }
            return result;
        }