Esempio n. 1
0
        static DepotDownloadInfo GetDepotInfo(uint depotId, uint appId, string branch)
        {
            if (steam3 != null && appId != INVALID_APP_ID)
            {
                steam3.RequestAppInfo(( uint )appId);
            }

            string contentName = GetAppOrDepotName(depotId, appId);

            if (!AccountHasAccess(depotId))
            {
                Console.WriteLine("Depot {0} ({1}) is not available from this account.", depotId, contentName);

                return(null);
            }

            if (steam3 != null)
            {
                steam3.RequestAppTicket(( uint )depotId);
            }

            ulong manifestID = GetSteam3DepotManifest(depotId, appId, branch);

            if (manifestID == INVALID_MANIFEST_ID && branch != "public")
            {
                Console.WriteLine("Warning: Depot {0} does not have branch named \"{1}\". Trying public branch.", depotId, branch);
                branch     = "public";
                manifestID = GetSteam3DepotManifest(depotId, appId, branch);
            }

            if (manifestID == INVALID_MANIFEST_ID)
            {
                Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName);
                return(null);
            }

            uint uVersion = GetSteam3AppBuildNumber(appId, branch);

            string installDir;

            if (!CreateDirectories(depotId, uVersion, out installDir))
            {
                Console.WriteLine("Error: Unable to create install directories!");
                return(null);
            }

            steam3.RequestDepotKey(depotId, appId);
            if (!steam3.DepotKeys.ContainsKey(depotId))
            {
                Console.WriteLine("No valid depot key for {0}, unable to download.", depotId);
                return(null);
            }

            byte[] depotKey = steam3.DepotKeys[depotId];

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

            info.depotKey = depotKey;
            return(info);
        }
Esempio n. 2
0
        public static void DownloadDepot(int depotId, int depotVersionRequested, int appId = 0)
        {
            if (steam3 != null && appId > 0)
            {
                steam3.RequestAppInfo((uint)appId);
            }

            string contentName = GetAppOrDepotName(depotId, appId);

            if (!AccountHasAccess(depotId, false))
            {
                Console.WriteLine("Depot {0} ({1}) is not available from this account.", depotId, contentName);

                return;
            }

            DownloadSource source       = GetAppDownloadSource(appId);
            uint           depotVersion = (uint)depotVersionRequested;

            if (source == DownloadSource.Steam3)
            {
                depotVersion = GetSteam3AppChangeNumber(appId);
            }

            string installDir;

            if (!CreateDirectories(depotId, depotVersion, out installDir))
            {
                Console.WriteLine("Error: Unable to create install directories!");
                return;
            }

            Console.WriteLine("Downloading \"{0}\" version {1} ...", contentName, depotVersion);

            if (steam3 != null)
            {
                steam3.RequestAppTicket((uint)depotId);
            }

            if (source == DownloadSource.Steam3)
            {
                ulong manifestID = GetSteam3DepotManifest(depotId, appId);
                if (manifestID == 0)
                {
                    Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName);
                    return;
                }

                steam3.RequestDepotKey(( uint )depotId, ( uint )appId);
                byte[] depotKey = steam3.DepotKeys[(uint)depotId];

                DownloadSteam3(depotId, manifestID, depotKey, installDir);
            }
            else
            {
                // steam2 path
                DownloadSteam2(depotId, depotVersionRequested, installDir);
            }
        }
Esempio n. 3
0
        static IDepotDownloadInfo GetDepotInfo(int depotId, int depotVersion, int appId, string branch)
        {
            if (steam3 != null && appId > 0)
            {
                steam3.RequestAppInfo((uint)appId);
            }

            string contentName = GetAppOrDepotName(depotId, appId);

            if (!AccountHasAccess(depotId, false))
            {
                Console.WriteLine("Depot {0} ({1}) is not available from this account.", depotId, contentName);

                return(null);
            }

            DownloadSource source = GetAppDownloadSource(appId);

            uint uVersion = (uint)depotVersion;

            if (source == DownloadSource.Steam3)
            {
                uVersion = GetSteam3AppBuildNumber(appId, branch);
            }

            string installDir;

            if (!CreateDirectories(depotId, uVersion, source, out installDir))
            {
                Console.WriteLine("Error: Unable to create install directories!");
                return(null);
            }

            if (steam3 != null)
            {
                steam3.RequestAppTicket((uint)depotId);
            }

            if (source == DownloadSource.Steam3)
            {
                ulong manifestID = GetSteam3DepotManifest(depotId, appId, branch);
                if (manifestID == 0)
                {
                    Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName);
                    return(null);
                }

                steam3.RequestDepotKey(( uint )depotId, ( uint )appId);
                if (!steam3.DepotKeys.ContainsKey((uint)depotId))
                {
                    Console.WriteLine("No valid depot key for {0}, unable to download.", depotId);
                    return(null);
                }

                byte[] depotKey = steam3.DepotKeys[(uint)depotId];

                var info = new DepotDownloadInfo3(depotId, manifestID, installDir, contentName);
                info.depotKey = depotKey;
                return(info);
            }
            else
            {
                // steam2 path
                var info = new DepotDownloadInfo2(depotId, depotVersion, installDir, contentName);
                return(info);
            }
        }