Beispiel #1
0
        private void ChangeBranch_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SelectBranch frm = new SelectBranch();

            frm.ShowDialog();
            frm.Dispose();
            CurBranch.Text      = UpdateSystem.GetCurrentBranch();
            CurBranch.ForeColor = UpdateSystem.GetCurrentBranchColor();
            BranchToolTip.SetToolTip(CurBranch, UpdateSystem.GetCurrentBranchToolTip());
        }
Beispiel #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);
            }
        }
Beispiel #3
0
        static void Main(String[] Args)
        {
            FileVersionInfo Driver          = FileVersionInfo.GetVersionInfo(UpdateSystem.UpdateFileVersion);
            List <String>   SoundFontsToAdd = new List <String>();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Functions.CheckDriverStatusInReg("x86", Functions.CLSID32);
            if (Environment.Is64BitOperatingSystem)
            {
                Functions.CheckDriverStatusInReg("x64", Functions.CLSID64);
            }

            OpenRequiredKey(ref Mixer, MIPath);
            OpenRequiredKey(ref SynthSettings, SSPath);
            OpenRequiredKey(ref Mapper, MPPath);
            OpenRequiredKey(ref Watchdog, WPath);

            if (!Directory.Exists(Path.GetDirectoryName(Program.ListsPath[0])))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(Program.ListsPath[0]));
            }

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

            foreach (String Arg in Args)
            {
                switch (Arg.ToLowerInvariant())
                {
                case "/rei":
                    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;

                case "/showchangelog":
                    if (Properties.Settings.Default.ShowChangelogStartUp)
                    {
                        try
                        {
                            ChangelogWindow F = new ChangelogWindow(Driver.FileVersion.ToString(), true);
                            F.FormBorderStyle = FormBorderStyle.FixedDialog;
                            F.ShowIcon        = true;
                            F.ShowInTaskbar   = true;
                            F.ShowDialog();
                            F.Dispose();
                        }
                        catch { }
                    }
                    break;

                default:
                    SoundFontsToAdd.Add(Arg);
                    break;
                }
            }

            bool dummy;

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

            GC.KeepAlive(BringToFrontMessage);
            GC.KeepAlive(m);

            // Donation dialog
            DateTime CD = DateTime.Now;
            Double   D  = (CD.Date - Properties.Settings.Default.DonationShownWhen).TotalDays;

            if (D > 30 && !Properties.Settings.Default.DonationDoNotShow)
            {
                new Donate().ShowDialog();
            }

            Application.Run(new MainWindow(SoundFontsToAdd.ToArray()));
        }