Пример #1
0
        /// <summary>
        /// Checks depots.
        /// </summary>
        /// <param name="application">SteamApplication object.</param>
        private static void CheckDepots(SteamApplication application)
        {
            if (application.CheckState == CheckState.NotChecked)
            {
                Boolean isNonInvariantDepotExists = false;
                Boolean isRequiredDepotNotExists = false;

                for (Int32 i = 0; i < application.DepotsCount; i++)
                {
                    SteamDepot depot = application.GetDepot(i);

                    if (depot.CheckState == CheckState.NotChecked)
                    {
                        if (depot.GetDirectoriesCount(SteamDepotFileTypes.Common) > 0 && depot.IsSharedFilesExists)
                            depot.CheckState = CheckState.Installable;
                        else
                        {
                            depot.CheckState = CheckState.NotInstallable;

                            if (depot.SharedFilesCount > 0)
                            {
                                SteamDepotSharedFile[] sharedFiles = depot.GetSharedFiles();

                                foreach (SteamDepotSharedFile sharedFile in sharedFiles)
                                {
                                    if (sharedFile.SourceDepot == depot)
                                    {
                                        SteamDepot[] clientDepots = sharedFile.GetClientDepots();

                                        foreach (SteamDepot clientDepot in clientDepots)
                                            clientDepot.CheckState = CheckState.NotInstallable;
                                    }
                                }
                            }
                        }

                        if (depot.CheckState == CheckState.Installable)
                        {
                            if (!depot.IsInvariant)
                                isNonInvariantDepotExists = true;
                        }
                        else
                        {
                            if (!depot.IsOptional)
                                isRequiredDepotNotExists = true;
                        }
                    }
                }

                if (isRequiredDepotNotExists || !isNonInvariantDepotExists)
                    application.CheckState = CheckState.NotInstallable;
                else
                    application.CheckState = CheckState.Installable;
            }
        }
Пример #2
0
        public FilesMap(SteamApplication application)
        {
            if (application == null)
                throw new ArgumentNullException("application");

            app = application;
            files = new Dictionary<String, List<SteamDepotFile>>();

            // Add files of application
            for (Int32 i = 0; i < application.DepotsCount; i++)
            {
                SteamDepot depot = application.GetDepot(i);

                if (depot.CheckState == CheckState.Installable)
                {
                    AddFiles(depot, depot.GetLatestVersion(SteamDepotFileTypes.Common), SteamDepotFileTypes.Common);
                    AddFiles(depot, SteamDepotFileTypes.Fix);
                }
            }
        }