示例#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);
        }
示例#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);
            }
        }
示例#3
0
        static DepotDownloadInfo GetDepotInfo(uint depotId, uint appId, ulong manifestId, string branch)
        {
            if (steam3 != null && appId != INVALID_APP_ID)
            {
                steam3.RequestAppInfo(( uint )appId);
            }

            string contentName = GetAppOrDepotName(depotId, appId);

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

            if (manifestId == INVALID_MANIFEST_ID)
            {
                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(appId, appName, depotId, uVersion, contentName, out installDir))
            {
                Console.WriteLine("Error: Unable to create install directories!");
                return(null);
            }

            if (!DepotKeyStore.ContainsKey(depotId) && !AccountHasAccess(depotId))
            {
                Console.WriteLine("Depot {0} ({1}) is not available from this account and no key found in depot key store.", depotId, contentName);

                return(null);
            }

            byte[] depotKey;

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



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

            info.depotKey = depotKey;

            File.WriteAllText($"depots\\{depotId}.key", BitConverter.ToString(depotKey).Replace("-", ""));
            return(info);
        }
        static async Task <DepotDownloadInfo> GetDepotInfo(Steam3Session steam3, uint depotId, uint appId, ulong manifestId, string branch)
        {
            if (steam3 != null && appId != INVALID_APP_ID)
            {
                await steam3.RequestAppInfo(appId);
            }

            string contentName = GetAppOrDepotName(steam3, depotId, appId);

            bool hasAccess = await AccountHasAccess(steam3, depotId);

            if (!hasAccess)
            {
                DebugLog.WriteLine("ContentDownloader", "Depot " + depotId + " (" + contentName + ") is not available from this account.");

                return(null);
            }

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

            if (manifestId == INVALID_MANIFEST_ID)
            {
                manifestId = await GetSteam3DepotManifest(steam3, depotId, appId, branch);

                if (manifestId == INVALID_MANIFEST_ID && branch != "public")
                {
                    DebugLog.WriteLine("ContentDownloader", "Warning: Depot " + depotId + " does not have branch named \"" + branch + "\". Trying public branch.");
                    branch     = "public";
                    manifestId = await GetSteam3DepotManifest(steam3, depotId, appId, branch);
                }

                if (manifestId == INVALID_MANIFEST_ID)
                {
                    DebugLog.WriteLine("ContentDownloader", "Depot " + depotId + " (" + contentName + ") missing public subsection or manifest section.");
                    return(null);
                }
            }

            uint uVersion = GetSteam3AppBuildNumber(steam3, appId, branch);

            string installDir;

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

            await steam3.RequestDepotKey(depotId, appId);

            if (!steam3.DepotKeys.ContainsKey(depotId))
            {
                DebugLog.WriteLine("ContentDownloader", "No valid depot key for " + depotId + ", unable to download.");
                return(null);
            }

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

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

            info.depotKey = depotKey;
            return(info);
        }
示例#5
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);
            }
        }