Пример #1
0
 private void ShowChangelog_Click(object sender, EventArgs e)
 {
     try
     {
         SoundEvent.MessageBeep(SoundToPlay);
         ChangelogWindow frm = new ChangelogWindow(OnlineVersion, true);
         frm.ShowDialog(this);
         frm.Dispose();
     }
     catch { }
 }
Пример #2
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()));
        }