- gestita abilitazione redis
- aggiunto Dictionary plugin
This commit is contained in:
+17
-1
@@ -1,6 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -26,6 +26,7 @@ Module ConstIni
|
||||
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"
|
||||
|
||||
End Module
|
||||
|
||||
@@ -161,23 +161,27 @@ Public Module Lua_General
|
||||
|
||||
Private Function Lua_RdsStringGet(ByVal p As IntPtr) As Integer
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
|
||||
EgtOutLog("Error! Trying to get string from a non existent redis!")
|
||||
LuaSetParam(state)
|
||||
Return 1
|
||||
End If
|
||||
' 1 parametro: sKey
|
||||
Dim sKey As String = ""
|
||||
LuaCheckParam(state, 1, sKey)
|
||||
LuaClearStack(state)
|
||||
Dim Result As RedisValue
|
||||
If Not IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
|
||||
Result = Map.refMainWindowVM.RedisManager.RedisDb.StringGet(sKey)
|
||||
' restituisco il risultato
|
||||
LuaSetParam(state, Result)
|
||||
Else
|
||||
' restituisco il risultato
|
||||
LuaSetParam(state, "")
|
||||
End If
|
||||
Result = Map.refMainWindowVM.RedisManager.RedisDb.StringGet(sKey)
|
||||
' restituisco il risultato
|
||||
LuaSetParam(state, Result)
|
||||
Return 1
|
||||
End Function
|
||||
|
||||
Private Function Lua_RdsStringSetAsync(ByVal p As IntPtr) As Integer
|
||||
If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
|
||||
EgtOutLog("Error! Trying to set string on a non existent redis!")
|
||||
Return 0
|
||||
End If
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
' 2 parametri: sKey, sVal
|
||||
Dim sKey As String = ""
|
||||
@@ -185,11 +189,15 @@ Public Module Lua_General
|
||||
LuaCheckParam(state, 1, sKey)
|
||||
LuaCheckParam(state, 2, sVal)
|
||||
LuaClearStack(state)
|
||||
If Not IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then Map.refMainWindowVM.RedisManager.RedisDb.StringSetAsync(sKey, sVal)
|
||||
Map.refMainWindowVM.RedisManager.RedisDb.StringSetAsync(sKey, sVal)
|
||||
Return 0
|
||||
End Function
|
||||
|
||||
Private Function Lua_RdsPublishAsync(ByVal p As IntPtr) As Integer
|
||||
If IsNothing(Map.refMainWindowVM.RedisManager) OrElse IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then
|
||||
EgtOutLog("Error! Trying to publish on a non existent redis!")
|
||||
Return 0
|
||||
End If
|
||||
Dim state = Lua.FromIntPtr(p)
|
||||
' 2 parametri: sKey, sVal
|
||||
Dim sChannel As String = ""
|
||||
@@ -197,7 +205,7 @@ Public Module Lua_General
|
||||
LuaCheckParam(state, 1, sChannel)
|
||||
LuaCheckParam(state, 2, sMessage)
|
||||
LuaClearStack(state)
|
||||
If Not IsNothing(Map.refMainWindowVM.RedisManager.Subscriber) Then Map.refMainWindowVM.RedisManager.Subscriber.PublishAsync(sChannel, sMessage)
|
||||
Map.refMainWindowVM.RedisManager.Subscriber.PublishAsync(sChannel, sMessage)
|
||||
Return 0
|
||||
End Function
|
||||
|
||||
|
||||
@@ -48,26 +48,31 @@ Public Class MainWindowVM
|
||||
|
||||
' creo gestore delle macchine a stati
|
||||
m_FiniteStateMachineManager = New FiniteStateMachineManager
|
||||
If GetMainPrivateProfileInt(S_REDIS, K_ENABLED, 0) = 1 Then
|
||||
m_RedisManager = New RedisManager
|
||||
End If
|
||||
|
||||
m_RedisManager = New RedisManager
|
||||
|
||||
Dim PluginUI As IPluginControl = GetControlByName(Of IPluginControl)("Supervisor.Plugin.FiveLakes")
|
||||
ContentPanel = PluginUI
|
||||
' aggiungo Dictionary del plugin
|
||||
Dim PluginDictionary As IPluginControl = GetDictionary(Of IPluginControl)("Supervisor.Plugin.FiveLakes")
|
||||
Application.Current.Resources.MergedDictionaries.Add(PluginDictionary)
|
||||
' aggiungo MainMenu dal plugin
|
||||
Dim PluginMainMenu As IPluginControl = GetControlByName(Of IPluginControl)("Supervisor.Plugin.FiveLakes", "MainMenu")
|
||||
'ContentPanel = PluginMainMenu
|
||||
' aggiungo Project dal plugin
|
||||
Dim ProjectPlugin As IPluginControl = GetControlByName(Of IPluginControl)("Supervisor.Plugin.FiveLakes", "Project")
|
||||
ContentPanel = ProjectPlugin
|
||||
End Sub
|
||||
|
||||
#Region "Plugin"
|
||||
|
||||
Private m_Loader As MEFLoader = New MEFLoader()
|
||||
|
||||
Private Function GetPathByName(ByVal name As String) As String
|
||||
'Dim PluginNameSplit() As String = name.Split("."c)
|
||||
'Dim res = MainWindowM.sDataRoot & "\Plugin\" & PluginNameSplit(0)
|
||||
Dim res = MainWindowM.sDataRoot & "\Plugin\" & name
|
||||
Return res
|
||||
Private Function GetPathByName(sPluginFileName As String) As String
|
||||
Return MainWindowM.sDataRoot & "\Plugin\" & sPluginFileName
|
||||
End Function
|
||||
|
||||
Friend Function GetControlByName(Of T)(sName As String) As Panel
|
||||
Dim PlugInControl As Object = m_Loader.LoadByTag(Of T)(GetPathByName(sName), sName).FirstOrDefault()
|
||||
Friend Function GetControlByName(Of T)(sPluginFileName As String, sPluginTagName As String) As Panel
|
||||
Dim PlugInControl As Object = m_Loader.LoadByTag(Of T)(GetPathByName(sPluginFileName), sPluginTagName).FirstOrDefault()
|
||||
Dim PluginPanel As Panel = Nothing
|
||||
If PlugInControl.GetType().BaseType.FullName = GetType(Panel).FullName OrElse PlugInControl.GetType().BaseType.FullName = GetType(Grid).FullName Then
|
||||
PluginPanel = TryCast(PlugInControl, Panel)
|
||||
@@ -75,6 +80,13 @@ Public Class MainWindowVM
|
||||
Return PluginPanel
|
||||
End Function
|
||||
|
||||
Friend Function GetDictionary(Of T)(sPluginFileName As String) As ResourceDictionary
|
||||
Dim DictionaryControl As Object = m_Loader.LoadByTag(Of T)(GetPathByName(sPluginFileName), "Dictionary").FirstOrDefault()
|
||||
Dim Dictionary As ResourceDictionary = Nothing
|
||||
Dictionary = TryCast(DictionaryControl, ResourceDictionary)
|
||||
Return DictionaryControl
|
||||
End Function
|
||||
|
||||
#End Region ' Plugin
|
||||
|
||||
End Class
|
||||
|
||||
@@ -73,8 +73,8 @@
|
||||
<Reference Include="KeraLua, Version=1.4.1.0, Culture=neutral, PublicKeyToken=6a194c04b9c89217, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\KeraLua.1.4.1\lib\net46\KeraLua.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\Plugin.Fivelakes\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
@@ -95,8 +95,8 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.1\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
<Reference Include="System.IO.Pipelines, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\Plugin.Fivelakes\packages\System.IO.Pipelines.6.0.0\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
@@ -108,8 +108,8 @@
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Channels, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.5.0.0\lib\net461\System.Threading.Channels.dll</HintPath>
|
||||
<Reference Include="System.Threading.Channels, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\Plugin.Fivelakes\packages\System.Threading.Channels.6.0.0\lib\net461\System.Threading.Channels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
|
||||
Module Map
|
||||
|
||||
Private m_refMainWindowVM As MainWindowVM
|
||||
'Private m_refMyStatusBarVM As MyStatusBarVM
|
||||
'Private m_refProjManagerVM As ProjManagerVM
|
||||
'Private m_refProjectVM As ProjectVM
|
||||
'Private m_refSecondaryWindowVM As SecondaryWindowVM
|
||||
'Private m_refSecondaryWindowV As SecondaryWindowV
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="KeraLua" version="1.4.1" targetFramework="net472" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" targetFramework="net472" />
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.2.8" targetFramework="net472" />
|
||||
<package id="StackExchange.Redis" version="2.7.33" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.IO.Compression" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="5.0.1" targetFramework="net472" />
|
||||
<package id="System.IO.Pipelines" version="6.0.0" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net472" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.Threading.Channels" version="5.0.0" targetFramework="net472" />
|
||||
<package id="System.Threading.Channels" version="6.0.0" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user