Example #1
0
        /// <summary>
        ///     Verifies that SteamCMD is present in the installation. Should be called before running SteamCMD.exe or doing
        ///     anything with SteamCMD.
        /// </summary>
        private static void VerifySteam()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                return;
            }

            var inst        = Installation.Load();
            var steamCmdExe = Path.Combine(inst.InstallationPath, "steamcmd.exe");

            try
            {
                if (FileActions.VerifyFile(steamCmdExe))
                {
                    return;
                }

                var zipTarget = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
                FileActions.Download(DownloadLink, zipTarget);
                FileActions.ExtractZip(zipTarget, inst.InstallationPath);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        ///     Downloads and installs RocketMod.
        /// </summary>
        public static void UpdateRocket()
        {
            var tempZip = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());

            if (!FileActions.Download(RocketDownloadUrl.Value, tempZip))
            {
                MessageBox.Show(
                    "An error occured during download. Please verify that you can access github.",
                    "Rocketmod download failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            FileActions.ExtractZip(tempZip, ServerPath.Value);
        }