Exemplo n.º 1
0
        public static void DownloadDepot(int depotId, int depotVersion, string branch, int appId = 0)
        {
            IDepotDownloadInfo info = GetDepotInfo(depotId, depotVersion, appId, branch);

            if (info.GetDownloadType() == DownloadSource.Steam2)
            {
                var infos = new List <DepotDownloadInfo2>();
                infos.Add((DepotDownloadInfo2)info);
                DownloadSteam2(infos);
            }
            else if (info.GetDownloadType() == DownloadSource.Steam3)
            {
                var infos = new List <DepotDownloadInfo3>();
                infos.Add((DepotDownloadInfo3)info);
                DownloadSteam3(infos);
            }
        }
Exemplo n.º 2
0
        public static void DownloadDepotsForGame(string game, string branch)
        {
            var        infos2   = new List <DepotDownloadInfo2>();
            var        infos3   = new List <DepotDownloadInfo3>();
            List <int> depotIDs = CDRManager.GetDepotIDsForGameserver(game, ContentDownloader.Config.DownloadAllPlatforms);

            foreach (var depot in depotIDs)
            {
                int depotVersion = CDRManager.GetLatestDepotVersion(depot, ContentDownloader.Config.PreferBetaVersions);
                if (depotVersion == -1)
                {
                    Console.WriteLine("Error: Unable to find DepotID {0} in the CDR!", depot);
                    ContentDownloader.ShutdownSteam3();
                    continue;
                }

                IDepotDownloadInfo info = GetDepotInfo(depot, depotVersion, 0, branch);
                if (info.GetDownloadType() == DownloadSource.Steam2)
                {
                    infos2.Add((DepotDownloadInfo2)info);
                }
                else if (info.GetDownloadType() == DownloadSource.Steam3)
                {
                    infos3.Add((DepotDownloadInfo3)info);
                }
            }

            if (infos2.Count() > 0)
            {
                DownloadSteam2(infos2);
            }

            if (infos3.Count() > 0)
            {
                DownloadSteam3(infos3);
            }
        }
Exemplo n.º 3
0
        public static void DownloadApp(int appId, int depotId, string branch, bool bListOnly = false)
        {
            if (steam3 != null)
            {
                steam3.RequestAppInfo((uint)appId);
            }

            if (!AccountHasAccess(appId, true))
            {
                string contentName = GetAppOrDepotName(-1, appId);
                Console.WriteLine("App {0} ({1}) is not available from this account.", appId, contentName);
                return;
            }

            List <int> depotIDs = null;

            if (AppIsSteam3(appId))
            {
                depotIDs = new List <int>();
                KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots);

                if (depots != null)
                {
                    foreach (var child in depots.Children)
                    {
                        int id = -1;
                        if (int.TryParse(child.Name, out id) && child.Children.Count > 0 && (depotId == -1 || id == depotId))
                        {
                            depotIDs.Add(id);
                        }
                    }
                }
            }
            else
            {
                // steam2 path
                depotIDs = CDRManager.GetDepotIDsForApp(appId, Config.DownloadAllPlatforms);
            }

            if (depotIDs == null || (depotIDs.Count == 0 && depotId == -1))
            {
                Console.WriteLine("Couldn't find any depots to download for app {0}", appId);
                return;
            }
            else if (depotIDs.Count == 0)
            {
                Console.WriteLine("Depot {0} not listed for app {1}", depotId, appId);
                return;
            }

            if (bListOnly)
            {
                Console.WriteLine("\n  {0} Depots:", appId);

                foreach (var depot in depotIDs)
                {
                    var depotName = CDRManager.GetDepotName(depot);
                    Console.WriteLine("{0} - {1}", depot, depotName);
                }

                return;
            }

            var infos2 = new List <DepotDownloadInfo2>();
            var infos3 = new List <DepotDownloadInfo3>();

            foreach (var depot in depotIDs)
            {
                int depotVersion = 0;

                if (!AppIsSteam3(appId))
                {
                    // Steam2 dependency
                    depotVersion = CDRManager.GetLatestDepotVersion(depot, Config.PreferBetaVersions);
                    if (depotVersion == -1)
                    {
                        Console.WriteLine("Error: Unable to find DepotID {0} in the CDR!", depot);
                        return;
                    }
                }

                IDepotDownloadInfo info = GetDepotInfo(depot, depotVersion, appId, branch);
                if (info != null)
                {
                    if (info.GetDownloadType() == DownloadSource.Steam2)
                    {
                        infos2.Add((DepotDownloadInfo2)info);
                    }
                    else if (info.GetDownloadType() == DownloadSource.Steam3)
                    {
                        infos3.Add((DepotDownloadInfo3)info);
                    }
                }
            }

            if (infos2.Count() > 0)
            {
                DownloadSteam2(infos2);
            }

            if (infos3.Count() > 0)
            {
                DownloadSteam3(infos3);
            }
        }