Ejemplo n.º 1
0
        private static bool RejectFolderIfIncludedInShow(bool fullLogging, [NotNull] ShowItem si, string theFolder)
        {
            if (si.AutoAddNewSeasons() && !string.IsNullOrEmpty(si.AutoAddFolderBase) &&
                theFolder.IsSubfolderOf(si.AutoAddFolderBase))
            {
                // we're looking at a folder that is a subfolder of an existing show
                if (fullLogging)
                {
                    Logger.Info("Rejecting {0} as it's already part of {1}.", theFolder, si.ShowName);
                }

                return(true);
            }

            if (si.UsesManualFolders())
            {
                Dictionary <int, List <string> > afl = si.AllExistngFolderLocations();
                foreach (KeyValuePair <int, List <string> > kvp in afl)
                {
                    foreach (string folder in kvp.Value)
                    {
                        if (!string.Equals(theFolder, folder, StringComparison.CurrentCultureIgnoreCase))
                        {
                            continue;
                        }

                        if (fullLogging)
                        {
                            Logger.Info("Rejecting {0} as it's already part of {1}:{2}.", theFolder, si.ShowName,
                                        folder);
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }