Merge branch 'develop' of https://gitlab.steamware.net/egalware-supervisor/ngp into develop
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
Imports NGP_COMM_DLL
|
||||
|
||||
Public Class MachineManager
|
||||
'
|
||||
'
|
||||
' !!!! TO DO : use a list of n machines, not just 2 !!!!
|
||||
'
|
||||
|
||||
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
|
||||
|
||||
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 Close()
|
||||
m_Machine1.Disconnect()
|
||||
m_Machine2.Disconnect()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -23,10 +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"
|
||||
|
||||
End Module
|
||||
|
||||
+246
-228
@@ -1,163 +1,163 @@
|
||||
Imports KeraLua
|
||||
Imports KeraLua
|
||||
Imports StackExchange.Redis
|
||||
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_ReadVariable As LuaFunction = AddressOf Lua_ReadVariable
|
||||
Friend func_WriteVariable As LuaFunction = AddressOf Lua_WriteVariable
|
||||
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
|
||||
|
||||
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_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_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_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_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_RdsStringGet(ByVal p As IntPtr) As Integer
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
@@ -209,93 +209,111 @@ Public Module Lua_General
|
||||
Return 0
|
||||
End Function
|
||||
|
||||
Private Function Lua_ReadVariable(ByVal p As IntPtr) As Integer
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
If state.Type(1) <> LuaType.String Then Return 0
|
||||
Dim sVarAddr As String = state.ToString(1, False)
|
||||
'state.Pop(1)
|
||||
Dim dResult As Double = 0
|
||||
If ReadVariable(sVarAddr, dResult) Then
|
||||
state.PushNumber(dResult)
|
||||
Return 1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End Function
|
||||
Private Function Lua_ReadShortVar(ByVal p As IntPtr) As Integer
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
|
||||
Private Function ReadVariable(sVarAddr As String, ByRef dResult As Double) As Boolean
|
||||
Select Case sVarAddr
|
||||
Case "a"
|
||||
dResult = 256
|
||||
Case "b"
|
||||
dResult = 257
|
||||
Case "c"
|
||||
dResult = 258
|
||||
Case "d"
|
||||
dResult = 259
|
||||
Case "e"
|
||||
dResult = 260
|
||||
Case "f"
|
||||
dResult = 261
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
Return True
|
||||
End Function
|
||||
' If state.Type(1) <> LuaType.String Then Return 0
|
||||
|
||||
Private Function Lua_WriteVariable(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 sVarAddr As String = state.ToString(1, False)
|
||||
Dim sValue As String = state.ToString(2, False)
|
||||
'state.Pop(2)
|
||||
Dim bResult As Boolean = False
|
||||
If WriteVariable(sVarAddr, sValue, bResult) Then
|
||||
state.PushBoolean(bResult)
|
||||
' state.PushInteger(If(bResult, 1, 0))
|
||||
Return 1
|
||||
Else
|
||||
Return 0
|
||||
End If
|
||||
End Function
|
||||
Dim nVarAddr As Integer = 0
|
||||
Dim nMachine As Integer = 0
|
||||
|
||||
Private Function WriteVariable(sVarAddr As String, sValue As String, ByRef bResult As Boolean) As Boolean
|
||||
Select Case sVarAddr
|
||||
Case "a"
|
||||
bResult = sValue = "abbecedario"
|
||||
Case "b"
|
||||
bResult = sValue = "bullone"
|
||||
Case "c"
|
||||
bResult = sValue = "cane"
|
||||
Case "d"
|
||||
bResult = sValue = "diario"
|
||||
Case "e"
|
||||
bResult = sValue = "elefante"
|
||||
Case "f"
|
||||
bResult = sValue = "foglia"
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
Return True
|
||||
End Function
|
||||
LuaCheckParam(state, 1, nVarAddr)
|
||||
LuaCheckParam(state, 2, nMachine)
|
||||
LuaClearStack(state)
|
||||
|
||||
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("ReadVariable", func_ReadVariable)
|
||||
state.Register("WriteVariable", func_WriteVariable)
|
||||
state.Register("print", func_print)
|
||||
Return True
|
||||
End Function
|
||||
Dim nResult As Short = 0
|
||||
|
||||
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_WriteShortVar(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 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
|
||||
|
||||
End Module
|
||||
|
||||
@@ -1,50 +1,59 @@
|
||||
Imports System.IO
|
||||
Imports System.IO
|
||||
Imports System.Windows.Threading
|
||||
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 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
|
||||
' 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
|
||||
|
||||
Sub New()
|
||||
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
|
||||
Map.BeginInit(Me)
|
||||
' Creo Model della MainWindow
|
||||
m_MainWindowM = New MainWindowM
|
||||
' 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
|
||||
|
||||
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
|
||||
@@ -65,7 +74,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,4 +1,4 @@
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -14,6 +14,21 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
@@ -79,6 +94,9 @@
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NGP_COMM_DLL">
|
||||
<HintPath>..\..\..\Users\carlo\Documents\Projects\vs2008\NGP_COMM_DLL\NGP_COMM_DLL\NGP_COMM_DLL\bin\Debug\NGP_COMM_DLL.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.2.8\lib\net472\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -133,6 +151,7 @@
|
||||
<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" />
|
||||
@@ -219,6 +238,18 @@
|
||||
<Name>Supervisor.Plugin.Interface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 e x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<Import Project="..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets" Condition="Exists('..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
Reference in New Issue
Block a user