11 Commits

Author SHA1 Message Date
Emmanuele Sassi 37986b0bcb - eliminato controllo chiave
- aggiunto try su cancellazione file
2024-08-05 16:22:17 +02:00
Emmanuele Sassi 06b06db04d Merge remote-tracking branch 'origin/develop' into ProcPipeComm 2024-01-05 09:20:55 +01:00
Emmanuele Sassi f3810fa708 - gestiti mutex con nome da ini per distinguere istanze
- spostata inizializzazione oggetto web in load
- corretti errori i n avvio per oggetti non inizializzati
- spostata path dell'Engine in file ini
2024-01-05 09:20:16 +01:00
Emmanuele Sassi cd32764c1e - resi configurabili ip e url per chiamate rest 2023-06-12 16:38:22 +02:00
Emmanuele Sassi 6a03d1e107 Merge remote-tracking branch 'origin/develop' into ProcPipeComm 2023-06-06 10:53:43 +02:00
Emmanuele Sassi 3e51ab18d2 WebDoorCreator.CamSrv 2.5f1 :
- aggiunto numero di processi da avviare in ini
- aggiunta possibilita' di partenza processi all'avvio in ini
- aggiunto timer per reset della lista dei process
- gestita chiusura dell'ambiente egt
2023-06-06 10:53:23 +02:00
Emmanuele Sassi 9218ac7d5b WebDoorCreator.CamSrv 2.5e1 :
- aggiornata EgtUILib
- corretto colore di sfondo start e estop
2023-05-30 08:51:02 +02:00
Emmanuele Sassi c699d8e2e5 Merge remote-tracking branch 'origin/develop' into ProcPipeComm 2023-05-30 08:35:14 +02:00
Emmanuele Sassi 6da0285af3 - aggiunta EgtUILib per log
- aggiunta gestione istanze
- aggiunto controllo licenza su applicazione
- aggiunto bottone per killare tutti i process
2023-05-30 08:34:54 +02:00
Emmanuele Sassi 0b5d4f4909 Merge remote-tracking branch 'origin/develop' into ProcPipeComm 2023-05-29 10:24:12 +02:00
Emmanuele Sassi b26f18575f - gestite pipe
- gestito riavvio processo
2023-05-29 10:23:48 +02:00
8 changed files with 789 additions and 235 deletions
Binary file not shown.
+10
View File
@@ -10,17 +10,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Debug|x64.ActiveCfg = Debug|x64
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Debug|x64.Build.0 = Debug|x64
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Release|Any CPU.Build.0 = Release|Any CPU
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Release|x64.ActiveCfg = Release|x64
{96266312-9739-4F12-A6C2-16C1CAFDDA6E}.Release|x64.Build.0 = Release|x64
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Debug|x64.ActiveCfg = Debug|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Debug|x64.Build.0 = Debug|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|Any CPU.Build.0 = Release|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|x64.ActiveCfg = Release|Any CPU
{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+45
View File
@@ -0,0 +1,45 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2015
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 12.02.15 DS Creazione modulo.
'
'
'----------------------------------------------------------------------------
Public Module ConstIni
' massimo numero di istanze del programma ammesse
Public Const MAX_INST As Integer = 32
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "WebDoorCreator.CamSrv.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key"
' File di log generale
Public Const GENLOG_FILE_NAME As String = "WebDoorCreator.CamSrv#.txt"
Public Const INI_FILE_NAME As String = "WebDoorCreator.CamSrv.ini"
Public Const S_GENERAL As String = "General"
Public Const K_DEBUG As String = "Debug"
Public Const K_LICENCE As String = "Licence"
Public Const K_NETKEY As String = "NetKey"
Public Const K_USERLEVEL As String = "UserLevel"
Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
Public Const K_COMMANDLOG As String = "CommandLog"
Public Const K_STARTINSTANCES As String = "StartInstances"
Public Const K_PROCESSPATH As String = "ProcessPath"
Public Const K_PROCESSATSTART As String = "ProcessAtStart"
Public Const K_BASEURL As String = "BaseUrl"
Public Const K_BASEIP As String = "BaseIp"
Public Const K_MUTEXNAME As String = "MutexName"
End Module
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("2.5.6.1")>
<Assembly: AssemblyFileVersion("2.5.6.1")>
+93 -74
View File
@@ -49,22 +49,24 @@ Partial Class ProcMan
Me.ThreadCurrentStatusList = New System.Windows.Forms.ListView()
Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chkStatAggr = New System.Windows.Forms.CheckBox()
Me.btnExportStats = New System.Windows.Forms.Button()
Me.chkAutoRestart = New System.Windows.Forms.CheckBox()
Me.TimerCheck = New System.Windows.Forms.Timer(Me.components)
Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.Button1 = New System.Windows.Forms.Button()
Me.TimerResetProcessing = New System.Windows.Forms.Timer(Me.components)
Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'btnTestPing
'
Me.btnTestPing.Location = New System.Drawing.Point(17, 16)
Me.btnTestPing.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnTestPing.Location = New System.Drawing.Point(19, 20)
Me.btnTestPing.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btnTestPing.Name = "btnTestPing"
Me.btnTestPing.Size = New System.Drawing.Size(100, 28)
Me.btnTestPing.Size = New System.Drawing.Size(112, 35)
Me.btnTestPing.TabIndex = 0
Me.btnTestPing.Text = "Test Ping"
Me.btnTestPing.UseVisualStyleBackColor = True
@@ -72,39 +74,39 @@ Partial Class ProcMan
'lblpingTest
'
Me.lblpingTest.AutoSize = True
Me.lblpingTest.Location = New System.Drawing.Point(153, 22)
Me.lblpingTest.Location = New System.Drawing.Point(172, 28)
Me.lblpingTest.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblpingTest.Name = "lblpingTest"
Me.lblpingTest.Size = New System.Drawing.Size(28, 16)
Me.lblpingTest.Size = New System.Drawing.Size(36, 20)
Me.lblpingTest.TabIndex = 1
Me.lblpingTest.Text = "???"
'
'lblTestAlive
'
Me.lblTestAlive.AutoSize = True
Me.lblTestAlive.Location = New System.Drawing.Point(365, 22)
Me.lblTestAlive.Location = New System.Drawing.Point(411, 28)
Me.lblTestAlive.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblTestAlive.Name = "lblTestAlive"
Me.lblTestAlive.Size = New System.Drawing.Size(28, 16)
Me.lblTestAlive.Size = New System.Drawing.Size(36, 20)
Me.lblTestAlive.TabIndex = 3
Me.lblTestAlive.Text = "???"
'
'btnTestAlive
'
Me.btnTestAlive.Location = New System.Drawing.Point(229, 16)
Me.btnTestAlive.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnTestAlive.Location = New System.Drawing.Point(258, 20)
Me.btnTestAlive.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btnTestAlive.Name = "btnTestAlive"
Me.btnTestAlive.Size = New System.Drawing.Size(100, 28)
Me.btnTestAlive.Size = New System.Drawing.Size(112, 35)
Me.btnTestAlive.TabIndex = 2
Me.btnTestAlive.Text = "Test Alive"
Me.btnTestAlive.UseVisualStyleBackColor = True
'
'btnResetQueue
'
Me.btnResetQueue.Location = New System.Drawing.Point(17, 201)
Me.btnResetQueue.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnResetQueue.Location = New System.Drawing.Point(19, 251)
Me.btnResetQueue.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btnResetQueue.Name = "btnResetQueue"
Me.btnResetQueue.Size = New System.Drawing.Size(100, 28)
Me.btnResetQueue.Size = New System.Drawing.Size(112, 35)
Me.btnResetQueue.TabIndex = 6
Me.btnResetQueue.Text = "Reset Q"
Me.btnResetQueue.UseVisualStyleBackColor = True
@@ -114,41 +116,41 @@ Partial Class ProcMan
Me.txtOut.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtOut.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtOut.ForeColor = System.Drawing.Color.Yellow
Me.txtOut.Location = New System.Drawing.Point(16, 240)
Me.txtOut.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtOut.MinimumSize = New System.Drawing.Size(79, 147)
Me.txtOut.Location = New System.Drawing.Point(18, 300)
Me.txtOut.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.txtOut.MinimumSize = New System.Drawing.Size(88, 183)
Me.txtOut.Multiline = True
Me.txtOut.Name = "txtOut"
Me.txtOut.Size = New System.Drawing.Size(99, 173)
Me.txtOut.Size = New System.Drawing.Size(111, 215)
Me.txtOut.TabIndex = 7
Me.txtOut.Text = "---"
'
'btnQueueStatus
'
Me.btnQueueStatus.Location = New System.Drawing.Point(17, 79)
Me.btnQueueStatus.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnQueueStatus.Location = New System.Drawing.Point(19, 99)
Me.btnQueueStatus.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btnQueueStatus.Name = "btnQueueStatus"
Me.btnQueueStatus.Size = New System.Drawing.Size(100, 28)
Me.btnQueueStatus.Size = New System.Drawing.Size(112, 35)
Me.btnQueueStatus.TabIndex = 8
Me.btnQueueStatus.Text = "Stato Queue"
Me.btnQueueStatus.UseVisualStyleBackColor = True
'
'StartProcess
'
Me.StartProcess.Location = New System.Drawing.Point(17, 23)
Me.StartProcess.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.StartProcess.Location = New System.Drawing.Point(19, 29)
Me.StartProcess.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.StartProcess.Name = "StartProcess"
Me.StartProcess.Size = New System.Drawing.Size(100, 28)
Me.StartProcess.Size = New System.Drawing.Size(112, 35)
Me.StartProcess.TabIndex = 9
Me.StartProcess.Text = "Start"
Me.StartProcess.UseVisualStyleBackColor = True
'
'StopProcess
'
Me.StopProcess.Location = New System.Drawing.Point(325, 22)
Me.StopProcess.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.StopProcess.Location = New System.Drawing.Point(366, 28)
Me.StopProcess.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.StopProcess.Name = "StopProcess"
Me.StopProcess.Size = New System.Drawing.Size(100, 28)
Me.StopProcess.Size = New System.Drawing.Size(112, 35)
Me.StopProcess.TabIndex = 10
Me.StopProcess.Text = "Stop"
Me.StopProcess.UseVisualStyleBackColor = True
@@ -157,17 +159,17 @@ Partial Class ProcMan
'
Me.StatusStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsProgBar})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 526)
Me.StatusStrip1.Location = New System.Drawing.Point(0, 659)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Padding = New System.Windows.Forms.Padding(1, 0, 19, 0)
Me.StatusStrip1.Size = New System.Drawing.Size(736, 22)
Me.StatusStrip1.Padding = New System.Windows.Forms.Padding(1, 0, 21, 0)
Me.StatusStrip1.Size = New System.Drawing.Size(828, 26)
Me.StatusStrip1.TabIndex = 11
Me.StatusStrip1.Text = "StatusStrip1"
'
'tsProgBar
'
Me.tsProgBar.Name = "tsProgBar"
Me.tsProgBar.Size = New System.Drawing.Size(133, 14)
Me.tsProgBar.Size = New System.Drawing.Size(150, 18)
Me.tsProgBar.Step = 1
'
'txtQueue
@@ -175,42 +177,42 @@ Partial Class ProcMan
Me.txtQueue.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtQueue.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.0!)
Me.txtQueue.ForeColor = System.Drawing.SystemColors.Window
Me.txtQueue.Location = New System.Drawing.Point(17, 114)
Me.txtQueue.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtQueue.Location = New System.Drawing.Point(19, 142)
Me.txtQueue.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.txtQueue.Multiline = True
Me.txtQueue.Name = "txtQueue"
Me.txtQueue.Size = New System.Drawing.Size(99, 78)
Me.txtQueue.Size = New System.Drawing.Size(111, 96)
Me.txtQueue.TabIndex = 12
Me.txtQueue.Text = "Q Status:"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(132, 30)
Me.Label1.Location = New System.Drawing.Point(148, 38)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(35, 16)
Me.Label1.Size = New System.Drawing.Size(44, 20)
Me.Label1.TabIndex = 13
Me.Label1.Text = "num:"
'
'txtNumThread
'
Me.txtNumThread.Location = New System.Drawing.Point(171, 26)
Me.txtNumThread.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtNumThread.Location = New System.Drawing.Point(192, 32)
Me.txtNumThread.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.txtNumThread.Name = "txtNumThread"
Me.txtNumThread.Size = New System.Drawing.Size(41, 22)
Me.txtNumThread.Size = New System.Drawing.Size(46, 26)
Me.txtNumThread.TabIndex = 14
Me.txtNumThread.Text = "1"
Me.txtNumThread.Text = "0"
Me.txtNumThread.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'lblRunning
'
Me.lblRunning.AutoSize = True
Me.lblRunning.Location = New System.Drawing.Point(221, 30)
Me.lblRunning.Location = New System.Drawing.Point(249, 38)
Me.lblRunning.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblRunning.MinimumSize = New System.Drawing.Size(100, 0)
Me.lblRunning.MinimumSize = New System.Drawing.Size(112, 0)
Me.lblRunning.Name = "lblRunning"
Me.lblRunning.Size = New System.Drawing.Size(100, 16)
Me.lblRunning.Size = New System.Drawing.Size(112, 20)
Me.lblRunning.TabIndex = 15
Me.lblRunning.Text = "running: -"
Me.lblRunning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
@@ -226,10 +228,10 @@ Partial Class ProcMan
'
Me.LISTThreadStatus.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.chThread, Me.chTime, Me.chOther})
Me.LISTThreadStatus.HideSelection = False
Me.LISTThreadStatus.Location = New System.Drawing.Point(17, 59)
Me.LISTThreadStatus.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.LISTThreadStatus.Location = New System.Drawing.Point(19, 74)
Me.LISTThreadStatus.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.LISTThreadStatus.Name = "LISTThreadStatus"
Me.LISTThreadStatus.Size = New System.Drawing.Size(536, 173)
Me.LISTThreadStatus.Size = New System.Drawing.Size(602, 215)
Me.LISTThreadStatus.TabIndex = 16
Me.LISTThreadStatus.UseCompatibleStateImageBehavior = False
Me.LISTThreadStatus.View = System.Windows.Forms.View.Details
@@ -259,11 +261,11 @@ Partial Class ProcMan
Me.GroupBox1.Controls.Add(Me.StopProcess)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.StartProcess)
Me.GroupBox1.Location = New System.Drawing.Point(157, 79)
Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.GroupBox1.Location = New System.Drawing.Point(177, 99)
Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.GroupBox1.Size = New System.Drawing.Size(563, 438)
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.GroupBox1.Size = New System.Drawing.Size(633, 548)
Me.GroupBox1.TabIndex = 17
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Threads"
@@ -272,10 +274,10 @@ Partial Class ProcMan
'
Me.ThreadCurrentStatusList.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader4, Me.ColumnHeader3})
Me.ThreadCurrentStatusList.HideSelection = False
Me.ThreadCurrentStatusList.Location = New System.Drawing.Point(17, 257)
Me.ThreadCurrentStatusList.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.ThreadCurrentStatusList.Location = New System.Drawing.Point(19, 321)
Me.ThreadCurrentStatusList.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.ThreadCurrentStatusList.Name = "ThreadCurrentStatusList"
Me.ThreadCurrentStatusList.Size = New System.Drawing.Size(536, 173)
Me.ThreadCurrentStatusList.Size = New System.Drawing.Size(602, 215)
Me.ThreadCurrentStatusList.TabIndex = 18
Me.ThreadCurrentStatusList.UseCompatibleStateImageBehavior = False
Me.ThreadCurrentStatusList.View = System.Windows.Forms.View.Details
@@ -290,25 +292,37 @@ Partial Class ProcMan
Me.ColumnHeader2.Text = "Thread Status"
Me.ColumnHeader2.Width = 100
'
'ColumnHeader4
'
Me.ColumnHeader4.DisplayIndex = 3
Me.ColumnHeader4.Text = "Thread Phase"
Me.ColumnHeader4.Width = 100
'
'ColumnHeader3
'
Me.ColumnHeader3.DisplayIndex = 2
Me.ColumnHeader3.Text = "Process Status"
Me.ColumnHeader3.Width = 100
'
'chkStatAggr
'
Me.chkStatAggr.AutoSize = True
Me.chkStatAggr.Checked = True
Me.chkStatAggr.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkStatAggr.Location = New System.Drawing.Point(435, 26)
Me.chkStatAggr.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.chkStatAggr.Location = New System.Drawing.Point(489, 32)
Me.chkStatAggr.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.chkStatAggr.Name = "chkStatAggr"
Me.chkStatAggr.Size = New System.Drawing.Size(91, 20)
Me.chkStatAggr.Size = New System.Drawing.Size(111, 24)
Me.chkStatAggr.TabIndex = 17
Me.chkStatAggr.Text = "Aggr Stats"
Me.chkStatAggr.UseVisualStyleBackColor = True
'
'btnExportStats
'
Me.btnExportStats.Location = New System.Drawing.Point(612, 16)
Me.btnExportStats.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnExportStats.Location = New System.Drawing.Point(688, 20)
Me.btnExportStats.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.btnExportStats.Name = "btnExportStats"
Me.btnExportStats.Size = New System.Drawing.Size(100, 28)
Me.btnExportStats.Size = New System.Drawing.Size(112, 35)
Me.btnExportStats.TabIndex = 18
Me.btnExportStats.Text = "Export Stats"
Me.btnExportStats.UseVisualStyleBackColor = True
@@ -316,10 +330,10 @@ Partial Class ProcMan
'chkAutoRestart
'
Me.chkAutoRestart.AutoSize = True
Me.chkAutoRestart.Location = New System.Drawing.Point(465, 21)
Me.chkAutoRestart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.chkAutoRestart.Location = New System.Drawing.Point(523, 26)
Me.chkAutoRestart.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.chkAutoRestart.Name = "chkAutoRestart"
Me.chkAutoRestart.Size = New System.Drawing.Size(99, 20)
Me.chkAutoRestart.Size = New System.Drawing.Size(122, 24)
Me.chkAutoRestart.TabIndex = 19
Me.chkAutoRestart.Text = "AutoRestart"
Me.chkAutoRestart.UseVisualStyleBackColor = True
@@ -328,23 +342,26 @@ Partial Class ProcMan
'
Me.TimerCheck.Interval = 30000
'
'ColumnHeader3
'Button1
'
Me.ColumnHeader3.DisplayIndex = 2
Me.ColumnHeader3.Text = "Process Status"
Me.ColumnHeader3.Width = 100
Me.Button1.Location = New System.Drawing.Point(688, 65)
Me.Button1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 35)
Me.Button1.TabIndex = 20
Me.Button1.Text = "Kill All Procs"
Me.Button1.UseVisualStyleBackColor = True
'
'ColumnHeader4
'TimerResetProcessing
'
Me.ColumnHeader4.DisplayIndex = 3
Me.ColumnHeader4.Text = "Thread Phase"
Me.ColumnHeader4.Width = 100
Me.TimerResetProcessing.Interval = 3000
'
'ProcMan
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(736, 548)
Me.ClientSize = New System.Drawing.Size(828, 685)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.chkAutoRestart)
Me.Controls.Add(Me.btnExportStats)
Me.Controls.Add(Me.GroupBox1)
@@ -358,7 +375,7 @@ Partial Class ProcMan
Me.Controls.Add(Me.lblpingTest)
Me.Controls.Add(Me.btnTestPing)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
Me.Name = "ProcMan"
Me.Text = "MainForm"
Me.StatusStrip1.ResumeLayout(False)
@@ -401,4 +418,6 @@ Partial Class ProcMan
Friend WithEvents ColumnHeader2 As ColumnHeader
Friend WithEvents ColumnHeader3 As ColumnHeader
Friend WithEvents ColumnHeader4 As ColumnHeader
Friend WithEvents Button1 As Button
Friend WithEvents TimerResetProcessing As Timer
End Class
+3
View File
@@ -129,6 +129,9 @@
<metadata name="TimerCheck.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>354, 17</value>
</metadata>
<metadata name="TimerResetProcessing.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>511, 22</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
+610 -159
View File
@@ -1,8 +1,10 @@
Imports System.IO
Imports System.Net.NetworkInformation
Imports System.Reflection
Imports System.Text
Imports System.Threading
Imports WebDoorCreator.SDK
Imports EgtUILib
Public Class ProcMan
@@ -46,8 +48,10 @@ Public Class ProcMan
Dim codPost As String = "WRK001"
Dim sEgtEnginePath As String = ""
' nome macchina calcolo
Dim currWDC As WDC = New WDC(baseIp, baseUrl, codPost)
Dim currWDC As WDC
Dim idxSim As Integer = 0
@@ -57,6 +61,17 @@ Public Class ProcMan
Dim m_ExecutionThread As Thread
Dim m_LastCrashedProcTime As DateTime
Private m_StatList As New List(Of ThreadStat)
Public Enum ProgramStatuses As Integer
START = 1
[STOP] = 2
End Enum
Dim m_ProgramStatus As ProgramStatuses = ProgramStatuses.STOP
'Private m_MaxCamInstances As Integer = 8
Private m_MaxCamInstances As Integer = 1
@@ -65,6 +80,9 @@ Public Class ProcMan
Dim ThreadList As Thread()
Dim ThreadDataList As ThreadData()
Dim HistoryThreadDataList As New List(Of ThreadStat)
Dim m_bCheckOrder As Boolean = True
Dim m_bPingOk As Boolean = False
Dim m_bAliveOk As Boolean = False
@@ -82,6 +100,52 @@ Public Class ProcMan
Private Class ThreadData
Public Enum ProcComm As Integer
Null = 0
WaitingAnswer = 1
AnswerReceived = 2
End Enum
Private m_CurrRequest As KeyValuePair(Of String, String)
Public ReadOnly Property CurrRequest As KeyValuePair(Of String, String)
Get
Return m_CurrRequest
End Get
End Property
Friend Sub SetCurrRequest(value As KeyValuePair(Of String, String))
m_CurrRequest = value
End Sub
Private m_sDdfPath As String
Public ReadOnly Property sDdfPath As String
Get
Return m_sDdfPath
End Get
End Property
Friend Sub SetDdfPath(value As String)
m_sDdfPath = value
End Sub
Private m_WaitProcAnswer As ProcComm = ProcComm.Null
Public ReadOnly Property WaitProcAnswer As ProcComm
Get
Return m_WaitProcAnswer
End Get
End Property
Friend Sub SetWaitProcAnswer(value As ProcComm)
m_WaitProcAnswer = value
End Sub
Private m_nProcResult As Integer
Public ReadOnly Property nProcResult As Integer
Get
Return m_nProcResult
End Get
End Property
Friend Sub SetProcResult(value As Integer)
m_nProcResult = value
End Sub
Private m_ThreadOperation As ThreadOperations
Public ReadOnly Property ThreadOperation As ThreadOperations
Get
@@ -102,10 +166,105 @@ Public Class ProcMan
m_Process = value
End Sub
Private m_ThreadStat As ThreadStat
Public ReadOnly Property ThreadStat As ThreadStat
Get
Return m_ThreadStat
End Get
End Property
Friend Sub SetThreadStat(value As ThreadStat)
m_ThreadStat = value
End Sub
End Class
Public Class ThreadStat
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_StartThread As DateTime
Public ReadOnly Property StartThread As DateTime
Get
Return m_StartThread
End Get
End Property
Private m_StopThread As DateTime
Public ReadOnly Property StopThread As DateTime
Get
Return m_StopThread
End Get
End Property
Friend Sub SetStopThread(value As DateTime)
m_StopThread = value
End Sub
Private m_ProcExecutionList As New List(Of ProcStat)
Public ReadOnly Property ProcExecutionList As List(Of ProcStat)
Get
Return m_ProcExecutionList
End Get
End Property
Sub New(nIndex As Integer)
m_nIndex = nIndex
End Sub
Sub New(nIndex As Integer, StartThread As DateTime)
MyClass.New(nIndex)
m_StartThread = StartThread
End Sub
End Class
Public Class ProcStat
Private m_StartProc As DateTime
Public ReadOnly Property StartProc As DateTime
Get
Return m_StartProc
End Get
End Property
Private m_StopProc As DateTime
Public ReadOnly Property StopProc As DateTime
Get
Return m_StopProc
End Get
End Property
Friend Sub SetStopProc(value As DateTime)
m_StopProc = value
End Sub
Private m_nDoneRequests As Integer = 0
Public ReadOnly Property nDoneRequests As Integer
Get
Return m_nDoneRequests
End Get
End Property
Friend Sub IncrementDoneRequest()
m_nDoneRequests += 1
End Sub
Sub New(StartProc As DateTime)
m_StartProc = StartProc
End Sub
End Class
#Region "Private Methods"
Private Sub Form_Shown() Handles MyBase.Shown
If GetPrivateProfileInt(S_GENERAL, K_PROCESSATSTART, 1, m_IniFilePath) = 1 Then
startAllThreads()
End If
End Sub
Private Sub UpdateThreadCurrentStatus()
synchronizationContext.Post(New SendOrPostCallback(
Sub(o)
@@ -121,15 +280,16 @@ Public Class ProcMan
' ThreadProcessState = ThreadDataList(ThreadIndex).Process.HasExited
'End If
ThreadCurrentStatusList.Items.Add(New ListViewItem(New String() {ThreadIndex,
ThreadList(ThreadIndex).ThreadState.ToString(),
If(Not IsNothing(ThreadList(ThreadIndex)), ThreadList(ThreadIndex).ThreadState.ToString(), ""),
ThreadProcessState,
ThreadDataList(ThreadIndex).ThreadOperation.ToString()}))
If(Not IsNothing(ThreadDataList(ThreadIndex)), ThreadDataList(ThreadIndex).ThreadOperation.ToString(), "")}))
Else
ThreadCurrentStatusList.Items.Add(New ListViewItem(New String() {ThreadIndex,
"nothing"}))
End If
Next
End If
ThreadCurrentStatusList.EndUpdate()
lblpingTest.Text = m_bPingOk.ToString()
lblTestAlive.Text = m_bAliveOk.ToString()
@@ -161,6 +321,7 @@ Public Class ProcMan
End Sub
Private Sub DisplayQueueStatus()
If IsNothing(currWDC) Then Return
Dim queueStatus As New Dictionary(Of String, Long)
queueStatus = currWDC.queueStatus
Dim sb As StringBuilder
@@ -175,12 +336,12 @@ Public Class ProcMan
Private Sub ExecutionProcess()
' recupero Id dei DDF
Dim sDdfRoot As String = "c:\EgtData\WebDoor\Ddf"
Dim sCurrDdfDir As String = ""
Dim nDdfId As Integer = 1
Dim bStopMainProcess As Boolean = False
Dim n30SecCounter As Integer = 0
Dim nStartingProc As Integer = 0
While Not bStopMainProcess
bStopMainProcess = m_bStopProcess
Dim bOk As Boolean = False
@@ -252,32 +413,80 @@ Public Class ProcMan
End If
' se qualche processo in stop, lo faccio ripartire
For ThreadIndex = 0 To ThreadList.Count - 1
Dim Thread = ThreadList(ThreadIndex)
If Not IsNothing(Thread) Then
If Thread.ThreadState = ThreadState.Stopped OrElse Thread.ThreadState = ThreadState.Aborted OrElse
Thread.ThreadState = ThreadState.Suspended Then
Thread.Abort()
Thread.Sleep(500)
While Not Thread.ThreadState = ThreadState.Aborted
Thread.Sleep(100)
End While
Thread = Nothing
If ThreadIndex < ThreadList.Count Then
Dim Thread = ThreadList(ThreadIndex)
If Not IsNothing(Thread) Then
If Thread.ThreadState = ThreadState.Stopped OrElse Thread.ThreadState = ThreadState.Aborted OrElse
Thread.ThreadState = ThreadState.Suspended OrElse IsNothing(ThreadDataList(ThreadIndex).Process) OrElse (Not IsNothing(ThreadDataList(ThreadIndex).Process) AndAlso ThreadDataList(ThreadIndex).Process.HasExited) Then
Dim nActiveProc As Integer = 0
If ThreadIndex < ThreadDataList.Count Then
Dim CurrThreadStat As ThreadStat = ThreadDataList(ThreadIndex).ThreadStat
Dim CurrProcess As ProcStat = Nothing
If Not IsNothing(CurrThreadStat) Then
CurrProcess = CurrThreadStat.ProcExecutionList(CurrThreadStat.ProcExecutionList.Count - 1)
If Not IsNothing(CurrProcess) AndAlso CurrProcess.StopProc = DateTime.MinValue Then CurrProcess.SetStopProc(DateTime.Now)
If CurrThreadStat.StopThread = DateTime.MinValue Then CurrThreadStat.SetStopThread(DateTime.Now)
End If
' verifico se posso rilanciarlo
For nIndex As Integer = 0 To m_MaxCamInstances - 1
If nIndex < ThreadDataList.Count Then
Dim IndexThreadStat As ThreadStat = ThreadDataList(nIndex).ThreadStat
If Not IsNothing(IndexThreadStat) Then
If IndexThreadStat.ProcExecutionList.Count > 0 Then
Dim IndexProcess As ProcStat = IndexThreadStat.ProcExecutionList(IndexThreadStat.ProcExecutionList.Count - 1)
Dim random As New Random()
Dim nRandWait As Integer = random.Next(15, 30)
Dim RandTimeSpan As TimeSpan = TimeSpan.FromSeconds(nRandWait)
'EgtOutLog("nIndex: " & nIndex)
'EgtOutLog("Now: " & DateTime.Now)
'EgtOutLog("Stop process: " & IndexProcess.StopProc)
'EgtOutLog("nRandWait: " & nRandWait)
'EgtOutLog("RandTimeSpan: " & RandTimeSpan.ToString)
If Not IsNothing(IndexProcess) AndAlso Not IsNothing(CurrProcess) AndAlso (IndexProcess.StopProc = DateTime.MinValue OrElse (DateTime.Now - IndexProcess.StopProc) < TimeSpan.FromSeconds(nRandWait)) Then
nActiveProc += 1
'EgtOutLog("ActiveProc + 1")
End If
End If
End If
End If
Next
End If
'EgtOutLog("Conto processi attivi: " & nActiveProc)
If nActiveProc + nStartingProc + 1 <= Math.Max(2, m_MaxCamInstances) Then
nStartingProc += 1
'EgtOutLog("Ne lancio un altro")
' lo chiudo e rilancio
If ThreadIndex < ThreadDataList.Count Then
If Not IsNothing(ThreadDataList(ThreadIndex).Process) AndAlso Not ThreadDataList(ThreadIndex).Process.HasExited Then ThreadDataList(ThreadIndex).Process.Kill()
Thread.Sleep(500)
Thread.Abort()
Thread.Sleep(500)
While Not Thread.ThreadState = ThreadState.Aborted
Thread.Sleep(100)
End While
Thread = Nothing
Dim ThreadId As Integer = ThreadIndex
ThreadList(ThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
ThreadList(ThreadIndex).Start()
End If
nStartingProc -= 1
End If
End If
Else
Dim ThreadId As Integer = ThreadIndex
Thread = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
Thread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
Thread.Start()
If ThreadIndex < ThreadList.Count Then
ThreadList(ThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
ThreadList(ThreadIndex).Start()
End If
End If
Else
Dim ThreadId As Integer = ThreadIndex
ThreadList(ThreadIndex) = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
ThreadList(ThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
ThreadList(ThreadIndex).Start()
End If
Next
If n30SecCounter <= 30 Then
@@ -327,12 +536,22 @@ Public Class ProcMan
'Thread.Sleep(100)
'startAllThreads()
End If
lblRunning.Text = $"threads: {ThreadCount()}/{m_MaxCamInstances}"
Dim nRunningProcess As Integer = 0
If Not IsNothing(ThreadDataList) Then
For ThreadIndex = 0 To ThreadDataList.Count - 1
Dim CurrThread As ThreadData = ThreadDataList(ThreadIndex)
If Not IsNothing(CurrThread) Then
If CurrThread.ThreadStat.StopThread = DateTime.MinValue Then
nRunningProcess += 1
End If
End If
Next
End If
lblRunning.Text = $"threads: {ThreadCount()}/{m_MaxCamInstances}/{nRunningProcess}"
lblRunning.Invalidate()
DisplayQueueStatus()
' colore btn start / stop...
If m_bStopProcess Then
If m_ProgramStatus = ProgramStatuses.STOP Then
StartProcess.BackColor = ButtonBase.DefaultBackColor
StartProcess.ForeColor = ButtonBase.DefaultForeColor
@@ -355,6 +574,7 @@ Public Class ProcMan
End Sub
Private Sub startAllThreads()
If m_ProgramStatus = ProgramStatuses.START Then Return
m_bStopProcess = False
m_bExecutionThreadStoped = False
m_ExecutionThread = New Thread(Sub()
@@ -364,6 +584,9 @@ Public Class ProcMan
m_ExecutionThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ExecutionThread.Start()
m_ProgramStatus = ProgramStatuses.START
#If False Then
'' recupero Id dei DDF
'Dim sDdfRoot As String = "c:\EgtData\WebDoor\Ddf"
@@ -606,9 +829,14 @@ Public Class ProcMan
' avvio il timer di refresh
TimerProgBar.Enabled = True
TimerProgBar.Start()
TimerResetProcessing.Enabled = True
TimerResetProcessing.Start()
End Sub
Private Sub stopAllThreads()
If m_ProgramStatus = ProgramStatuses.STOP Then Return
m_bStopProcess = True
While Not m_bExecutionThreadStoped
Thread.Sleep(100)
@@ -621,9 +849,7 @@ Public Class ProcMan
m_ExecutionThread = Nothing
End If
ThreadList = Nothing
' fix timer
TimerProgBar.Enabled = False
TimerProgBar.Stop()
m_ProgramStatus = ProgramStatuses.STOP
End Sub
Private Sub StopProcess_Click(sender As Object, e As EventArgs) Handles StopProcess.Click
@@ -647,143 +873,213 @@ Public Class ProcMan
Private Sub ThreadFunction(ThreadIndex As Integer)
Dim MyThreadData As New ThreadData
ThreadDataList(ThreadIndex) = MyThreadData
Dim sExePath As String = "c:\EgtProg\EgtEngine\EgtEngineR32.exe"
Dim sCurrDdfDir As String = "c:\EgtData\WebDoor\Ddf"
Dim CurrThreadStat As New ThreadStat(ThreadIndex, DateTime.Now)
HistoryThreadDataList.Add(CurrThreadStat)
MyThreadData.SetThreadStat(CurrThreadStat)
Dim sDrive As String = "c" ' If(ThreadIndex Mod 2 = 0, "A", "B")
Dim sCurrDdfDir As String = sDrive & ":\EgtData\WebDoor\Ddf"
Dim stopWatch As New Stopwatch()
Dim lExeTime As Long = 0
Dim lOtherTime As Long = 0
While Not m_bStopProcess
MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
' se c'e' qualcosa da processare
If currWDC.numTask2proc > 0 Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
Dim Item As KeyValuePair(Of String, String) = LastRequest.First()
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
' avvio processo
Dim Proc As Process = New Process()
Proc.StartInfo.FileName = sEgtEnginePath
Proc.StartInfo.RedirectStandardInput = True
Proc.StartInfo.RedirectStandardOutput = True
Proc.StartInfo.Arguments = ThreadIndex.ToString() & " """ & sDrive & ":\EgtData\WebDoor\TestPipe.lua"""
Proc.StartInfo.UseShellExecute = False
Proc.StartInfo.CreateNoWindow = True
AddHandler Proc.OutputDataReceived, AddressOf Thread_OutputDataReceived
' avvio cronometro
'stopWatch.Reset()
stopWatch.Restart()
' svuoto vecchio set file della porta richiesta
Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
' elimino vecchi
If Not IsNothing(fileList) Then
For Each sFile In fileList
File.Delete(sFile)
Next
End If
If Proc.Start() Then
Dim CurrPocStat As New ProcStat(DateTime.Now)
CurrThreadStat.ProcExecutionList.Add(CurrPocStat)
Proc.BeginOutputReadLine()
MyThreadData.SetProcess(Proc)
' scrivo ddf
MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
Dim sDdfPath As String = sCurrDdfDir & "\" & Item.Key & ".ddf"
Try
File.WriteAllText(sDdfPath, Item.Value)
Catch ex As Exception
bOk = False
End Try
If bOk Then
MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
' eseguo calcolo
Dim Proc As Process = New Process()
MyThreadData.SetProcess(Proc)
Proc.StartInfo.FileName = sExePath
Proc.StartInfo.Arguments = """C:\EgtData\WebDoor\Main.lua""" & " """ & sDdfPath & """"
Proc.StartInfo.UseShellExecute = False
If Proc.Start() Then
While Not Proc.HasExited
Thread.Sleep(1)
End While
MyThreadData.SetProcess(Nothing)
' salvo exe time...
stopWatch.Stop()
lExeTime = stopWatch.ElapsedMilliseconds
stopWatch.Restart()
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
Dim fContent As String = ""
MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
currRes.Validated = Proc.ExitCode = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = fContent
Else
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
procResults.Add(currRes)
Dim respPut As String = currWDC.SendProcResults(procResults)
stopWatch.Stop()
lOtherTime = stopWatch.ElapsedMilliseconds
' aggiorno thread display...
UpdateThreadList(Item.Key, lExeTime, lOtherTime)
' cambio nomi file generati in old
Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
Try
File.Delete(NewSvg)
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
Try
File.Move(OldSvg, NewSvg)
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
Dim nProc0Wait As Integer = 0
' ciclo per leggere coda ed eseguire
While Not m_bStopProcess AndAlso Not Proc.HasExited
Select Case MyThreadData.WaitProcAnswer
Case ThreadData.ProcComm.Null
MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
' se c'e' qualcosa da processare
Dim nNumTaskToProcess As Integer = 0
If ThreadIndex = 0 Then
nNumTaskToProcess = currWDC.numTask2proc
If nNumTaskToProcess > 0 Then
If Not m_bCheckOrder Then m_bCheckOrder = True
Else
If m_bCheckOrder Then m_bCheckOrder = False
Thread.Sleep(100)
End If
ElseIf m_bCheckOrder Then
nNumTaskToProcess = currWDC.numTask2proc
If nNumTaskToProcess = 0 Then
m_bCheckOrder = False
End If
stopWatch.Stop()
End If
End If
End If
If m_bCheckOrder Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
MyThreadData.SetCurrRequest(LastRequest.First())
Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
' avvio cronometro
'stopWatch.Reset()
stopWatch.Restart()
' svuoto vecchio set file della porta richiesta
Dim fileList As String() = Directory.GetFiles(sCurrDdfDir, Item.Key + ".*")
' elimino vecchi
If Not IsNothing(fileList) Then
For Each sFile In fileList
Try
File.Delete(sFile)
Catch ex As Exception
End Try
Next
End If
' scrivo ddf
MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
MyThreadData.SetDdfPath(sCurrDdfDir & "\" & Item.Key & ".ddf")
Dim sDdfPath As String = MyThreadData.sDdfPath
Try
File.WriteAllText(sDdfPath, Item.Value)
Catch ex As Exception
bOk = False
End Try
If bOk Then
MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
Proc.StandardInput.WriteLine(ThreadIndex & "," & sDdfPath)
MyThreadData.SetWaitProcAnswer(ThreadData.ProcComm.WaitingAnswer)
End If
End If
Else
Thread.Sleep(100)
End If
Else
Thread.Sleep(100)
End If
Case ThreadData.ProcComm.WaitingAnswer
Thread.Sleep(10)
Case ThreadData.ProcComm.AnswerReceived
Dim Item As KeyValuePair(Of String, String) = MyThreadData.CurrRequest
Dim sDdfPath As String = MyThreadData.sDdfPath
Dim bOk As Boolean = True
' salvo exe time...
stopWatch.Stop()
lExeTime = stopWatch.ElapsedMilliseconds
stopWatch.Restart()
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
Dim fContent As String = ""
MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
currRes.Validated = MyThreadData.nProcResult = 0 AndAlso bOk
currRes.DoorIdVers = Item.Key
' se NON fosse validato --> messo il messaggio...
If (currRes.Validated) Then
currRes.SvgGen = fContent
Else
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
procResults.Add(currRes)
Dim respPut As String = currWDC.SendProcResults(procResults)
stopWatch.Stop()
lOtherTime = stopWatch.ElapsedMilliseconds
CurrPocStat.IncrementDoneRequest()
' aggiorno thread display...
UpdateThreadList(Item.Key, lExeTime, lOtherTime)
' cambio nomi file generati in old
Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
Try
File.Delete(NewSvg)
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
Try
File.Move(OldSvg, NewSvg)
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
MyThreadData.SetWaitProcAnswer(ThreadData.ProcComm.Null)
End Select
End While
CurrPocStat.SetStopProc(DateTime.Now)
If m_bStopProcess Then
Proc.StandardInput.WriteLine("quit")
End If
End While
End If
CurrThreadStat.SetStopThread(DateTime.Now)
MyThreadData.SetProcess(Nothing)
MyThreadData.SetThreadOperation(ThreadOperations.Closed)
End Sub
Private Sub Thread_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
Dim sResult As String = e.Data
If Not String.IsNullOrWhiteSpace(sResult) AndAlso sResult.StartsWith("#42315#,") Then
Dim Results() As String = sResult.Split(","c)
If Results.Count >= 2 Then
Dim nIndex As Integer = -1
Dim nResult As Integer = -1
If Integer.TryParse(Results(1), nIndex) AndAlso nIndex >= 0 Then
If Integer.TryParse(Results(2), nResult) AndAlso nResult >= 0 Then
ThreadDataList(nIndex).SetProcResult(nResult)
End If
ThreadDataList(nIndex).SetWaitProcAnswer(ThreadData.ProcComm.AnswerReceived)
End If
End If
End If
End Sub
Private Sub TimerProgBar_Tick(sender As Object, e As EventArgs) Handles TimerProgBar.Tick
' esegue refresh prog bar
performBarAdvance()
@@ -947,7 +1243,17 @@ Public Class ProcMan
Private Sub ProcMan_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
' forzo chiusura threads!
stopAllThreads()
If m_ProgramStatus = ProgramStatuses.START Then stopAllThreads()
EgtExit()
' fix timer
TimerProgBar.Stop()
TimerProgBar.Enabled = False
TimerResetProcessing.Stop()
TimerResetProcessing.Enabled = False
TimerUI.Stop()
TimerUI.Enabled = False
TimerCheck.Stop()
TimerCheck.Enabled = False
End Sub
Private Sub chkAutoRestart_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoRestart.CheckedChanged
@@ -991,6 +1297,151 @@ Public Class ProcMan
startAllThreads()
End Sub
Private Sub ProcMan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
m_IniFilePath = AppDomain.CurrentDomain.BaseDirectory & INI_FILE_NAME
ManageInstance()
'' Imposto tipo di chiave
'EgtSetLockType(KEY_TYPE.HW)
'' Leggo e imposto chiave di protezione
'Dim sLicFileName As String = String.Empty
'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_IniFilePath)
'Dim sLicFile As String = AppDomain.CurrentDomain.BaseDirectory & sLicFileName
'Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey(sKey)
'Dim bNetHwKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0, m_IniFilePath) = 1)
'EgtSetNetHwKey(bNetHwKey)
'Dim sLockId As String = ""
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile)
'If Not String.IsNullOrEmpty(sLockId) Then
' Dim x = EgtSetLockId(sLockId)
'End If
'' Recupero livello e opzioni della chiave
'Dim nKeyLevel As Integer = 0
'Dim nKeyOptions As Integer = 0
'Dim bKey As Boolean = EgtGetKeyLevel(9935, 2505, 1, nKeyLevel) And
' EgtGetKeyOptions(9935, 2505, 1, nKeyOptions)
' Inizializzazione generale di EgtInterface
m_sLogFile = AppDomain.CurrentDomain.BaseDirectory & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Title.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(0, m_sLogFile, sLogMsg)
'If Not bKey Then
' MessageBox.Show("No licences available!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End
'End If
' leggo sorgente richieste rest da ini
GetPrivateProfileString(S_GENERAL, K_BASEIP, "", baseIp, m_IniFilePath)
GetPrivateProfileString(S_GENERAL, K_BASEURL, "", baseUrl, m_IniFilePath)
' inizializzo oggetto web
currWDC = New WDC(baseIp, baseUrl, codPost)
txtNumThread.Text = GetPrivateProfileInt(S_GENERAL, K_STARTINSTANCES, 1, m_IniFilePath).ToString()
' recupero path EgtEngine
GetPrivateProfileString(S_GENERAL, K_PROCESSPATH, "", sEgtEnginePath, m_IniFilePath)
MyBase.Text = baseUrl
End Sub
Dim m_objMutex As Mutex
Dim m_bFirstInstance As Boolean
Dim m_nInstance As Integer
Dim m_IniFilePath As String = ""
Dim m_sLogFile As String = ""
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
Dim sMutexName As String = "Global\WebDoorCreator.CamSrv"
GetPrivateProfileString(S_GENERAL, K_MUTEXNAME, sMutexName, sMutexName, m_IniFilePath)
m_objMutex = New Mutex(False, sMutexName, bCreated)
Catch
bCreated = False
End Try
m_bFirstInstance = bCreated
If bCreated Then
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WritePrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString(), m_IniFilePath)
Else
' Leggo il massimo numero di istanze ammesse
Const MAX_INST As Integer = 32
Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1, m_IniFilePath)
nMaxInst = Math.Max(1, Math.Min(nMaxInst, MAX_INST))
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0, m_IniFilePath)
m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And m_nInstance <= MAX_INST
m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("WebDoorCreator.CamSrv")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, 1)
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("IcarusR64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.RESTORE)
Exit For
End If
Next
End If
' esco dal programma
End
End If
' Aggiorno stato istanze attive
nTmp += (1 << (m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString(), m_IniFilePath)
End If
End Sub
Friend Function GetMaxInstances() As Integer
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1, m_IniFilePath)
Return 1 ' Max(1, Min(nMaxInst, MAX_INST))
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' chiudo tutti i processi EgtEngine
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("EgtEngineR32")
For Each p As Process In localProc
p.Kill()
Next
localProc = Process.GetProcessesByName("EgtEngineR64")
For Each p As Process In localProc
p.Kill()
Next
End Sub
Private Sub TimerResetProcessing_Tick(sender As Object, e As EventArgs) Handles TimerResetProcessing.Tick
If Not IsNothing(currWDC) Then
currWDC.ResetQueueProcessing()
End If
End Sub
#End Region
End Class
@@ -50,7 +50,32 @@
<PropertyGroup>
<ApplicationIcon>Resources\Temp.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Debug\</OutputPath>
<DocumentationFile>WebDoorCreator.CamSrv.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Release\</OutputPath>
<DocumentationFile>WebDoorCreator.CamSrv.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EgtUILib, Version=2.5.5.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtLib\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\DemoServer\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -96,6 +121,7 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConstIni.vb" />
<Compile Include="ProcMan.vb">
<SubType>Form</SubType>
</Compile>