Exemplo n.º 1
0
        private void ChangeBranch_Click(object sender, EventArgs e)
        {
            new SelectBranch().ShowDialog();

            CurBranch.Text      = UpdateSystem.GetCurrentBranch();
            CurBranch.ForeColor = UpdateSystem.GetCurrentBranchColor();
            BranchToolTip.SetToolTip(CurBranch, UpdateSystem.GetCurrentBranchToolTip());
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
0
        private void CheckUpdates_DoWork(object sender, DoWorkEventArgs e)
        {
            this.Invoke((MethodInvoker) delegate
            {
                SetDefaultCursor(sender, null);

                VersionLabel.Click -= CheckUpdatesStartUp;
                VersionLabel.Image  = Properties.Resources.ReloadIcon;

                DriverInfo.Enabled   = false;
                CFUBtn.Enabled       = false;
                VersionLabel.Enabled = false;
            });

            String IUA = UpdateSystem.CheckForUpdatesMini().ToLowerInvariant();

            switch (IUA)
            {
            case "yes":
                this.Invoke((MethodInvoker) delegate
                {
                    VersionLabel.Click += CFUBtn_Click;
                    VersionLabel.Image  = Properties.Resources.dlready;

                    DriverInfo.Enabled   = true;
                    CFUBtn.Enabled       = true;
                    VersionLabel.Enabled = true;
                });
                break;

            case "no":
                this.Invoke((MethodInvoker) delegate
                {
                    VersionLabel.Click += CheckUpdatesStartUp;
                    VersionLabel.Image  = Properties.Resources.ok;

                    DriverInfo.Enabled   = true;
                    CFUBtn.Enabled       = true;
                    VersionLabel.Enabled = true;
                });
                break;

            default:
                this.Invoke((MethodInvoker) delegate
                {
                    VersionLabel.Click += CheckUpdatesStartUp;
                    VersionLabel.Image  = Properties.Resources.dlerror;

                    DriverInfo.Enabled   = true;
                    CFUBtn.Enabled       = true;
                    VersionLabel.Enabled = true;
                });
                break;
            }
        }
Exemplo n.º 4
0
 private void CFUBtn_Click(object sender, EventArgs e)
 {
     if (Control.ModifierKeys == Keys.Shift)
     {
         UpdateSystem.CheckForUpdates(true, false, false);
     }
     else
     {
         UpdateSystem.CheckForUpdates(false, false, false);
     }
 }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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()));
        }
Exemplo n.º 7
0
        public InfoWindow()
        {
            InitializeComponent();

            VerLabel.Text = ReturnDriverAssemblyVersion(
                "OmniMIDI",
                "CR",
                new int[] { Driver.FileMajorPart, Driver.FileMinorPart, Driver.FileBuildPart, Driver.FilePrivatePart }
                );
            VerLabel.Cursor = Program.SystemHandCursor;

            BASSVer.Text = ReturnDriverAssemblyVersion(
                null,
                "U",
                new int[] { BASS.FileMajorPart, BASS.FileMinorPart, BASS.FileBuildPart, BASS.FilePrivatePart }
                );

            BASSMIDIVer.Text = ReturnDriverAssemblyVersion(
                null,
                "U",
                new int[] { BASSMIDI.FileMajorPart, BASSMIDI.FileMinorPart, BASSMIDI.FileBuildPart, BASSMIDI.FilePrivatePart }
                );

            int[] KDMAPIVerRef = { 0, 0, 0, 0 };
            if (KDMAPI.ReturnKDMAPIVer(ref KDMAPIVerRef[0], ref KDMAPIVerRef[1], ref KDMAPIVerRef[2], ref KDMAPIVerRef[3]) != 0)
            {
                KDMAPIVer.Text = ReturnDriverAssemblyVersion(
                    null,
                    "U",
                    KDMAPIVerRef
                    );
            }
            else
            {
                KDMAPIVer.Text = "N/A";
            }

            CopyrightLabel.Text = String.Format(CopyrightLabel.Text, DateTime.Today.Year);

            CurBranch.Text      = UpdateSystem.GetCurrentBranch();
            CurBranch.ForeColor = UpdateSystem.GetCurrentBranchColor();
            BranchToolTip.SetToolTip(CurBranch, UpdateSystem.GetCurrentBranchToolTip());
            if (Properties.Settings.Default.PreRelease)
            {
                VerLabel.Text += " (PR)";
            }

            OMBigLogo.Image =
                (DateTime.Today.Month == 4 && DateTime.Today.Day == 1) ? Properties.Resources.OMLauncherFish : Properties.Resources.OMLauncher;

            BB.Location  = new Point(OMBigLogo.Size.Width - BB.Size.Width - 8, OMBigLogo.Size.Height - BB.Size.Height - 8);
            BB.Parent    = OMBigLogo;
            BB.Image     = Properties.Resources.BB;
            BB.BackColor = Color.Transparent;

            BecomePatron.Cursor = Program.SystemHandCursor;
            BecomePatron.Image  = Properties.Resources.PatreonLogo;

            PayPalDonation.Cursor = Program.SystemHandCursor;
            PayPalDonation.Image  = Properties.Resources.PayPalLogo;

            GitHubPage.Cursor = Program.SystemHandCursor;
            GitHubPage.Image  = Properties.Resources.Octocat;

            OMLicense.Cursor = Program.SystemHandCursor;
            OMLicense.Image  = Properties.Resources.TextLogo;

            WinName.Text   = String.Format("{0}", OSInfo.Name.Replace("Microsoft ", ""));
            RAMAmount.Text = SoundFontListExtension.ReturnSoundFontSize(null, "ram", Convert.ToInt64((new ComputerInfo()).TotalPhysicalMemory));
            switch (Environment.OSVersion.Version.Major)
            {
            case 10:
                WinVer.Text = String.Format(
                    "Version {0} ({1})\nRelease {2}, Revision {3}",
                    WVerKey.GetValue("ReleaseId", 0).ToString(),
                    Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit",
                    Environment.OSVersion.Version.Build,
                    WVerKey.GetValue("UBR", 0).ToString()
                    );
                break;

            case 6:
                if (Environment.OSVersion.Version.Minor > 1)
                {
                    WinVer.Text = String.Format(
                        "Version {0}.{1}\nBuild {2}",
                        Environment.OSVersion.Version.Major,
                        Environment.OSVersion.Version.Minor,
                        Environment.OSVersion.Version.Build
                        );
                }
                else
                {
                    if (Int32.Parse(Regex.Match(Environment.OSVersion.ServicePack, @"\d+").Value, NumberFormatInfo.InvariantInfo) > 0)
                    {
                        WinVer.Text = String.Format("{0}.{1}\nBuild {2}, Service Pack {3}",
                                                    Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                    Environment.OSVersion.Version.Build, Environment.OSVersion.ServicePack);
                    }
                    else
                    {
                        WinVer.Text = String.Format("{0}.{1}\nBuild {2}",
                                                    Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                    Environment.OSVersion.Version.Build);
                    }
                }
                break;
            }
        }
