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; }
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); }