コード例 #1
0
        static async Task <DepotDownloadInfo> GetDepotInfoAsync(uint depotId, uint appId, ulong manifestId, string branch)
        {
            string contentName = await GetAppOrDepotName(depotId, appId).ConfigureAwait(false);

            // Skip requesting an app ticket
            //SteamSession.AppTickets[depotId] = null;

            uint uVersion = await GetSteam3AppBuildNumber(appId, branch).ConfigureAwait(false);

            string installDir;

            if (!CreateDirectories(depotId, uVersion, out installDir))
            {
                throw new ContentDownloaderException("Could not create install directories.");
            }

            byte[] depotKey = await SteamSession.RequestDepotKey(depotId, appId).ConfigureAwait(false);

            if (depotKey == null)
            {
                throw new ContentDownloaderException($"No valid depot key for {depotId}, unable to download.");
            }

            var info = new DepotDownloadInfo(depotId, manifestId, installDir, contentName);

            info.DepotKey = depotKey;
            return(info);
        }
コード例 #2
0
        public CDNClientPool(SteamSession steamSession)
        {
            this.steamSession = steamSession ?? throw new ArgumentNullException(nameof(steamSession));
            CDNClient         = new CDNClient(steamSession.Client);

            activeConnectionPool     = new ConcurrentBag <CDNClient.Server>();
            availableServerEndpoints = new BlockingCollection <CDNClient.Server>();

            populatePoolEvent = new AutoResetEvent(true);
            shutdownToken     = new CancellationTokenSource();

            monitorTask = Task.Factory.StartNew(ConnectionPoolMonitorAsync).Unwrap();
        }
コード例 #3
0
        internal static async Task <KeyValue> GetSteam3AppSectionAsync(uint appId, EAppInfoSection section)
        {
            SteamApps.PICSProductInfoCallback.PICSProductInfo app = await SteamSession.RequestAppInfoAsync(appId).ConfigureAwait(false);

            if (app == null)
            {
                return(null);
            }

            KeyValue appInfo = app.KeyValues;
            string   sectionKey;

            switch (section)
            {
            case EAppInfoSection.Common:
                sectionKey = "common";
                break;

            case EAppInfoSection.Extended:
                sectionKey = "extended";
                break;

            case EAppInfoSection.Config:
                sectionKey = "config";
                break;

            case EAppInfoSection.Depots:
                sectionKey = "depots";
                break;

            default:
                throw new NotImplementedException();
            }

            KeyValue sectionKv = appInfo.Children.FirstOrDefault(c => c.Name == sectionKey);

            return(sectionKv);
        }