public SourceFile RenameFile(string folder, SourceFile file) { DirectoryInfo info = new DirectoryInfo(folder); var sourceFile = Path.Combine(info.FullName, file.Filename); var destinationFile = GetNewFileName(file.Filename, info.Name); File.Move(sourceFile, Path.Combine(info.FullName, destinationFile)); SourceFile renamedFile = new SourceFile(destinationFile, file.ReferenceNumber); return renamedFile; }
private List<SourceFile> ParseFiles(string content) { var regex = new Regex(@"\""(?<filename>.*?)\""=(?<referencenumber>\d{1,})", RegexOptions.Multiline); MatchCollection matches = regex.Matches(content); var resourceFiles = new List<SourceFile>(); foreach (Match match in matches) { string filename = match.Groups["filename"].Value; string referencenumber = match.Groups["referencenumber"].Value; var resourceFile = new SourceFile(filename, referencenumber); resourceFiles.Add(resourceFile); } return resourceFiles; }