Commit 7eaab142101891cfbfc5b742927153a814bb940e

Authored by Schwirg László
1 parent 13749fa5

v1.6.3

- BackupPackage package list megjelenítésében levő hiba javítása
Vrh.Log4Pro.MaintenanceConsole/Manager - BackupPackageManager.cs
@@ -70,37 +70,27 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -70,37 +70,27 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
70 foreach (var p in sr.SelectedParameterList) { OnePackageToCreate(p.Parameters as BackupPackage,TS); } 70 foreach (var p in sr.SelectedParameterList) { OnePackageToCreate(p.Parameters as BackupPackage,TS); }
71 return o; 71 return o;
72 } 72 }
73 - private static void OnePackageToCreate(BackupPackage bp,DateTime? timestamp=null) 73 + private static void OnePackageToCreate(BackupPackage bpck,DateTime? timestamp)
74 { 74 {
75 try 75 try
76 { 76 {
77 - //packaget  
78 - var packagets = (timestamp.HasValue ? timestamp.Value : DateTime.Now).ToString("yyyyMMddHHmmss");  
79 - var vars = new Dictionary<string, string>();  
80 - vars.Add("PACKAGENAME", bp.Xml_PackageName);  
81 - vars.Add("PACKAGETS", packagets);  
82 - vars.Add("PACKAGEKEY", bp.Xml_Key); 77 + var bp = bpck.ResolveNames(timestamp);
83 78
84 var destinationfolder = Path.GetDirectoryName(bp.Xml_PackageFilePath); 79 var destinationfolder = Path.GetDirectoryName(bp.Xml_PackageFilePath);
85 if (!Path.IsPathRooted(destinationfolder)) { destinationfolder = Path.Combine(Directory.GetCurrentDirectory(), destinationfolder); } 80 if (!Path.IsPathRooted(destinationfolder)) { destinationfolder = Path.Combine(Directory.GetCurrentDirectory(), destinationfolder); }
86 if (!Directory.Exists(destinationfolder)) { Directory.CreateDirectory(destinationfolder); } 81 if (!Directory.Exists(destinationfolder)) { Directory.CreateDirectory(destinationfolder); }
87 82
88 var destinationfilename = Path.GetFileNameWithoutExtension(bp.Xml_PackageFilePath); 83 var destinationfilename = Path.GetFileNameWithoutExtension(bp.Xml_PackageFilePath);
89 - //string tempfolderpath = Tools.GetTemporaryFoldername(destinationfolder);  
90 -  
91 - destinationfilename = StringConstructor.ResolveConstructorR(vars, destinationfilename, "{}@@");  
92 - destinationfolder = StringConstructor.ResolveConstructorR(vars, destinationfolder, "{}@@");  
93 var temprootfolder=string.IsNullOrEmpty(bp.Xml_TempDirectoryPath) ? destinationfolder : bp.Xml_TempDirectoryPath; 84 var temprootfolder=string.IsNullOrEmpty(bp.Xml_TempDirectoryPath) ? destinationfolder : bp.Xml_TempDirectoryPath;
94 -  
95 string tempfolderpath = Path.Combine(temprootfolder, destinationfilename); 85 string tempfolderpath = Path.Combine(temprootfolder, destinationfilename);
96 86
97 if (Directory.Exists(tempfolderpath)) { Directory.Delete(tempfolderpath, true); } 87 if (Directory.Exists(tempfolderpath)) { Directory.Delete(tempfolderpath, true); }
98 if (!Directory.Exists(tempfolderpath)) { Directory.CreateDirectory(tempfolderpath); } 88 if (!Directory.Exists(tempfolderpath)) { Directory.CreateDirectory(tempfolderpath); }
99 89
100 - foreach (var bf in bp.Xml_BackupFolderList) { BackupPackageManagerCore.FolderZipBackup(bf, tempfolderpath, vars); } 90 + foreach (var bf in bp.Xml_BackupFolderList) { BackupPackageManagerCore.FolderZipBackup(bf, tempfolderpath); }
101 foreach (var sqldb in bp.Xml_BackupSQLDataBaseList) { SQLDataBaseManagerNS.SQLDataBaseManager.Execute(sqldb.Xml_Key,sqldb.Xml_DBBackup,sqldb.Xml_ScriptBackup,sqldb.Xml_TableDataBackup, tempfolderpath, timestamp); } 91 foreach (var sqldb in bp.Xml_BackupSQLDataBaseList) { SQLDataBaseManagerNS.SQLDataBaseManager.Execute(sqldb.Xml_Key,sqldb.Xml_DBBackup,sqldb.Xml_ScriptBackup,sqldb.Xml_TableDataBackup, tempfolderpath, timestamp); }
102 92
103 - BackupPackageManagerCore.CreatePackageFile(bp.Xml_PackageName, tempfolderpath, vars, destinationfilename,destinationfolder, bp.Xml_CreateExe, bp.Xml_SourceIncludeFilenameMaskList); 93 + BackupPackageManagerCore.CreatePackageFile(bp.Xml_PackageName, tempfolderpath, destinationfilename,destinationfolder, bp.Xml_CreateExe, bp.Xml_SourceIncludeFilenameMaskList);
104 if (Directory.Exists(tempfolderpath)) { Directory.Delete(tempfolderpath,true); } 94 if (Directory.Exists(tempfolderpath)) { Directory.Delete(tempfolderpath,true); }
105 } 95 }
106 catch (Exception ex) { ColorConsole.WriteLine(ex.MessageNested(), ConsoleColor.Red); } 96 catch (Exception ex) { ColorConsole.WriteLine(ex.MessageNested(), ConsoleColor.Red); }
@@ -131,7 +121,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -131,7 +121,8 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
131 #region private method: DisplayBackupPackageInfo 121 #region private method: DisplayBackupPackageInfo
132 private static object DisplayBackupPackageInfo(object obj, int lineix) 122 private static object DisplayBackupPackageInfo(object obj, int lineix)
133 { 123 {
134 - BackupPackage bp = ((obj as Menu.ExecutorParameter).Parameters as BackupPackage); 124 + BackupPackage xbp = ((obj as Menu.ExecutorParameter).Parameters as BackupPackage);
  125 + BackupPackage bp = (new BackupPackage(xbp)).ResolveNames(null);
135 if (lineix == 0) 126 if (lineix == 0)
136 { 127 {
137 ColorConsole.Write($"{bp.Xml_PackageName}", ConsoleColor.Black, ConsoleColor.White); 128 ColorConsole.Write($"{bp.Xml_PackageName}", ConsoleColor.Black, ConsoleColor.White);
@@ -185,7 +176,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -185,7 +176,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
185 /// <param name="bf">BackupFolder descriptor</param> 176 /// <param name="bf">BackupFolder descriptor</param>
186 /// <param name="destinationfolderpath">the target directory path where the zip file is created</param> 177 /// <param name="destinationfolderpath">the target directory path where the zip file is created</param>
187 /// <param name="vars">filename substitution variables</param> 178 /// <param name="vars">filename substitution variables</param>
188 - public static void FolderZipBackup(BackupPackage.BackupFolder bf, string destinationfolderpath, Dictionary<string, string> vars) 179 + public static void FolderZipBackup(BackupPackage.BackupFolder bf, string destinationfolderpath)
189 { 180 {
190 string foldertobackuppath = bf.Xml_Path; 181 string foldertobackuppath = bf.Xml_Path;
191 182
@@ -198,8 +189,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -198,8 +189,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
198 var destinationext = Path.GetExtension(destinationbackupfile); if (string.IsNullOrWhiteSpace(destinationext)) { destinationext = ".zip"; } 189 var destinationext = Path.GetExtension(destinationbackupfile); if (string.IsNullOrWhiteSpace(destinationext)) { destinationext = ".zip"; }
199 destinationbackupfile = Path.Combine(destinationfolderpath, destinationfile+destinationext); 190 destinationbackupfile = Path.Combine(destinationfolderpath, destinationfile+destinationext);
200 191
201 - destinationbackupfile = VRH.Common.StringConstructor.ResolveConstructorR(vars, destinationbackupfile, "{}@@");  
202 -  
203 if (File.Exists(destinationbackupfile)) { File.Delete(destinationbackupfile); } 192 if (File.Exists(destinationbackupfile)) { File.Delete(destinationbackupfile); }
204 193
205 if (!Path.IsPathRooted(foldertobackuppath)) { foldertobackuppath = Path.Combine(Directory.GetCurrentDirectory(), foldertobackuppath); } 194 if (!Path.IsPathRooted(foldertobackuppath)) { foldertobackuppath = Path.Combine(Directory.GetCurrentDirectory(), foldertobackuppath); }
@@ -216,7 +205,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -216,7 +205,7 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
216 /// <param name="vars">substitution vars</param> 205 /// <param name="vars">substitution vars</param>
217 /// <param name="createexe">if true, exe self extractor will be created, otherwise zip file; the extension of the package file is zip or exe</param> 206 /// <param name="createexe">if true, exe self extractor will be created, otherwise zip file; the extension of the package file is zip or exe</param>
218 /// <param name="sourceincludefilenamemaskList">comma separated list of masks for the files to include (NOT regex! "old fashioned" masking characters, like ?/* can be used)</param> 207 /// <param name="sourceincludefilenamemaskList">comma separated list of masks for the files to include (NOT regex! "old fashioned" masking characters, like ?/* can be used)</param>
219 - public static void CreatePackageFile(string packagename,string sourcedirectorypath, Dictionary<string,string> vars,string destinationfilename =null,string destinationfolder=null,bool createexe=true,string sourceincludefilenamemaskList=null) 208 + public static void CreatePackageFile(string packagename,string sourcedirectorypath, string destinationfilename =null,string destinationfolder=null,bool createexe=true,string sourceincludefilenamemaskList=null)
220 { 209 {
221 string[] sourceinclfnamemasklist = sourceincludefilenamemaskList.Split(','); 210 string[] sourceinclfnamemasklist = sourceincludefilenamemaskList.Split(',');
222 bool createselfextractor = createexe; 211 bool createselfextractor = createexe;
@@ -228,7 +217,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -228,7 +217,6 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
228 destinationfilename = destinationfilename??Path.GetFileNameWithoutExtension(sourcedirectorypath); 217 destinationfilename = destinationfilename??Path.GetFileNameWithoutExtension(sourcedirectorypath);
229 218
230 string package___filepath = Path.Combine(destinationfolder, destinationfilename); 219 string package___filepath = Path.Combine(destinationfolder, destinationfilename);
231 - package___filepath=VRH.Common.StringConstructor.ResolveConstructorR(vars, package___filepath, "{}@@");  
232 220
233 string packageEXEfilepath = package___filepath + ".exe"; 221 string packageEXEfilepath = package___filepath + ".exe";
234 string packageZIPfilepath = package___filepath + ".zip"; 222 string packageZIPfilepath = package___filepath + ".zip";
@@ -571,6 +559,28 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS @@ -571,6 +559,28 @@ namespace Vrh.Log4Pro.MaintenanceConsole.BackupPackageManagerNS
571 } 559 }
572 #endregion BackupSQLDataBase class 560 #endregion BackupSQLDataBase class
573 561
  562 + #region ResolveNames
  563 + public BackupPackage ResolveNames(DateTime? timestamp)
  564 + {
  565 + var rbp = new BackupPackage(this);
  566 + var packagets = timestamp.HasValue ? timestamp.Value.ToString("yyyyMMddHHmmss") : "yyyyMMddHHmmss";
  567 + var vars = new Dictionary<string, string>();
  568 + vars.Add("PACKAGETS", packagets);
  569 + vars.Add("PACKAGEKEY", rbp.Xml_Key);
  570 + rbp.Xml_PackageName = StringConstructor.ResolveConstructorR(vars, rbp.Xml_PackageName, "{}@@");
  571 + vars.Add("PACKAGENAME", rbp.Xml_PackageName);
  572 + rbp.Xml_Description = StringConstructor.ResolveConstructorR(vars, rbp.Xml_Description, "{}@@");
  573 + foreach (var bf in rbp.Xml_BackupFolderList)
  574 + {
  575 + bf.Xml_BackupToFile = StringConstructor.ResolveConstructorR(vars, bf.Xml_BackupToFile, "{}@@");
  576 + bf.Xml_Description = StringConstructor.ResolveConstructorR(vars, bf.Xml_Description, "{}@@");
  577 + bf.Xml_Path = StringConstructor.ResolveConstructorR(vars, bf.Xml_Path, "{}@@");
  578 + }
  579 + rbp.Xml_PackageFilePath = StringConstructor.ResolveConstructorR(vars, rbp.Xml_PackageFilePath, "{}@@");
  580 + rbp.Xml_TempDirectoryPath = StringConstructor.ResolveConstructorR(vars, rbp.Xml_TempDirectoryPath, "{}@@");
  581 + return rbp;
  582 + }
  583 + #endregion ResolveNames
574 } 584 }
575 #endregion BackupPackage class 585 #endregion BackupPackage class
576 } 586 }
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.6.2.0")]  
36 -[assembly: AssemblyFileVersion("1.6.2.0")] 35 +[assembly: AssemblyVersion("1.6.3.0")]
  36 +[assembly: AssemblyFileVersion("1.6.3.0")]