/// <summary> /// Previews NamingRequests files according to RenameSettings profile. /// </summary> /// <param name="namingRequests">List of requested objets to rename.</param> /// <returns>Returns a collection of NamingResult, one for each input NamingRequest.</returns> public List <NamingResult> Preview(List <NamingRequest> namingRequests) { try { var namingResults = new List <NamingResult>(); new RenameEngineValidator(this.renameSettings.RenameType, this.renameSettings.Parameters, namingRequests).Validate(); BaseNaming naming = this.GetNamingPattern(this.renamer, this.renameSettings); foreach (var namingRequest in namingRequests) { NamingResult namingResult = naming.Preview(namingRequest.ObjectType, namingRequest.CurrentName); namingResults.Add(namingResult); } return(namingResults); } catch (Exception ex) { throw ex; } }
/// <summary> /// Renames NamingRequests files according to RenameSettings profile. /// </summary> /// <param name="namingRequests">List of requested objets to rename.</param> /// <returns>Returns a collection of NamingResult, one for each input NamingRequest.</returns> public async Task <List <NamingResult> > Rename(List <NamingRequest> namingRequests) { try { var count = 1; var namingResults = new List <NamingResult>(); new RenameEngineValidator(this.renameSettings.RenameType, this.renameSettings.Parameters, namingRequests).Validate(); BaseNaming naming = this.GetNamingPattern(this.renamer, this.renameSettings); foreach (var namingRequest in namingRequests) { NamingResult namingResult = await naming.Execute(namingRequest.ObjectType, namingRequest.CurrentName); var eventArgs = new NamingProcessedEventArgs(Operation.Rename, namingResult, count++ *100 / namingRequests.Count); this.OnNamingProcessed(eventArgs); namingResults.Add(namingResult); } return(namingResults); } catch (Exception ex) { throw ex; } }