Commit 1bceef56567bd50fc8285de3e2f75ecbe9d12cbd
1 parent
38e7286e
v1.34.1
Showing
2 changed files
with
40 additions
and
19 deletions
Show diff stats
Vrh.Log4Pro.MaintenanceConsole/Manager - BackupPackageManager.cs
| @@ -23,6 +23,7 @@ using VRH.Common; | @@ -23,6 +23,7 @@ using VRH.Common; | ||
| 23 | using System.Xml.Linq; | 23 | using System.Xml.Linq; |
| 24 | using System.Text.RegularExpressions; | 24 | using System.Text.RegularExpressions; |
| 25 | using System.Security.Cryptography; | 25 | using System.Security.Cryptography; |
| 26 | +using System.Numerics; | ||
| 26 | 27 | ||
| 27 | namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | 28 | namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS |
| 28 | { | 29 | { |
| @@ -75,49 +76,69 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -75,49 +76,69 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 75 | ColorConsole.WriteLine(); | 76 | ColorConsole.WriteLine(); |
| 76 | 77 | ||
| 77 | 78 | ||
| 78 | - var folder1Files = GetFilesWithRelativePaths(rootWORKING, searchpatterncsvlist); | 79 | + var folderWFiles = GetFilesWithRelativePaths(rootWORKING, searchpatterncsvlist); |
| 79 | var folder2Files = GetFilesWithRelativePaths(rootUPGRADE, searchpatterncsvlist); | 80 | var folder2Files = GetFilesWithRelativePaths(rootUPGRADE, searchpatterncsvlist); |
| 80 | 81 | ||
| 81 | - var allKeys = new HashSet<string>(folder1Files.Keys); | ||
| 82 | - allKeys.UnionWith(folder2Files.Keys); | 82 | + |
| 83 | + var allfiles = new HashSet<string>(folderWFiles.Keys); | ||
| 84 | + allfiles.UnionWith(folder2Files.Keys); | ||
| 83 | 85 | ||
| 84 | var savedcursortop = Console.CursorTop; | 86 | var savedcursortop = Console.CursorTop; |
| 85 | Console.WriteLine(); | 87 | Console.WriteLine(); |
| 86 | var actualcursortop = Console.CursorTop; | 88 | var actualcursortop = Console.CursorTop; |
| 87 | var numberofprocessedfiles = 0; | 89 | var numberofprocessedfiles = 0; |
| 88 | var upgradefiles = new Dictionary<string, CompareDirectoriesActions>(); | 90 | var upgradefiles = new Dictionary<string, CompareDirectoriesActions>(); |
| 89 | - foreach (var relativePath in allKeys.OrderBy(p => p)) | 91 | + string previousdirectory = null; |
| 92 | + foreach (var onefile in allfiles.OrderBy(p => Path.GetDirectoryName(p))) | ||
| 90 | { | 93 | { |
| 91 | numberofprocessedfiles++; | 94 | numberofprocessedfiles++; |
| 92 | if (numberofprocessedfiles < 25) | 95 | if (numberofprocessedfiles < 25) |
| 93 | { | 96 | { |
| 94 | actualcursortop = Console.CursorTop; | 97 | actualcursortop = Console.CursorTop; |
| 95 | - ColorConsole.SetCursorPosition(0, savedcursortop); ColorConsole.Write(relativePath, suffix: new string(' ', 20)); | 98 | + ColorConsole.SetCursorPosition(0, savedcursortop); ColorConsole.Write(onefile, suffix: new string(' ', 20)); |
| 96 | ColorConsole.SetCursorPosition(0, actualcursortop); | 99 | ColorConsole.SetCursorPosition(0, actualcursortop); |
| 97 | } | 100 | } |
| 98 | - bool inWORKFolder = folder1Files.TryGetValue(relativePath, out string file1); | ||
| 99 | - bool inUPGRADEFolder = folder2Files.TryGetValue(relativePath, out string file2); | 101 | + bool inWORKFolder = folderWFiles.TryGetValue(onefile, out string file1); |
| 102 | + bool inUPGRADEFolder = folder2Files.TryGetValue(onefile, out string file2); | ||
| 100 | 103 | ||
| 101 | if (inWORKFolder && inUPGRADEFolder) | 104 | if (inWORKFolder && inUPGRADEFolder) |
| 102 | { | 105 | { |
| 103 | if (!FilesAreEqual(file1, file2, out string difftext)) | 106 | if (!FilesAreEqual(file1, file2, out string difftext)) |
| 104 | { | 107 | { |
| 108 | + string actualdirectory = Path.GetDirectoryName(onefile); | ||
| 109 | + if (previousdirectory != actualdirectory) | ||
| 110 | + { | ||
| 111 | + ColorConsole.WriteLine(actualdirectory, ConsoleColor.DarkYellow); | ||
| 112 | + previousdirectory = actualdirectory; | ||
| 113 | + } | ||
| 105 | //ColorConsole.WriteLine($"DIFFERENT ({difftext}): {relativePath}", ConsoleColor.Yellow); | 114 | //ColorConsole.WriteLine($"DIFFERENT ({difftext}): {relativePath}", ConsoleColor.Yellow); |
| 106 | - ColorConsole.WriteLine($"< {relativePath} ({difftext}):", ConsoleColor.Yellow); | ||
| 107 | - upgradefiles.Add(relativePath, CompareDirectoriesActions.CopyFROMUPGRADE); | 115 | + ColorConsole.WriteLine($"< {onefile} ({difftext}):", ConsoleColor.Yellow); |
| 116 | + upgradefiles.Add(onefile, CompareDirectoriesActions.CopyFROMUPGRADE); | ||
| 108 | } | 117 | } |
| 109 | } | 118 | } |
| 110 | else if (inWORKFolder) | 119 | else if (inWORKFolder) |
| 111 | { | 120 | { |
| 121 | + string actualdirectory = Path.GetDirectoryName(onefile); | ||
| 122 | + if (previousdirectory != actualdirectory) | ||
| 123 | + { | ||
| 124 | + ColorConsole.WriteLine(actualdirectory, ConsoleColor.DarkYellow); | ||
| 125 | + previousdirectory = actualdirectory; | ||
| 126 | + } | ||
| 112 | //ColorConsole.WriteLine($"ONLY IN Folder1: {relativePath}", ConsoleColor.Yellow); | 127 | //ColorConsole.WriteLine($"ONLY IN Folder1: {relativePath}", ConsoleColor.Yellow); |
| 113 | - ColorConsole.WriteLine($"-- {relativePath}", ConsoleColor.Yellow); | ||
| 114 | - upgradefiles.Add(relativePath, CompareDirectoriesActions.DeleteINWORKING); | 128 | + ColorConsole.WriteLine($"-- {onefile}", ConsoleColor.Yellow); |
| 129 | + upgradefiles.Add(onefile, CompareDirectoriesActions.DeleteINWORKING); | ||
| 115 | } | 130 | } |
| 116 | else if (inUPGRADEFolder) | 131 | else if (inUPGRADEFolder) |
| 117 | { | 132 | { |
| 133 | + string actualdirectory = Path.GetDirectoryName(onefile); | ||
| 134 | + if (previousdirectory != actualdirectory) | ||
| 135 | + { | ||
| 136 | + ColorConsole.WriteLine(actualdirectory, ConsoleColor.DarkYellow); | ||
| 137 | + previousdirectory = actualdirectory; | ||
| 138 | + } | ||
| 118 | //ColorConsole.WriteLine($"ONLY IN Folder2: {relativePath}", ConsoleColor.Yellow); | 139 | //ColorConsole.WriteLine($"ONLY IN Folder2: {relativePath}", ConsoleColor.Yellow); |
| 119 | - ColorConsole.WriteLine($"<< {relativePath}", ConsoleColor.Yellow); | ||
| 120 | - upgradefiles.Add(relativePath, CompareDirectoriesActions.CopyFROMUPGRADE); | 140 | + ColorConsole.WriteLine($"<< {onefile}", ConsoleColor.Yellow); |
| 141 | + upgradefiles.Add(onefile, CompareDirectoriesActions.CopyFROMUPGRADE); | ||
| 121 | } | 142 | } |
| 122 | } | 143 | } |
| 123 | ColorConsole.WriteLine(); | 144 | ColorConsole.WriteLine(); |
| @@ -132,7 +153,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -132,7 +153,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 132 | } | 153 | } |
| 133 | return o; | 154 | return o; |
| 134 | } | 155 | } |
| 135 | - private enum CompareDirectoriesActions { CopyFROMUPGRADE, DeleteINWORKING,} | 156 | + private enum CompareDirectoriesActions { CopyFROMUPGRADE, DeleteINWORKING,} |
| 136 | private static Dictionary<string, string> GetFilesWithRelativePaths(string root,string searchpattern="*") | 157 | private static Dictionary<string, string> GetFilesWithRelativePaths(string root,string searchpattern="*") |
| 137 | { | 158 | { |
| 138 | var searchpatternlist = searchpattern.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); | 159 | var searchpatternlist = searchpattern.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); |
| @@ -142,10 +163,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | @@ -142,10 +163,10 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS | ||
| 142 | files.AddRange(Directory.GetFiles(root, sp, SearchOption.AllDirectories)); | 163 | files.AddRange(Directory.GetFiles(root, sp, SearchOption.AllDirectories)); |
| 143 | } | 164 | } |
| 144 | var dict = new Dictionary<string, string>(); | 165 | var dict = new Dictionary<string, string>(); |
| 145 | - foreach (var file in files) | 166 | + foreach (var fileAbsolutPath in files) |
| 146 | { | 167 | { |
| 147 | - string relativePath = GetRelativePath(root, file); | ||
| 148 | - dict[relativePath] = file; | 168 | + string relativePath = GetRelativePath(root, fileAbsolutPath); |
| 169 | + dict[relativePath] = fileAbsolutPath; | ||
| 149 | } | 170 | } |
| 150 | return dict; | 171 | return dict; |
| 151 | } | 172 | } |
Vrh.Log4Pro.MaintenanceConsole/Properties/AssemblyInfo.cs
| @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||
| 32 | // You can specify all the values or you can default the Build and Revision Numbers | 32 | // You can specify all the values or you can default the Build and Revision Numbers |
| 33 | // by using the '*' as shown below: | 33 | // by using the '*' as shown below: |
| 34 | // [assembly: AssemblyVersion("1.0.*")] | 34 | // [assembly: AssemblyVersion("1.0.*")] |
| 35 | -[assembly: AssemblyVersion("1.34.0.0")] | ||
| 36 | -[assembly: AssemblyFileVersion("1.34.0.0")] | 35 | +[assembly: AssemblyVersion("1.34.1.0")] |
| 36 | +[assembly: AssemblyFileVersion("1.34.1.0")] |