Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. public void getMatch(string name)
  2. {
  3. Task.Delay(10000).Wait();
  4. var g = riotClient.Summoner.GetSummonersByName(RiotApiConfig.Regions.NA, name.ToLower().Replace(" ", string.Empty));
  5. var Fellow = new Dictionary<int, long>();
  6. var t = g[name.ToLower().Replace(" ", string.Empty)];
  7. var games = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, t.Id).Games.ToList();
  8.  
  9. int i = 1;
  10. foreach (var e in games[0].FellowPlayers.ToList())
  11. {
  12. Fellow.Add(i, e.SummonerId);
  13. i++;
  14.  
  15. }
  16. Task.Delay(1000).Wait();
  17. var FellowGames1 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[1]).Games.ToList()[0];
  18. var FellowGames2 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[2]).Games.ToList()[0];
  19. var FellowGames3 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[3]).Games.ToList()[0];
  20. var FellowGames4 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[4]).Games.ToList()[0];
  21. Task.Delay(1000).Wait();
  22. var user1 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[1].ToString())[Fellow[1].ToString()].Name;
  23. var user2 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[2].ToString())[Fellow[2].ToString()].Name;
  24. var user3 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[3].ToString())[Fellow[3].ToString()].Name;
  25. var user4 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[4].ToString())[Fellow[4].ToString()].Name;
  26.  
  27. Console.WriteLine(name);
  28. Console.WriteLine(user1);
  29. Console.WriteLine(user2);
  30. Console.WriteLine(user3);
  31. Console.WriteLine(user4);
  32.  
  33. AddUser(name);
  34. AddUser(user1);
  35. AddUser(user2);
  36. AddUser(user3);
  37. AddUser(user4);
  38.  
  39.  
  40. }
  41. public void getMom(string name)
  42. {
  43. var g = riotClient.Summoner.GetSummonersByName(RiotApiConfig.Regions.NA, name.ToLower().Replace(" ", string.Empty));
  44. var Fellow = new Dictionary<int, long>();
  45. var t = g[name.ToLower().Replace(" ", string.Empty)];
  46. var games = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, t.Id).Games.ToList();
  47.  
  48. int i = 1;
  49. foreach (var e in games[0].FellowPlayers.ToList())
  50. {
  51. Fellow.Add(i, e.SummonerId);
  52. i++;
  53.  
  54. }
  55. Task.Delay(1000).Wait();
  56. var FellowGames1 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[1]).Games.ToList()[0];
  57. var FellowGames2 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[2]).Games.ToList()[0];
  58. var FellowGames3 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[3]).Games.ToList()[0];
  59. var FellowGames4 = riotClient.Game.GetRecentGamesBySummonerId(RiotApiConfig.Regions.NA, Fellow[4]).Games.ToList()[0];
  60. Task.Delay(1000).Wait();
  61. var user1 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[1].ToString())[Fellow[1].ToString()].Name;
  62. var user2 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[2].ToString())[Fellow[2].ToString()].Name;
  63. var user3 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[3].ToString())[Fellow[3].ToString()].Name;
  64. var user4 = riotClient.Summoner.GetSummonersById(RiotApiConfig.Regions.NA, Fellow[4].ToString())[Fellow[4].ToString()].Name;
  65.  
  66.  
  67. Console.WriteLine(user1);
  68. Console.WriteLine(user2);
  69. Console.WriteLine(user3);
  70. Console.WriteLine(user4);
  71.  
  72.  
  73. AddUser(user1);
  74. AddUser(user2);
  75. AddUser(user3);
  76. AddUser(user4);
  77. }
  78. public bool AddUser(string name)
  79. {
  80. Task.Delay(10000).Wait();
  81. // First let's create the using statement:
  82. // The using statement will make sure your objects will be disposed after
  83. // usage. Even if you return a value in the block.
  84. // It's also syntax sugar for a "try - finally" block.
  85. string serverIp = "sql9.freemysqlhosting.net";
  86. string username = "sql9132819";
  87. string password = "5jt2vZeRmH";
  88. string databaseName = "sql9132819";
  89.  
  90. using (MySqlConnection cn = new MySqlConnection(string.Format("server={0};uid={1};pwd={2};database={3};", serverIp, username, password, databaseName)))
  91. {
  92. // Here we have to create a "try - catch" block, this makes sure your app
  93. // catches a MySqlException if the connection can't be opened,
  94. // or if any other error occurs.
  95.  
  96. try
  97. {
  98. // Here we already start using parameters in the query to prevent
  99. // SQL injection.
  100. string query = "INSERT INTO League (User) VALUES (@name);";
  101.  
  102. cn.Open();
  103.  
  104. // Yet again, we are creating a new object that implements the IDisposable
  105. // interface. So we create a new using statement.
  106.  
  107. using (MySqlCommand cmd = new MySqlCommand(query, cn))
  108. {
  109. // Now we can start using the passed values in our parameters:
  110.  
  111. cmd.Parameters.AddWithValue("@name", name);
  112.  
  113. // Execute the query
  114. cmd.ExecuteNonQuery();
  115. }
  116.  
  117. // All went well so we return true
  118. getMom(name);
  119. return true;
  120. }
  121. catch (MySqlException)
  122. {
  123. // Here we got an error so we return false
  124. return false;
  125. }
  126. }
  127.  
  128.  
  129.  
  130.  
  131. }
  132. public void Start()
  133. {
  134. Console.WriteLine("Program started... Using user xxrylexx as starter");
  135. getMatch("xxrylexx");
  136.  
  137.  
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement