private string GetValueByType(int type) { if (type > 0) { return(CharEnum.ToList().FirstOrDefault(p => p.Codigo == type).Valor); } else { if (type < -1) { switch (type) { case -2: return(RolesEnum.VANGUARD); case -3: return(RolesEnum.ASSASSIN); case -4: return(RolesEnum.MASKSMEN); case -5: return(RolesEnum.SPECIALIST); } } else { return("PLAYER");; } return(CharEnum.ToList().FirstOrDefault(p => p.Codigo == type).Valor); } }
public DissidiaModule(IBootstrapInjection injection) { Get[EndpointConfigurationEnum.GET_CHARACTERS] = p => { return(Response.AsJson(CharEnum.ToList())); }; Get["email"] = p => { injection.Services.Team.InvitePlayer("*****@*****.**", "teste"); return(""); }; }
public void OnMatchProcessed(object sender, OnMatchDoneArgs args) { var result = args.Match; var matches = GroupMatchesByDate(args.MatchInfo); matches.GroupBy(p => p.Key) .ToList() .Where(p => !string.IsNullOrEmpty(p.Key)) .ToList() .ForEach(match => { var m = match.FirstOrDefault(); if (args.Match.IsMatchDateEmpty) { result = Factory.From(result) .WithDate( DateTime.ParseExact(match.Key, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture)) .Instance; } m.Value.ForEach(player => { var values = player.Split(';'); int points = 0; int.TryParse(values[2], out points); var character = values[3]; var currentChar = CharEnum.ToList().FirstOrDefault(c => c.Valor.ToUpper() == character.ToUpper()); if (currentChar == null) { currentChar = CharEnum.UNDEFINED; } var p = new PlayerInfo(currentChar, values[1], points); if (values[0] == "Derrota") { result.PlayersTeamLooser.Add(p); } else { result.PlayersTeamWinner.Add(p); } }); }); _matchRepository.Upsert(result); OnMatchResolved?.Invoke(this, args); }