Beispiel #1
0
        private void Preload_Click(object sender, EventArgs e)
        {
            try
            {
                if (Lis.SelectedIndices.Count != -1 && Lis.SelectedIndices.Count > 0)
                {
                    for (int i = Lis.SelectedIndices.Count - 1; i >= 0; i--)
                    {
                        switch (Lis.SelectedItems[i].SubItems[7].Text.ToLowerInvariant())
                        {
                        default:
                        case "yes":
                            Lis.SelectedItems[i].SubItems[7].Text = "No";
                            break;

                        case "no":
                            Lis.SelectedItems[i].SubItems[7].Text = "Yes";
                            break;
                        }
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }
        }
Beispiel #2
0
 private void SelectedListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelectedIndexCSF = (SelectedListBox.SelectedIndex == 0);
     SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false);
     Properties.Settings.Default.LastListSelected = SelectedListBox.SelectedIndex;
     Properties.Settings.Default.Save();
 }
Beispiel #3
0
        private void PasteSoundFonts()
        {
            String FCB = Clipboard.GetText();

            if (!String.IsNullOrEmpty(FCB))
            {
                String   InvalidChars = new String(Path.GetInvalidPathChars());
                String[] Is           = FCB.Split('\t');

                for (int i = 0; i < Is.Count(); i++)
                {
                    foreach (char C in InvalidChars)
                    {
                        Is[i] = Is[i].Replace(C.ToString(), "");
                    }
                }

                ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(Is, false, true);

                if (iSFs != null)
                {
                    foreach (ListViewItem iSF in iSFs)
                    {
                        Lis.Items.Add(iSF);
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
        }
Beispiel #4
0
        private void IEL_Click(object sender, EventArgs e)
        {
            OpenFileDialog OFD = new OpenFileDialog()
            {
                Multiselect      = true,
                InitialDirectory = Properties.Settings.Default.LastImportExportPath,
                Filter           = "Soundfont lists | *.sflist; *.omlist; *.txt;"
            };

            try
            {
                if (OFD.ShowDialog(this) == DialogResult.OK)
                {
                    Properties.Settings.Default.LastImportExportPath = Path.GetDirectoryName(OFD.FileNames[0]);
                    Properties.Settings.Default.Save();

                    foreach (string ListW in OFD.FileNames)
                    {
                        SoundFontListExtension.ChangeList(-1, ListW, true, false);
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);

                    Program.ShowError(0, "Import finished", "The selected lists have been imported successfully to the currently selected list in the configurator.", null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }

            OFD.Dispose();
        }
Beispiel #5
0
 private void CSFHandler(object source, FileSystemEventArgs e)
 {
     if (SelectedIndexCSF && !SoundFontListExtension.StopCheck)
     {
         this.Invoke((Action) delegate {
             SoundFontListExtension.ChangeList(0, null, false, true);
         });
     }
 }
Beispiel #6
0
        private void PerformRAMCheck()
        {
            ulong check = (ulong)((ArraySize.Value * 4) / RatioVal.Value);

            if (check >= (installedMemory / 8))
            {
                if ((check >= installedMemory) || ((RatioVal.Value == 1) && (GetRAMSize.Checked == true)))
                {
                    WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wir;
                    WarningLabel.Text =
                        String.Format("ERROR:\nYou cannot use all the available memory!\n(Size: {0} ({1} DWORDs * 4 / {2}))",
                                      SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value
                                      );
                    ApplySettings.Enabled = false;
                }
                else
                {
                    WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wi;
                    WarningLabel.Text =
                        String.Format("WARNING:\nYou should leave at least {0} of RAM available to Windows.\n(Size: {1} ({2} DWORDs * 4 / {3}))",
                                      SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 6),
                                      SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value
                                      );
                    ApplySettings.Enabled = true;
                }
            }
            else if (check > 1 && check < 128)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.wi;
                WarningLabel.Text     = "WARNING: You might experience lag when going below 128 bytes.";
                ApplySettings.Enabled = true;
            }
            else if (check == 1)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.wi;
                WarningLabel.Text     = String.Format("The final size will be {0}.\n(({1} DWORDs * 4) / {2})\nGood luck.", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                ApplySettings.Enabled = true;
            }
            else if (check < 1)
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.infoicon;
                WarningLabel.Text     = "ERROR:\nHooray, you found the easter egg! Now set a valid value.";
                ApplySettings.Enabled = false;
            }
            else
            {
                WarningSign.Image     = OmniMIDIConfigurator.Properties.Resources.successicon;
                WarningLabel.Text     = String.Format("The final size will be {0}.\n({1} DWORDs * 4) / {2})\nLooks good!", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value);
                ApplySettings.Enabled = true;
            }
        }
Beispiel #7
0
        private void SelectedListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            SelectedIndexCSF = (SelectedListBox.SelectedIndex == 0);
            SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false);
            Properties.Settings.Default.LastListSelected = SelectedListBox.SelectedIndex;
            Properties.Settings.Default.Save();

            if (SelectedListBox.SelectedIndex == 0)
            {
                SoundFontListExtension.StartCSFWatcher();
            }

            // Activate the CSFWatcher now by assigning the events, to avoid a race condition
            SoundFontListExtension.OpenCSFWatcher(true, new FileSystemEventHandler(CSFHandler));
        }
