diff --git a/IOB-MAN/App.config b/IOB-MAN/App.config index a95da3ed..2e123514 100644 --- a/IOB-MAN/App.config +++ b/IOB-MAN/App.config @@ -9,9 +9,11 @@ + - + + \ No newline at end of file diff --git a/IOB-MAN/CONF/.placeholder b/IOB-MAN/CONF/.placeholder new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/IOB-MAN/CONF/.placeholder @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/IOB-MAN/CONF/process.json b/IOB-MAN/CONF/process.json new file mode 100644 index 00000000..ca0ead80 --- /dev/null +++ b/IOB-MAN/CONF/process.json @@ -0,0 +1 @@ +[ "SIMUL_01", "SIMUL_02", "SIMUL_03", "SIMUL_04" ] \ No newline at end of file diff --git a/IOB-MAN/IOB-MAN.csproj b/IOB-MAN/IOB-MAN.csproj index 162b615c..64e5fcf2 100644 --- a/IOB-MAN/IOB-MAN.csproj +++ b/IOB-MAN/IOB-MAN.csproj @@ -38,9 +38,15 @@ IobManIcon.ico + + ..\packages\Autoupdater.NET.Official.1.5.8\lib\net40\AutoUpdater.NET.dll + ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\NLog.4.6.8\lib\net45\NLog.dll @@ -91,6 +97,10 @@ True Resources.resx + + Always + + Always diff --git a/IOB-MAN/IOBManPanel.Designer.cs b/IOB-MAN/IOBManPanel.Designer.cs index 175c1a09..0b63c883 100644 --- a/IOB-MAN/IOBManPanel.Designer.cs +++ b/IOB-MAN/IOBManPanel.Designer.cs @@ -44,13 +44,14 @@ this.btnMinimizeAll = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel2 = new System.Windows.Forms.Panel(); + this.btnMoreTOut = new System.Windows.Forms.Button(); this.txtTOutAutoCheck = new System.Windows.Forms.TextBox(); this.chkAutoRestart = new System.Windows.Forms.CheckBox(); this.btnOpenAll = new System.Windows.Forms.Button(); this.btnRestartAll = new System.Windows.Forms.Button(); this.btnCloseAll = new System.Windows.Forms.Button(); this.dgvManagedItems = new System.Windows.Forms.DataGridView(); - this.btnMoreTOut = new System.Windows.Forms.Button(); + this.forceCloseALLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.panel1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -128,22 +129,23 @@ // this.processManagerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.updateIOBMANToolStripMenuItem, - this.updateIOBWINToolStripMenuItem}); + this.updateIOBWINToolStripMenuItem, + this.forceCloseALLToolStripMenuItem}); this.processManagerToolStripMenuItem.Name = "processManagerToolStripMenuItem"; - this.processManagerToolStripMenuItem.Size = new System.Drawing.Size(57, 20); - this.processManagerToolStripMenuItem.Text = "&Update"; + this.processManagerToolStripMenuItem.Size = new System.Drawing.Size(62, 20); + this.processManagerToolStripMenuItem.Text = "&Manage"; // // updateIOBMANToolStripMenuItem // this.updateIOBMANToolStripMenuItem.Name = "updateIOBMANToolStripMenuItem"; - this.updateIOBMANToolStripMenuItem.Size = new System.Drawing.Size(167, 22); + this.updateIOBMANToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.updateIOBMANToolStripMenuItem.Text = "Update IOB-&MAN"; this.updateIOBMANToolStripMenuItem.Click += new System.EventHandler(this.updateIOBMANToolStripMenuItem_Click); // // updateIOBWINToolStripMenuItem // this.updateIOBWINToolStripMenuItem.Name = "updateIOBWINToolStripMenuItem"; - this.updateIOBWINToolStripMenuItem.Size = new System.Drawing.Size(167, 22); + this.updateIOBWINToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.updateIOBWINToolStripMenuItem.Text = "Update IOB-&WIN"; this.updateIOBWINToolStripMenuItem.Click += new System.EventHandler(this.updateIOBWINToolStripMenuItem_Click); // @@ -208,6 +210,17 @@ this.panel2.Size = new System.Drawing.Size(116, 341); this.panel2.TabIndex = 85; // + // btnMoreTOut + // + this.btnMoreTOut.Location = new System.Drawing.Point(81, 306); + this.btnMoreTOut.Name = "btnMoreTOut"; + this.btnMoreTOut.Size = new System.Drawing.Size(25, 23); + this.btnMoreTOut.TabIndex = 87; + this.btnMoreTOut.Text = "+"; + this.btnMoreTOut.UseVisualStyleBackColor = true; + this.btnMoreTOut.Visible = false; + this.btnMoreTOut.Click += new System.EventHandler(this.btnMoreTOut_Click); + // // txtTOutAutoCheck // this.txtTOutAutoCheck.Location = new System.Drawing.Point(11, 306); @@ -286,16 +299,12 @@ this.dgvManagedItems.TabIndex = 76; this.dgvManagedItems.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvManagedItems_CellDoubleClick); // - // btnMoreTOut + // forceCloseALLToolStripMenuItem // - this.btnMoreTOut.Location = new System.Drawing.Point(81, 306); - this.btnMoreTOut.Name = "btnMoreTOut"; - this.btnMoreTOut.Size = new System.Drawing.Size(25, 23); - this.btnMoreTOut.TabIndex = 87; - this.btnMoreTOut.Text = "+"; - this.btnMoreTOut.UseVisualStyleBackColor = true; - this.btnMoreTOut.Visible = false; - this.btnMoreTOut.Click += new System.EventHandler(this.btnMoreTOut_Click); + this.forceCloseALLToolStripMenuItem.Name = "forceCloseALLToolStripMenuItem"; + this.forceCloseALLToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.forceCloseALLToolStripMenuItem.Text = "&Force Close ALL"; + this.forceCloseALLToolStripMenuItem.Click += new System.EventHandler(this.forceCloseALLToolStripMenuItem_Click); // // IOBManPanel // @@ -350,6 +359,7 @@ private System.Windows.Forms.CheckBox chkAutoRestart; private System.Windows.Forms.TextBox txtTOutAutoCheck; private System.Windows.Forms.Button btnMoreTOut; + private System.Windows.Forms.ToolStripMenuItem forceCloseALLToolStripMenuItem; } } diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 60f0b67a..7a505aa0 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -1,3 +1,5 @@ +using AutoUpdaterDotNET; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; @@ -88,7 +90,9 @@ namespace IOB_MAN utils.lgInfo("Start processi effettuato"); } } - + /// + /// Caricamento configurazione + /// private void loadConfig() { ArgsList.Clear(); @@ -98,25 +102,53 @@ namespace IOB_MAN TargetExe = string.Format(@"{0}\Resources\Test.bat", Application.StartupPath); } utils.lgInfo($"Target exe: {TargetExe}"); - string ArgsString = utils.CRS("ArgsList"); - utils.lgInfo($"Args found: {ArgsString}"); - if (string.IsNullOrEmpty(ArgsString)) + // caricamento configurazione argomenti di avvio processi + loadArgList(); + } + + private void loadArgList() + { + // in primis cerco SE ESISTA il file json di configuraizone parametri avvio + string fileName = utils.CRS("ArgsConfFile"); + string jsonFileName = $"{Application.StartupPath}{fileName}"; + // verifico se esista il file richeisto + if (File.Exists(jsonFileName)) { - var rand = new Random(); - // ne creo rand (5-15) di default... - for (int i = 0; i < rand.Next(5, 10); i++) + // leggo il file json + StreamReader reader = new StreamReader(jsonFileName); + string jsonData = reader.ReadToEnd(); + if (!string.IsNullOrEmpty(jsonData)) { - ArgsList.Add("127.0.0.1"); + ArgsList = JsonConvert.DeserializeObject>(jsonData); } } else { - var elenco = ArgsString.Split(','); - foreach (var item in elenco) + // se non lo trovassi --> uso la chaive in web.config e GENERO un nuovo file x prox avvio... + string ArgsString = utils.CRS("ArgsList"); + utils.lgInfo($"Args found: {ArgsString}"); + if (string.IsNullOrEmpty(ArgsString)) { - ArgsList.Add(item); + var rand = new Random(); + // ne creo rand (5-15) di default... + for (int i = 0; i < rand.Next(5, 10); i++) + { + ArgsList.Add("127.0.0.1"); + } } + else + { + var elenco = ArgsString.Split(','); + foreach (var item in elenco) + { + ArgsList.Add(item); + } + } + // serializzo e salvo file! + string jsonData = JsonConvert.SerializeObject(ArgsList); + File.WriteAllText(jsonFileName, jsonData); } + } private void ElencoIOB_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) @@ -177,6 +209,10 @@ namespace IOB_MAN /// private void apriChild() { + // preventivamente CHIUDO TUTTO + closeAllChild(true); + Thread.Sleep(250); + // avvio i child foreach (var item in ArgsList) { startChildProc(item); @@ -429,6 +465,8 @@ namespace IOB_MAN private void IOBManPanel_FormClosing(object sender, FormClosingEventArgs e) { closeAllChild(true); + Thread.Sleep(500); + closeAllChild(true); } /// /// Chiude tutti i child @@ -665,12 +703,46 @@ namespace IOB_MAN apriChild(); updateStatus(); } - + /// + /// Ramo applicazione (x update) + /// + protected string branchName = "master"; + /// + /// URL stringa di UPDATE... + /// + protected string updateUrl + { + get + { + return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-MAN/{0}/manifest.xml", branchName); + } + } private void updateIOBMANToolStripMenuItem_Click(object sender, EventArgs e) { - // FIXME fare come IOB-WIN! + utils.lgInfo($"Avvio procedura controllo update: url: {updateUrl}"); + // avvio controllo + AutoUpdater.ShowSkipButton = false; + AutoUpdater.ShowRemindLaterButton = false; + AutoUpdater.RunUpdateAsAdmin = utils.CRB("AUpdAsAdm"); + AutoUpdater.ReportErrors = false; + AutoUpdater.DownloadPath = @"C:\Steawmare\src\"; + AutoUpdater.ApplicationExitEvent += AutoUpdater_ApplicationExitEvent; + AutoUpdater.Start(updateUrl); } + private void AutoUpdater_ApplicationExitEvent() + { + utils.lgInfo("Chiusura IOB-WIN"); + Thread.Sleep(100); + // chiudo tutto + closeAllChild(true); + Thread.Sleep(1000); + utils.lgInfo("Chiusura Applicazione"); + // attendo 1 sec... + Thread.Sleep(1000); + // ESCO! + Application.Exit(); + } private void updateIOBWINToolStripMenuItem_Click(object sender, EventArgs e) { // chiude tutte @@ -698,6 +770,14 @@ namespace IOB_MAN { } + + private void forceCloseALLToolStripMenuItem_Click(object sender, EventArgs e) + { + // per iscurezza chiudo tutto + closeAllChild(true); + Thread.Sleep(1000); + updateStatus(); + } } } diff --git a/IOB-MAN/packages.config b/IOB-MAN/packages.config index 9c216584..bab4e106 100644 --- a/IOB-MAN/packages.config +++ b/IOB-MAN/packages.config @@ -1,7 +1,9 @@  + + diff --git a/Jenkinsfile b/Jenkinsfile index 5611a643..bcd4af74 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,11 +12,11 @@ pipeline { /* copio le libs...*/ // step([$class: 'CopyArtifact', fingerprintArtifacts: true, projectName: 'Steamware/SteamWareLib', selector: [$class: 'WorkspaceSelector'], target: '../Steamware/SteamWareLib']) // mirroring directory x SteamWare Libs - bat "robocopy /MIR ..\\..\\SteamWare\\SteamWareLib ..\\SteamWare\\SteamWareLib || EXIT /B 0" + //bat "robocopy /MIR ..\\..\\SteamWare\\SteamWareLib ..\\SteamWare\\SteamWareLib || EXIT /B 0" /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=619']) { + withEnv(['NEXT_BUILD_NUMBER=627']) { // env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' @@ -40,8 +40,16 @@ pipeline { agent any steps { script { - // compilo installers in base al BRANCH del cliente... - if (env.BRANCH_NAME == "develop") { + // compilo installers in base al BRANCH ... + if(env.BRANCH_NAME == "IobMan") { + // CAMBIO numero versione in file sorgente!!! + bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + // checkout NuGet in file sorgente!!! + fixNuget("${WORKSPACE}\\IOB-WIN.sln") + // BUILD! + bat "\"${tool 'MSBuild-16.0'}\" IOB-MAN/IOB-MAN.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m" + } + else if (env.BRANCH_NAME == "develop") { // CAMBIO numero versione in file sorgente!!! bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" // checkout NuGet in file sorgente!!! @@ -65,8 +73,16 @@ pipeline { steps { // in primis compilo a seconda del branch... TUTTO tranne develop... script { + if(env.BRANCH_NAME == "IobMan") { + // CAMBIO numero versione in file sorgente!!! + bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + // checkout NuGet in file sorgente!!! + fixNuget("${WORKSPACE}\\IOB-WIN.sln") + // BUILD! + bat "\"${tool 'MSBuild-16.0'}\" IOB-MAN/IOB-MAN.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m" + } // procedo solo se NON si tratta di commit in ramo DOCUMentazione... - if (env.BRANCH_NAME != "docum") { + else if (env.BRANCH_NAME != "docum") { // CAMBIO numero versione in file sorgente!!! bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" // checkout NuGet in file sorgente!!! @@ -81,8 +97,31 @@ pipeline { } // ora mi occupo delle operazioni di compressione e copia... script { + // se è ramo IobMan compilo SOLO IOB-MAN... + if(env.BRANCH_NAME == "IobMan") { + env.classifier = "" + // Compressione in .zip dell'installer... + bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\IOB-MAN.zip ${WORKSPACE}\\IOB-MAN\\bin\\*" + // ora mi occupo delle operazioni di invio a NEXUS... + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: 'nexus.steamware.net', + groupId: 'MAPO', + //version: "${env.versionNumber}", + repository: 'utility', + // repository: 'SWS', + credentialsId: 'bc9d8e92-4302-3266-817f-7b58501d12d5', + artifacts: [ + [artifactId: 'IOB-MAN', + classifier: "${env.classifier}", + file: "Releases\\${env.BRANCH_NAME}\\IOB-MAN.zip", + type: 'zip'] + ] + ) + } // procedo solo se NON si tratta di commit in ramo DOCUMentazione... - if (env.BRANCH_NAME != "docum") { + else if (env.BRANCH_NAME != "docum") { def now = new Date() def anno = now.format("yyyy", TimeZone.getTimeZone('UTC')) // elimino files conf personalizzata per ogni install...