Exemple #1
0
        /// <summary>
        /// Determines whether the install cookie is empty
        /// </summary>
        /// <returns><c>true</c> if the install cookie is empty, otherwise, <c>false</c>.</returns>
        private static bool IsInstallCookieEmpty()
        {
            //Is there an .install file in the directory?
            bool bHasInstallationCookie = File.Exists(ConfigHandler.GetGameCookiePath());

            //Is the .install file empty? Assume false.
            bool bIsInstallCookieEmpty = false;

            if (bHasInstallationCookie)
            {
                bIsInstallCookieEmpty = string.IsNullOrEmpty(File.ReadAllText(ConfigHandler.GetGameCookiePath()));
            }

            return(bIsInstallCookieEmpty);
        }
Exemple #2
0
        /// <summary>
        /// Deletes all local data and installs the game again.
        /// </summary>
        public void ReinstallGame()
        {
            Log.Info("Beginning full reinstall of game files.");
            if (Directory.Exists(Config.GetGamePath()))
            {
                Log.Info("Deleting existing game files.");
                Directory.Delete(Config.GetGamePath(), true);
            }

            if (File.Exists(ConfigHandler.GetGameCookiePath()))
            {
                Log.Info("Deleting install progress cookie.");
                File.Delete(ConfigHandler.GetGameCookiePath());
            }

            Thread t = new Thread(() => this.Patch.InstallGame());

            t.Start();
        }
Exemple #3
0
        /// <summary>
        /// Determines whether the game is installed.
        /// </summary>
        /// <returns><c>true</c> if the game is installed; otherwise, <c>false</c>.</returns>
        public bool IsGameInstalled()
        {
            // Criteria for considering the game 'installed'
            // Does the game directory exist?
            bool bHasGameDirectory = Directory.Exists(Configuration.GetGamePath());

            // Is there an .install file in the directory?
            bool bHasInstallationCookie = File.Exists(ConfigHandler.GetGameCookiePath());

            // Is there a version file?
            bool bHasGameVersion = File.Exists(Configuration.GetGameVersionPath());

            if (!bHasGameVersion && bHasGameDirectory)
            {
                Log.Warn("No GameVersion.txt file was found in the installation directory.\n" +
                         "This may be due to a download error, or the develop may not have included one.\n" +
                         "Without it, the game cannot be considered fully installed.\n" +
                         "If you are the developer of this game, add one to your game files with your desired version in it.");
            }

            // If any of these criteria are false, the game is not considered fully installed.
            return(bHasGameDirectory && bHasInstallationCookie && IsInstallCookieEmpty() && bHasGameVersion);
        }