Пример #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;
            }

            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); });
        }
Пример #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;
            }

            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);
            }
        }
Пример #3
0
        public void RequestPackageInfo(uint packageId)
        {
            if (PackageInfo.ContainsKey(packageId))
            {
                return;
            }

            if (packageInfoCallback != null)
            {
                do
                {
                    WaitForCallbacks();
                }while (!packageInfoCallback.Completed && !bAborted);

                if (PackageInfo.ContainsKey(packageId))
                {
                    return;
                }
            }

            using (var singlePackageInfoCallback = new JobCallback <SteamApps.PackageInfoCallback>(PackageInfoCallback, callbacks, steamApps.GetPackageInfo(packageId)))
            {
                do
                {
                    WaitForCallbacks();
                }while (!singlePackageInfoCallback.Completed && !bAborted);
            }
        }
Пример #4
0
        public async Task RequestPackageInfo(IEnumerable <uint> packageIds)
        {
            List <uint> packages = packageIds.ToList();

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

            bool packageInfoReceived = false;

            while (!bAborted && !packageInfoReceived && packages.Count > 0)
            {
                packageInfoReceived = await RequestPackageInfoInside(packages);

                packages.RemoveAll(pid => PackageInfo.ContainsKey(pid));
            }
        }
Пример #5
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[package.ID] = package;
                }

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

            var packageRequests = new List <SteamApps.PICSRequest>();

            foreach (var package in packages)
            {
                var request = new SteamApps.PICSRequest(package);

                if (PackageTokens.TryGetValue(package, out var token))
                {
                    request.AccessToken = token;
                    request.Public      = false;
                }

                packageRequests.Add(request);
            }

            WaitUntilCallback(() =>
            {
                callbacks.Subscribe(steamApps.PICSGetProductInfo(new List <SteamApps.PICSRequest>(), packageRequests), cbMethod);
            }, () => { return(completed); });
        }