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); } }
public void ProcessMessage(IProcessorMessage message) { renamer.ProcessMessage(message); }