Exemplo n.º 1
0
        public static async Task <bool> InstallUpdate(string url, UpdaterOptions options)
        {
            var result = false;

            while (!result)
            {
                result = await Installer.Run(url, options.pluginDirectory, options.project + ".tmp", options.strippedDirs, true);

                if (!result)
                {
                    var response = MessageBox.Show(
                        Resources.UpdateFailedError,
                        string.Format(Resources.ErrorTitle, options.project),
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Warning
                        );

                    if (response != DialogResult.Yes)
                    {
                        return(false);
                    }
                }
            }

            MessageBox.Show(
                Resources.UpdateSuccess,
                string.Format(Resources.UpdateTitle, options.project),
                MessageBoxButtons.OK,
                MessageBoxIcon.Information
                );

            return(true);
        }
Exemplo n.º 2
0
        public static async Task <bool> InstallCef(string cefPath, string archivePath = null)
        {
            var lib = IntPtr.Zero;

            while (true)
            {
                lib = NativeMethods.LoadLibrary("msvcp140.dll");
                if (lib != IntPtr.Zero)
                {
                    NativeMethods.FreeLibrary(lib);
                    break;
                }

                var response = MessageBox.Show(
                    Resources.MsvcrtMissing,
                    Resources.OverlayPluginTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question
                    );

                if (response == DialogResult.Yes)
                {
                    var installed = await Installer.InstallMsvcrt();

                    if (!installed)
                    {
                        MessageBox.Show(
                            Resources.MsvcrtFailed,
                            Resources.OverlayPluginTitle,
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error
                            );
                    }
                }
                else
                {
                    return(false);
                }
            }

            var url = GetUrl();

            var result = await Installer.Run(archivePath == null?url : archivePath, cefPath);

            if (!result || !Directory.Exists(cefPath))
            {
                MessageBox.Show(
                    Resources.UpdateCefDlFailed,
                    Resources.ErrorTitle,
                    MessageBoxButtons.OK
                    );

                return(false);
            }
            else
            {
                File.WriteAllText(Path.Combine(cefPath, "version.txt"), CEF_VERSION);
                return(true);
            }
        }
Exemplo n.º 3
0
        public static async Task <bool> InstallCef(string cefPath)
        {
            while (!File.Exists("C:\\Windows\\system32\\msvcp140.dll"))
            {
                var response = MessageBox.Show(
                    "You're missing the MS Visual C++ Redistributable for Visual Studio 2019.\nYou'll need that for OverlayPlugin. Install it now?",
                    "OverlayPlugin",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question
                    );

                if (response == DialogResult.Yes)
                {
                    var installed = await Installer.InstallMsvcrt();

                    if (!installed)
                    {
                        MessageBox.Show(
                            "The MSVCRT installation failed.",
                            "OverlayPlugin",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error
                            );
                    }
                }
                else
                {
                    return(false);
                }
            }

            var url = CEF_DL.Replace("{CEF_VERSION}", CEF_VERSION).Replace("{ARCH}", Environment.Is64BitProcess ? "x64" : "x86");

            var result = await Installer.Run(url, cefPath);

            if (!result || !Directory.Exists(cefPath))
            {
                var response = MessageBox.Show(
                    "Failed to download CEF! You will not be able to use OverlayPlugin. Retry?",
                    "OverlayPlugin Error",
                    MessageBoxButtons.YesNo
                    );

                if (response == DialogResult.Yes)
                {
                    return(await InstallCef(cefPath));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                File.WriteAllText(Path.Combine(cefPath, "version.txt"), CEF_VERSION);
                return(true);
            }
        }
Exemplo n.º 4
0
        public static async Task <bool> InstallCef(string cefPath, string archivePath = null)
        {
            var result = await Installer.Run(archivePath == null?GetUrl() : archivePath, cefPath, "OverlayPluginCef.tmp");

            if (!result || !Directory.Exists(cefPath))
            {
                MessageBox.Show(
                    Resources.UpdateCefDlFailed,
                    Resources.ErrorTitle,
                    MessageBoxButtons.OK
                    );

                return(false);
            }
            else
            {
                File.WriteAllText(Path.Combine(cefPath, "version.txt"), CEF_VERSION);
                return(true);
            }
        }
Exemplo n.º 5
0
        public static async Task <bool> InstallUpdate(Version version, string pluginDirectory)
        {
            var url = DL.Replace("{VERSION}", version.ToString());

            var result = await Installer.Run(url, pluginDirectory, true);

            if (!result)
            {
                var response = MessageBox.Show(
                    "Failed to update the plugin. It might not load the next time you start ACT. Retry?",
                    "OverlayPlugin Error",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning
                    );

                if (response == DialogResult.Yes)
                {
                    return(await InstallUpdate(version, pluginDirectory));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(
                    "The update was successful. Please restart ACT to load the new plugin version.",
                    "OverlayPlugin Update",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );

                return(true);
            }
        }
Exemplo n.º 6
0
        public static async Task <bool> InstallUpdate(Version version, string pluginDirectory)
        {
            var url = DL.Replace("{VERSION}", version.ToString());

            var result = await Installer.Run(url, pluginDirectory, true);

            if (!result)
            {
                var response = MessageBox.Show(
                    Resources.UpdateFailedError,
                    Resources.ErrorTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning
                    );

                if (response == DialogResult.Yes)
                {
                    return(await InstallUpdate(version, pluginDirectory));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(
                    Resources.UpdateSuccess,
                    Resources.UpdateTitle,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );

                return(true);
            }
        }
Exemplo n.º 7
0
        public static async Task <bool> InstallCef(string cefPath)
        {
            var lib = IntPtr.Zero;

            while (true)
            {
                lib = NativeMethods.LoadLibrary("msvcp140.dll");
                if (lib != IntPtr.Zero)
                {
                    NativeMethods.FreeLibrary(lib);
                    break;
                }

                var response = MessageBox.Show(
                    Resources.MsvcrtMissing,
                    Resources.OverlayPluginTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question
                    );

                if (response == DialogResult.Yes)
                {
                    var installed = await Installer.InstallMsvcrt();

                    if (!installed)
                    {
                        MessageBox.Show(
                            Resources.MsvcrtFailed,
                            Resources.OverlayPluginTitle,
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error
                            );
                    }
                }
                else
                {
                    return(false);
                }
            }

            var url = CEF_DL.Replace("{CEF_VERSION}", CEF_VERSION).Replace("{ARCH}", Environment.Is64BitProcess ? "x64" : "x86");

            var result = await Installer.Run(url, cefPath);

            if (!result || !Directory.Exists(cefPath))
            {
                var response = MessageBox.Show(
                    Resources.UpdateCefDlFailed,
                    Resources.ErrorTitle,
                    MessageBoxButtons.YesNo
                    );

                if (response == DialogResult.Yes)
                {
                    return(await InstallCef(cefPath));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                File.WriteAllText(Path.Combine(cefPath, "version.txt"), CEF_VERSION);
                return(true);
            }
        }