public QueryFiles ( string root, string regex ) : IEnumerable |
||
root | string | |
regex | string | |
return | IEnumerable |
private void Button_Click(object sender, RoutedEventArgs e) { VisualStateManager.GoToElementState(stage, "preview", true); PreviewItems.Clear(); var service = new FileStorageService(); if(UserInteraction.SelectFile) { var files = service.QueryFiles(UserInteraction.RootDirectory, UserInteraction.Regex); foreach (var file in files) { var fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(file); var reanmeTo = service.ReanmePreview(fileNameWithoutExtension, UserInteraction.Regex, UserInteraction.TargetExpression); PreviewItems.Add(new PreviewItemVM { Name = fileNameWithoutExtension, Action = "重命名[文件]", Result = reanmeTo }); } } if(UserInteraction.SelectFolder) { var folders = service.QueryFolders(UserInteraction.RootDirectory, UserInteraction.Regex); foreach(var folder in folders) { var reanmeTo = service.ReanmePreview(folder, UserInteraction.Regex, UserInteraction.TargetExpression); PreviewItems.Add(new PreviewItemVM { Name = folder, Action = "重命名[文件夹]", Result = reanmeTo }); } } }
private void ExecuteButton_Click(object sender, RoutedEventArgs e) { VisualStateManager.GoToElementState(stage, "oinit", true); PreviewItems.Clear(); var service = new FileStorageService(); if (UserInteraction.SelectFile) { var files = service.QueryFiles(UserInteraction.RootDirectory, UserInteraction.Regex); foreach (var file in files) { service.RenameFile(System.IO.Path.Combine(UserInteraction.RootDirectory, file), UserInteraction.Regex, UserInteraction.TargetExpression); } } if (UserInteraction.SelectFolder) { var folders = service.QueryFolders(UserInteraction.RootDirectory, UserInteraction.Regex); foreach (var folder in folders) { service.RenameFolder(System.IO.Path.Combine(UserInteraction.RootDirectory, folder), UserInteraction.Regex, UserInteraction.TargetExpression); } } }