Esempio n. 1
0
            public static ThreadPair SpawnThread(AutoResetEvent r)
            {
                var    thisThread = new SteamKit(r);
                Thread tThread    = new Thread(() => thisThread.RunThread())
                {
                    IsBackground = true
                };

                tThread.Start();
                return(new ThreadPair(tThread, thisThread));
            }
Esempio n. 2
0
        public static int GetGameInformation(uint appid)
        {
            var WaitHandle = new AutoResetEvent(false);

            using (var Steam3 = SteamKit.SpawnThread(WaitHandle))
            {
                // Wait for Steam3 to be ready
                WaitHandle.WaitOne();
                WaitHandle.Reset();

                // Prepare request to Steam3
                if (Steam3.tClass.Ready && !Steam3.tClass.Failed)
                {
                    var returndata = -1;
                    Steam3.tClass.RequestAppInfo(appid, (x) => {
                        KeyValue appinfo      = x.KeyValues;
                        KeyValue DepotSection = appinfo.Children.Where(c => c.Name == "depots").FirstOrDefault();

                        // Retrieve Public Branch
                        KeyValue branches = DepotSection["branches"];
                        KeyValue node     = branches["public"];

                        if (node != KeyValue.Invalid)
                        {
                            KeyValue buildid = node["buildid"];
                            if (buildid != KeyValue.Invalid)
                            {
                                //_Parent.Log.ConsolePrint(LogLevel.Debug, "Retrieved Buildid from Steam3: {0}", buildid.Value);
                                returndata = Convert.ToInt32(buildid.Value);
                            }
                        }

                        // Clear wait handle
                        WaitHandle.Set();
                    });

                    // Wait for Callback to finish
                    WaitHandle.WaitOne();
                    return(returndata);
                }
            }

            return(-1);
        }
Esempio n. 3
0
 public ThreadPair(Thread t, SteamKit c)
 {
     tThread = t;
     tClass  = c;
 }