From 7b4c35c4b3bf198bc74d836969b48035da368ca3 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 27 Nov 2019 18:50:22 +0100 Subject: [PATCH] Update metodi x HwSwInfo --- Jenkinsfile | 2 +- SteamWareLib/HwSwInfo.cs | 49 +++++++++--- TestBench/MainFOrm.Designer.cs | 142 ++++++++++++++++++++------------- TestBench/MainFOrm.cs | 10 +-- 4 files changed, 129 insertions(+), 74 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7edc9bb..5d3d145 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=697']) { + withEnv(['NEXT_BUILD_NUMBER=698']) { // 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/HwSwInfo.cs b/SteamWareLib/HwSwInfo.cs index 2e49716..93c4e7d 100644 --- a/SteamWareLib/HwSwInfo.cs +++ b/SteamWareLib/HwSwInfo.cs @@ -13,15 +13,40 @@ namespace SteamWare /// public class HwSwInfo { + /// /// Assembly di base /// - protected static Assembly assembly = Assembly.GetEntryAssembly(); - + protected Assembly assembly = Assembly.GetExecutingAssembly(); + /// + /// Istanza base + /// + public HwSwInfo() + { + assembly = Assembly.GetExecutingAssembly(); + } + public HwSwInfo(Assembly targetAssembly) + { + assembly = targetAssembly; + } +#if false + /// + /// Singleton! + /// + public static HwSwInfo man = new HwSwInfo(); +#endif + /// + /// Singleton! + /// + public static HwSwInfo man(Assembly targetAssembly) + { + HwSwInfo answ = new HwSwInfo(targetAssembly); + return answ; + } /// /// Restitusice l'elenco pareto (decrescente) delle dimensioni browser registrate /// - public static string paretoBrowserSize + public string paretoBrowserSize { get { @@ -44,7 +69,7 @@ namespace SteamWare /// /// /// - public static string memFormat(double rawSize) + public string memFormat(double rawSize) { string[] sizes = { "B", "KB", "MB", "GB", "TB" }; int order = 0; @@ -61,7 +86,7 @@ namespace SteamWare /// /// Dati sui server redis... /// - public static string redisServersData + public string redisServersData { get { @@ -101,14 +126,14 @@ namespace SteamWare /// /// /// - public static string ToDateString(TimeSpan time) + public string ToDateString(TimeSpan time) { return string.Format("{0}gg, {1:00}:{2:00}:{3:00} (h:m:s)", time.Days, time.Hours, time.Minutes, time.Seconds); } /// /// Statistiche server /// - public static string ServerStats + public string ServerStats { get { @@ -147,7 +172,7 @@ namespace SteamWare /// /// Statistiche IIS /// - public static string IISStats + public string IISStats { get { @@ -166,7 +191,7 @@ namespace SteamWare /// /// Nome MainAssembly /// - public static string mainAssembly + public string mainAssembly { get { @@ -183,7 +208,7 @@ namespace SteamWare /// /// Runtime assembly /// - public static string runtimeImg + public string runtimeImg { get { @@ -200,7 +225,7 @@ namespace SteamWare /// /// Versioni di ogni libreria compresa /// - public static string librariesVers + public string librariesVers { get { @@ -221,7 +246,7 @@ namespace SteamWare /// /// Num di librerie inserite /// - public static int numLibraries + public int numLibraries { get { diff --git a/TestBench/MainFOrm.Designer.cs b/TestBench/MainFOrm.Designer.cs index aa882aa..1f749a1 100644 --- a/TestBench/MainFOrm.Designer.cs +++ b/TestBench/MainFOrm.Designer.cs @@ -29,13 +29,15 @@ private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.txtSourceDir = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); + this.lblOutMessage = new System.Windows.Forms.Label(); + this.chkRecursive = new System.Windows.Forms.CheckBox(); + this.btnCopyAll = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.txtDestDir = new System.Windows.Forms.TextBox(); - this.btnCopyAll = new System.Windows.Forms.Button(); - this.chkRecursive = new System.Windows.Forms.CheckBox(); - this.lblOutMessage = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.txtSourceDir = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.lblHwSwData = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -51,80 +53,110 @@ 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(12, 12); + this.groupBox1.Location = new System.Drawing.Point(9, 10); + this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(776, 97); + this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox1.Size = new System.Drawing.Size(582, 79); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "File IO test"; // - // txtSourceDir + // lblOutMessage // - this.txtSourceDir.Location = new System.Drawing.Point(103, 21); - this.txtSourceDir.Name = "txtSourceDir"; - this.txtSourceDir.Size = new System.Drawing.Size(156, 22); - this.txtSourceDir.TabIndex = 1; + this.lblOutMessage.AutoSize = true; + this.lblOutMessage.Location = new System.Drawing.Point(13, 50); + this.lblOutMessage.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblOutMessage.Name = "lblOutMessage"; + this.lblOutMessage.Size = new System.Drawing.Size(16, 13); + this.lblOutMessage.TabIndex = 7; + this.lblOutMessage.Text = "..."; // - // label1 + // chkRecursive // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(17, 24); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(80, 17); - this.label1.TabIndex = 2; - this.label1.Text = "Source DIR"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(301, 24); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(64, 17); - this.label2.TabIndex = 4; - this.label2.Text = "Dest DIR"; - // - // txtDestDir - // - this.txtDestDir.Location = new System.Drawing.Point(371, 21); - this.txtDestDir.Name = "txtDestDir"; - this.txtDestDir.Size = new System.Drawing.Size(156, 22); - this.txtDestDir.TabIndex = 3; + this.chkRecursive.AutoSize = true; + this.chkRecursive.Location = new System.Drawing.Point(400, 17); + this.chkRecursive.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.chkRecursive.Name = "chkRecursive"; + this.chkRecursive.Size = new System.Drawing.Size(69, 17); + this.chkRecursive.TabIndex = 6; + this.chkRecursive.Text = "recursive"; + this.chkRecursive.UseVisualStyleBackColor = true; // // btnCopyAll // - this.btnCopyAll.Location = new System.Drawing.Point(695, 18); + this.btnCopyAll.Location = new System.Drawing.Point(521, 15); + this.btnCopyAll.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnCopyAll.Name = "btnCopyAll"; - this.btnCopyAll.Size = new System.Drawing.Size(75, 23); + this.btnCopyAll.Size = new System.Drawing.Size(56, 19); this.btnCopyAll.TabIndex = 5; this.btnCopyAll.Text = "Copy All"; this.btnCopyAll.UseVisualStyleBackColor = true; this.btnCopyAll.Click += new System.EventHandler(this.BtnCopyAll_Click); // - // chkRecursive + // label2 // - this.chkRecursive.AutoSize = true; - this.chkRecursive.Location = new System.Drawing.Point(534, 21); - this.chkRecursive.Name = "chkRecursive"; - this.chkRecursive.Size = new System.Drawing.Size(88, 21); - this.chkRecursive.TabIndex = 6; - this.chkRecursive.Text = "recursive"; - this.chkRecursive.UseVisualStyleBackColor = true; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(226, 20); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(51, 13); + this.label2.TabIndex = 4; + this.label2.Text = "Dest DIR"; // - // lblOutMessage + // txtDestDir // - this.lblOutMessage.AutoSize = true; - this.lblOutMessage.Location = new System.Drawing.Point(17, 62); - this.lblOutMessage.Name = "lblOutMessage"; - this.lblOutMessage.Size = new System.Drawing.Size(20, 17); - this.lblOutMessage.TabIndex = 7; - this.lblOutMessage.Text = "..."; + this.txtDestDir.Location = new System.Drawing.Point(278, 17); + this.txtDestDir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtDestDir.Name = "txtDestDir"; + this.txtDestDir.Size = new System.Drawing.Size(118, 20); + this.txtDestDir.TabIndex = 3; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 20); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(63, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Source DIR"; + // + // txtSourceDir + // + this.txtSourceDir.Location = new System.Drawing.Point(77, 17); + this.txtSourceDir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtSourceDir.Name = "txtSourceDir"; + this.txtSourceDir.Size = new System.Drawing.Size(118, 20); + this.txtSourceDir.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(21, 143); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(64, 13); + this.label3.TabIndex = 2; + this.label3.Text = "HwSw Data"; + // + // lblHwSwData + // + this.lblHwSwData.AutoSize = true; + this.lblHwSwData.Location = new System.Drawing.Point(109, 143); + this.lblHwSwData.Name = "lblHwSwData"; + this.lblHwSwData.Size = new System.Drawing.Size(16, 13); + this.lblHwSwData.TabIndex = 3; + this.lblHwSwData.Text = "..."; // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(600, 366); + this.Controls.Add(this.lblHwSwData); + this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "MainForm"; this.Text = "WinForm library POC"; this.groupBox1.ResumeLayout(false); @@ -144,6 +176,8 @@ private System.Windows.Forms.TextBox txtSourceDir; private System.Windows.Forms.CheckBox chkRecursive; private System.Windows.Forms.Label lblOutMessage; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lblHwSwData; } } diff --git a/TestBench/MainFOrm.cs b/TestBench/MainFOrm.cs index d32858f..8443dc8 100644 --- a/TestBench/MainFOrm.cs +++ b/TestBench/MainFOrm.cs @@ -1,12 +1,6 @@ using SteamWare; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; using System.Windows.Forms; namespace TestBench @@ -24,6 +18,8 @@ namespace TestBench // imposto folders txtSourceDir.Text = @"C:\TMP\"; txtDestDir.Text = @"L:\TMP\"; + + lblHwSwData.Text = SteamWare.HwSwInfo.man(Assembly.GetExecutingAssembly()).librariesVers; } private void BtnCopyAll_Click(object sender, EventArgs e)