Пример #1
0
        public void RequestPackageInfo(IEnumerable <uint> packageIds)
        {
            List <uint> packages = packageIds.ToList();

            packages.RemoveAll(pid => PackageInfo.ContainsKey(pid));

            if (packages.Count == 0 || bAborted)
            {
                return;
            }

            Action <SteamApps.PICSProductInfoCallback, JobID> cbMethod = (packageInfo, jobId) =>
            {
                Debug.Assert(packageInfo.ResponsePending == false);

                foreach (var package_value in packageInfo.Packages)
                {
                    var package = package_value.Value;
                    PackageInfo.Add(package.ID, package);
                }

                foreach (var package in packageInfo.UnknownPackages)
                {
                    PackageInfo.Add(package, null);
                }
            };

            using (JobCallback <SteamApps.PICSProductInfoCallback> packageInfoCallback = new JobCallback <SteamApps.PICSProductInfoCallback>(cbMethod, callbacks, steamApps.PICSGetProductInfo(new List <uint>(), packages)))
            {
                do
                {
                    WaitForCallbacks();
                }while (!packageInfoCallback.Completed && !bAborted);
            }
        }
Пример #2
0
        public void RequestPackageInfo(IEnumerable <uint> packageIds)
        {
            List <uint> packages = packageIds.ToList();

            packages.RemoveAll(pid => PackageInfo.ContainsKey(pid));

            if (packages.Count == 0 || bAborted)
            {
                return;
            }

            bool completed = false;
            Action <SteamApps.PICSProductInfoCallback> cbMethod = (packageInfo) =>
            {
                completed = !packageInfo.ResponsePending;

                foreach (var package_value in packageInfo.Packages)
                {
                    var package = package_value.Value;
                    PackageInfo.Add(package.ID, package);
                }

                foreach (var package in packageInfo.UnknownPackages)
                {
                    PackageInfo.Add(package, null);
                }
            };

            WaitUntilCallback(() =>
            {
                callbacks.Subscribe(steamApps.PICSGetProductInfo(new List <uint>(), packages), cbMethod);
            }, () => { return(completed); });
        }
Пример #3
0
        private Task <bool> RequestPackageInfoInside(IEnumerable <uint> packages)
        {
            var tsc = new TaskCompletionSource <bool>();

            IDisposable subscription = null;
            Action <SteamApps.PICSProductInfoCallback> cbMethod = (packageInfo) =>
            {
                subscription.Dispose();
                foreach (var package_value in packageInfo.Packages)
                {
                    var package = package_value.Value;
                    PackageInfo.Add(package.ID, package);
                    //PackageInfo[package.ID] = package;
                }

                foreach (var package in packageInfo.UnknownPackages)
                {
                    PackageInfo.Add(package, null);
                    //PackageInfo[package] = null;
                }

                DebugLog.WriteLine("Steam3Session", "Package info response pending: " + packageInfo.ResponsePending);
                tsc.SetResult(!packageInfo.ResponsePending);
            };

            subscription = callbacks.Subscribe(steamApps.PICSGetProductInfo(new List <uint>(), packages), cbMethod);
            return(tsc.Task);
        }