コード例 #1
0
ファイル: Adapter.cs プロジェクト: a253560600/tdmaker
        public static MediaWizardOptions GetMediaType(List<string> FileOrDirPaths, bool silent)
        {
            MediaWizardOptions mwo = new MediaWizardOptions() { MediaTypeChoice = MediaType.MediaIndiv };

            bool showWizard = false;

            if (FileOrDirPaths.Count == 1 && File.Exists(FileOrDirPaths[0]))
            {
                mwo.MediaTypeChoice = MediaType.MediaIndiv;
            }
            else
            {
                bool bDirFound = false;
                int dirCount = 0;

                foreach (string fd in FileOrDirPaths)
                {
                    if (Directory.Exists(fd))
                    {
                        dirCount++;
                        bDirFound = true;
                    }
                    if (dirCount > 1) break;
                }
                if (bDirFound)
                {
                    if (dirCount == 1)
                    {
                        string dir = FileOrDirPaths[0];
                        if (MediaIsDisc(dir))
                        {
                            mwo.MediaTypeChoice = MediaType.MediaDisc;
                        }
                        else if (MediaIsAudio(dir))
                        {
                            mwo.MediaTypeChoice = MediaType.MusicAudioAlbum;
                        }
                        else if (!silent)
                        {
                            showWizard = true;
                        }
                    }
                }
                else if (!silent) // no dir found
                {
                    showWizard = true;
                }
            }

            if (showWizard)
            {
                MediaWizard mw = new MediaWizard(FileOrDirPaths);
                mwo.DialogResultMy = mw.ShowDialog();
                if (mwo.DialogResultMy == DialogResult.OK)
                {
                    mwo = mw.Options;
                }
                mwo.PromptShown = true;
            }

            FileSystem.AppendDebug("Determined media type as: " + mwo.MediaTypeChoice.ToString());
            return mwo;
        }
コード例 #2
0
        public static MediaWizardOptions GetMediaType(List <string> FileOrDirPaths, bool silent)
        {
            MediaWizardOptions mwo = new MediaWizardOptions()
            {
                MediaTypeChoice = MediaType.MediaIndiv
            };

            bool showWizard = false;

            if (FileOrDirPaths.Count == 1 && File.Exists(FileOrDirPaths[0]))
            {
                mwo.MediaTypeChoice = MediaType.MediaIndiv;
            }
            else
            {
                bool bDirFound = false;
                int  dirCount  = 0;

                foreach (string fd in FileOrDirPaths)
                {
                    if (Directory.Exists(fd))
                    {
                        dirCount++;
                        bDirFound = true;
                    }
                    if (dirCount > 1)
                    {
                        break;
                    }
                }
                if (bDirFound)
                {
                    if (dirCount == 1)
                    {
                        string dir = FileOrDirPaths[0];
                        if (MediaIsDisc(dir))
                        {
                            mwo.MediaTypeChoice = MediaType.MediaDisc;
                        }
                        else if (MediaIsAudio(dir))
                        {
                            mwo.MediaTypeChoice = MediaType.MusicAudioAlbum;
                        }
                        else if (!silent)
                        {
                            showWizard = true;
                        }
                    }
                }
                else if (!silent) // no dir found
                {
                    showWizard = true;
                }
            }

            if (showWizard)
            {
                MediaWizard mw = new MediaWizard(FileOrDirPaths);
                mwo.DialogResultMy = mw.ShowDialog();
                if (mwo.DialogResultMy == DialogResult.OK)
                {
                    mwo = mw.Options;
                }
                mwo.PromptShown = true;
            }

            FileSystem.AppendDebug("Determined media type as: " + mwo.MediaTypeChoice.ToString());
            return(mwo);
        }