Exemple #1
0
        public static void CheckChangelog()
        {
            if (!Functions.IsWindowsVistaOrNewer())
            {
                return;
            }

            bool internetok = IsInternetAvailable();

            if (internetok == false)
            {
                MessageBox.Show("There's no Internet connection.\n\nYou can't see the changelog without one.", String.Format("{0} - No Internet connection available", ProductName), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    Octokit.Release Release = UpdateClient.Repository.Release.GetLatest("KeppySoftware", "OmniMIDI").Result;
                    Process.Start(String.Format(UpdatePage, Release.TagName));
                }
                catch (Exception ex)
                {
                    Functions.ShowErrorDialog(ErrorType.Error, System.Media.SystemSounds.Exclamation, "Unknown error", "An error has occurred while trying to show you the latest changelog.\nPlease try again later.\n\nPress OK to continue.", true, ex);
                }
            }
        }
Exemple #2
0
        static void DoAnyway(String[] args)
        {
            try
            {
                DebugToConsole(false, "Started configurator.", null);

                if (!Functions.IsWindowsVistaOrNewer())
                {
                    MessageBox.Show("This version of the configurator won't work on Windows XP and older!", "OmniMIDI Configurator - FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                DebugToConsole(false, "Checking if driver is registered...", null);
                if (!CheckDriverStatusInReg("x86", clsid32))
                {
                    return;
                }
                if (Environment.Is64BitOperatingSystem)
                {
                    if (!CheckDriverStatusInReg("x64", clsid64))
                    {
                        return;
                    }
                }

                // Parse KDMAPI version
                Int32 Major = 0, Minor = 0, Build = 0, Revision = 0;
                if (Convert.ToBoolean(KDMAPI.ReturnKDMAPIVer(ref Major, ref Minor, ref Build, ref Revision)))
                {
                    KDMAPI.KDMAPIVer = String.Format("{0}.{1}.{2} (Revision {3})", Major, Minor, Build, Revision);
                }
                else
                {
                    MessageBox.Show("Failed to initialize KDMAPI!\n\nPress OK to quit.", "OmniMIDI ~ Configurator | FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.ExitThread();
                }

                Application.SetCompatibleTextRenderingDefault(false);

                int  runmode = 0;
                int  window  = 0;
                bool ok;

                BringToFrontMessage = WinAPI.RegisterWindowMessage("OmniMIDIConfiguratorToFront");
                m = new EventWaitHandle(false, EventResetMode.ManualReset, "OmniMIDIConfigurator", out ok);
                if (!ok)
                {
                    WinAPI.PostMessage((IntPtr)WinAPI.HWND_BROADCAST, BringToFrontMessage, IntPtr.Zero, IntPtr.Zero);
                    return;
                }

                TriggerDate();

                foreach (String s in args)
                {
                    if (s.ToLowerInvariant() == "/rei")
                    {
                        TLS12Enable(true);

                        FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(UpdateSystem.UpdateFileVersion);

                        var current = Process.GetCurrentProcess();
                        Process.GetProcessesByName(current.ProcessName)
                        .Where(t => t.Id != current.Id)
                        .ToList()
                        .ForEach(t => t.Kill());

                        UpdateSystem.CheckForTLS12ThenUpdate(Driver.FileVersion, UpdateSystem.WIPE_SETTINGS);
                        return;
                    }
                    else if (s.ToLowerInvariant() == "/toomni")
                    {
                        UpdateToOmniMIDI();
                        return;
                    }
                    else if (s.ToLowerInvariant() == "/inf")
                    {
                        runmode = 2;
                        window  = 1;
                        break;
                    }

                    /*
                     * else if (s.ToLowerInvariant() == "/winmmdbg")
                     * {
                     *  runmode = 2;
                     *  window = 2;
                     *  break;
                     * }
                     */
                    else if (s.ToLowerInvariant() == "/egg")
                    {
                        CrashMyComputer.RtlAdjustPrivilege(19, true, false, ref CrashMyComputer.DummyBool);
                        CrashMyComputer.NtRaiseHardError(0xC01E0200, 0U, 0U, IntPtr.Zero, 6U, ref CrashMyComputer.DummyDWORD);
                        return;
                    }
                    else
                    {
                        runmode = 0;
                        window  = 0;
                        break;
                    }
                }

                TLS12Enable(false);

                if (Properties.Settings.Default.UpdateBranch == "choose")
                {
                    SelectBranch frm = new SelectBranch();
                    frm.ShowInTaskbar = true;
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowDialog();
                    frm.Dispose();
                }

                ExecuteForm(runmode, args, m, window);
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Fatal error during the execution of the configurator!\nMore details: {0}\n\nPress OK to quit.", ex.ToString()), "OmniMIDI Configurator - FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Exemple #3
0
        public static void CheckForUpdates(bool forced, bool startup, bool isitfromthechangelogwindow)
        {
            if (!Functions.IsWindowsVistaOrNewer())
            {
                return;
            }

            bool internetok = IsInternetAvailable();

            if (internetok == false)
            {
                NoUpdates(startup, false);
            }
            else
            {
                try
                {
                    Octokit.Release Release = UpdateClient.Repository.Release.GetLatest("KeppySoftware", "OmniMIDI").Result;
                    FileVersionInfo Driver  = FileVersionInfo.GetVersionInfo(UpdateFileVersion);

                    Version DriverOnline = null;
                    Version.TryParse(Release.TagName, out DriverOnline);
                    Version DriverCurrent = null;
                    Version.TryParse(Driver.FileVersion.ToString(), out DriverCurrent);

                    if (forced == true)
                    {
                        if (Properties.Settings.Default.UpdateBranch == "canary")
                        {
                            if (DriverCurrent < DriverOnline)
                            {
                                Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("The user forced a reinstall/downgrade of the program. ({0})", Release.TagName), null);
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                        }
                        else if (Properties.Settings.Default.UpdateBranch == "normal")
                        {
                            if (DriverCurrent.Major < DriverOnline.Major || DriverCurrent.Minor < DriverOnline.Minor)
                            {
                                if ((DriverCurrent.Build >= DriverOnline.Build || DriverCurrent.Build < DriverOnline.Build))
                                {
                                    Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    Program.DebugToConsole(false, String.Format("The user forced a reinstall/downgrade of the program. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                                }
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("The user forced a reinstall/downgrade of the program. ({0})", Release.TagName), null);
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                        }
                        else if (Properties.Settings.Default.UpdateBranch == "delay")
                        {
                            if (DriverCurrent.Major < DriverOnline.Major)
                            {
                                if ((DriverCurrent.Minor >= DriverOnline.Minor || DriverCurrent.Minor < DriverOnline.Minor))
                                {
                                    Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    Program.DebugToConsole(false, String.Format("The user forced a reinstall/downgrade of the program. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                                }
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("The user forced a reinstall/downgrade of the program. ({0})", Release.TagName), null);
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                        }
                    }
                    else
                    {
                        if (Properties.Settings.Default.UpdateBranch == "canary")
                        {
                            if (DriverCurrent < DriverOnline)
                            {
                                Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                NoUpdates(startup, internetok);
                            }
                        }
                        else if (Properties.Settings.Default.UpdateBranch == "normal")
                        {
                            if (DriverCurrent.Major < DriverOnline.Major || DriverCurrent.Minor < DriverOnline.Minor)
                            {
                                if ((DriverCurrent.Build >= DriverOnline.Build || DriverCurrent.Build < DriverOnline.Build))
                                {
                                    Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                    NoUpdates(startup, internetok);
                                }
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                NoUpdates(startup, internetok);
                            }
                        }
                        else if (Properties.Settings.Default.UpdateBranch == "delay")
                        {
                            if (DriverCurrent.Major < DriverOnline.Major)
                            {
                                if ((DriverCurrent.Minor >= DriverOnline.Minor || DriverCurrent.Minor < DriverOnline.Minor))
                                {
                                    Program.DebugToConsole(false, String.Format("New version found. Requesting user to download it. ({0})", Release.TagName), null);
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                    NoUpdates(startup, internetok);
                                }
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                NoUpdates(startup, internetok);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Program.DebugToConsole(true, "An error has occurred while checking for updates.", ex);
                    NoUpdates(startup, internetok);
                }
            }
        }
Exemple #4
0
        public static string CheckForUpdatesMini()
        {
            if (!Functions.IsWindowsVistaOrNewer())
            {
                return("nointernet");
            }

            Program.DebugToConsole(false, "Checking for updates...", null);

            bool internetok = IsInternetAvailable();

            if (internetok == false)
            {
                Program.DebugToConsole(false, "No Internet available.", null);
                return("nointernet");
            }
            else
            {
                try
                {
                    Octokit.Release Release = UpdateClient.Repository.Release.GetLatest("KeppySoftware", "OmniMIDI").Result;
                    FileVersionInfo Driver  = FileVersionInfo.GetVersionInfo(UpdateFileVersion);

                    Version DriverOnline = null;
                    Version.TryParse(Release.TagName, out DriverOnline);
                    Version DriverCurrent = null;
                    Version.TryParse(Driver.FileVersion.ToString(), out DriverCurrent);

                    if (Properties.Settings.Default.UpdateBranch == "canary")
                    {
                        if (DriverCurrent < DriverOnline)
                        {
                            Program.DebugToConsole(false, String.Format("New version found. ({0})", Release.TagName), null);
                            return("yes");
                        }
                        else
                        {
                            Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                            return("no");
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "normal")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major || DriverCurrent.Minor < DriverOnline.Minor)
                        {
                            if ((DriverCurrent.Build >= DriverOnline.Build || DriverCurrent.Build < DriverOnline.Build))
                            {
                                Program.DebugToConsole(false, String.Format("New version found. ({0})", Release.TagName), null);
                                return("yes");
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                return("no");
                            }
                        }
                        else
                        {
                            Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                            return("no");
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "delay")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major)
                        {
                            if ((DriverCurrent.Minor >= DriverOnline.Minor || DriverCurrent.Minor < DriverOnline.Minor))
                            {
                                Program.DebugToConsole(false, String.Format("New version found. ({0})", Release.TagName), null);
                                return("yes");
                            }
                            else
                            {
                                Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                                return("no");
                            }
                        }
                        else
                        {
                            Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                            return("no");
                        }
                    }
                    else
                    {
                        Program.DebugToConsole(false, String.Format("No updates have been found. Latest canary release is {0}.", Release.TagName), null);
                        return("no");
                    }
                }
                catch
                {
                    Program.DebugToConsole(false, "Error while checking for updates.", null);
                    return("fail");
                }
            }
        }
Exemple #5
0
        public static void CheckForUpdates(bool forced, bool startup, bool isitfromthechangelogwindow)
        {
            if (!Functions.IsWindowsVistaOrNewer())
            {
                return;
            }

            bool internetok = IsInternetAvailable();

            if (internetok == false)
            {
                NoUpdates(startup, false);
            }
            else
            {
                try
                {
                    Octokit.Release Release = UpdateClient.Repository.Release.GetLatest("KeppySoftware", "OmniMIDI").Result;
                    FileVersionInfo Driver  = FileVersionInfo.GetVersionInfo(UpdateFileVersion);

                    Version DriverOnline = null;
                    Version.TryParse(Release.TagName, out DriverOnline);
                    Version DriverCurrent = null;
                    Version.TryParse(Driver.FileVersion.ToString(), out DriverCurrent);

                    if (Properties.Settings.Default.UpdateBranch == "canary")
                    {
                        if (DriverCurrent < DriverOnline)
                        {
                            TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                        }
                        else
                        {
                            if (forced)
                            {
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                NoUpdates(startup, internetok);
                            }
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "normal")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major || DriverCurrent.Minor < DriverOnline.Minor)
                        {
                            if ((DriverCurrent.Build >= DriverOnline.Build || DriverCurrent.Build < DriverOnline.Build))
                            {
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                if (forced)
                                {
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    NoUpdates(startup, internetok);
                                }
                            }
                        }
                        else
                        {
                            if (forced)
                            {
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                NoUpdates(startup, internetok);
                            }
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "delay")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major)
                        {
                            if ((DriverCurrent.Minor >= DriverOnline.Minor || DriverCurrent.Minor < DriverOnline.Minor))
                            {
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Release.TagName, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                if (forced)
                                {
                                    TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                                }
                                else
                                {
                                    NoUpdates(startup, internetok);
                                }
                            }
                        }
                        else
                        {
                            if (forced)
                            {
                                TriggerUpdateWindow(DriverCurrent, DriverOnline, Driver.FileVersion, forced, startup, isitfromthechangelogwindow);
                            }
                            else
                            {
                                NoUpdates(startup, internetok);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Program.ShowError(4, "Unknown error", "An error has occurred while checking for updates.\nPlease try again later.\n\nPress OK to continue.", ex);
                    NoUpdates(startup, internetok);
                }
            }
        }
Exemple #6
0
        public static string CheckForUpdatesMini()
        {
            if (!Functions.IsWindowsVistaOrNewer())
            {
                return("nointernet");
            }

            bool internetok = IsInternetAvailable();

            if (internetok == false)
            {
                return("nointernet");
            }
            else
            {
                try
                {
                    Octokit.Release Release = UpdateClient.Repository.Release.GetLatest("KeppySoftware", "OmniMIDI").Result;
                    FileVersionInfo Driver  = FileVersionInfo.GetVersionInfo(UpdateFileVersion);

                    Version DriverOnline = null;
                    Version.TryParse(Release.TagName, out DriverOnline);
                    Version DriverCurrent = null;
                    Version.TryParse(Driver.FileVersion.ToString(), out DriverCurrent);

                    if (Properties.Settings.Default.UpdateBranch == "canary")
                    {
                        if (DriverCurrent < DriverOnline)
                        {
                            return("yes");
                        }
                        else
                        {
                            return("no");
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "normal")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major || DriverCurrent.Minor < DriverOnline.Minor)
                        {
                            if ((DriverCurrent.Build >= DriverOnline.Build || DriverCurrent.Build < DriverOnline.Build))
                            {
                                return("yes");
                            }
                            else
                            {
                                return("no");
                            }
                        }
                        else
                        {
                            return("no");
                        }
                    }
                    else if (Properties.Settings.Default.UpdateBranch == "delay")
                    {
                        if (DriverCurrent.Major < DriverOnline.Major)
                        {
                            if ((DriverCurrent.Minor >= DriverOnline.Minor || DriverCurrent.Minor < DriverOnline.Minor))
                            {
                                return("yes");
                            }
                            else
                            {
                                return("no");
                            }
                        }
                        else
                        {
                            return("no");
                        }
                    }
                    else
                    {
                        return("no");
                    }
                }
                catch
                {
                    Program.ShowError(4, "Unknown error", "An error has occurred while checking for updates.\nPlease try again later.\n\nPress OK to continue.", null);
                    return("fail");
                }
            }
        }