예제 #1
0
        public void Process(object obj)
        {
            var album = obj as AlbumExplorer.AlbumResult;

            DirectoryInfo srcDir = album.Directory;

            if (!VirtualDrive.ExistsDirectory(srcDir.FullName))
            {
                throw new Exception("Source directory not found: \""
                                    + srcDir.FullName + "\"");
            }

            DirectoryNameGenerator generator = new DirectoryNameGenerator(Pattern);

            if (!generator.CanBuildName(album.Album.Words))
            {
                Logger.WriteLine(Tokens.Warning, "Can not build name for directory \""
                                 + srcDir + "\" with pattern \"" + generator.ToString() + "\"");

                return;
            }

            renamer.ProcessMessage(new FileOperationProcessor.Message(
                                       Path.Combine(srcDir.Parent.FullName, generator.Name(album.Album.Words)),
                                       FileOperationProcessor.FileOperation.Move));

            try
            {
                renamer.Process(srcDir);
            }
            catch (IOException exception)
            {
                Logger.WriteLine(Tokens.Exception, exception + "\n" + exception.StackTrace);
            }
        }
예제 #2
0
 public void ProcessMessage(IProcessorMessage message)
 {
     renamer.ProcessMessage(message);
 }