Beispiel #8
0
        private void Lis_DragDrop(object sender, DragEventArgs e)
        {
            string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(s, BankPresetOverride.Checked, false);

            if (iSFs != null)
            {
                foreach (ListViewItem iSF in iSFs)
                {
                    Lis.Items.Add(iSF);
                }

                SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
            }
        }
Beispiel #9
0
        private void ReloadListAfterError(Exception ex)
        {
            DialogResult RES = Program.ShowError(
                3,
                "Error",
                String.Format(
                    "Oh snap!\nThe configurator encountered an error while editing the following list:\n{0}\n\nDo you want to reload the list?\n\n{1}",
                    Program.ListsPath[SelectedListBox.SelectedIndex], ex.ToString()
                    ),
                null
                );

            if (RES == DialogResult.Yes)
            {
                SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false);
            }
        }
Beispiel #10
0
        private void CLi_Click(object sender, EventArgs e)
        {
            DialogResult RES = Program.ShowError(1, String.Format("Clear {0}", SelectedListBox.Text), "Are you sure you want to clear this list?", null);

            if (RES == DialogResult.Yes)
            {
                try
                {
                    Lis.Items.Clear();
                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                    Program.ShowError(0, "Cleaning finished", "The list has been cleaned successfully.", null);
                }
                catch (Exception ex)
                {
                    ReloadListAfterError(ex);
                }
            }
        }
