Beispiel #1
0
        private IEnumerable <System.IO.FileInfo> ReturnCommonFiles(IEnumerable <System.IO.FileInfo> list1,
                                                                   IEnumerable <System.IO.FileInfo> list2, FileCompare myFileCompare)
        {
            var queryCommonFiles = list1.Intersect(list2, myFileCompare);

            if (queryCommonFiles.Count() > 0)
            {
                Console.WriteLine("nastepujace plik są w obu folderach:");
                foreach (var v in queryCommonFiles)
                {
                    Console.WriteLine(v.FullName); //shows which items end up in result list
                }
            }
            else
            {
                Console.WriteLine("Brak wspólnych plików");
            }

            return(queryCommonFiles);
        }
Beispiel #2
0
        private IEnumerable <System.IO.FileInfo> ReturnExeptFiles(IEnumerable <System.IO.FileInfo> list1,
                                                                  IEnumerable <System.IO.FileInfo> list2, FileCompare myFileCompare)
        {
            var queryList1Only = (from file in list1
                                  select file).Except(list2, myFileCompare);

            Console.WriteLine("The following files are in list1 but not list2:");
            foreach (var v in queryList1Only)
            {
                fmanager.CopyFile(v.Name);
            }

            return(queryList1Only);
        }
Beispiel #3
0
 private bool AreIdentical(IEnumerable <System.IO.FileInfo> l1,
                           IEnumerable <System.IO.FileInfo> l2, FileCompare myFileCompare)
 {
     return((l1.SequenceEqual(l2, myFileCompare)) ? true : false);
 }