private void CreateSeasonFolder(ShowItem si, int snum, ICollection <string> ignoredLocations, string proposedFolderName) { string folder = proposedFolderName; // generate new filename info // ReSharper disable once RedundantAssignment bool goAgain = false; DirectoryInfo di = null; bool firstAttempt = true; do { goAgain = false; if (!string.IsNullOrEmpty(folder)) { try { di = new DirectoryInfo(folder); } catch { break; } } if (ignoredLocations.Contains(folder)) { break; } if (di != null && di.Exists) { continue; } string sn = si.ShowName; string text = snum + " of " + si.MaxSeason(); string theFolder = folder; string otherFolder = null; FaResult whatToDo = GetDefaultAction(); if (TVSettings.Instance.AutoCreateFolders && firstAttempt) { whatToDo = FaResult.kfaCreate; firstAttempt = false; } if (whatToDo == FaResult.kfaNotSet) { // no command line guidance, so ask the user MissingFolderAction mfa = new MissingFolderAction(sn, text, theFolder); mfa.ShowDialog(); whatToDo = mfa.Result; otherFolder = mfa.FolderName; } switch (whatToDo) { case FaResult.kfaRetry: goAgain = true; break; case FaResult.kfaDifferentFolder: folder = otherFolder; goAgain = UpdateDirectory(si, snum, folder); break; case FaResult.kfaNotSet: break; case FaResult.kfaCancel: throw new TVRenameOperationInterruptedException(); case FaResult.kfaCreate: TryCreateDirectory(folder, sn, text); goAgain = true; break; case FaResult.kfaIgnoreOnce: ignoredLocations.Add(folder); break; case FaResult.kfaIgnoreAlways: si.IgnoreSeasons.Add(snum); Doc.SetDirty(); break; default: throw new ArgumentOutOfRangeException(); } } while (goAgain); }