SHARE
TWEET

Untitled

a guest Aug 12th, 2016 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using SteamKit2;
  3.  
  4. namespace StartProject
  5. {
  6.     class Program
  7.     {
  8.         private static SteamUser steamUser;
  9.         private static SteamApps steamApps;
  10.         private static bool running;
  11.         private static uint currentChangeNo;
  12.         private static readonly uint DOTA_APP_ID = 570;
  13.  
  14.         static void Main(string[] args)
  15.         {
  16.             currentChangeNo = 0;
  17.             running = true;
  18.  
  19.             SteamClient steamClient = new SteamClient();
  20.  
  21.             CallbackManager cbManager;
  22.             cbManager = new CallbackManager(steamClient);
  23.  
  24.             steamUser = steamClient.GetHandler<SteamUser>();
  25.             steamApps = steamClient.GetHandler<SteamApps>();
  26.  
  27.             cbManager.Subscribe<SteamClient.ConnectedCallback>(ConnectedCallback);
  28.             cbManager.Subscribe<SteamApps.AppChangesCallback>(AppChangesCallback);
  29.             cbManager.Subscribe<SteamUser.LoggedOnCallback>(OnLogOn);
  30.  
  31.             Console.WriteLine("Connecting to steam..");
  32.  
  33.  
  34.             steamClient.Connect();
  35.  
  36.             while (running)
  37.             {
  38.                 cbManager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
  39.                 steamApps.GetAppChanges(currentChangeNo, true);
  40.             }
  41.             steamUser.LogOff();
  42.         }
  43.  
  44.         static void AppChangesCallback(SteamApps.AppChangesCallback cbd)
  45.         {
  46.             if (cbd.AppIDs.Count != 0 && currentChangeNo != cbd.CurrentChangeNumber)
  47.             {
  48.                 foreach (uint appid in cbd.AppIDs)
  49.                 {
  50.                     if(appid == DOTA_APP_ID)
  51.                     {
  52.                         NotifyUpdate();
  53.                     }
  54.                 }
  55.             }
  56.             currentChangeNo = cbd.CurrentChangeNumber;
  57.         }
  58.  
  59.         static void ConnectedCallback(SteamClient.ConnectedCallback cbd)
  60.         {
  61.             if (cbd.Result != EResult.OK)
  62.             {
  63.                 Console.WriteLine("Cannot connect to steam");
  64.                 running = false;
  65.                 return;
  66.             }
  67.             Console.WriteLine("Connected, logging on");
  68.             steamUser.LogOn(new SteamUser.LogOnDetails() { Username = "niggerfaggot1115", Password = "ihatemyparents" });
  69.         }
  70.        
  71.         static void OnLogOn(SteamUser.LoggedOnCallback cbd)
  72.         {
  73.             if (cbd.Result != EResult.OK)
  74.             {
  75.                 Console.WriteLine("Unable to log on, Error: {0} Extended Error: {1}", cbd.Result, cbd.ExtendedResult);
  76.                 running = false;
  77.                 return;
  78.             }
  79.             Console.WriteLine("Logged on, awaiting updates...");
  80.         }
  81.  
  82.         /// <summary>
  83.         /// notify update here
  84.         /// </summary>
  85.         static void NotifyUpdate()
  86.         {
  87.         }
  88.     }
  89. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top