示例#1
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;
            }
        }
示例#2
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);
            }
        }