/// <inheritdoc />
 public bool OpenFileSelector(Jacobi.Vst.Core.VstFileSelect fileSelect)
 {
     RaisePluginCalled("OpenFileSelector(" + fileSelect.Command + ")");
     return(false);
 }
Example #2
0
 /// <inheritdoc />
 public bool CloseFileSelector(Jacobi.Vst.Core.VstFileSelect fileSelect)
 {
     _cmdStub.RaisePluginCalled("CloseFileSelector(" + fileSelect.Command + ")");
     return(false);
 }
        /// <inheritdoc />
        public bool OpenFileSelector(Jacobi.Vst.Core.VstFileSelect fileSelect)
        {
            switch (fileSelect.Command)
            {
            case VstFileSelectCommand.DirectorySelect:
            {
                if (!string.IsNullOrEmpty(fileSelect.InitialPath) && System.IO.Directory.Exists(fileSelect.InitialPath))
                {
                    fbd.SelectedPath = fileSelect.InitialPath;
                }
                if (!string.IsNullOrEmpty(fileSelect.Title))
                {
                    fbd.Description = fileSelect.Title;
                }
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileSelect.ReturnPaths = new string[] { fbd.SelectedPath }
                }
                ;
            }
            break;

            case VstFileSelectCommand.FileLoad:
            {
                if (!string.IsNullOrEmpty(fileSelect.InitialPath) && System.IO.Directory.Exists(fileSelect.InitialPath))
                {
                    ofd.InitialDirectory = fileSelect.InitialPath;
                }
                if (!string.IsNullOrEmpty(fileSelect.Title))
                {
                    ofd.Title = fileSelect.Title;
                }
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileSelect.ReturnPaths = new string[] { ofd.FileName }
                }
                ;
            }
            break;

            case VstFileSelectCommand.FileSave:
            {
                if (!string.IsNullOrEmpty(fileSelect.InitialPath) && System.IO.Directory.Exists(fileSelect.InitialPath))
                {
                    sfd.InitialDirectory = fileSelect.InitialPath;
                }
                if (!string.IsNullOrEmpty(fileSelect.Title))
                {
                    sfd.Title = fileSelect.Title;
                }
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileSelect.ReturnPaths = new string[] { sfd.FileName }
                }
                ;
            }
            break;

            case VstFileSelectCommand.MultipleFilesLoad:
            {
                if (!string.IsNullOrEmpty(fileSelect.InitialPath) && System.IO.Directory.Exists(fileSelect.InitialPath))
                {
                    sfd.InitialDirectory = fileSelect.InitialPath;
                }
                if (!string.IsNullOrEmpty(fileSelect.Title))
                {
                    sfd.Title = fileSelect.Title;
                }
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileSelect.ReturnPaths = ofd.SafeFileNames;
                }
            }
            break;
            }
            RaisePluginCalled("OpenFileSelector(" + fileSelect.Command + ")");
            return(false);
        }