コード例 #1
0
        public bool GetGameVersion(out string version)
        {
            Replays.Configuration config;
            bool result = Replays.GetReplayConfiguration(out config);

            version = config.gameVersion;
            return(result);
        }
コード例 #2
0
        public async Task <MMgame> Report(dsreplay replay, string id)
        {
            MMgame mmgame = new MMgame();
            int    gid    = int.Parse(id);

            if (Replays.ContainsKey(gid))
            {
                Replays[gid].Add(replay);
            }
            else
            {
                Replays.TryAdd(gid, new ConcurrentBag <dsreplay>());
                Replays[gid].Add(replay);
            }
            Save(Games[gid], replay);
            lock (Games)
            {
                if (Games.ContainsKey(gid))
                {
                    if (Games[gid].Reported == true)
                    {
                        return(Games[gid]);
                    }
                }

                replay.GenHash();
                if (ReplayHash.Contains(replay.HASH))
                {
                    //return null;
                }
                else
                {
                    ReplayHash.Add(replay.HASH);
                }

                List <MMplayer> team1 = new List <MMplayer>();
                List <MMplayer> team2 = new List <MMplayer>();
                foreach (var pl in replay.PLAYERS)
                {
                    MMplayer mmpl = new MMplayer();
                    if (MMplayers.ContainsKey(pl.NAME))
                    {
                        mmpl = MMplayers[pl.NAME];
                    }
                    else
                    {
                        mmpl.Name = "Dummy";
                    }

                    if (pl.TEAM == replay.WINNER)
                    {
                        team1.Add(mmpl);
                    }
                    else
                    {
                        team2.Add(mmpl);
                    }
                }
                MMgame repgame = new MMgame();
                repgame          = MMrating.RateGame(team1, team2);
                repgame.ID       = Games[gid].ID;
                repgame.Quality  = Games[gid].Quality;
                repgame.Server   = Games[gid].Server;
                repgame.Reported = true;
                Games[gid]       = repgame;
            }
            Save();
            return(Games[gid]);
        }
コード例 #3
0
 public bool GetReplayFolder(out string folder)
 {
     return(Replays.GetReplayPath(out folder));
 }