예제 #1
0
    public static IEnumerator Update()
    {
        if (!UpdateAvailable)
        {
            yield return(CheckForUpdates());
        }

        if (!UpdateAvailable)
        {
            IRCConnection.SendMessage("Twitch Plays is up-to-date.");
            yield break;
        }

        IRCConnection.SendMessage("Updating Twitch Plays and restarting.");

        // Make the current build the previous build
        var previousBuild = new DirectoryInfo(Path.Combine(TwitchPlaysService.DataFolder, "Previous Build"));

        if (previousBuild.Exists)
        {
            previousBuild.Delete(true);
        }

        DirectoryInfo modFolder = new DirectoryInfo(GetModFolder());

        modFolder.MoveToSafe(previousBuild);

        // Copy the build that CheckForUpdates() downloaded to where the current one was.
        DirectoryInfo buildFolder = new DirectoryInfo(Path.Combine(BuildStorage, "Twitch Plays"));

        buildFolder.MoveToSafe(modFolder);

        GlobalCommands.RestartGame();
    }
예제 #2
0
    public static IEnumerator Update()
    {
        if (!UpdateAvailable)
        {
            yield return(CheckForUpdates());
        }

        if (!UpdateAvailable)
        {
            IRCConnection.SendMessage("Twitch Plays is up-to-date.");
            yield break;
        }

        IRCConnection.SendMessage("Updating Twitch Plays and restarting.");

        // Delete the current build
        DirectoryInfo modFolder = new DirectoryInfo(GetModFolder());

        modFolder.Delete(true);

        // Copy the build that CheckForUpdates() downloaded to where the current one was.
        // Note: .MoveTo(desDirName) was intentionally not used as it doesn't work across drives.
        DirectoryInfo buildFolder = new DirectoryInfo(Path.Combine(BuildStorage, "Twitch Plays"));

        buildFolder.CopyTo(modFolder);
        buildFolder.Delete(true);

        GlobalCommands.RestartGame();
    }
예제 #3
0
    public static IEnumerator Revert()
    {
        var previousBuild = new DirectoryInfo(Path.Combine(TwitchPlaysService.DataFolder, "Previous Build"));

        if (!previousBuild.Exists)
        {
            IRCConnection.SendMessage("There is no previous version of Twitch Plays to revert to.");
            yield break;
        }

        IRCConnection.SendMessage("Reverting to the previous Twitch Plays build and restarting.");

        DirectoryInfo modFolder = new DirectoryInfo(GetModFolder());

        modFolder.Delete(true);

        previousBuild.MoveToSafe(modFolder);

        GlobalCommands.RestartGame();
    }