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();
        }
        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);
        }