- implementata lista macchine configurabili

- aggiunte funzioni lua
- corretta esportazione funzioni per plugin
- aggiunta funzione che lancia eseguibile per cam
This commit is contained in:
Emmanuele Sassi
2024-08-09 11:42:31 +02:00
parent 4dcc1744e8
commit fad64bb5b4
16 changed files with 573 additions and 420 deletions
Binary file not shown.
+13 -6
View File
@@ -3,11 +3,18 @@
<InheritedExport>
Public Interface IHost
Property PluginTestInfo As Integer
'Function PlgOutLog(sLogMsg As String) As Boolean
'Function PlgGetPrivateProfileInt(lpAppName As String, lpKeyName As String, nDefault As Integer, lpFileName As String) As Integer
'Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double, lpFileName As String) As Double
'Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, lpFileName As String) As Integer
'Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean
ReadOnly Property PluginTestInfo As Integer
Function PlgOutLog(sLogMsg As String) As Boolean
Function PlgGetPrivateProfileInt(lpAppName As String, lpKeyName As String, nDefault As Integer, lpFileName As String) As Integer
Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double, lpFileName As String) As Double
Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, lpFileName As String) As Integer
Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean
Function PlgExecProcess(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean
Function ComReadShortVar(nVarAddr As Integer, ByRef nResult As Short, nMachine As Integer) As Boolean
Function ComReadBitVar(nVarAddr As Integer, nBit As Integer, ByRef bResult As Boolean, nMachine As Integer) As Boolean
Function ComReadDoubleVar(nVarAddr As Integer, ByRef dResult As Double, nMachine As Integer) As Boolean
Function ComWriteShortVar(nVarAddr As Integer, nValue As Integer, nMachine As Integer) As Boolean
Function ComWriteBitVar(nVarAddr As Integer, nBit As Integer, bValue As Boolean, nMachine As Integer) As Boolean
Function ComWriteDoubleVar(nVarAddr As Integer, dValue As Double, nMachine As Integer) As Boolean
End Interface
@@ -111,6 +111,8 @@
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.InterfaceR32.dll
IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.InterfaceD32.dll
IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.InterfaceR64.dll
IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.InterfaceD64.dll</PostBuildEvent>
IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.InterfaceD64.dll
copy $(TargetPath) c:\EgtData\Supervisor\Plugin\Supervisor.Plugin.FiveLakes\Supervisor.Plugin.FiveLakes.dll
copy $(TargetPath) c:\EgtProg\Supervisor\Supervisor.Plugin.Interface.dll</PostBuildEvent>
</PropertyGroup>
</Project>
+14 -1
View File
@@ -3,7 +3,19 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OPENcontrol" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.2:8080" binding="basicHttpBinding"
bindingConfiguration="OPENcontrol" contract="OpenControl.OPENcontrolPortType"
name="OPENcontrol" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -19,4 +31,5 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
-19
View File
@@ -1,19 +0,0 @@
Public Class GenericCN
Friend Function Init()
End Function
Friend Function ReadVariable()
End Function
Friend Function WriteVariable()
End Function
Friend Function Close()
End Function
End Class
+57 -39
View File
@@ -1,49 +1,67 @@
Imports NGP_COMM_DLL
Public Class MachineManager
'
'
' !!!! TO DO : use a list of n machines, not just 2 !!!!
'
'
'
' !!!! TO DO : use a list of n machines, not just 2 !!!!
Private m_MachineList(20) As NC.NC_generic
Friend ReadOnly Property MachineList As NC.NC_generic()
Get
Return m_MachineList
End Get
End Property
Private m_Machine1 As NC.NC_generic
Public ReadOnly Property Machine1 As NC.NC_generic
Get
Return m_Machine1
End Get
End Property
Private m_Machine1 As NC.NC_generic
Public ReadOnly Property Machine1 As NC.NC_generic
Get
Return m_Machine1
End Get
End Property
Private m_Machine2 As NC.NC_generic
Public ReadOnly Property Machine2 As NC.NC_generic
Get
Return m_Machine2
End Get
End Property
Private m_Machine2 As NC.NC_generic
Public ReadOnly Property Machine2 As NC.NC_generic
Get
Return m_Machine2
End Get
End Property
Sub New()
End Sub
Sub New()
End Sub
Sub Init()
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
m_Machine1 = New NC.Simulated
m_Machine1.Connect("")
m_Machine2 = New NC.Simulated
m_Machine2.Connect("")
Else
m_Machine1 = New NC.OsaiOpen
m_Machine2 = New NC.OsaiOpen
Dim sM1IpAddress As String = ""
Dim sM2IpAddress As String = ""
GetMainPrivateProfileString(S_NC, K_IP_ADDRESS & 1.ToString(), "", sM1IpAddress)
GetMainPrivateProfileString(S_NC, K_IP_ADDRESS & 2.ToString(), "", sM2IpAddress)
m_Machine1.Connect(sM1IpAddress)
m_Machine2.Connect(sM2IpAddress)
End If
End Sub
Sub Init()
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
Dim nMachineIndex As Integer = 1
Dim sMachine As String = ""
While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
Dim NewSimulatedMachine As New NC.Simulated
NewSimulatedMachine.Connect("")
m_MachineList(nMachineIndex) = NewSimulatedMachine
nMachineIndex += 1
End While
Else
Dim nMachineIndex As Integer = 1
Dim sMachine As String = ""
While GetMainPrivateProfileString(S_NC, K_MACHINE & nMachineIndex.ToString(), "", sMachine) > 0
Dim sMachineSplit() As String = sMachine.Split(","c)
Dim nType As Integer = 0
If sMachineSplit.Count >= 1 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(0)) AndAlso Integer.TryParse(sMachineSplit(0), nType) Then
Select Case nType
Case 1 ' OsaiOpen
If sMachineSplit.Count >= 2 AndAlso Not String.IsNullOrWhiteSpace(sMachineSplit(1)) Then
Dim NewOsaiOpen As New NC.OsaiOpen
NewOsaiOpen.Connect(sMachineSplit(1))
m_MachineList(nMachineIndex) = NewOsaiOpen
End If
End Select
End If
nMachineIndex += 1
End While
End If
End Sub
Sub Close()
m_Machine1.Disconnect()
m_Machine2.Disconnect()
End Sub
Sub Close()
m_Machine1.Disconnect()
m_Machine2.Disconnect()
End Sub
End Class
-3
View File
@@ -1,3 +0,0 @@
Public Class OsaiCn
End Class
+4 -4
View File
@@ -23,15 +23,15 @@ Module ConstIni
Public Const K_PREPROC As String = "PreProc"
Public Const K_POSTPROC As String = "PostProc"
Public Const K_MACHINESTATE As String = "MachineState"
Public Const K_INITLUA As String = "InitLua"
Public Const K_INITLUA As String = "InitLua"
Public Const S_REDIS As String = "Redis"
Public Const K_ENABLED As String = "Enabled"
Public Const K_DBINDEX As String = "DbIndex"
Public Const S_NC As String = "NC"
Public Const K_NC_SIMULATE As String = "NcSimulate"
Public Const K_IP_ADDRESS As String = "IpAddress"
Public Const S_NC As String = "NC"
Public Const K_NC_SIMULATE As String = "NcSimulate"
Public Const K_MACHINE As String = "Machine"
End Module
@@ -62,12 +62,12 @@ Public Class FiniteStateMachineManager
Private Sub FiniteStateMachineTimer_Tick(sender As Object, e As EventArgs)
' lancio esecuzione macchine a stati
For Each FiniteStateMachine In m_FiniteStateMachineList
LuaManager.ExecLuaFunction("MACHINE1.Tick", -1, Nothing)
LuaManager.ExecLuaFunction("MACHINE1_Tick", -1, Nothing)
Next
' lancio esecuzione preprocessore
LuaManager.SetGlobVar("PREPROC.ERROR", 0)
LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
LuaManager.ExecLuaFunction("PREPROC.Tick", -1, Nothing)
LuaManager.ExecLuaFunction("PREPROC_Tick", -1, Nothing)
Dim nError As Integer = 0
If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
nError = 1
+1 -36
View File
@@ -7,7 +7,6 @@ Imports KeraLua
Public Module LuaManager
Private state As Lua
Friend func_print As LuaFunction = AddressOf Print
Friend Function SetGlobVar(sName As String, bValue As Boolean) As Boolean
Return Lua_Aux.LuaSetGlobVar(state, sName, bValue)
@@ -45,40 +44,6 @@ Public Module LuaManager
Return Lua_Aux.LuaCreateGlobTable(state, sName)
End Function
Private Function Print(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim n As Integer = state.GetTop()
Dim i As Integer
For i = 1 To n
Dim type As LuaType = state.Type(i)
Select Case type
Case LuaType.Nil
Trace.Write("nil")
Case LuaType.String
Dim s As String = state.ToString(i, False)
Trace.Write(s)
Case LuaType.Number
Dim number As Double = state.ToNumber(i)
Trace.Write(number)
Case LuaType.None
Case LuaType.Boolean
Dim bBoolean As Boolean = state.ToBoolean(i)
Trace.Write(bBoolean)
Case LuaType.LightUserData
Case LuaType.Table
Case LuaType.[Function]
Case LuaType.UserData
Case LuaType.Thread
Case Else
End Select
Next
state.PushInteger(544)
Trace.WriteLine(vbLf)
Return 1
End Function
Public Function ExecFile(ByVal sPath As String) As Boolean
' verifico ambiente lua
If IsNothing(state) Then Return False
@@ -93,7 +58,7 @@ Public Module LuaManager
If result <> LuaStatus.OK Then
sError = state.ToString(1)
state.Pop(1)
EgtOutLog("Fail calling file: " & sPath & " ERROR: " & sError)
EgtOutLog("Fail calling file: " & sPath & " ERROR: " & If(String.IsNullOrWhiteSpace(sError), "Unknown", sError))
End If
Return result = LuaStatus.OK
End Function
+329 -242
View File
@@ -4,160 +4,178 @@ Imports System.IO
Public Module Lua_General
' Lock per scrittura file di log
Private m_Lock_OutLog As New Object
' Lock per scrittura file di log
Private m_Lock_OutLog As New Object
Private m_sLogPath As String
Friend Sub SetLogPath(sPath As String)
m_sLogPath = sPath
End Sub
Private m_sLogPath As String
Friend Sub SetLogPath(sPath As String)
m_sLogPath = sPath
End Sub
' da eliminare quando arriva funzione di libreria!!
Public Function EgtOutLog(sLogMsg As String) As Boolean
SyncLock (m_Lock_OutLog)
Using LogStreamWriter As StreamWriter = File.AppendText(m_sLogPath)
LogStreamWriter.WriteLine(DateTime.Now.ToLongTimeString() & " " & sLogMsg)
End Using
End SyncLock
Return True
End Function
' da eliminare quando arriva funzione di libreria!!
Public Function EgtOutLog(sLogMsg As String) As Boolean
SyncLock (m_Lock_OutLog)
Using LogStreamWriter As StreamWriter = File.AppendText(m_sLogPath)
LogStreamWriter.WriteLine(DateTime.Now.ToLongTimeString() & " " & sLogMsg)
End Using
End SyncLock
Return True
End Function
Friend func_EntIs64bit As LuaFunction = AddressOf Lua_EntIs64bit
Friend func_EntOutLog As LuaFunction = AddressOf Lua_EntOutLog
Friend func_EntExistsDirectory As LuaFunction = AddressOf Lua_EntExistsDirectory
Friend func_EntCopyFile As LuaFunction = AddressOf Lua_EntCopyFile
Friend func_EntGetIniFile As LuaFunction = AddressOf Lua_EntGetIniFile
Friend func_EntGetNumberFromIni As LuaFunction = AddressOf Lua_EntGetNumberFromIni
Friend func_EntGetStringFromIni As LuaFunction = AddressOf Lua_EntGetStringFromIni
Friend func_EntWriteStringToIni As LuaFunction = AddressOf Lua_EntWriteStringToIni
Friend func_RdsStringGet As LuaFunction = AddressOf Lua_RdsStringGet
Friend func_RdsStringSetAsync As LuaFunction = AddressOf Lua_RdsStringSetAsync
Friend func_RdsPublishAsync As LuaFunction = AddressOf Lua_RdsPublishAsync
Friend func_ReadShortVar As LuaFunction = AddressOf Lua_ReadShortVar
Friend func_WriteShortVar As LuaFunction = AddressOf Lua_WriteShortVar
Friend func_EntIs64bit As LuaFunction = AddressOf Lua_EntIs64bit
Friend func_EntOutLog As LuaFunction = AddressOf Lua_EntOutLog
Friend func_EntExistsDirectory As LuaFunction = AddressOf Lua_EntExistsDirectory
Friend func_EntCopyFile As LuaFunction = AddressOf Lua_EntCopyFile
Friend func_EntGetIniFile As LuaFunction = AddressOf Lua_EntGetIniFile
Friend func_EntGetDataDir As LuaFunction = AddressOf Lua_EntGetDataDir
Friend func_EntGetNumberFromIni As LuaFunction = AddressOf Lua_EntGetNumberFromIni
Friend func_EntGetStringFromIni As LuaFunction = AddressOf Lua_EntGetStringFromIni
Friend func_EntWriteStringToIni As LuaFunction = AddressOf Lua_EntWriteStringToIni
Friend func_EntGetNextDoor As LuaFunction = AddressOf Lua_EntGetNextDoor
Friend func_RdsStringGet As LuaFunction = AddressOf Lua_RdsStringGet
Friend func_RdsStringSetAsync As LuaFunction = AddressOf Lua_RdsStringSetAsync
Friend func_RdsPublishAsync As LuaFunction = AddressOf Lua_RdsPublishAsync
Friend func_ComReadShortVar As LuaFunction = AddressOf Lua_ComReadShortVar
Friend func_ComWriteShortVar As LuaFunction = AddressOf Lua_ComWriteShortVar
Private Function Lua_EntIs64bit(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
state.PushBoolean(Not IntPtr.Size = 4)
Return 1
End Function
Private Function Lua_EntIs64bit(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
state.PushBoolean(Not IntPtr.Size = 4)
Return 1
End Function
Private Function Lua_EntOutLog(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 1 o 2 parametri : stringa da emettere [, DebugLevel = 0]
Dim sLogMsg As String = ""
Dim nDebugLevel As Integer = 0
LuaCheckParam(state, 1, sLogMsg)
LuaGetParam(state, 2, nDebugLevel)
LuaClearStack(state)
' accodo il messaggio nel file di log
EgtOutLog(sLogMsg)
' non c'è risultato
Return 0
End Function
Private Function Lua_EntOutLog(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 1 o 2 parametri : stringa da emettere [, DebugLevel = 0]
Dim sLogMsg As String = ""
Dim nDebugLevel As Integer = 0
LuaCheckParam(state, 1, sLogMsg)
LuaGetParam(state, 2, nDebugLevel)
LuaClearStack(state)
' accodo il messaggio nel file di log
EgtOutLog(sLogMsg)
' non c'è risultato
Return 0
End Function
Private Function Lua_EntExistsDirectory(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 1 parametro : sDir
Dim sDirectory As String = ""
LuaCheckParam(state, 1, sDirectory)
LuaClearStack(state)
Dim bResult As Boolean
Try
' verifico esistenza direttorio
bResult = Directory.Exists(sDirectory)
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntExistsDirectory on " & sDirectory & " failed! " & ex.Message)
End Try
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntExistsDirectory(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 1 parametro : sDir
Dim sDirectory As String = ""
LuaCheckParam(state, 1, sDirectory)
LuaClearStack(state)
Dim bResult As Boolean
Try
' verifico esistenza direttorio
bResult = Directory.Exists(sDirectory)
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntExistsDirectory on " & sDirectory & " failed! " & ex.Message)
End Try
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntCopyFile(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 2 parametri : sFile, sNewFile
Dim sSourcePath As String = ""
Dim sDestinationPath As String = ""
LuaCheckParam(state, 1, sSourcePath)
LuaCheckParam(state, 2, sDestinationPath)
LuaClearStack(state)
Dim bResult As Boolean
Try
' copio il file
File.Copy(sSourcePath, sDestinationPath, True)
bResult = True
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntCopyFile from " & sSourcePath & " to " & sDestinationPath & " failed! " & ex.Message)
End Try
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntCopyFile(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 2 parametri : sFile, sNewFile
Dim sSourcePath As String = ""
Dim sDestinationPath As String = ""
LuaCheckParam(state, 1, sSourcePath)
LuaCheckParam(state, 2, sDestinationPath)
LuaClearStack(state)
Dim bResult As Boolean
Try
' copio il file
File.Copy(sSourcePath, sDestinationPath, True)
bResult = True
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntCopyFile from " & sSourcePath & " to " & sDestinationPath & " failed! " & ex.Message)
End Try
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntGetIniFile(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' restituisco il risultato
LuaSetParam(state, IniFile.sPath)
Return 1
End Function
Private Function Lua_EntGetIniFile(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' restituisco il risultato
LuaSetParam(state, IniFile.sPath)
Return 1
End Function
Private Function Lua_EntGetNumberFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, dDef, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim dDef As Integer = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, dDef)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim nResult As Integer = GetPrivateProfileInt(sSec, sKey, dDef, sIniFile)
' restituisco il risultato
LuaSetParam(state, nResult)
Return 1
End Function
Private Function Lua_EntGetDataDir(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' restituisco il risultato
LuaSetParam(state, Map.refMainWindowVM.MainWindowM.sDataRoot)
Return 1
End Function
Private Function Lua_EntGetStringFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sDef, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim sDef As String = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sDef)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim sResult As String = ""
GetPrivateProfileString(sSec, sKey, sDef, sResult, sIniFile)
' restituisco il risultato
LuaSetParam(state, sResult)
Return 1
End Function
Private Function Lua_EntGetNumberFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, dDef, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim dDef As Integer = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, dDef)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim nResult As Integer = GetPrivateProfileInt(sSec, sKey, dDef, sIniFile)
' restituisco il risultato
LuaSetParam(state, nResult)
Return 1
End Function
Private Function Lua_EntWriteStringToIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim sVal As Integer = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sVal)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim bResult As Boolean = WritePrivateProfileString(sSec, sKey, sVal, sIniFile)
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntGetStringFromIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sDef, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim sDef As String = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sDef)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim sResult As String = ""
GetPrivateProfileString(sSec, sKey, sDef, sResult, sIniFile)
' restituisco il risultato
LuaSetParam(state, sResult)
Return 1
End Function
Private Function Lua_EntWriteStringToIni(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal, sIniFile
Dim sSec As String = ""
Dim sKey As String = ""
Dim sVal As Integer = 0
Dim sIniFile As String = ""
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sVal)
LuaCheckParam(state, 4, sIniFile)
LuaClearStack(state)
Dim bResult As Boolean = WritePrivateProfileString(sSec, sKey, sVal, sIniFile)
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntGetNextDoor(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
LuaClearStack(state)
Dim bResult As Boolean = WritePrivateProfileString(sSec, sKey, sVal, sIniFile)
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_RdsStringGet(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
@@ -209,111 +227,180 @@ Public Module Lua_General
Return 0
End Function
Private Function Lua_ReadShortVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Private Function Lua_ComReadShortVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
Dim nResult As Short = 0
If Machine.ReadShortVar(nVarAddr, nResult) Then
state.PushNumber(nResult)
Return 1
Else
Return 0
End If
End Function
' If state.Type(1) <> LuaType.String Then Return 0
Private Function Lua_ComReadBitVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim nBit As Integer = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nBit)
LuaCheckParam(state, 3, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
Dim bResult As Boolean = 0
If Machine.ReadBitVar(nVarAddr, nBit, bResult) Then
state.PushBoolean(bResult)
Return 1
Else
Return 0
End If
End Function
Dim nVarAddr As Integer = 0
Dim nMachine As Integer = 0
Private Function Lua_ComReadDoubleVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
Dim dResult As Double = 0
If Machine.ReadDoubleVar(nVarAddr, dResult) Then
state.PushBoolean(dResult)
Return 1
Else
Return 0
End If
End Function
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nMachine)
LuaClearStack(state)
Private Function Lua_ComWriteShortVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim nValue As Integer = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nValue)
LuaCheckParam(state, 3, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
If Machine.WriteShortVar(nVarAddr, nValue) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Dim nResult As Short = 0
Private Function Lua_ComWriteBitVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim nBit As Integer = 0
Dim bValue As Boolean = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nBit)
LuaCheckParam(state, 3, bValue)
LuaCheckParam(state, 4, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
If Machine.WriteBitVar(nVarAddr, nBit, bValue) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
If Machine.ReadShortVar(nVarAddr, nResult) Then
state.PushNumber(nResult)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_ComWriteDoubleVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim nVarAddr As Integer = 0
Dim dValue As Double = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, dValue)
LuaCheckParam(state, 3, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
If Machine.WriteDoubleVar(nVarAddr, dValue) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_WriteShortVar(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Private Function Lua_ExecProcess(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sFileName As String = ""
Dim sMainLuaPath As String = ""
Dim sArguments As String = ""
LuaCheckParam(state, 1, sFileName)
LuaCheckParam(state, 2, sMainLuaPath)
LuaCheckParam(state, 3, sArguments)
LuaClearStack(state)
If ExecProcessManager.ExecProcess(sFileName, sMainLuaPath, sArguments) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
' If state.Type(1) <> LuaType.String OrElse state.Type(2) <> LuaType.String Then Return 0
Dim nVarAddr As Integer = 0
Dim nValue As Integer = 0
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, nVarAddr)
LuaCheckParam(state, 2, nValue)
LuaCheckParam(state, 3, nMachine)
LuaClearStack(state)
' Dim bResult As Boolean = False
Dim Machine As NGP_COMM_DLL.NC.NC_generic
If nMachine = 1 Then
Machine = Map.refMainWindowVM.MachineManager.Machine1
Else
Machine = Map.refMainWindowVM.MachineManager.Machine2
End If
If Machine.WriteShortVar(nVarAddr, nValue) Then
state.PushNumber(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_Exec_EgtEngine(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' If state.Type(1) <> LuaType.String OrElse state.Type(2) <> LuaType.String Then Return 0
Dim sz_DDF_name As String
LuaCheckParam(state, 1, sz_DDF_name)
LuaClearStack(state)
Dim bResult As Boolean = False
'If Machine.WriteShortVar(nVarAddr, nValue) Then
' state.PushNumber(True)
' Return 1
'Else
' Return 0
'End If
End Function
Friend Function LuaInstallGeneral(state As Lua) As Boolean
If IsNothing(state) Then Return False
state.Register("EntIs64bit", func_EntIs64bit)
state.Register("EntOutLog", func_EntOutLog)
state.Register("EntExistsDirectory", func_EntExistsDirectory)
state.Register("EntCopyFile", func_EntCopyFile)
state.Register("EntGetIniFile", func_EntGetIniFile)
state.Register("EntGetNumberFromIni", func_EntGetNumberFromIni)
state.Register("EntGetStringFromIni", func_EntGetStringFromIni)
state.Register("EntWriteStringToIni", func_EntWriteStringToIni)
state.Register("RdsStringGet", func_RdsStringGet)
state.Register("RdsStringSetAsync", func_RdsStringSetAsync)
state.Register("RdsPublishAsync", func_RdsPublishAsync)
state.Register("ReadShortVar", func_ReadShortVar)
state.Register("WriteShortVar", func_WriteShortVar)
state.Register("print", func_print)
Return True
End Function
Friend Function LuaInstallGeneral(state As Lua) As Boolean
If IsNothing(state) Then Return False
state.Register("EntIs64bit", func_EntIs64bit)
state.Register("EntOutLog", func_EntOutLog)
state.Register("EntExistsDirectory", func_EntExistsDirectory)
state.Register("EntCopyFile", func_EntCopyFile)
state.Register("EntGetIniFile", func_EntGetIniFile)
state.Register("EntGetDataDir", func_EntGetDataDir)
state.Register("EntGetNumberFromIni", func_EntGetNumberFromIni)
state.Register("EntGetStringFromIni", func_EntGetStringFromIni)
state.Register("EntWriteStringToIni", func_EntWriteStringToIni)
state.Register("RdsStringGet", func_RdsStringGet)
state.Register("RdsStringSetAsync", func_RdsStringSetAsync)
state.Register("RdsPublishAsync", func_RdsPublishAsync)
state.Register("ComReadShortVar", func_ComReadShortVar)
state.Register("ComWriteShortVar", func_ComWriteShortVar)
state.Register("EntGetNextDoor", func_print)
Return True
End Function
End Module
+6
View File
@@ -1,5 +1,6 @@
Imports System.ComponentModel.Composition
Imports System.ComponentModel.Composition.Hosting
Imports Supervisor.Plugin.Interface
Public Class MEFLoader
@@ -41,6 +42,9 @@ Public Class MEFImporter(Of T)
<ImportMany(AllowRecomposition:=True)>
Public Property [imports] As IEnumerable(Of Lazy(Of T, IMetadata))
<Export>
Public Property SupervisorFunctions As IHost
Private Sub New()
End Sub
@@ -54,8 +58,10 @@ Public Class MEFImporter(Of T)
Protected Sub DoImport(ByVal path As String)
Dim catalog = New AggregateCatalog()
catalog.Catalogs.Add(directoryCatalog)
'catalog.Catalogs.Add(New AssemblyCatalog(System.Reflection.Assembly.GetCallingAssembly()))
catalog.Catalogs.Add(New AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly()))
Dim container As CompositionContainer = New CompositionContainer(catalog)
Me.SupervisorFunctions = New SupervisorFunctions
container.ComposeParts(Me)
End Sub
+67 -20
View File
@@ -1,36 +1,83 @@
Imports System.ComponentModel.Composition
Imports Supervisor.Plugin.Interface
<Export>
Public Class SupervisorFunctions
Implements IHost
Public Property PluginTestInfo As Integer Implements IHost.PluginTestInfo
Public ReadOnly Property PluginTestInfo As Integer Implements IHost.PluginTestInfo
Get
Return Map.refMainWindowVM.m_PluginTestInfo
End Get
Set(value As Integer)
Throw New NotImplementedException()
End Set
End Property
'Public Function PlgOutLog(sLogMsg As String) As Boolean Implements IHost.PlgOutLog
' Return EgtOutLog(sLogMsg)
'End Function
Public Function PlgOutLog(sLogMsg As String) As Boolean Implements IHost.PlgOutLog
Return EgtOutLog(sLogMsg)
End Function
'Public Function PlgGetPrivateProfileInt(lpAppName As String, lpKeyName As String, nDefault As Integer, lpFileName As String) As Integer Implements IHost.PlgGetPrivateProfileInt
' Return GetPrivateProfileInt(lpAppName, lpKeyName, nDefault, lpFileName)
'End Function
Public Function PlgGetPrivateProfileInt(lpAppName As String, lpKeyName As String, nDefault As Integer, lpFileName As String) As Integer Implements IHost.PlgGetPrivateProfileInt
Return GetPrivateProfileInt(lpAppName, lpKeyName, nDefault, lpFileName)
End Function
'Public Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double, lpFileName As String) As Double Implements IHost.PlgGetPrivateProfileDouble
' Return GetPrivateProfileDouble(lpAppName, lpKeyName, dDefault, lpFileName)
'End Function
Public Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double, lpFileName As String) As Double Implements IHost.PlgGetPrivateProfileDouble
Return GetPrivateProfileDouble(lpAppName, lpKeyName, dDefault, lpFileName)
End Function
'Public Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, lpFileName As String) As Integer Implements IHost.PlgGetPrivateProfileString
' Return GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, lpFileName)
'End Function
Public Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String, lpFileName As String) As Integer Implements IHost.PlgGetPrivateProfileString
Return GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString, lpFileName)
End Function
'Public Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean Implements IHost.PlgWritePrivateProfileString
' Return WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName)
'End Function
Public Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean Implements IHost.PlgWritePrivateProfileString
Return WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName)
End Function
Public Function PlgExecProcess(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean Implements IHost.PlgExecProcess
Return ExecProcessManager.ExecProcess(sFileName, sMainLuaPath, sArguments)
End Function
Public Function ComReadShortVar(nVarAddr As Integer, ByRef nResult As Short, nMachine As Integer) As Boolean Implements IHost.ComReadShortVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadShortVar(nVarAddr, nResult)
Else
Return False
End If
End Function
Public Function ComReadBitVar(nVarAddr As Integer, nBit As Integer, ByRef bResult As Boolean, nMachine As Integer) As Boolean Implements IHost.ComReadBitVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadBitVar(nVarAddr, nBit, bResult)
Else
Return False
End If
End Function
Public Function ComReadDoubleVar(nVarAddr As Integer, ByRef dResult As Double, nMachine As Integer) As Boolean Implements IHost.ComReadDoubleVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).ReadDoubleVar(nVarAddr, dResult)
Else
Return False
End If
End Function
Public Function ComWriteShortVar(nVarAddr As Integer, nValue As Integer, nMachine As Integer) As Boolean Implements IHost.ComWriteShortVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteShortVar(nVarAddr, nValue)
Else
Return False
End If
End Function
Public Function ComWriteBitVar(nVarAddr As Integer, nBit As Integer, bValue As Boolean, nMachine As Integer) As Boolean Implements IHost.ComWriteBitVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteBitVar(nVarAddr, nBit, bValue)
Else
Return False
End If
End Function
Public Function ComWriteDoubleVar(nVarAddr As Integer, dValue As Double, nMachine As Integer) As Boolean Implements IHost.ComWriteDoubleVar
If Map.refMainWindowVM.MachineManager.MachineList.Count >= nMachine AndAlso Not IsNothing(Map.refMainWindowVM.MachineManager.MachineList(nMachine)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine).WriteDoubleVar(nVarAddr, dValue)
Else
Return False
End If
End Function
End Class
+48 -45
View File
@@ -4,56 +4,56 @@ Imports Supervisor.Plugin.Interface
Public Class MainWindowVM
Friend m_PluginTestInfo As Integer = 764
Friend m_PluginTestInfo As Integer = 764
' Riferimento al Model della MainWindow
Private m_MainWindowM As MainWindowM
Friend ReadOnly Property MainWindowM As MainWindowM
Get
Return m_MainWindowM
End Get
End Property
' Riferimento al Model della MainWindow
Private m_MainWindowM As MainWindowM
Friend ReadOnly Property MainWindowM As MainWindowM
Get
Return m_MainWindowM
End Get
End Property
' Riferimento al gestore delle macchine a stati
Private m_FiniteStateMachineManager As FiniteStateMachineManager
Friend ReadOnly Property FiniteStateMachineManager As FiniteStateMachineManager
Get
Return m_FiniteStateMachineManager
End Get
End Property
' Riferimento al gestore delle macchine a stati
Private m_FiniteStateMachineManager As FiniteStateMachineManager
Friend ReadOnly Property FiniteStateMachineManager As FiniteStateMachineManager
Get
Return m_FiniteStateMachineManager
End Get
End Property
' Riferimento al gestore del della comunicazione macchine
Private m_MachineManager As MachineManager
Friend ReadOnly Property MachineManager As MachineManager
Get
Return m_MachineManager
End Get
End Property
' Riferimento al gestore del della comunicazione macchine
Private m_MachineManager As MachineManager
Friend ReadOnly Property MachineManager As MachineManager
Get
Return m_MachineManager
End Get
End Property
' Riferimento al gestore del server Redis
Private m_RedisManager As RedisManager
Friend ReadOnly Property RedisManager As RedisManager
Get
Return m_RedisManager
End Get
End Property
' Riferimento al gestore del server Redis
Private m_RedisManager As RedisManager
Friend ReadOnly Property RedisManager As RedisManager
Get
Return m_RedisManager
End Get
End Property
Private m_ContentPanel As Panel
Public Property ContentPanel As Panel
Get
Return m_ContentPanel
End Get
Set(value As Panel)
m_ContentPanel = value
End Set
End Property
Private m_ContentPanel As Panel
Public Property ContentPanel As Panel
Get
Return m_ContentPanel
End Get
Set(value As Panel)
m_ContentPanel = value
End Set
End Property
Sub New()
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
Map.BeginInit(Me)
' Creo Model della MainWindow
m_MainWindowM = New MainWindowM
Sub New()
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
Map.BeginInit(Me)
' Creo Model della MainWindow
m_MainWindowM = New MainWindowM
' creo gestore delle macchine a stati
m_FiniteStateMachineManager = New FiniteStateMachineManager
@@ -61,10 +61,13 @@ Public Class MainWindowVM
m_RedisManager = New RedisManager
End If
m_MachineManager = New MachineManager
m_MachineManager.Init()
' aggiungo Dictionary del plugin
Dim PluginDictionary As IPluginControl = GetDictionary(Of IPluginControl)("Supervisor.Plugin.FiveLakes")
Application.Current.Resources.MergedDictionaries.Add(PluginDictionary)
' aggiungo MainMenu dal plugin
'' aggiungo MainMenu dal plugin
Dim PluginMainMenu As IPluginControl = GetControlByName(Of IPluginControl)("Supervisor.Plugin.FiveLakes", "MainMenu")
'ContentPanel = PluginMainMenu
' aggiungo Project dal plugin
@@ -74,7 +77,7 @@ Public Class MainWindowVM
#Region "Plugin"
Private m_Loader As MEFLoader = New MEFLoader()
Private m_Loader As MEFLoader = New MEFLoader()
Private Function GetPathByName(sPluginFileName As String) As String
Return MainWindowM.sDataRoot & "\Plugin\" & sPluginFileName
+1 -2
View File
@@ -150,9 +150,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Comms\GenericCN.vb" />
<Compile Include="Comms\MachineManager.vb" />
<Compile Include="Comms\OsaiCn.vb" />
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="FiniteStateMachineManager\FiniteStateMachineManager.vb" />
@@ -161,6 +159,7 @@
<Compile Include="LUA\LuaManager.vb" />
<Compile Include="MEFPlugin\MefPlugin.vb" />
<Compile Include="MEFPlugin\SupervisorFunctions.vb" />
<Compile Include="Utility\ExecProcessManager.vb" />
<Compile Include="Utility\GenInterface.vb" />
<Compile Include="Utility\IniFile.vb" />
<Compile Include="LUA\Lua_General.vb" />
+28
View File
@@ -0,0 +1,28 @@
Module ExecProcessManager
Friend Function ExecProcess(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean
' lancio esecuzione programma
Dim bResult As Boolean = True
Dim Proc As New Process()
Proc.StartInfo.FileName = sFileName
Proc.StartInfo.RedirectStandardInput = False
Proc.StartInfo.RedirectStandardOutput = False
Proc.StartInfo.Arguments = 1.ToString() & " """ & sMainLuaPath & """ """ & sArguments & """"
Proc.StartInfo.UseShellExecute = False
Proc.StartInfo.CreateNoWindow = True
Dim ExecCounter = 0
If Proc.Start Then
While Not Proc.HasExited
If ExecCounter >= 100 Then
bResult = False
Proc.Kill()
Exit While
End If
Threading.Thread.Sleep(100)
ExecCounter += 1
End While
End If
Return bResult
End Function
End Module