Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void getMatch(string name)
- {
- Task.Delay(10000).Wait();
- var g = riotClient.Summoner.GetSummonersByName(RiotApiConfig.Regions.NA, name.ToLower().Replace(" ", string.Empty));
- var Fellow = new Dictionary<int, long>();
- var t = g[name.ToLower().Replace(" ", string.Empty)];
- var games = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, t.Id).Games.ToList();
- int i = 1;
- foreach (var e in games[0].FellowPlayers.ToList())
- {
- Fellow.Add(i, e.SummonerId);
- i++;
- }
- Task.Delay(1000).Wait();
- var FellowGames1 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[1]).Games.ToList()[0];
- var FellowGames2 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[2]).Games.ToList()[0];
- var FellowGames3 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[3]).Games.ToList()[0];
- var FellowGames4 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[4]).Games.ToList()[0];
- Task.Delay(1000).Wait();
- var user1 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[1].ToString())[Fellow[1].ToString()].Name;
- var user2 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[2].ToString())[Fellow[2].ToString()].Name;
- var user3 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[3].ToString())[Fellow[3].ToString()].Name;
- var user4 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[4].ToString())[Fellow[4].ToString()].Name;
- Console.WriteLine(name);
- Console.WriteLine(user1);
- Console.WriteLine(user2);
- Console.WriteLine(user3);
- Console.WriteLine(user4);
- AddUser(name);
- AddUser(user1);
- AddUser(user2);
- AddUser(user3);
- AddUser(user4);
- }
- public void getMom(string name)
- {
- var g = riotClient.Summoner.GetSummonersByName(RiotApiConfig.Regions.NA, name.ToLower().Replace(" ", string.Empty));
- var Fellow = new Dictionary<int, long>();
- var t = g[name.ToLower().Replace(" ", string.Empty)];
- var games = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, t.Id).Games.ToList();
- int i = 1;
- foreach (var e in games[0].FellowPlayers.ToList())
- {
- Fellow.Add(i, e.SummonerId);
- i++;
- }
- Task.Delay(1000).Wait();
- var FellowGames1 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[1]).Games.ToList()[0];
- var FellowGames2 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[2]).Games.ToList()[0];
- var FellowGames3 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[3]).Games.ToList()[0];
- var FellowGames4 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[4]).Games.ToList()[0];
- Task.Delay(1000).Wait();
- var user1 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[1].ToString())[Fellow[1].ToString()].Name;
- var user2 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[2].ToString())[Fellow[2].ToString()].Name;
- var user3 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[3].ToString())[Fellow[3].ToString()].Name;
- var user4 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[4].ToString())[Fellow[4].ToString()].Name;
- Console.WriteLine(user1);
- Console.WriteLine(user2);
- Console.WriteLine(user3);
- Console.WriteLine(user4);
- AddUser(user1);
- AddUser(user2);
- AddUser(user3);
- AddUser(user4);
- }
- public bool AddUser(string name)
- {
- Task.Delay(10000).Wait();
- // First let's create the using statement:
- // The using statement will make sure your objects will be disposed after
- // usage. Even if you return a value in the block.
- // It's also syntax sugar for a "try - finally" block.
- string serverIp = "sql9.freemysqlhosting.net";
- string username = "sql9132819";
- string password = "5jt2vZeRmH";
- string databaseName = "sql9132819";
- using (MySqlConnection cn = new MySqlConnection(string.Format("server={0};uid={1};pwd={2};database={3};", serverIp, username, password, databaseName)))
- {
- // Here we have to create a "try - catch" block, this makes sure your app
- // catches a MySqlException if the connection can't be opened,
- // or if any other error occurs.
- try
- {
- // Here we already start using parameters in the query to prevent
- // SQL injection.
- string query = "INSERT INTO League (User) VALUES (@name);";
- cn.Open();
- // Yet again, we are creating a new object that implements the IDisposable
- // interface. So we create a new using statement.
- using (MySqlCommand cmd = new MySqlCommand(query, cn))
- {
- // Now we can start using the passed values in our parameters:
- cmd.Parameters.AddWithValue("@name", name);
- // Execute the query
- cmd.ExecuteNonQuery();
- }
- // All went well so we return true
- getMom(name);
- return true;
- }
- catch (MySqlException)
- {
- // Here we got an error so we return false
- return false;
- }
- }
- }
- public void Start()
- {
- Console.WriteLine("Program started... Using user xxrylexx as starter");
- getMatch("xxrylexx");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement