static void Main(string[] args) { SteamInstaller installer = new SteamInstaller("C:\\SteamTest\\"); if (!installer.Installed) { Console.WriteLine("Preparing steamcmd.."); installer.installSteam(); SteamInstance _ = new SteamInstance(new System.IO.FileInfo(installer.Folder.FullName + "\\steamcmd.exe")); _.tryGetSteamLogin(); _.close().Wait(); } SteamInstance.killAll(); SteamInstance instance = new SteamInstance(new System.IO.FileInfo(installer.Folder.FullName + "\\steamcmd.exe")); instance.SteamOutput += Instance_SteamOutput; instance.LoggedIn += Instance_LoggedIn; Console.WriteLine("Please enter your steam-username:"******"Please enter your password:"******"Please enter your steam guard code:"); string code = Console.ReadLine(); Console.WriteLine(instance.login(username, password, code)); } else { Console.WriteLine("Result: " + r.ToString()); } instance.SteamOutput -= Instance_SteamOutput; Console.WriteLine("Press return to exit.."); Console.ReadLine(); instance.close(); }
private Task <bool> PrepareSteam(SteamInstance steam) { return(Task.Run(() => { try { foreach (string user in Steam.Utils.publicSteamAccounts.Keys) { LoginResult result = steam.login(user, Steam.Utils.publicSteamAccounts[user], "", 6000); if (result == LoginResult.OK) { return true; } } return false; } catch (Exception) { return false; } })); }