From 117e4029c560c29d58ed837edbb3788f8ea4751f Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 21 Jan 2020 09:55:37 +0100 Subject: [PATCH] Fix refresh appConf con reset e testato --- Jenkinsfile | 2 +- SteamWareLib/logger.cs | 7 +- SteamWareLib/memLayer.cs | 6 +- TestBench/App.config | 3 + TestBench/MainFOrm.Designer.cs | 156 ++++++++++++++++++++++++++----- TestBench/MainFOrm.cs | 19 ++++ TestBench/TestBench.csproj | 3 + TestBench/logs/.placeholder.file | 1 + 8 files changed, 167 insertions(+), 30 deletions(-) create mode 100644 TestBench/logs/.placeholder.file diff --git a/Jenkinsfile b/Jenkinsfile index 8317534..1d25722 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=708']) { + withEnv(['NEXT_BUILD_NUMBER=709']) { // env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.versionNumberBeta = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') diff --git a/SteamWareLib/logger.cs b/SteamWareLib/logger.cs index 9c72253..44202c6 100644 --- a/SteamWareLib/logger.cs +++ b/SteamWareLib/logger.cs @@ -54,13 +54,14 @@ namespace SteamWare /// public logger() { + string _logDir = memLayer.ML.confReadString("_logDir"); try { - _logBaseDir = SteamwareStrings.getFilePath(memLayer.ML.confReadString("_logDir")); + _logBaseDir = SteamwareStrings.getFilePath(_logDir); } - catch + catch (Exception exc) { - _logBaseDir = "~/logs/"; + _logBaseDir = _logDir != "" ? _logDir : "~/logs/"; } _logMaxMb = 100; // di default 100 mb... try diff --git a/SteamWareLib/memLayer.cs b/SteamWareLib/memLayer.cs index ed81abc..0e7e6a0 100644 --- a/SteamWareLib/memLayer.cs +++ b/SteamWareLib/memLayer.cs @@ -132,6 +132,7 @@ namespace SteamWare /// public void resetAppConf() { + redDelKey(ACBH); startupAppConf(); } /// @@ -145,7 +146,6 @@ namespace SteamWare try { if (redKeyPresent(ACBH)) - //if (redHashPresent(ACBH)) { AppConf = new Dictionary(); foreach (var item in redGetHash(ACBH)) @@ -163,10 +163,6 @@ namespace SteamWare valori[i] = new KeyValuePair(item.Key, item.Value); i++; } -#if false - // tolgo SE ci fosse chiave redis..... !!!FIXME!!! - redDelKey(ACBH); -#endif // salvo in redis valori (con TTL) redSaveHash(ACBH, valori, maxAgeAppConf); logger.lg.scriviLog("Completato procedura startupAppConf ", tipoLog.INFO); diff --git a/TestBench/App.config b/TestBench/App.config index 2218127..f650a3a 100644 --- a/TestBench/App.config +++ b/TestBench/App.config @@ -8,6 +8,9 @@ + + + diff --git a/TestBench/MainFOrm.Designer.cs b/TestBench/MainFOrm.Designer.cs index 52be437..c9e17c1 100644 --- a/TestBench/MainFOrm.Designer.cs +++ b/TestBench/MainFOrm.Designer.cs @@ -44,7 +44,20 @@ this.button1 = new System.Windows.Forms.Button(); this.lblNumMerged = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.lblRedCDV = new System.Windows.Forms.Label(); + this.btnShowCdv = new System.Windows.Forms.Button(); + this.btnResetCdv = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.tabPage4.SuspendLayout(); this.SuspendLayout(); // // groupBox1 @@ -59,11 +72,11 @@ this.groupBox1.Controls.Add(this.txtDestDir); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.txtSourceDir); - this.groupBox1.Location = new System.Drawing.Point(9, 10); + this.groupBox1.Location = new System.Drawing.Point(5, 5); this.groupBox1.Margin = new System.Windows.Forms.Padding(2); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(2); - this.groupBox1.Size = new System.Drawing.Size(582, 79); + this.groupBox1.Size = new System.Drawing.Size(740, 79); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "File IO test"; @@ -139,7 +152,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(21, 174); + this.label3.Location = new System.Drawing.Point(9, 16); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(64, 13); this.label3.TabIndex = 2; @@ -148,7 +161,7 @@ // lblHwSwData // this.lblHwSwData.AutoSize = true; - this.lblHwSwData.Location = new System.Drawing.Point(109, 174); + this.lblHwSwData.Location = new System.Drawing.Point(97, 16); this.lblHwSwData.Name = "lblHwSwData"; this.lblHwSwData.Size = new System.Drawing.Size(16, 13); this.lblHwSwData.TabIndex = 3; @@ -159,9 +172,9 @@ this.lblRedis.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblRedis.AutoEllipsis = true; - this.lblRedis.Location = new System.Drawing.Point(109, 129); + this.lblRedis.Location = new System.Drawing.Point(8, 39); this.lblRedis.Name = "lblRedis"; - this.lblRedis.Size = new System.Drawing.Size(482, 43); + this.lblRedis.Size = new System.Drawing.Size(372, 293); this.lblRedis.TabIndex = 5; this.lblRedis.Text = "---"; // @@ -174,7 +187,7 @@ // // txtMergedName // - this.txtMergedName.Location = new System.Drawing.Point(112, 94); + this.txtMergedName.Location = new System.Drawing.Point(92, 14); this.txtMergedName.Name = "txtMergedName"; this.txtMergedName.Size = new System.Drawing.Size(153, 20); this.txtMergedName.TabIndex = 6; @@ -182,7 +195,7 @@ // // button1 // - this.button1.Location = new System.Drawing.Point(25, 91); + this.button1.Location = new System.Drawing.Point(5, 11); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 7; @@ -193,7 +206,7 @@ // lblNumMerged // this.lblNumMerged.AutoSize = true; - this.lblNumMerged.Location = new System.Drawing.Point(320, 100); + this.lblNumMerged.Location = new System.Drawing.Point(300, 20); this.lblNumMerged.Name = "lblNumMerged"; this.lblNumMerged.Size = new System.Drawing.Size(10, 13); this.lblNumMerged.TabIndex = 8; @@ -201,7 +214,7 @@ // // button2 // - this.button2.Location = new System.Drawing.Point(25, 124); + this.button2.Location = new System.Drawing.Point(5, 13); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 9; @@ -209,26 +222,119 @@ this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage4); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(0, 0); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(776, 363); + this.tabControl1.TabIndex = 10; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.groupBox1); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(750, 113); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "File IO test"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.lblNumMerged); + this.tabPage2.Controls.Add(this.txtMergedName); + this.tabPage2.Controls.Add(this.button1); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(768, 337); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "PDF test"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.btnResetCdv); + this.tabPage3.Controls.Add(this.lblRedCDV); + this.tabPage3.Controls.Add(this.btnShowCdv); + this.tabPage3.Controls.Add(this.lblRedis); + this.tabPage3.Controls.Add(this.button2); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(768, 337); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Redis test"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.label3); + this.tabPage4.Controls.Add(this.lblHwSwData); + this.tabPage4.Location = new System.Drawing.Point(4, 22); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Size = new System.Drawing.Size(750, 192); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "Hw Sw pages"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // lblRedCDV + // + this.lblRedCDV.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblRedCDV.AutoEllipsis = true; + this.lblRedCDV.Location = new System.Drawing.Point(411, 39); + this.lblRedCDV.Name = "lblRedCDV"; + this.lblRedCDV.Size = new System.Drawing.Size(349, 293); + this.lblRedCDV.TabIndex = 10; + this.lblRedCDV.Text = "---"; + // + // btnShowCdv + // + this.btnShowCdv.Location = new System.Drawing.Point(414, 13); + this.btnShowCdv.Name = "btnShowCdv"; + this.btnShowCdv.Size = new System.Drawing.Size(75, 23); + this.btnShowCdv.TabIndex = 11; + this.btnShowCdv.Text = "Show Config"; + this.btnShowCdv.UseVisualStyleBackColor = true; + this.btnShowCdv.Click += new System.EventHandler(this.btnShowCdv_Click); + // + // btnResetCdv + // + this.btnResetCdv.Location = new System.Drawing.Point(495, 13); + this.btnResetCdv.Name = "btnResetCdv"; + this.btnResetCdv.Size = new System.Drawing.Size(75, 23); + this.btnResetCdv.TabIndex = 13; + this.btnResetCdv.Text = "Reset CDV"; + this.btnResetCdv.UseVisualStyleBackColor = true; + this.btnResetCdv.Click += new System.EventHandler(this.btnResetCdv_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(600, 366); - this.Controls.Add(this.button2); - this.Controls.Add(this.lblNumMerged); - this.Controls.Add(this.button1); - this.Controls.Add(this.txtMergedName); - this.Controls.Add(this.lblRedis); - this.Controls.Add(this.lblHwSwData); - this.Controls.Add(this.label3); - this.Controls.Add(this.groupBox1); + this.ClientSize = new System.Drawing.Size(776, 363); + this.Controls.Add(this.tabControl1); this.Margin = new System.Windows.Forms.Padding(2); this.Name = "MainForm"; this.Text = "WinForm library POC"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.tabPage3.ResumeLayout(false); + this.tabPage4.ResumeLayout(false); + this.tabPage4.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -250,6 +356,14 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.Label lblNumMerged; private System.Windows.Forms.Button button2; - } + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.Button btnResetCdv; + private System.Windows.Forms.Label lblRedCDV; + private System.Windows.Forms.Button btnShowCdv; + } } diff --git a/TestBench/MainFOrm.cs b/TestBench/MainFOrm.cs index 85c4cba..5744614 100644 --- a/TestBench/MainFOrm.cs +++ b/TestBench/MainFOrm.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Text; using System.Windows.Forms; namespace TestBench @@ -23,6 +24,8 @@ namespace TestBench lblHwSwData.Text = SteamWare.HwSwInfo.man(Assembly.GetExecutingAssembly()).librariesVers; + // reset conf CDV + memLayer.ML.resetAppConf(); } private void BtnCopyAll_Click(object sender, EventArgs e) @@ -76,5 +79,21 @@ namespace TestBench lblRedis.Text = answ; } + + private void btnResetCdv_Click(object sender, EventArgs e) + { + memLayer.ML.resetAppConf(); + } + + private void btnShowCdv_Click(object sender, EventArgs e) + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("----- REDIS CDV data -----"); + foreach (var item in memLayer.ML.AppConf) + { + sb.AppendLine($"{item.Key}: {item.Value}"); + } + lblRedCDV.Text = sb.ToString(); + } } } diff --git a/TestBench/TestBench.csproj b/TestBench/TestBench.csproj index b921006..60e2ce4 100644 --- a/TestBench/TestBench.csproj +++ b/TestBench/TestBench.csproj @@ -66,6 +66,9 @@ True Resources.resx + + Always + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/TestBench/logs/.placeholder.file b/TestBench/logs/.placeholder.file new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/TestBench/logs/.placeholder.file @@ -0,0 +1 @@ + \ No newline at end of file