Пример #1
0
        internal void Run(DirectoryInfo workingDirectory, bool dryRun)
        {
            var results = workingDirectory
                          .AllFiles()
                          .Select(f => (File: f.FullName, Model: TookWithIPhone5(f)))
                          .Where(tuple => tuple.Model == "iPhone 5s")
                          .Select(tuple => tuple.File);

            Console.WriteLine(string.Join("\n", results));
        }
Пример #2
0
        internal void Run(DirectoryInfo workingDirectory, DirectoryInfo output, bool dryRun)
        {
            var results = workingDirectory
                          .AllFiles()
                          .Select(ToImage)
                          .Select((Either <ImageWithoutExifDate, ImageWithExifDate> image) => ToOperation(image, output))
                          .Select(operation => operation.Run(dryRun));


            Console.WriteLine(string.Join("\n", results));
        }
Пример #3
0
        public static void Run(DirectoryInfo workingDirectory, bool dryRun)
        {
            var groupBy = workingDirectory
                          .AllFiles()
                          .Where(f => f.Extension.ToLower() is ".jpg" or ".heic")
                          .ToLookup(f => f.Extension.ToLower());

            var jpgs  = groupBy[".jpg"];
            var heics = groupBy[".heic"];

            var toBeDeleted = jpgs.Select(j => (Jpg: j, Heic: EquivalentHeic(j, heics))).Where(t => t.Heic != null);

            Console.WriteLine($"Found {toBeDeleted.Count()} to be deleted");
            foreach (var(jpg, heic) in toBeDeleted)
            {
                Console.WriteLine($"{jpg.Name} / {heic.Name}");
                if (!dryRun)
                {
                    File.Delete(jpg.FullName);
                }
            }
        }
Пример #4
0
 internal static IEnumerable <MappableImage> GetImages(this DirectoryInfo workingDirectory,
                                                       RootImageHandler rootImageHandler) =>
 workingDirectory
 .AllFiles()
 .Select(fileInfo => ToMappableImage(fileInfo, rootImageHandler));