Пример #1
0
        public static string[] RenameImages(string[] images, DirectoryInfo moveDirectory, bool allowTagBaseNaming)
        {
            ///-----Filtering & Initial Processing-----

            // Convert string array to WallpaperData.ImageData array and remove images that conflict with the user's filter
            List <WallpaperData.ImageData> imagesData = new List <WallpaperData.ImageData>();

            ImageType[] filter = GetFilter();
            foreach (string image in images)
            {
                bool filterBreached = false;
                foreach (ImageType imageType in filter) // allows for the filtering of an image type, i.e. Static, GIF, & Video
                {
                    if (WallpaperData.GetAllImagesOfType(imageType).Contains(image))
                    {
                        filterBreached = true;
                        break;
                    }
                }

                if (filterBreached)
                {
                    continue;
                }

                imagesData.Add(WallpaperData.GetImageData(image));
            }

            WallpaperData.ImageData[] imagesToRename = imagesData.ToArray();

            //? This checks if all images were filtered out
            if (imagesToRename.Length == 0)
            {
                MessageBox.Show("None of the given images were able to be renamed");
                return(null);
            }

            //-----Begin Renaming Process-----

            //! Don't forget to save the theme after renaming! (Take note of the return statements)
            //! Don't forget to save the theme after renaming! (Take note of the return statements)
            //! Don't forget to save the theme after renaming! (Take note of the return statements)

            if (allowTagBaseNaming)
            {
                return(TagBasedNaming(imagesToRename, moveDirectory));
            }
            else
            {
                // regardless of if an image is tagged are not, all images in this code block will be directly MOVED (this only applies to moved images)
                // read the TODOs below for some related comments, although there should still be yet another renaming segment below for directly renamed images
            }

            // TODO for all images that won't be renamed based on tags, you should gather a collection of all tag-based renamed images so that they won't be processed a second time
            // TODO See if you can use hashSet's union()/unionWith()/intersectWith() system for this
            // TODO Considering that the filter doesn't highlight the possibility of moving naming-disabled images, the user should be warned of this option with a prompt

            return(null);
        }
Пример #2
0
        private string[] SelectAllImagesOfType(ImageType imageType)
        {
            switch (imageType)
            {
            case ImageType.Static:
                return(WallpaperData.GetAllImagesOfType(ImageType.Static));

            case ImageType.GIF:
                return(WallpaperData.GetAllImagesOfType(ImageType.GIF));

            case ImageType.Video:
                return(WallpaperData.GetAllImagesOfType(ImageType.Video));

            default:
                return(null);
            }
        }