Advertisement
Guest User

Untitled

a guest
Jan 6th, 2017
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using SteamKit2;
  7.  
  8. namespace ConsoleApplication1
  9. {
  10. class Program
  11. {
  12. static string user, pass;
  13.  
  14. static SteamClient steamClient;
  15. static CallbackManager manager;
  16. static SteamUser steamUser;
  17.  
  18. static bool isRunning = false;
  19.  
  20. static void Main(string[] args)
  21. {
  22. Console.Title = ¨A Bot¨;
  23. Console.WriteLine(¨CTRL + C Quits the program.¨);
  24.  
  25. Console.Write(¨Username: ¨);
  26. user = Console.ReadLine();
  27.  
  28. Console.Write(¨Password: ¨);
  29. pass = Console.ReadLine();
  30.  
  31. SteamLogIn();
  32. }
  33.  
  34. static void SteamLogIn()
  35. {
  36. steamClient = new SteamClient();
  37.  
  38. manager = new CallbackManager(steamClient);
  39.  
  40. steamUser = steamClient.GetHandler<SteamUser>();
  41.  
  42. new Callback<SteamClient.ConnectedCallback>(OnConnected, manager);
  43.  
  44. new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, manager);
  45.  
  46. steamClient.Connect();
  47.  
  48. isRunning = true;
  49. while (isRunning)
  50. {
  51. manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
  52. }
  53. Console.ReadKey();
  54. static void OnConnected(SteamClient.ConnectedCallback callback)
  55. {
  56. if (callback.Result != EResult.OK)
  57. {
  58. Console.WriteLine(¨Unable to connect to Steam: { 0}¨,callback.Result);
  59. isRunning = false;
  60. return;
  61. }
  62.  
  63. Console.WriteLine(¨Connected to steam. \nLogging on { 0}...\n¨,user);
  64.  
  65. steamUser.LogOn(new SteamUser.LogOnDetails)
  66. {
  67. Username = user,
  68. Password = pass,
  69. });
  70. }
  71. }
  72.  
  73. static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
  74. {
  75. if (callback.Result == EResult.AccountLogonDenied)
  76. {
  77. Console.WriteLine(¨This account is SteamGuard protected.¨);
  78. isRunning = false;
  79. return;
  80. }
  81. if(callback.Result != EResult.OK)
  82. {
  83. Console.WriteLine(¨Unable to log in to Steam {0}\n¨,callback.Result);
  84. isRunning = false;
  85. return;
  86. }
  87. console.WriteLine(¨{0} succesfully logged in!, user¨);
  88. console.ReadKey();
  89. Enviroment.Exit();
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement