Пример #1
0
        //public List<Metadata> getUpdated(string photoShootPaths)
        public void getUpdated(string photoShootPaths)
        {
            //List<Metadata> allPhotos = new List<Metadata>();
            foreach (var folder in new DirectoryInfo(photoShootPaths).GetDirectories())
            {
                List <Metadata> allPhotos = new List <Metadata>();
                PhotoSearch.AddUpdateLuceneIndex(recursiveSearch(folder, 0, photoShootPaths));

                //allPhotos.AddRange(recursiveSearch(folder, 0, photoShootPaths));
            }

            //return allPhotos;
        }
Пример #2
0
        private List <Metadata> recursiveSearch(DirectoryInfo folder, int id, string folderPath)
        {
            List <Metadata> allPhotos = new List <Metadata>();

            if ((folder.Name == "image") || (folder.Name == "images"))
            {
                folderPath = folderPath + @"/" + folder.Name;
                string[]   extensions  = new[] { ".jpg", ".tiff", ".bmp" };
                int        photoNumber = 1;
                FileInfo[] t           = new DirectoryInfo(folderPath).GetFiles();
                foreach (FileInfo photo in new DirectoryInfo(folderPath).GetFiles().Where(f => extensions.Contains(f.Extension.ToLower())).ToArray())
                {
                    Console.WriteLine(photo.Name + "\n");
                    if (photo.Name[0] != '.')
                    {
                        allPhotos.Add(photoMetadata(photo.FullName, photo.Name, id, photoNumber));
                        photoNumber++;
                        id++;
                    }
                }
                return(allPhotos);
            }
            else if (folder.GetDirectories().Count() > 0)
            {
                folderPath = folderPath + @"/" + folder.Name;
                foreach (var f in new DirectoryInfo(folderPath).GetDirectories())
                {
                    PhotoSearch.AddUpdateLuceneIndex(recursiveSearch(f, id, folderPath));
                    //allPhotos.AddRange(recursiveSearch(f, id, folderPath));
                }
                return(allPhotos);
            }
            else
            {
                return(allPhotos);
            }
        }