Exemplo n.º 1
0
        public static void MergePreVerToPostVer(string dataPath, string dataSuffix, string searchPath)
        {
            DataStore.Initialise(dataPath, dataSuffix);
            var pm = new PathManager(searchPath);

            pm.AddExcludePath(DataStore.LosPath);
            foreach (var f in pm.GetFiles())
            {
                Console.WriteLine(f.FullName);
                Match match;
                if ((match = Regex.Match(f.Name, @"^(?<region>[A-Z]+)-match-id-nonexistent\.losmid$")).Success)
                {
                    var region = EnumStrong.Parse <Region>(match.Groups["region"].Value);
                    DataStore.LosMatchIdsNonExistent[region].AppendItems(new MatchIdContainer(f.FullName, region).ReadItems(), LosChunkFormat.LZ4HC);
                }
                else if ((match = Regex.Match(f.Name, @"^(?<region>[A-Z]+)-match-id-existing\.losmid$")).Success)
                {
                    var region = EnumStrong.Parse <Region>(match.Groups["region"].Value);
                    DataStore.LosMatchIdsExisting[region].AppendItems(new MatchIdContainer(f.FullName, region).ReadItems(), LosChunkFormat.LZ4HC);
                }
                else if ((match = Regex.Match(f.Name, @"^(?<region>[A-Z]+)-matches-(?<queueId>\d+)\.losjs$")).Success)
                {
                    var region  = EnumStrong.Parse <Region>(match.Groups["region"].Value);
                    var queueId = int.Parse(match.Groups["queueId"].Value);
                    foreach (var json in new JsonContainer(f.FullName).ReadItems())
                    {
                        var info = new BasicMatchInfo(json);
                        Ut.Assert(info.QueueId == queueId);
                        DataStore.LosMatchJsons[region][info.GameVersion][info.QueueId].AppendItems(new[] { json }, LosChunkFormat.LZ4);
                    }
                }
            }
        }