Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SteamKit2;
- namespace ConsoleApplication1
- {
- class Program
- {
- static string user, pass;
- static SteamClient steamClient;
- static CallbackManager manager;
- static SteamUser steamUser;
- static bool isRunning = false;
- static void Main(string[] args)
- {
- Console.Title = ¨A Bot¨;
- Console.WriteLine(¨CTRL + C Quits the program.¨);
- Console.Write(¨Username: ¨);
- user = Console.ReadLine();
- Console.Write(¨Password: ¨);
- pass = Console.ReadLine();
- SteamLogIn();
- }
- static void SteamLogIn()
- {
- steamClient = new SteamClient();
- manager = new CallbackManager(steamClient);
- steamUser = steamClient.GetHandler<SteamUser>();
- new Callback<SteamClient.ConnectedCallback>(OnConnected, manager);
- new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, manager);
- steamClient.Connect();
- isRunning = true;
- while (isRunning)
- {
- manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
- }
- Console.ReadKey();
- static void OnConnected(SteamClient.ConnectedCallback callback)
- {
- if (callback.Result != EResult.OK)
- {
- Console.WriteLine(¨Unable to connect to Steam: { 0}¨,callback.Result);
- isRunning = false;
- return;
- }
- Console.WriteLine(¨Connected to steam. \nLogging on { 0}...\n¨,user);
- steamUser.LogOn(new SteamUser.LogOnDetails)
- {
- Username = user,
- Password = pass,
- });
- }
- }
- static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
- {
- if (callback.Result == EResult.AccountLogonDenied)
- {
- Console.WriteLine(¨This account is SteamGuard protected.¨);
- isRunning = false;
- return;
- }
- if(callback.Result != EResult.OK)
- {
- Console.WriteLine(¨Unable to log in to Steam {0}\n¨,callback.Result);
- isRunning = false;
- return;
- }
- console.WriteLine(¨{0} succesfully logged in!, user¨);
- console.ReadKey();
- Enviroment.Exit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement