コード例 #1
0
        private static bool FilterFolderToDelete(IEnumerable <string> filesList)
        {
            List <FileHideInfo> filesDeleteList = FileHideInfo.GetFilesList(filesList);
            var DeleteCandidateList             = filesDeleteList.Where(x => x.DeleteFolder == false);

            if (DeleteCandidateList.Count() > 0)//Found a Video File so we don't want to delete the Folder that returned this filesList
            {
                return(false);
            }

            return(true);//Nothing that we want to keep found so delete
        }
コード例 #2
0
        public static List <FileHideInfo> GetFilesList(IEnumerable <string> filesList)
        {
            List <FileHideInfo> List = new List <FileHideInfo>();

            foreach (var item in filesList)
            {
                FileHideInfo fi = new FileHideInfo(item);
                List.Add(fi);
            }

            List = CheckRelatedFiles(List);

            return(List);
        }
コード例 #3
0
        private static List <FileHideInfo> CheckRelatedFiles(List <FileHideInfo> list)
        {
            List <FileHideInfo> returnList = new List <FileHideInfo>();
            var VideoFiles = list.Where(x => x.FileWithoutExtension != Program.PosterFileName && x.DeleteFile == false).Select(x => x.FileWithoutExtension).ToList();//Check For Video Files

            for (int i = 0; i < list.Count; i++)
            {
                FileHideInfo item = list[i];
                item.RelatedMetadataFiles = list.Where(x => x.File != item.File && x.FileWithoutExtension == item.FileWithoutExtension).Select(x => x.File).ToList();

                if (item.FileWithoutExtension == Program.PosterFileName || VideoFiles.Contains(item.FileWithoutExtension))
                {
                    item.DeleteFile = false;//Set the file To Not be Deleted, Because a related Video File Exsits
                }
                if (item.RelatedMetadataFiles.Count == 0)
                {
                    item.DeleteFile = false;
                }

                returnList.Add(item);
            }
            return(returnList);
        }
コード例 #4
0
        private static IEnumerable <string> FilterFilesToDelete(IEnumerable <string> filesList)
        {
            List <FileHideInfo> filesHideList = FileHideInfo.GetFilesList(filesList);

            return(filesHideList.Where(x => x.DeleteFile == true).Select(x => x.File));
        }