Exemplo n.º 1
0
        public static void LoudMaxInstall()
        {
            try
            {
                int isalreadyinstalled = 0;
                string userfolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Keppy's Synthesizer";
                string loudmax32 = "https://raw.githubusercontent.com/KaleidonKep99/Keppy-s-Synthesizer/master/external_packages/lib/LoudMax.dll";
                string loudmax64 = "https://raw.githubusercontent.com/KaleidonKep99/Keppy-s-Synthesizer/master/external_packages/lib64/LoudMax64.dll";

                // 32-bit DLL
                if (!File.Exists(userfolder + "\\LoudMax.dll"))
                {
                    Forms.KeppySynthDLEngine frm = new Forms.KeppySynthDLEngine(null, "Downloading LoudMax 32-bit... {0}%", loudmax32, 1);
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("LoudMax 32-bit seems to be already installed.", "Keppy's Synthesizer - Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    isalreadyinstalled++;
                }

                // 64-bit DLL
                if (Environment.Is64BitOperatingSystem)
                {
                    if (!File.Exists(userfolder + "\\LoudMax64.dll"))
                    {
                        Forms.KeppySynthDLEngine frm = new Forms.KeppySynthDLEngine(null, "Downloading LoudMax 64-bit... {0}%", loudmax64, 1);
                        frm.StartPosition = FormStartPosition.CenterScreen;
                        frm.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("LoudMax 64-bit seems to be already installed.", "Keppy's Synthesizer - Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        isalreadyinstalled++;
                    }
                }

                if (isalreadyinstalled != 2)
                {
                    MessageBox.Show("LoudMax successfully installed!", "Keppy's Synthesizer - Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Crap, an error!\nAre you sure you have a working Internet connection?\n\nError:\n" + ex.ToString(), "Oh no! Keppy's Synthesizer encountered an error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 2
0
        static void DoAnyway(String[] args)
        {
            RegistryKey SynthSettings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Synthesizer\\Settings", true);
            int runmode = 0;
            bool ok;
            BringToFrontMessage = WinAPI.RegisterWindowMessage("KeppySynthConfiguratorToFront");
            Mutex m = new Mutex(true, "KeppySynthConfigurator", out ok);
            if (!ok)
            {
                WinAPI.PostMessage((IntPtr)WinAPI.HWND_BROADCAST, BringToFrontMessage,IntPtr.Zero,IntPtr.Zero);
                return;
            }
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                foreach (String s in args)
                {
                    switch (s.Substring(0, 4).ToUpper())
                    {
                        case "/ASP":
                            runmode = 1;
                            break;
                        default:
                            runmode = 0;
                            break;
                    }
                }

                if (runmode == 0)
                {
                    if (SynthSettings.GetValue("autoupdatecheck", 1).ToString() == "1")
                    {
                        if (Functions.IsInternetAvailable() == false)
                        {
                            MessageBox.Show("The configurator can not connect to the GitHub servers.\n\nCheck your network connection, or contact your system administrator or network service provider.\n\nPress OK to continue and open the configurator's window.", "Keppy's Synthesizer - Connection error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            try
                            {
                                WebClient client = new WebClient();
                                Stream stream = client.OpenRead("https://raw.githubusercontent.com/KaleidonKep99/Keppy-s-Driver/master/output/keppydriverupdate.txt");
                                StreamReader reader = new StreamReader(stream);
                                String newestversion = reader.ReadToEnd();
                                FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppysynth\\keppysynth.dll");
                                Version x = null;
                                Version.TryParse(newestversion.ToString(), out x);
                                Version y = null;
                                Version.TryParse(Driver.FileVersion.ToString(), out y);
                                Thread.Sleep(50);
                                if (x > y)
                                {
                                    DialogResult dialogResult = MessageBox.Show("A new update for Keppy's Synthesizer has been found.\n\nVersion installed: " + Driver.FileVersion.ToString() + "\nVersion available online: " + newestversion.ToString() + "\n\nWould you like to update now?\nIf you choose \"Yes\", the configurator will be automatically closed.\n\n(You can disable the automatic update check through the advanced settings.)", "New version of Keppy's Synthesizer found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                                    if (dialogResult == DialogResult.Yes)
                                    {
                                        Forms.KeppySynthDLEngine frm = new Forms.KeppySynthDLEngine(newestversion, String.Format("Downloading update {0}, please wait... {1}%", newestversion, "{0}"), null, 0);
                                        frm.StartPosition = FormStartPosition.CenterScreen;
                                        frm.ShowDialog();
                                    }
                                }
                            }
                            catch
                            {
                                MessageBox.Show("Unknown error.\n\nPress OK to continue and open the configurator's window.", "Keppy's Synthesizer - Connection error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
                Application.EnableVisualStyles();
                SynthSettings.Close();
                Application.Run(new KeppySynthConfiguratorMain(args));
                GC.KeepAlive(m);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error as occurred while starting the configurator.\n\nMore informations down below:\n" + ex.ToString() + "\n\nThe configurator can still be used, press OK to continue", "Keppy's Synthesizer ~ Error" , MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new KeppySynthConfiguratorMain(args));
                GC.KeepAlive(m);
            }
        }
Exemplo n.º 3
0
 public static void CheckForUpdates()
 {
     if (IsInternetAvailable() == false)
     {
         MessageBox.Show("The configurator can not connect to the GitHub servers.\n\nCheck your network connection, or contact your system administrator or network service provider.\n\nPress OK to continue and open the configurator's window.", "Keppy's Synthesizer - Connection error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         try
         {
             WebClient client = new WebClient();
             Stream stream = client.OpenRead("https://raw.githubusercontent.com/KaleidonKep99/Keppy-s-Driver/master/output/keppydriverupdate.txt");
             StreamReader reader = new StreamReader(stream);
             String newestversion = reader.ReadToEnd();
             FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppysynth\\keppysynth.dll");
             Version x = null;
             Version.TryParse(newestversion.ToString(), out x);
             Version y = null;
             Version.TryParse(Driver.FileVersion.ToString(), out y);
             if (x > y)
             {
                 DialogResult dialogResult = MessageBox.Show("A new update for Keppy's Synthesizer has been found.\n\nVersion installed: " + Driver.FileVersion.ToString() + "\nVersion available online: " + newestversion.ToString() + "\n\nWould you like to update now?\nIf you choose \"Yes\", the configurator will be automatically closed.\n\n(You can disable the automatic update check through the advanced settings.)", "New version of Keppy's Synthesizer found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (dialogResult == DialogResult.Yes)
                 {
                     Forms.KeppySynthDLEngine frm = new Forms.KeppySynthDLEngine(newestversion, String.Format("Downloading update {0}, please wait... {1}%", newestversion, @"{0}"), null, 0);
                     frm.StartPosition = FormStartPosition.CenterScreen;
                     frm.ShowDialog();
                 }
             }
             else
             {
                 MessageBox.Show("No updates have been found.\n\nPlease try again later.", "Keppy's Synthesizer - No updates found", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         catch
         {
             MessageBox.Show("Unknown error.\n\nPress OK to continue and open the configurator's window.", "Keppy's Synthesizer - Connection error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }