示例#1
0
    public List <BattleRite> GetBattleritesByChampionName(string name)
    {
        MySqlConnection   conn           = new MySqlConnection(connString);
        List <BattleRite> battleriteList = new List <BattleRite>();

        try
        {
            conn.Open();
            string           query   = "SELECT * FROM BattleRite where ChampionName = '" + name + "';";
            MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
            DataTable        data    = new DataTable();
            adapter.Fill(data);
            foreach (DataRow row in data.Rows)
            {
                BattleRite br = new BattleRite();
                br.battleRiteName  = (row["BattleRiteName"]).ToString();
                br.championName    = (row["ChampionName"]).ToString();
                br.description     = (row["Description"]).ToString();
                br.battleRiteType  = (row["BattleRiteType"]).ToString();
                br.battleRiteImage = (row["Image"]).ToString();

                battleriteList.Add(br);
            }
            return(battleriteList);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
        }
    }
示例#2
0
        static void Main(string[] args)
        {
            BattleRite battleRite = new BattleRite(new Uri("E:\\Documents\\battlerite_api_key.txt"));

            BattleRiteApi.Matches.MatchCollection matchCollection = battleRite.GetMatchCollection();
            Console.WriteLine(battleRite.GetSingeMatch(matchCollection.matches[0].id).match.links);
            Console.WriteLine(battleRite.GetApiStatusAsync().GetAwaiter().GetResult());
            Console.Read();
        }