예제 #1
0
        public void RequestDepotKey(uint depotId, uint appid = 0)
        {
            if (DepotKeys.ContainsKey(depotId) || bAborted)
            {
                return;
            }

            bool completed = false;

            Action <SteamApps.DepotKeyCallback> cbMethod = (depotKey) =>
            {
                completed = true;
                Log.Info("Got depot key for {0} result: {1}", depotKey.DepotID, depotKey.Result);

                if (depotKey.Result != EResult.OK)
                {
                    Abort();
                    return;
                }

                DepotKeys[depotKey.DepotID] = depotKey.DepotKey;
            };

            WaitUntilCallback(() =>
            {
                callbacks.Subscribe(steamApps.GetDepotDecryptionKey(depotId, appid), cbMethod);
            }, () => { return(completed); });
        }
예제 #2
0
        public void RequestDepotKey(uint depotId, uint appid = 0)
        {
            if (DepotKeys.ContainsKey(depotId) || bAborted)
            {
                return;
            }

            Action <SteamApps.DepotKeyCallback, JobID> cbMethod = (depotKey, jobId) =>
            {
                Console.WriteLine("Got depot key for {0} result: {1}", depotKey.DepotID, depotKey.Result);

                if (depotKey.Result != EResult.OK)
                {
                    Abort();
                    return;
                }

                DepotKeys[depotKey.DepotID] = depotKey.DepotKey;
            };

            using (var depotKeyCallback = new JobCallback <SteamApps.DepotKeyCallback>(cbMethod, callbacks, steamApps.GetDepotDecryptionKey(depotId, appid)))
            {
                do
                {
                    WaitForCallbacks();
                }while (!depotKeyCallback.Completed && !bAborted);
            }
        }
예제 #3
0
        public Task <bool> RequestDepotKey(uint depotId, uint appid = 0)
        {
            var tsc = new TaskCompletionSource <bool>();

            if (DepotKeys.ContainsKey(depotId) || bAborted)
            {
                tsc.SetResult(true);
                return(tsc.Task);
            }
            else
            {
                IDisposable subscription = null;
                Action <SteamApps.DepotKeyCallback> cbMethod = (depotKey) =>
                {
                    subscription.Dispose();
                    DebugLog.WriteLine("Steam3Session", "Got depot key for " + depotKey.DepotID + " result: " + depotKey.Result);

                    if (depotKey.Result != EResult.OK)
                    {
                        Abort();
                        return;
                    }

                    DepotKeys[depotKey.DepotID] = depotKey.DepotKey;
                    tsc.SetResult(true);
                };

                subscription = callbacks.Subscribe(steamApps.GetDepotDecryptionKey(depotId, appid), cbMethod);
                return(tsc.Task);
            }
        }
예제 #4
0
        public void RequestDepotKey(uint depotId, uint appid = 0)
        {
            if (DepotKeys.ContainsKey(depotId) || bAborted)
            {
                return;
            }
            bool completed = false;

            Action <SteamApps.DepotKeyCallback> cbMethod = (depotKey) =>
            {
                completed = true;
                Console.WriteLine("Got depot key for {0} result: {1}", depotKey.DepotID, depotKey.Result);


                if (depotKey.Result == EResult.Timeout)
                {
                    completed = true;
                    return;
                }
                else if (depotKey.Result != EResult.OK)
                {
                    Abort();
                    return;
                }

                Program.sw.WriteLine($"{depotKey.DepotID};{string.Concat(depotKey.DepotKey.Select(b => b.ToString("X2")).ToArray())}");
                DepotKeys[depotKey.DepotID] = depotKey.DepotKey;
            };

            WaitUntilCallback(() =>
            {
                callbacks.Subscribe(steamApps.GetDepotDecryptionKey(depotId, appid), cbMethod);
            }, () => { return(completed); });
        }
예제 #5
0
        public async Task <byte[]> RequestDepotKey(uint appId, uint depotId)
        {
            if (!DepotKeys.ContainsKey(depotId))
            {
                DepotKeys[depotId] = (await Apps.GetDepotDecryptionKey(depotId, appId)).DepotKey;
            }

            return(DepotKeys[depotId]);
        }