예제 #1
0
        static async Task InstallModAsync(string manifestUri, string installFolder = null)
        {
            var  info    = new CliModUpdateInfo(rootPath);
            bool success = await info.PrepareNewInstallation(manifestUri, installFolder);

            if (!success)
            {
                Helper.Log("\n");
                Helper.Log("The following target directory is not empty.");
                Helper.Log(info.basePath);
                if (!Confirm("Do you want to delete this folder permanently in order to continue installation? [y/N] : ", false))
                {
                    return;
                }
                await info.PrepareNewInstallation(manifestUri, installFolder);
            }
            await UpdateModAsync(info);
        }
예제 #2
0
        static async Task UpdateModAsync(CliModUpdateInfo updateInfo)
        {
            await updateInfo.CheckAndPrepareUpdate();

            Helper.Log("\n");
            if (updateInfo.isUpdateAvailable)
            {
                Helper.LogSeparator();
                Helper.Log(updateInfo.GetConfirmationMessage());
            }
            Helper.LogSeparator();
            Helper.Log(updateInfo.GetConfirmationTitle());
            Helper.LogSeparator();
            Helper.Log("\n");

            if (!updateInfo.isUpdateAvailable)
            {
                return;
            }

            if (!Confirm("Do you want to install this mod? [Y/n] : ", true))
            {
                return;
            }

            await updateInfo.ApplyUpdate();

            Helper.Log("\n");
            string finishMessage = updateInfo.GetFinishMessage();

            if (!string.IsNullOrWhiteSpace(finishMessage))
            {
                Helper.LogSeparator();
                Helper.Log(finishMessage);
            }
            Helper.LogSeparator();
            Helper.Log(updateInfo.GetFinishTitle());
            Helper.LogSeparator();
            Helper.Log("\n");
        }
예제 #3
0
        static void UpdateMod(string basePath)
        {
            var updateInfo = new CliModUpdateInfo(basePath);

            UpdateModAsync(updateInfo).Wait();
        }