// Renamer.rename() searches through DirectoryTree.Tree, renaming and rebuilding files // to reflect a change in the NameRegistry. public static void rename(UInt32[] hashes, string[] oldNames, PleaseWait progress) { // TODO: do something with progress bar var nameBytes = from n in oldNames select Encoding.UTF8.GetBytes(n.ToLowerInvariant()); DirectoryTree.Tree.Search( SearchSpec.all ); var renamer = new Renamer { oldNames = nameBytes.ToArray(), hashes = hashes, leftPath = MainWindow.Instance.LeftPath + "\\", rightPath = MainWindow.Instance.RightPath + "\\" }; renamer.renameTree( DirectoryTree.Tree ); DirectoryTree.Tree.Search(SearchSpec.all); if (renamer.errors.Count != 0) { string s = "There were errors updating the following files:\n"; foreach (var e in renamer.errors) s += " " + e + "\n"; MessageBox.Show(s, "Warning"); } }