Exemplo n.º 8
0
 private void CheckForUpdates_Click(object sender, EventArgs e)
 {
     UpdateSystem.CheckForUpdates((Control.ModifierKeys == Keys.Shift), false, false);
 }
Exemplo n.º 9
0
 private void UpdateBtn_Click(object sender, EventArgs e)
 {
     UpdateSystem.CheckForUpdates((ModifierKeys == Keys.Shift), false, true);
 }
Exemplo n.º 10
0
 private void CheckForUpdates_Click(object sender, EventArgs e)
 {
     UpdateSystem.CheckForUpdates(false, false, false);
 }
Exemplo n.º 11
0
        private void InfoDialog_Load(object sender, EventArgs e)
        {
            CurrentLogo.Image = Properties.Resources.KSynthLogo;

            if (!OmniMIDIConfiguratorMain.IsInternetAvailable)
            {
                CFU.Visible = false;
            }

            ComputerInfo CI      = new ComputerInfo();
            String       Version = String.Format("{0}.{1}.{2}", Driver.FileMajorPart, Driver.FileMinorPart, Driver.FileBuildPart);

            VerLabel.Text       = String.Format("OmniMIDI {0}\nⒸ 2011 KaleidonKep99 && SonoSooS\n\nFork of BASSMIDI Driver by Kode54 and Mudlord", Version, DateTime.Now.Year.ToString());
            DriverVer.Text      = ReturnDriverAssemblyVersion(Version, Driver.FilePrivatePart);
            BASSVer.Text        = ReturnBASSAssemblyVersion(BASS.FileVersion, BASS.FilePrivatePart);
            BASSMIDIVer.Text    = ReturnBASSAssemblyVersion(BASSMIDI.FileVersion, BASSMIDI.FilePrivatePart);
            KDMAPIVer.Text      = KDMAPI.KDMAPIVer;
            CurBranch.Text      = UpdateSystem.GetCurrentBranch();
            CurBranch.ForeColor = UpdateSystem.GetCurrentBranchColor();
            BranchToolTip.SetToolTip(CurBranch, UpdateSystem.GetCurrentBranchToolTip());

            OSInfo.OSVERSIONINFOEX osVersionInfo = new OSInfo.OSVERSIONINFOEX();
            osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSInfo.OSVERSIONINFOEX));

            if (Properties.Settings.Default.IsItPreRelease)
            {
                DriverVer.Text += " (Pre-release build)";
            }

            WinName.Text = String.Format("{0} ({1})", OSInfo.Name.Replace("Microsoft ", ""), Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit");

            if (Environment.OSVersion.Version.Major == 10) // If OS is Windows 10, get UBR too
            {
                WinVer.Text = String.Format("Version {0} (Release {1}, Revision {2})",
                                            CurrentVerKey.GetValue("ReleaseId", 0).ToString(), Environment.OSVersion.Version.Build, CurrentVerKey.GetValue("UBR", 0).ToString());
            }
            else // Else, give normal version number
            {
                if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor > 1)
                {
                    WinVer.Text = String.Format("{0}.{1}.{2}",
                                                Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                Environment.OSVersion.Version.Build);
                }
                else
                {
                    if (Int32.Parse(Regex.Match(Environment.OSVersion.ServicePack, @"\d+").Value, NumberFormatInfo.InvariantInfo) > 0)
                    {
                        WinVer.Text = String.Format("{0}.{1}.{2} ({3})",
                                                    Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                    Environment.OSVersion.Version.Build, Environment.OSVersion.ServicePack);
                    }
                    else
                    {
                        WinVer.Text = String.Format("{0}.{1}.{2}",
                                                    Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor,
                                                    Environment.OSVersion.Version.Build);
                    }
                }
            }
        }