Beispiel #11
0
        private void MoveListViewItems(ListViewEx sender, MoveDirection direction)
        {
            try
            {
                int dir = (int)direction;
                int opp = dir * -1;

                bool valid = sender.SelectedItems.Count > 0 &&
                             ((direction == MoveDirection.Down && (sender.SelectedItems[sender.SelectedItems.Count - 1].Index < sender.Items.Count - 1)) ||
                              (direction == MoveDirection.Up && (sender.SelectedItems[0].Index > 0)));

                if (valid)
                {
                    List <int>     Is   = new List <int>();
                    ListViewItem[] iTBM = sender.SelectedItems.Cast <ListViewItem>().ToArray();

                    IEnumerable <ListViewItem> iTBMEnum;
                    iTBMEnum = (direction == MoveDirection.Down) ? iTBM.Reverse() : iTBM;

                    WinAPI.SendMessage(sender.Handle, WinAPI.WM_SETREDRAW, (IntPtr)0, IntPtr.Zero);
                    foreach (ListViewItem item in iTBMEnum)
                    {
                        int index = item.Index + dir;

                        sender.Items.RemoveAt(item.Index);
                        Is.Add(sender.Items.Insert(index, item).Index);
                    }

                    foreach (int I in Is)
                    {
                        sender.Items[I].Selected = true;
                    }

                    WinAPI.SendMessage(sender.Handle, WinAPI.WM_SETREDRAW, (IntPtr)1, IntPtr.Zero);
                    sender.Refresh();

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }
        }
Beispiel #12
0
        private void RmvSF_Click(object sender, EventArgs e)
        {
            try
            {
                if (Lis.SelectedIndices.Count != -1 && Lis.SelectedIndices.Count > 0)
                {
                    foreach (int index in Lis.SelectedIndices.Cast <int>().Select(x => x).Reverse())
                    {
                        Lis.Items.RemoveAt(index);
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }
        }
Beispiel #13
0
        private void AddSF_Click(object sender, EventArgs e)
        {
            String F = "SoundFont files | ";

            foreach (String Fi in Properties.Settings.Default.SupportedFormats)
            {
                F += String.Format("*{0}; ", Fi);
            }

            OpenFileDialog OFD = new OpenFileDialog()
            {
                Multiselect      = true,
                InitialDirectory = Properties.Settings.Default.LastSoundFontPath,
                Filter           = F
            };

            try
            {
                if (OFD.ShowDialog(this) == DialogResult.OK)
                {
                    Properties.Settings.Default.LastSoundFontPath = Path.GetDirectoryName(OFD.FileNames[0]);
                    Properties.Settings.Default.Save();

                    ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(OFD.FileNames, BankPresetOverride.Checked, false);

                    if (iSFs != null)
                    {
                        foreach (ListViewItem iSF in iSFs)
                        {
                            Lis.Items.Add(iSF);
                        }
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }

            OFD.Dispose();
        }
Beispiel #14
0
        private void EL_Click(object sender, EventArgs e)
        {
            SaveFileDialog SFD = new SaveFileDialog()
            {
                OverwritePrompt  = true,
                InitialDirectory = Properties.Settings.Default.LastImportExportPath,
                Filter           = "Soundfont lists | *.sflist; *.omlist; *.txt;"
            };

            if (SFD.ShowDialog(this) == DialogResult.OK)
            {
                Properties.Settings.Default.LastImportExportPath = Path.GetDirectoryName(SFD.FileName);
                Properties.Settings.Default.Save();

                SoundFontListExtension.SaveList(ref Lis, -1, SFD.FileName);

                Program.ShowError(0, "Export finished", String.Format("The list has been exported successfully to \"{0}\".", SFD.FileName), null);
            }

            SFD.Dispose();
        }
Beispiel #15
0
        private void SFEDSwitch(bool status)
        {
            try
            {
                if (Lis.SelectedIndices.Count != -1 && Lis.SelectedIndices.Count > 0)
                {
                    for (int i = Lis.SelectedIndices.Count - 1; i >= 0; i--)
                    {
                        if (Lis.SelectedItems[i].ForeColor != (status ? SoundFontListExtension.SFEnabled : SoundFontListExtension.SFDisabled))
                        {
                            Lis.SelectedItems[i].ForeColor = (status ? SoundFontListExtension.SFEnabled : SoundFontListExtension.SFDisabled);
                        }
                    }

                    SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                }
            }
            catch (Exception ex)
            {
                ReloadListAfterError(ex);
            }
        }
Beispiel #16
0
 public void CloseCSFWatcherExt()
 {
     SoundFontListExtension.CloseCSFWatcher();
 }
Beispiel #17
0
 private void SaveList_Click(object sender, EventArgs e)
 {
     SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
 }
Beispiel #18
0
        public SoundFontInfo(String SoundFont)
        {
            InitializeComponent();

            ERROR = false;

            // Here we go
            String   next;
            String   sf = "";
            Int32    fonthandle;
            FileInfo f;

            OriginalSF = SoundFont;

            if (SoundFont.ToLower().IndexOf('=') != -1)
            {
                sf = SoundFont.Substring(SoundFont.LastIndexOf('|') + 1);
                if (!File.Exists(sf))
                {
                    Program.ShowError(4, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), null);
                    ERROR = true;
                    Close();
                    return;
                }
                fonthandle = BassMidi.BASS_MIDI_FontInit(sf);
                f          = new FileInfo(sf);
                next       = sf;
            }
            else
            {
                sf = SoundFont;
                if (!File.Exists(SoundFont))
                {
                    Program.ShowError(4, "Error", String.Format("The SoundFont \"{0}\" doesn't exist.", SoundFont), null);
                    ERROR = true;
                    Close();
                    return;
                }
                fonthandle = BassMidi.BASS_MIDI_FontInit(SoundFont);
                f          = new FileInfo(SoundFont);
                next       = SoundFont;
            }

            BASS_MIDI_FONTINFO fontinfo = BassMidi.BASS_MIDI_FontGetInfo(fonthandle);

            FNBox.Text  = next;
            ISFBox.Text = ReturnName(fontinfo.name, next);
            CIBox.Text  = ReturnCopyright(fontinfo.copyright);
            SamF.Text   = String.Format("{0} ({1})", ReturnSampleType(fontinfo.samtype), fontinfo.samtype);

            if (f.Length > (long)2147483648)
            {
                SofSFLab.Font      = new Font(SofSFLab.Font, FontStyle.Bold);
                SofSFLab.ForeColor = Color.DarkRed;
                SofSFLab.Cursor    = Cursors.Help;
                SizeWarning.SetToolTip(SofSFLab, "SoundFonts bigger than 2GB may not load correctly\non 32-bit applications, cause audio corruptions or even cause loss of data!\n\nBe careful!");
            }

            if (Path.GetExtension(sf).ToLowerInvariant() == ".sfz")
            {
                SofSFLab.Text = String.Format("{0} (Samples: {1}, Presets: {2})",
                                              Functions.ReturnLength(f.Length + SFZ.GetSoundFontZSize(sf), true),
                                              Functions.ReturnLength(SFZ.GetSoundFontZSize(sf), true),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize, false));
            }
            else
            {
                SofSFLab.Text = String.Format("{0} (Samples: {1}, Presets: {2})",
                                              Functions.ReturnLength(f.Length, false),
                                              Functions.ReturnLength(fontinfo.samsize, false),
                                              Functions.ReturnLength(f.Length - (long)fontinfo.samsize, false));
            }

            SFfLab.Text      = SoundFontListExtension.ReturnSoundFontFormatMore(Path.GetExtension(next));
            CommentRich.Text = ReturnComment(fontinfo.comment);
            LELabel.Text     = f.LastWriteTimeUtc.ToString();

            BassMidi.BASS_MIDI_FontFree(fonthandle);
        }
Beispiel #19
0
        public SoundFontListEditor(String[] SFs)
        {
            InitializeComponent();

            Delegate = this;

            for (int i = 0; i < Lis.Columns.Count; i++)
            {
                if (Properties.Settings.Default.SFColumnsSize[i] != -1)
                {
                    Lis.Columns[i].Width = Properties.Settings.Default.SFColumnsSize[i];
                }
                else
                {
                    Properties.Settings.Default.SFColumnsSize[i] = Lis.Columns[i].Width;
                    Properties.Settings.Default.Save();
                }
            }

            // Attach context menu
            Lis.ContextMenu = LisCM;

            // Prepare CSFWatcher
            SoundFontListExtension.OpenCSFWatcher(false, null);

            SFlg.BackgroundImage      = Properties.Resources.Question;
            CLi.BackgroundImage       = Properties.Resources.ClearIcon;
            AddSF.BackgroundImage     = Properties.Resources.AddSFIcon;
            RmvSF.BackgroundImage     = Properties.Resources.RmvSFIcon;
            MvU.BackgroundImage       = Properties.Resources.MvUpIcon;
            MvD.BackgroundImage       = Properties.Resources.MvDwIcon;
            LoadToApp.BackgroundImage = Properties.Resources.ReloadIcon;
            EnableSF.BackgroundImage  = Properties.Resources.EnableIcon;
            DisableSF.BackgroundImage = Properties.Resources.DisableIcon;
            IEL.BackgroundImage       = Properties.Resources.ImportIcon;
            EL.BackgroundImage        = Properties.Resources.ExportIcon;

            // Add the SoundFonts before activating the CSFWatcher
            if (SFs != null && SFs.Count() > 0)
            {
                foreach (String SF in SFs)
                {
                    if (Path.GetExtension(SF).ToLowerInvariant() == ".sf1" |
                        Path.GetExtension(SF).ToLowerInvariant() == ".sf2" |
                        Path.GetExtension(SF).ToLowerInvariant() == ".sfz" |
                        Path.GetExtension(SF).ToLowerInvariant() == ".sfark" |
                        Path.GetExtension(SF).ToLowerInvariant() == ".sfpack")
                    {
                        using (AddToWhichList TF = new AddToWhichList(SF))
                        {
                            if (TF.ShowDialog() == DialogResult.OK)
                            {
                                SelectedListBox.SelectedIndex = TF.Index;

                                String[]       TSF  = new String[] { SF };
                                ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(TSF, false, true);

                                if (iSFs != null)
                                {
                                    foreach (ListViewItem iSF in iSFs)
                                    {
                                        Lis.Items.Add(iSF);
                                    }
                                }

                                SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                            }
                        }
                    }
                }
            }

            SelectedListBox.SelectedIndex = Properties.Settings.Default.LastListSelected;
            if (SelectedListBox.SelectedIndex == 0)
            {
                SoundFontListExtension.StartCSFWatcher();
            }

            // Activate the CSFWatcher now by assigning the events, to avoid a race condition
            SoundFontListExtension.OpenCSFWatcher(true, new FileSystemEventHandler(CSFHandler));
        }
Beispiel #20
0
 private void Lis_ItemChecked(object sender, ItemCheckedEventArgs e)
 {
     SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
 }
Beispiel #21
0
        public SoundFontListEditor(String[] SFs)
        {
            InitializeComponent();

            Delegate = this;

            try
            {
                for (int i = 0; i < Lis.Columns.Count; i++)
                {
                    if (Properties.Settings.Default.SFColumnsSize[i] != -1)
                    {
                        Lis.Columns[i].Width = Properties.Settings.Default.SFColumnsSize[i];
                    }
                    else
                    {
                        Properties.Settings.Default.SFColumnsSize[i] = Lis.Columns[i].Width;
                        Properties.Settings.Default.Save();
                    }
                }
            }
            catch { Functions.ResetSpecificSetting("SFColumnsSize"); }

            // Attach context menu
            Lis.ContextMenu = LisCM;

            // Prepare CSFWatcher
            SoundFontListExtension.OpenCSFWatcher(false, null);

            SFlg.BackgroundImage      = Properties.Resources.Question;
            CLi.BackgroundImage       = Properties.Resources.ClearIcon;
            AddSF.BackgroundImage     = Properties.Resources.AddSFIcon;
            RmvSF.BackgroundImage     = Properties.Resources.RmvSFIcon;
            MvU.BackgroundImage       = Properties.Resources.MvUpIcon;
            MvD.BackgroundImage       = Properties.Resources.MvDwIcon;
            LoadToApp.BackgroundImage = Properties.Resources.ReloadIcon;
            Preload.BackgroundImage   = Properties.Resources.PreloadIcon;
            IEL.BackgroundImage       = Properties.Resources.ImportIcon;
            EL.BackgroundImage        = Properties.Resources.ExportIcon;

            // Add the SoundFonts before activating the CSFWatcher
            if (SFs != null && SFs.Count() > 0)
            {
                foreach (String SF in SFs)
                {
                    if (SoundFontListExtension.CheckSupportedFormat(Path.GetExtension(SF)))
                    {
                        using (AddToWhichList TF = new AddToWhichList(SF))
                        {
                            if (TF.ShowDialog() == DialogResult.OK)
                            {
                                SelectedListBox.SelectedIndex = TF.Index;

                                String[]       TSF  = new String[] { SF };
                                ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(TSF, false, true);

                                if (iSFs != null)
                                {
                                    foreach (ListViewItem iSF in iSFs)
                                    {
                                        Lis.Items.Add(iSF);
                                    }
                                }

                                SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                            }
                        }
                    }
                }
            }

            SelectedListBox.SelectedIndex = Properties.Settings.Default.LastListSelected;
        }
Beispiel #22
0
 private void WarningLabel_Click(object sender, EventArgs e)
 {
     MessageBox.Show(String.Format("Leave at least 1/8 of RAM ({0}) available to Windows, to avoid unexpected data loss and system crashes.\n\nRemember, you're responsible of anything that might happen after tampering with this setting.",
                                   SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 8)),
                     "What does this warning mean?", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 }
Beispiel #23
0
        private void EBPV_Click(object sender, EventArgs e)
        {
            Boolean       ToReload = false;
            List <String> SFErr    = new List <String>();

            foreach (ListViewItem Item in Lis.SelectedItems)
            {
                try
                {
                    try
                    {
                        Int32[] OldValues =
                        {
                            Convert.ToInt32(Item.SubItems[1].Text),
                            Convert.ToInt32(Item.SubItems[2].Text),
                            Convert.ToInt32(Item.SubItems[3].Text),
                            Convert.ToInt32(Item.SubItems[4].Text),
                            Convert.ToInt32(Item.SubItems[5].Text),
                            Convert.ToInt32(Item.SubItems[6].Text.ToLowerInvariant().Equals("yes") ? 1 : 0)
                        };

                        using (var BPOW = new BankNPresetSel(Path.GetFileName(Item.Text), true, Path.GetExtension(Item.Text).ToLowerInvariant() != ".sfz", OldValues))
                        {
                            var RES = BPOW.ShowDialog();

                            if (RES == DialogResult.OK)
                            {
                                ToReload = true;
                                Item.SubItems[1].Text = BPOW.BankValueReturn.ToString();
                                Item.SubItems[2].Text = BPOW.PresetValueReturn.ToString();
                                Item.SubItems[3].Text = BPOW.DesBankValueReturn.ToString();
                                Item.SubItems[4].Text = BPOW.DesPresetValueReturn.ToString();
                                Item.SubItems[5].Text = BPOW.DesBankLSBValueReturn.ToString();
                                Item.SubItems[6].Text = BPOW.XGModeC ? "Yes" : "No";
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                    catch { SFErr.Add(Item.Text); }

                    if (SFErr.Count > 0)
                    {
                        Program.ShowError(
                            2,
                            "Unable to edit SoundFont(s)",
                            String.Format(
                                "The configurator was unable to edit the following SoundFont(s).\n\n{0}\n\nPress OK to continue.",
                                String.Join(Environment.NewLine, SFErr.ToArray())),
                            null);
                    }

                    if (ToReload)
                    {
                        SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null);
                    }
                }
                catch (Exception ex)
                {
                    ReloadListAfterError(ex);
                }
            }
        }
Beispiel #24
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;
            }
        }