22 Commits

Author SHA1 Message Date
Emmanuele Sassi 27f2ba0aae - aggiunta icona in taskbar 2024-09-18 11:31:40 +02:00
Emmanuele Sassi 66fd112ef7 - inizio modifica per mostrare messaggi da finitestatemachine 2024-09-18 11:04:47 +02:00
Emmanuele Sassi fc95ec8882 - aggiunta icona programma
- aggiunte a lua funzioni che accedono direttamente ad ini programma e funzione file exists
2024-09-12 09:54:17 +02:00
Emmanuele Sassi 8259a0d7d2 - spostato gestore macchine a stati dopo plugin
- rimosso parametro inutile da lettura ini supervisore da plugin
2024-09-11 10:07:13 +02:00
Emmanuele Sassi cb34b20d74 - aggiunte funzioni per lua sleep, DeleteFile, FileLength e CopyFileToNc
- nuova dll di comunicazione
2024-09-09 14:20:57 +02:00
Emmanuele Sassi f23608580f - corretto indice di creazione macchine per comunicazione
- gestito posizionamento e dimensione finestra
- aggiunta funzione SplitStrign per lua
- aggiunta barra sopra in MainWindow
- gestita finestra con riposizionamento, dimensioni, ecc
- gestita esecuzione asincrona
- aggiunta verifica esecuzione macchina stati
2024-09-03 11:27:59 +02:00
Emmanuele Sassi 84f191782b - corretto indici lista macchine
- eliminate chiamate di test da gestore macchine a stati
- anticipata caricamento comunicazione macchine rispetto alle macchine a stati
- allungato counter di esecuzione processi lanciati
- aggiunto dictionary
- iniziata gestione finestra custom
2024-08-23 19:08:06 +02:00
Emmanuele Sassi cf6e28662f Merge remote-tracking branch 'origin/develop' into develop 2024-08-22 15:45:59 +02:00
Carlo d0a6e11a0c - inserita EntExecProcess 2024-08-22 11:18:07 +02:00
Emmanuele Sassi 23a00eff4d Merge remote-tracking branch 'origin/develop' into develop 2024-08-19 17:16:41 +02:00
Carlo da19606163 - aggiunte definizioni funzioni lua comunicazione mancanti 2024-08-19 16:59:38 +02:00
Emmanuele Sassi 0056ac7801 - aggiunta lettura nome plugin da file ini 2024-08-19 15:40:33 +02:00
Emmanuele Sassi ffb77868db - aggiunta gestione LuaManager per plugin 2024-08-09 17:03:53 +02:00
Emmanuele Sassi fad64bb5b4 - implementata lista macchine configurabili
- aggiunte funzioni lua
- corretta esportazione funzioni per plugin
- aggiunta funzione che lancia eseguibile per cam
2024-08-09 11:42:31 +02:00
Emmanuele Sassi 4dcc1744e8 - cambiato riferimento dll comunicazione 2024-07-31 19:32:14 +02:00
Emmanuele Sassi 8ddca3d5a2 Merge branch 'develop' of https://gitlab.steamware.net/egalware-supervisor/ngp into develop 2024-07-31 18:44:20 +02:00
Emmanuele Sassi 0b655aeb09 - gestita abilitazione redis
- aggiunto Dictionary plugin
2024-07-31 18:39:49 +02:00
Carlo 38e9d55c14 scrittura codice 2 2024-07-31 16:52:52 +02:00
Emmanuele Sassi aff5e53493 - correzione sln 2024-07-24 09:54:11 +02:00
Emmanuele Sassi 706c959527 - aggiunta gestione redis non funzionante 2024-07-23 17:41:37 +02:00
Emmanuele Sassi 9add240f1d - commit iniziale 2024-07-23 15:56:02 +02:00
Emmanuele Sassi a920109e4d - aggiunto gitignore 2024-07-23 15:55:30 +02:00
47 changed files with 4628 additions and 0 deletions
+330
View File
@@ -0,0 +1,330 @@
# ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# ---> C Sharp
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/
# mstest test results
TestResults
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
packages
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
.ionide/symbolCache.db
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
Imports System.ComponentModel.Composition
<InheritedExport>
Public Interface IHost
ReadOnly Property PluginTestInfo As Integer
' ReadOnly Property FiniteStateMachineList As List(Of FiniteStateMachine)
Function PlgOutLog(sLogMsg As String) As Boolean
Function PlgGetPrivateProfileInt(lpAppName As String, lpKeyName As String, nDefault As Integer) As Integer
Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double) As Double
Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String) As Integer
Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String) As Boolean
Function PlgExecProcess(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean
Function PlgExecProcessAsync(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean
Function PlgCheckExecProcessAsync(ByRef bHasExited As Boolean, ByRef nExitCode As Integer) 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
@@ -0,0 +1,8 @@
Public Interface IPluginControl
'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, lpReturnedString As StringBuilder, nSize As Integer, lpFileName As String) As Integer
'Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean
End Interface
@@ -0,0 +1,8 @@
Public Interface IPluginLuaManager
Function PlgInit(state As Object) As Boolean
'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, lpReturnedString As StringBuilder, nSize As Integer, lpFileName As String) As Integer
'Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String, lpFileName As String) As Boolean
End Interface
@@ -0,0 +1,59 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Globalization
Imports System.Resources
Imports System.Windows
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Supervisor.Plugin.Interface")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Windows User")>
<Assembly: AssemblyProduct("Supervisor.Plugin.Interface")>
<Assembly: AssemblyCopyright("Copyright @ Windows User 2024")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> to "en-US". Then uncomment the
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
'below to match the UICulture setting in the project file.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
'1st parameter: where theme specific resource dictionaries are located
'(used if a resource is not found in the page,
' or application resource dictionaries)
'2nd parameter: where the generic resource dictionary is located
'(used if a resource is not found in the page,
'app, and any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("c2324e1b-e8d0-4e39-adb6-273a15914498")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:$clrversion$
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Supervisor.Plugin.Interface.My.MySettings
Get
Return Global.Supervisor.Plugin.Interface.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,119 @@
<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>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<RootNamespace>Supervisor.Plugin.Interface</RootNamespace>
<AssemblyName>Supervisor.Plugin.Interface</AssemblyName>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<MyType>Custom</MyType>
<Deterministic>true</Deterministic>
<ProjectGuid>{7D14D864-2BDC-4785-80F4-320164C2D5E4}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>true</IncrementalBuild>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>Supervisor.Plugin.Interface.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugSymbols>false</DebugSymbols>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<IncrementalBuild>false</IncrementalBuild>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>Supervisor.Plugin.Interface.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Shapes" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
</ItemGroup>
<ItemGroup>
<Compile Include="IHost.vb" />
<Compile Include="IPluginControl.vb" />
<Compile Include="IPluginLuaManager.vb" />
<Compile Include="My Project\AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
</EmbeddedResource>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<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
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>
+65
View File
@@ -0,0 +1,65 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Supervisor", "Supervisor\Supervisor.vbproj", "{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Supervisor.Plugin.Interface", "Supervisor.Plugin.Interface\Supervisor.Plugin.Interface.vbproj", "{7D14D864-2BDC-4785-80F4-320164C2D5E4}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Supervisor.Plugin.FiveLakes", "..\Plugin.FiveLakes\Supervisor.Plugin.FiveLakes\Supervisor.Plugin.FiveLakes.vbproj", "{7C77F537-8235-40AB-B24A-4E71CFB96D2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.ActiveCfg = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|Any CPU.Build.0 = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.ActiveCfg = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x64.Build.0 = Debug|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.ActiveCfg = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Debug|x86.Build.0 = Debug|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.ActiveCfg = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|Any CPU.Build.0 = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.ActiveCfg = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x64.Build.0 = Release|x64
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.ActiveCfg = Release|x86
{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}.Release|x86.Build.0 = Release|x86
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x64.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Debug|x86.Build.0 = Debug|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|Any CPU.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x64.Build.0 = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.ActiveCfg = Release|Any CPU
{7D14D864-2BDC-4785-80F4-320164C2D5E4}.Release|x86.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x64.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Debug|x86.Build.0 = Debug|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x64.Build.0 = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.ActiveCfg = Release|Any CPU
{7C77F537-8235-40AB-B24A-4E71CFB96D2C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9D87F62-BDA1-4B0C-BE15-C43A682829E8}
EndGlobalSection
EndGlobal
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<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" />
<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>
+10
View File
@@ -0,0 +1,10 @@
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Supervisor">
<Application.Resources>
<ResourceDictionary Source="Utility/Dictionary.xaml"/>
</Application.Resources>
</Application>
+16
View File
@@ -0,0 +1,16 @@
Class Application
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
' can be handled in this file.
Protected Overrides Sub OnStartup(e As StartupEventArgs)
MyBase.OnStartup(e)
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
' Creo la View principale
Dim MainWindowVM As New MainWindowVM
Me.MainWindow = New MainWindowV
Me.MainWindow.DataContext = MainWindowVM
' Mostro la View principale
Me.MainWindow.Show()
End Sub
End Class
+56
View File
@@ -0,0 +1,56 @@
Imports NGP_COMM_DLL
Public Class MachineManager
'
'
' !!!! 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
Sub New()
End Sub
Sub Init()
If GetMainPrivateProfileInt(S_NC, K_NC_SIMULATE, 0) = 1 Then
Dim nMachineIndex As Integer = 0
Dim sMachine As String = ""
While GetMainPrivateProfileString(S_NC, K_MACHINE & (nMachineIndex + 1).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 - 1) = NewOsaiOpen
End If
End Select
End If
nMachineIndex += 1
End While
End If
End Sub
Sub Close()
For Each Machine In m_MachineList
If Not IsNothing(Machine) Then
Machine.Disconnect()
End If
Next
End Sub
End Class
+74
View File
@@ -0,0 +1,74 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2017
'----------------------------------------------------------------------------
' File : ConstGen.vb Data : 08.05.24 Versione : 2.6e1
' Contenuto : Modulo costanti generali.
'
'
'
' Modifiche : 08.05.24 ES Creazione modulo.
'
'
'----------------------------------------------------------------------------
Public Module ConstGen
' File con direttorio radice dei dati
Public Const DAT_FILE_NAME As String = "DataRoot.Ini"
Public Const S_DATA As String = "Data"
Public Const K_DATAROOT As String = "DataRoot"
' File con dati di licenza
Public Const LIC_FILE_NAME As String = "EgtBEAMWALL.lic"
Public Const S_LICENCE As String = "Licence"
Public Const K_LOCKID As String = "LockId"
Public Const K_KEY As String = "Key"
' Abilitazioni licenza
Public Enum KEY_OPT As UInteger
SUPERVISOR = 1
'WALL = 2
'NESTING_AUTO = 4
'SUPERVISOR = 8
'NETWORK = 16
'ANY_DB = 32
End Enum
' File di log generale
Public Const GENLOG_FILE_NAME As String = "Supervisor#.txt"
' Sottodirettorio di configurazione
Public Const CONF_DIR As String = "Config"
' Sottodirettorio delle risorse
Public Const RES_DIR As String = "Resources"
' Sottodirettorio script
Public Const SCRIPT_DIR As String = "Script"
' Sottodirettorio temporaneo
Public Const TEMP_DIR As String = "Temp"
'' Sottodirettorio per Cam automatico
'Public Const PROJS_DIR As String = "Projs"
'' Sottodirettorio per Csv automatico
'Public Const PRODS_DIR As String = "Prods"
'' Sottodirettorio per Macro
'Public Const MACRO_DIR As String = "Macro"
'' Sottodirettorio per Magazzino
'Public Const WAREHOUSE_DIR As String = "Warehouse"
'' Sottodirettorio per lavorazioni travi
'Public Const BEAM_DIR As String = "Beam"
'' Sottodirettorio per lavorazioni pareti
'Public Const WALL_DIR As String = "Wall"
'' Sottodirettorio di default per il salvataggio con nome
'Public Const SAVE_DFL_NAMEDIR As String = "MyProjects"
'' Sottodirettorio di default per le macchine
'Public Const MACHINES_DFL_DIR As String = "Machines"
'' Sottodirettorio di default per toolmakers
'Public Const TOOLMAKERS_DFL_DIR As String = "ToolMakers"
'' Nome file Lua con le funzioni di attrezzaggio
'Public Const SETUP_LUA As String = "SetUp.lua"
'' Nome eseguibile per stampa
'Public Const ZEBRAPRINTER_EXE As String = "ZebraPrinterUtilitiesD32.exe"
'' Sottodirettorio di default per macro
'Public Const MACRO_DFL_DIR As String = "Macro"
End Module
+39
View File
@@ -0,0 +1,39 @@
'----------------------------------------------------------------------------
' EgalTech 2015-2024
'----------------------------------------------------------------------------
' File : ConstIni.vb Data : 08.05.24 Versione : 2.6e1
' Contenuto : Modulo costanti sezione e chiavi per file Ini.
'
'
'
' Modifiche : 08.05.24 ES Creazione modulo.
'
'
'----------------------------------------------------------------------------
Module ConstIni
Public Const INI_FILE_NAME As String = "Supervisor.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_USERLEVEL As String = "UserLevel"
'Public Const K_MAXINST As String = "MaxInstances"
Public Const K_INSTANCES As String = "Instances"
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_PLUGINNAME As String = "PluginName"
Public Const K_WINPLACE = "WinPlace"
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_MACHINE As String = "Machine"
End Module
+35
View File
@@ -0,0 +1,35 @@
Public Class FiniteStateMachine
Private m_bLuaExecuted As Boolean
Public ReadOnly Property bLuaExecuted As Boolean
Get
Return m_bLuaExecuted
End Get
End Property
Private m_State As Integer
Private m_sLuaPath As String
Friend ReadOnly Property sLuaPath As String
Get
Return m_sLuaPath
End Get
End Property
Private m_sMessageText As String = ""
Friend ReadOnly Property sMessageText As String
Get
Return m_sMessageText
End Get
End Property
Friend Sub SetMessageText(sText As String)
m_sMessageText = sText
End Sub
Sub New(sLuaPath As String)
m_sLuaPath = sLuaPath
m_bLuaExecuted = LuaManager.ExecFile(Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sLuaPath)
EgtOutLog(m_sLuaPath & " execution " & If(m_bLuaExecuted, "ok", "failed"))
End Sub
End Class
@@ -0,0 +1,106 @@
Imports System.IO
Imports System.Windows.Threading
Public Class FiniteStateMachineManager
Private m_FiniteStateMachineTimer As New DispatcherTimer
Private m_FiniteStateMachineList As New List(Of FiniteStateMachine)
Friend ReadOnly Property FiniteStateMachineList As List(Of FiniteStateMachine)
Get
Return m_FiniteStateMachineList
End Get
End Property
Private m_PreProcPath As String = ""
Private m_PostProcPath As String = ""
Sub New()
' leggo file inizializzazione variabili lua
Dim sLuaInitPath As String = ""
If GetMainPrivateProfileString(S_GENERAL, K_INITLUA, "", sLuaInitPath) > 0 Then
LuaManager.ExecFile(Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sLuaInitPath)
End If
'' leggo configurazioni
'Dim sPreProcName As String = ""
'If GetMainPrivateProfileString(S_GENERAL, K_PREPROC, "", sPreProcName) > 0 AndAlso
' Not String.IsNullOrWhiteSpace(sPreProcName) Then
' m_PreProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPreProcName
' If File.Exists(m_PreProcPath) Then
' ' lancio esecuzione file preprocessore
' LuaManager.SetGlobVar("PREPROC.ERROR", 0)
' LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
' LuaManager.ExecFile(m_PreProcPath)
' Dim nError As Integer = 0
' If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
' nError = 1
' End If
' If nError > 0 Then
' Dim sErrorMsg As String = ""
' If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
' EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
' End If
' End If
' End If
'End If
'Dim sPostProcName As String = ""
'If GetMainPrivateProfileString(S_GENERAL, K_POSTPROC, "", sPostProcName) > 0 AndAlso
' Not String.IsNullOrWhiteSpace(m_PostProcPath) Then
' m_PostProcPath = Map.refMainWindowVM.MainWindowM.sScriptDir & "\" & sPostProcName
' If File.Exists(m_PostProcPath) Then
' LuaManager.ExecFile(m_PostProcPath)
' End If
'End If
Dim nIndex As Integer = 1
Dim sMachineState As String = ""
While GetMainPrivateProfileString(S_GENERAL, K_MACHINESTATE & nIndex.ToString(), "", sMachineState) > 0
m_FiniteStateMachineList.Add(New FiniteStateMachine(sMachineState))
nIndex += 1
End While
' avvio timer macchine a stati
m_FiniteStateMachineTimer.Interval = New TimeSpan(500)
AddHandler m_FiniteStateMachineTimer.Tick, AddressOf FiniteStateMachineTimer_Tick
m_FiniteStateMachineTimer.Start()
End Sub
'Private m_bFiniteStateMachineExecuting As Boolean = False
Private Sub FiniteStateMachineTimer_Tick(sender As Object, e As EventArgs)
'If m_bFiniteStateMachineExecuting Then Return
'm_bFiniteStateMachineExecuting = True
' lancio esecuzione macchine a stati
For nMachineIndex = 0 To m_FiniteStateMachineList.Count - 1
If m_FiniteStateMachineList(nMachineIndex).bLuaExecuted Then
LuaManager.ExecLuaFunction("MACHINE" & (nMachineIndex + 1).ToString() & "_Tick", -1, Nothing)
End If
Next
'' lancio esecuzione preprocessore
'LuaManager.SetGlobVar("PREPROC.ERROR", 0)
'LuaManager.SetGlobVar("PREPROC.ERROR_MSG", "")
'LuaManager.ExecLuaFunction("PREPROC_Tick", -1, Nothing)
'Dim nError As Integer = 0
'If Not LuaManager.GetGlobVar("PREPROC.ERROR", nError) Then
' nError = 1
'End If
'If nError > 0 Then
' Dim sErrorMsg As String = ""
' If LuaManager.GetGlobVar("PREPROC.ERROR_MSG", sErrorMsg) Then
' EgtOutLog("Error in PreProc! #" & nError & ":" & sErrorMsg)
' End If
'End If
' lancio esecuzione postprocessore
'LuaManager.ExecLuaFunction("Tick", -1, Nothing)
'm_bFiniteStateMachineExecuting = False
End Sub
Friend Sub ResetFiniteStateMachineTimer()
If Not IsNothing(m_FiniteStateMachineTimer) AndAlso m_FiniteStateMachineTimer.IsEnabled Then
m_FiniteStateMachineTimer.Stop()
RemoveHandler m_FiniteStateMachineTimer.Tick, AddressOf FiniteStateMachineTimer_Tick
m_FiniteStateMachineTimer = Nothing
End If
End Sub
End Class
+152
View File
@@ -0,0 +1,152 @@
Imports System
Imports System.Diagnostics
Imports System.IO
Imports KeraLua
Imports Supervisor.Plugin.Interface
Public Module LuaManager
Private m_state As Lua
Friend ReadOnly Property state As Lua
Get
Return m_state
End Get
End Property
Friend Function SetGlobVar(sName As String, bValue As Boolean) As Boolean
Return Lua_Aux.LuaSetGlobVar(m_state, sName, bValue)
End Function
Friend Function SetGlobVar(sName As String, nValue As Integer) As Boolean
Return Lua_Aux.LuaSetGlobVar(m_state, sName, nValue)
End Function
Friend Function SetGlobVar(sName As String, dValue As Double) As Boolean
Return Lua_Aux.LuaSetGlobVar(m_state, sName, dValue)
End Function
Friend Function SetGlobVar(sName As String, sValue As String) As Boolean
Return Lua_Aux.LuaSetGlobVar(m_state, sName, sValue)
End Function
Friend Function GetGlobVar(sName As String, ByRef bValue As Boolean) As Boolean
Return Lua_Aux.LuaGetGlobVar(m_state, sName, bValue)
End Function
Friend Function GetGlobVar(sName As String, ByRef nValue As Integer) As Boolean
Return Lua_Aux.LuaGetGlobVar(m_state, sName, nValue)
End Function
Friend Function GetGlobVar(sName As String, ByRef dValue As Double) As Boolean
Return Lua_Aux.LuaGetGlobVar(m_state, sName, dValue)
End Function
Friend Function GetGlobVar(sName As String, ByRef sValue As String) As Boolean
Return Lua_Aux.LuaGetGlobVar(m_state, sName, sValue)
End Function
Friend Function CreateGlobTable(sName As String) As Boolean
Return Lua_Aux.LuaCreateGlobTable(m_state, sName)
End Function
Public Function ExecFile(ByVal sPath As String) As Boolean
' verifico ambiente lua
If IsNothing(m_state) Then Return False
' eseguo la linea
Dim result As LuaStatus = m_state.LoadFile(sPath)
Dim sError As String = String.Empty
If result <> LuaStatus.OK Then
sError = m_state.ToString(1)
EgtOutLog("Fail loading file: " & sPath & "ERROR:" & sError)
End If
result = m_state.PCall(0, -1, 0)
If result <> LuaStatus.OK Then
sError = m_state.ToString(1)
m_state.Pop(1)
EgtOutLog("Fail calling file: " & sPath & " ERROR: " & If(String.IsNullOrWhiteSpace(sError), "Unknown", sError))
End If
Return result = LuaStatus.OK
End Function
Public Function ExecLuaFunction(ByVal sName As String, nReturns As Integer, Params() As Object) As Boolean
' recupero la funzione
If Not sName.Contains("."c) Then
' e' direttamente la funzione
m_state.GetGlobal(sName)
Else
' e' in una table
Dim sTableName As String = "", sFunctionName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sFunctionName = sParams(1)
m_state.GetGlobal(sTableName)
If Not m_state.IsTable(-1) Then Return False
m_state.GetField(-1, sFunctionName)
' porto la funzione uno slot sotto e diminuisco lo stack di uno (per essere come caso sopra)
m_state.Copy(-1, -2)
m_state.Pop(1)
End If
Dim nParamCount = 0
If Not IsNothing(Params) Then
' numero di parametri
nParamCount = Params.Count()
' inserisco i parametri sullo stack
For Each Param In Params
Select Case Param.GetType()
Case GetType(Boolean)
m_state.PushBoolean(CBool(Param))
Case GetType(Integer)
m_state.PushInteger(CInt(Param))
Case GetType(Double)
m_state.PushNumber(CDbl(Param))
Case GetType(String)
m_state.PushString(CStr(Param))
End Select
Next
End If
' eseguo la chiamata
Dim result As LuaStatus = m_state.PCall(nParamCount, -1, 0)
' senza errori
If result = LuaStatus.OK Then
Return True
Else
' recupero il messaggio di errore
Dim sError As String = m_state.ToString(-1)
m_state.Pop(1)
EgtOutLog("Fail calling function: " & sName & " ERROR: " & sError)
Return False
End If
End Function
Public Function Init() As Boolean
' se già aperto, lo fermo per riavviarlo
If Not IsNothing(m_state) Then
m_state.Close()
m_state = Nothing
End If
' inizializzo Lua
m_state = New Lua()
If IsNothing(m_state) Then
EgtOutLog("Error in Lua interpreter starting (LuaManager.Init)")
Return False
End If
' carico le librerie standard
m_state.OpenLibs()
If Not LuaInstallGeneral(m_state) Then
Return False
End If
Return True
End Function
Public Function Close() As Boolean
' verifico ambiente lua
If IsNothing(m_state) Then Return False
' termino Lua
m_state.Close()
m_state = Nothing
Return True
End Function
End Module
+377
View File
@@ -0,0 +1,377 @@
Imports KeraLua
Public Module Lua_Aux
Friend Function LuaClearStack(state As Lua)
Dim nIndex As Integer = state.GetTop()
If nIndex > 0 Then
state.Pop(nIndex)
End If
Return True
End Function
Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef bValue As Boolean)
If Not LuaGetParam(state, nIndex, bValue) Then
Return state.Error(" Invalid Parameter # " & nIndex)
End If
Return True
End Function
Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef nValue As Integer)
If Not LuaGetParam(state, nIndex, nValue) Then
Return state.Error(" Invalid Parameter # " & nIndex)
End If
Return True
End Function
Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef dValue As Double)
If Not LuaGetParam(state, nIndex, dValue) Then
Return state.Error(" Invalid Parameter # " & nIndex)
End If
Return True
End Function
Friend Function LuaCheckParam(state As Lua, nIndex As Integer, ByRef sValue As String)
If Not LuaGetParam(state, nIndex, sValue) Then
Return state.Error(" Invalid Parameter # " & nIndex)
End If
Return True
End Function
Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef bValue As Boolean) As Boolean
If Not state.IsBoolean(nIndex) Then Return False
bValue = state.ToBoolean(nIndex)
Return True
End Function
Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef nValue As Integer) As Boolean
If Not state.IsNumber(nIndex) Then Return False
nValue = Math.Round(state.ToNumber(nIndex))
Return True
End Function
Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef dValue As Double) As Boolean
If Not state.IsNumber(nIndex) Then Return False
dValue = state.ToNumber(nIndex)
Return True
End Function
Friend Function LuaGetParam(state As Lua, nIndex As Integer, ByRef sValue As String) As Boolean
If Not state.IsString(nIndex) Then Return False
sValue = state.ToString(nIndex)
Return True
End Function
Friend Function LuaSetParam(state As Lua) As Boolean
Try
state.PushNil()
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaSetParam(state As Lua, ByRef bValue As Boolean) As Boolean
Try
state.PushBoolean(bValue)
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaSetParam(state As Lua, ByRef nValue As Integer) As Boolean
Try
state.PushInteger(nValue)
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaSetParam(state As Lua, ByRef dValue As Double) As Boolean
Try
state.PushNumber(dValue)
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaSetParam(state As Lua, ByRef sValue As String) As Boolean
Try
state.PushString(sValue)
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaSetParam(state As Lua, ByRef sValue() As String) As Boolean
Try
Dim nSize As Integer = sValue.Count()
state.CreateTable(nSize, 0)
For nIndex = 0 To nSize - 1
state.PushString(sValue(nIndex))
state.RawSetInteger(-2, nIndex)
Next
Catch ex As Exception
Return False
End Try
Return True
End Function
Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef bValue As Boolean) As Boolean
If Not state.IsTable(nIndex) Then Return False
state.GetField(nIndex, sVarName)
Dim bResult As Boolean = LuaGetParam(state, -1, bValue)
state.Pop(1)
Return bResult
End Function
Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef nValue As Integer) As Boolean
If Not state.IsTable(nIndex) Then Return False
state.GetField(nIndex, sVarName)
Dim bResult As Boolean = LuaGetParam(state, -1, nValue)
state.Pop(1)
Return bResult
End Function
Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef dValue As Double) As Boolean
If Not state.IsTable(nIndex) Then Return False
state.GetField(nIndex, sVarName)
Dim bResult As Boolean = LuaGetParam(state, -1, dValue)
state.Pop(1)
Return bResult
End Function
Friend Function LuaGetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef sValue As String) As Boolean
If Not state.IsTable(nIndex) Then Return False
state.GetField(nIndex, sVarName)
Dim bResult As Boolean = LuaGetParam(state, -1, sValue)
state.Pop(1)
Return bResult
End Function
Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef bValue As Boolean) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
state.GetGlobal(sName)
Dim bResult As Boolean = LuaGetParam(state, -1, bValue)
state.Pop(1)
Return bResult
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, bValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef nValue As Integer) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
state.GetGlobal(sName)
Dim bResult As Boolean = LuaGetParam(state, -1, nValue)
state.Pop(1)
Return bResult
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, nValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef dValue As Double) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
state.GetGlobal(sName)
Dim bResult As Boolean = LuaGetParam(state, -1, dValue)
state.Pop(1)
Return bResult
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, dValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaGetGlobVar(state As Lua, ByRef sName As String, ByRef sValue As String) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
state.GetGlobal(sName)
Dim bResult As Boolean = LuaGetParam(state, -1, sValue)
state.Pop(1)
Return bResult
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaGetTabFieldParam(state, -1, sVarName, sValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String) As Boolean
If Not state.IsTable(nIndex) Then Return False
If Not LuaSetParam(state) Then Return False
Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
state.SetField(nPos, sVarName)
Return True
End Function
Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef bValue As Boolean) As Boolean
If Not state.IsTable(nIndex) Then Return False
If Not LuaSetParam(state, bValue) Then Return False
Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
state.SetField(nPos, sVarName)
Return True
End Function
Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef nValue As Integer) As Boolean
If Not state.IsTable(nIndex) Then Return False
If Not LuaSetParam(state, nValue) Then Return False
Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
state.SetField(nPos, sVarName)
Return True
End Function
Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef dValue As Double) As Boolean
If Not state.IsTable(nIndex) Then Return False
If Not LuaSetParam(state, dValue) Then Return False
Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
state.SetField(nPos, sVarName)
Return True
End Function
Friend Function LuaSetTabFieldParam(state As Lua, nIndex As Integer, sVarName As String, ByRef sValue As String) As Boolean
If Not state.IsTable(nIndex) Then Return False
If Not LuaSetParam(state, sValue) Then Return False
Dim nPos As Integer = (If(nIndex > 0, nIndex, nIndex - 1))
state.SetField(nPos, sVarName)
Return True
End Function
Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef bValue As Boolean) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
If Not LuaSetParam(state, bValue) Then Return False
state.SetGlobal(sName)
Return True
' altrimenti campo di tabella
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, bValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef nValue As Integer) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
If Not LuaSetParam(state, nValue) Then Return False
state.SetGlobal(sName)
Return True
' altrimenti campo di tabella
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, nValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef dValue As Double) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
If Not LuaSetParam(state, dValue) Then Return False
state.SetGlobal(sName)
Return True
' altrimenti campo di tabella
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, dValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaSetGlobVar(state As Lua, ByRef sName As String, ByRef sValue As String) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
If Not LuaSetParam(state, sValue) Then Return False
state.SetGlobal(sName)
Return True
' altrimenti campo di tabella
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName, sValue)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaResetGlobVar(state As Lua, ByRef sName As String) As Boolean
' se variabile standard
If Not sName.Contains("."c) Then
If Not LuaSetParam(state) Then Return False
state.SetGlobal(sName)
Return True
' altrimenti campo di tabella
Else
Dim sTableName As String = "", sVarName As String = ""
Dim sParams() As String = sName.Split("."c)
sTableName = sParams(0)
sVarName = sParams(1)
state.GetGlobal(sTableName)
Dim bResult As Boolean = LuaSetTabFieldParam(state, -1, sVarName)
state.Pop(1)
Return bResult
End If
End Function
Friend Function LuaCreateGlobTable(state As Lua, ByRef sName As String) As Boolean
Try
state.NewTable()
state.SetGlobal(sName)
Catch ex As Exception
Return False
End Try
Return True
End Function
End Module
+550
View File
@@ -0,0 +1,550 @@
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
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
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_EntFileExists As LuaFunction = AddressOf Lua_EntFileExists
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_EntGetMainNumberFromIni As LuaFunction = AddressOf Lua_EntGetMainNumberFromIni
Friend func_EntGetMainStringFromIni As LuaFunction = AddressOf Lua_EntGetMainStringFromIni
Friend func_EntWriteMainStringToIni As LuaFunction = AddressOf Lua_EntWriteMainStringToIni
Friend func_EntSplitString As LuaFunction = AddressOf Lua_EntSplitString
Friend func_EntSleep As LuaFunction = AddressOf Lua_EntSleep
Friend func_EntDeleteFile As LuaFunction = AddressOf Lua_EntDeleteFile
Friend func_EntFileLength As LuaFunction = AddressOf Lua_EntFileLength
Friend func_EntExecProcess As LuaFunction = AddressOf Lua_EntExecProcess
Friend func_EntStateMachineOutText As LuaFunction = AddressOf Lua_EntStateMachineOutText
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
Friend func_ComReadDoubleVar As LuaFunction = AddressOf Lua_ComReadDoubleVar
Friend func_ComWriteDoubleVar As LuaFunction = AddressOf Lua_ComWriteDoubleVar
Friend func_ComReadBitVar As LuaFunction = AddressOf Lua_ComReadBitVar
Friend func_ComWriteBitVar As LuaFunction = AddressOf Lua_ComWriteBitVar
Friend func_ComCopyFileToNc As LuaFunction = AddressOf Lua_ComCopyFileToNc
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_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_EntFileExists(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 1 parametro : sDir
Dim sFilePath As String = ""
LuaCheckParam(state, 1, sFilePath)
LuaClearStack(state)
Dim bResult As Boolean
Try
' verifico esistenza direttorio
bResult = File.Exists(sFilePath)
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntExistsDirectory on " & sFilePath & " 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_EntDeleteFile(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 2 parametri : sFile, sNewFile
Dim sSourcePath As String = ""
LuaCheckParam(state, 1, sSourcePath)
LuaClearStack(state)
Dim bResult As Boolean
Try
' copio il file
File.Delete(sSourcePath)
bResult = True
Catch ex As Exception
bResult = False
EgtOutLog("Lua_EntDeleteFile" & sSourcePath & " 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_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_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 dResult As Double = GetPrivateProfileDouble(sSec, sKey, dDef, sIniFile)
' restituisco il risultato
LuaSetParam(state, dResult)
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_EntGetMainNumberFromIni(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
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, dDef)
LuaClearStack(state)
Dim dResult As Double = GetMainPrivateProfileDouble(sSec, sKey, dDef)
' restituisco il risultato
LuaSetParam(state, dResult)
Return 1
End Function
Private Function Lua_EntGetMainStringFromIni(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
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sDef)
LuaClearStack(state)
Dim sResult As String = ""
GetMainPrivateProfileString(sSec, sKey, sDef, sResult)
' restituisco il risultato
LuaSetParam(state, sResult)
Return 1
End Function
Private Function Lua_EntWriteMainStringToIni(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
LuaCheckParam(state, 1, sSec)
LuaCheckParam(state, 2, sKey)
LuaCheckParam(state, 3, sVal)
LuaClearStack(state)
Dim bResult As Boolean = WriteMainPrivateProfileString(sSec, sKey, sVal)
' restituisco il risultato
LuaSetParam(state, bResult)
Return 1
End Function
Private Function Lua_EntSplitString(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal, sIniFile
Dim sVal As String = ""
Dim sSeparator As Char = ","c
LuaCheckParam(state, 1, sVal)
LuaGetParam(state, 2, sSeparator)
LuaClearStack(state)
Dim sSplitString() As String = sVal.Split(sSeparator)
' restituisco il risultato
LuaSetParam(state, sSplitString)
Return 1
End Function
Private Function Lua_EntSleep(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal, sIniFile
Dim nSleepTime As Integer = 0
LuaCheckParam(state, 1, nSleepTime)
LuaClearStack(state)
Threading.Thread.Sleep(nSleepTime)
Return 0
End Function
Private Function Lua_EntFileLength(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
' 4 parametri: sSec, sKey, sVal, sIniFile
Dim sFilePath As String = 0
LuaCheckParam(state, 1, sFilePath)
LuaClearStack(state)
If String.IsNullOrWhiteSpace(sFilePath) Then Return 0
Dim FileInfo As New FileInfo(sFilePath)
If IsNothing(FileInfo) Then Return 0
LuaSetParam(state, FileInfo.Length)
Return 1
End Function
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
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 = ""
Dim sVal As String = 0
LuaCheckParam(state, 1, sKey)
LuaCheckParam(state, 2, sVal)
LuaClearStack(state)
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 = ""
Dim sMessage As String = 0
LuaCheckParam(state, 1, sChannel)
LuaCheckParam(state, 2, sMessage)
LuaClearStack(state)
Map.refMainWindowVM.RedisManager.Subscriber.PublishAsync(sChannel, sMessage)
Return 0
End Function
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
Dim nResult As Short = 0
If Machine.ReadShortVar(nVarAddr, nResult) Then
state.PushInteger(nResult)
Return 1
Else
Return 0
End If
End Function
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
Dim bResult As Boolean = 0
If Machine.ReadBitVar(nVarAddr, nBit, bResult) Then
state.PushBoolean(bResult)
Return 1
Else
Return 0
End If
End Function
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
Dim dResult As Double = 0
If Machine.ReadDoubleVar(nVarAddr, dResult) Then
state.PushNumber(dResult)
Return 1
Else
Return 0
End If
End Function
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
If Machine.WriteShortVar(nVarAddr, nValue) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
If Machine.WriteBitVar(nVarAddr, nBit, bValue) Then
state.PushBoolean(True)
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 = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
If Machine.WriteDoubleVar(nVarAddr, dValue) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_ComCopyFileToNc(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sSourcePath As String = ""
Dim sDestPath As String = ""
Dim nMachine As Integer = 0
LuaCheckParam(state, 1, sSourcePath)
LuaCheckParam(state, 2, sDestPath)
LuaCheckParam(state, 3, nMachine)
LuaClearStack(state)
Dim Machine As NGP_COMM_DLL.NC.NC_generic = Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1)
If Machine.CopyFileToNc(sSourcePath, sDestPath) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_EntExecProcess(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
Private Function Lua_EntStateMachineOutText(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sMessage As String = ""
Dim nStateMachine As Integer = 0
LuaCheckParam(state, 1, sMessage)
LuaCheckParam(state, 2, nStateMachine)
LuaClearStack(state)
Dim StateMachine As FiniteStateMachine = Map.refMainWindowVM.FiniteStateMachineManager.FiniteStateMachineList(nStateMachine - 1)
StateMachine.SetMessageText(sMessage)
Return 0
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("EntFileExists", func_EntFileExists)
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("EntGetMainNumberFromIni", func_EntGetMainNumberFromIni)
state.Register("EntGetMainStringFromIni", func_EntGetMainStringFromIni)
state.Register("EntWriteMainStringToIni", func_EntWriteMainStringToIni)
state.Register("EntSplitString", func_EntSplitString)
state.Register("EntSleep", func_EntSleep)
state.Register("EntFileLength", func_EntFileLength)
state.Register("EntDeleteFile", func_EntDeleteFile)
state.Register("EntExecProcess", func_EntExecProcess)
state.Register("EntStateMachineOutText", func_EntStateMachineOutText)
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("ComReadDoubleVar", func_ComReadDoubleVar)
state.Register("ComWriteDoubleVar", func_ComWriteDoubleVar)
state.Register("ComReadBitVar", func_ComReadBitVar)
state.Register("ComWriteBitVar", func_ComWriteBitVar)
state.Register("ComCopyFileToNc", func_ComCopyFileToNc)
Return True
End Function
End Module
+82
View File
@@ -0,0 +1,82 @@
Imports System.ComponentModel.Composition
Imports System.ComponentModel.Composition.Hosting
Imports Supervisor.Plugin.Interface
Public Class MEFLoader
Private importers As Dictionary(Of String, List(Of Object)) = New Dictionary(Of String, List(Of Object))()
Public Overridable Function LoadByTag(Of T)(ByVal path As String, ByVal tag As String) As ICollection(Of T)
Dim importer = GetImporter(Of T)(path)
Return importer.LoadByMEF(path, tag)
End Function
Protected Function GetImporter(Of T)(ByVal path As String) As MEFImporter(Of T)
Dim importerList = GetImporterList(path)
Dim importer = importerList.OfType(Of MEFImporter(Of T))().FirstOrDefault()
If importer Is Nothing Then
importer = New MEFImporter(Of T)(path)
importerList.Add(importer)
End If
Return importer
End Function
Protected Function GetImporterList(ByVal path As String) As List(Of Object)
If importers.ContainsKey(path) = False Then importers.Add(path, New List(Of Object)())
Return importers(path)
End Function
Public Overridable Function LoadByType(Of T)(ByVal path As String) As ICollection(Of T)
Return LoadByTag(Of T)(path, String.Empty)
End Function
End Class
Public Interface IMetadata
ReadOnly Property Name As String
End Interface
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
Public Sub New(ByVal path As String)
Me.New()
directoryCatalog = New DirectoryCatalog(path)
End Sub
Protected directoryCatalog As DirectoryCatalog = Nothing
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
Public Function LoadByMEF(ByVal path As String, ByVal name As String) As ICollection(Of T)
Dim res = New List(Of T)()
DoImport(path)
For Each [module] As Lazy(Of T, IMetadata) In [imports]
If [module].Metadata.Name = name OrElse String.IsNullOrEmpty(name) Then
res.Add([module].Value)
End If
Next
Return res
End Function
End Class
@@ -0,0 +1,92 @@
Imports System.ComponentModel.Composition
Imports Supervisor.Plugin.Interface
Public Class SupervisorFunctions
Implements IHost
Public ReadOnly Property PluginTestInfo As Integer Implements IHost.PluginTestInfo
Get
Return Map.refMainWindowVM.m_PluginTestInfo
End Get
End Property
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) As Integer Implements IHost.PlgGetPrivateProfileInt
Return GetMainPrivateProfileInt(lpAppName, lpKeyName, nDefault)
End Function
Public Function PlgGetPrivateProfileDouble(lpAppName As String, lpKeyName As String, dDefault As Double) As Double Implements IHost.PlgGetPrivateProfileDouble
Return GetMainPrivateProfileDouble(lpAppName, lpKeyName, dDefault)
End Function
Public Function PlgGetPrivateProfileString(lpAppName As String, lpKeyName As String, lpDefault As String, ByRef lpString As String) As Integer Implements IHost.PlgGetPrivateProfileString
Return GetMainPrivateProfileString(lpAppName, lpKeyName, lpDefault, lpString)
End Function
Public Function PlgWritePrivateProfileString(lpAppName As String, lpKeyName As String, lpString As String) As Boolean Implements IHost.PlgWritePrivateProfileString
Return WriteMainPrivateProfileString(lpAppName, lpKeyName, lpString)
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 PlgExecProcessAsync(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean Implements IHost.PlgExecProcessAsync
Return ExecProcessManager.ExecProcessAsync(sFileName, sMainLuaPath, sArguments)
End Function
Public Function PlgCheckExecProcessAsync(ByRef bHasExited As Boolean, ByRef nExitCode As Integer) As Boolean Implements IHost.PlgCheckExecProcessAsync
Return ExecProcessManager.CheckExecProcessAsync(bHasExited, nExitCode)
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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).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 - 1)) Then
Return Map.refMainWindowVM.MachineManager.MachineList(nMachine - 1).WriteDoubleVar(nVarAddr, dValue)
Else
Return False
End If
End Function
End Class
+296
View File
@@ -0,0 +1,296 @@
Imports System.Threading
Imports System.Math
Imports System.IO
Public Class MainWindowM
#Region "FIELDS"
' massimo numero di istanze del programma ammesse
Const MAX_INST As Integer = 1
Private m_objMutex As Mutex
Private m_sDataRoot As String = String.Empty
Friend ReadOnly Property sDataRoot As String
Get
Return m_sDataRoot
End Get
End Property
Private m_sDataDir As String = String.Empty
Friend ReadOnly Property sDataDir As String
Get
Return m_sDataDir
End Get
End Property
Private m_sConfigDir As String = String.Empty
Public ReadOnly Property sConfigDir As String
Get
Return m_sConfigDir
End Get
End Property
Private m_sScriptDir As String = String.Empty
Public ReadOnly Property sScriptDir As String
Get
Return m_sScriptDir
End Get
End Property
Private m_nDebug As Integer = 0
Public ReadOnly Property DebugLevel As Integer
Get
Return m_nDebug
End Get
End Property
Private m_bFirstInstance As Boolean = False
Friend ReadOnly Property bFirstInstance As Boolean
Get
Return m_bFirstInstance
End Get
End Property
Private m_nInstance As Integer = 0
Friend ReadOnly Property nInstance As Integer
Get
Return m_nInstance
End Get
End Property
Private m_nUserLevel As Integer = 1
Friend ReadOnly Property nUserLevel As Integer
Get
Return m_nUserLevel
End Get
End Property
Private m_nKeyLevel As Integer = 0
Friend ReadOnly Property nKeyLevel As Integer
Get
Return m_nKeyLevel
End Get
End Property
Private m_nKeyOptions As UInteger = 0
Friend ReadOnly Property nKeyOptions As Integer
Get
Return m_nKeyOptions
End Get
End Property
Friend ReadOnly Property sVersion As String
Get
Return 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()
End Get
End Property
Private m_sTempDir As String
Friend ReadOnly Property sTempDir As String
Get
Return m_sTempDir
End Get
End Property
Private m_sResourcesRoot As String
Friend ReadOnly Property sResourcesRoot As String
Get
Return m_sResourcesRoot
End Get
End Property
Private m_sLogFile As String
Friend ReadOnly Property sLogFile As String
Get
Return m_sLogFile
End Get
End Property
#End Region ' FIELDS
#Region "CONSTRUCTOR"
Sub New()
InitializeEgtEnvironment()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub InitializeEgtEnvironment()
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
' Impostazione direttorio per file script
m_sScriptDir = m_sDataRoot & "\" & SCRIPT_DIR
' Impostazione direttorio per file temporanei
m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione path Ini file
IniFile.SetIniFile(m_sConfigDir & "\" & INI_FILE_NAME)
' Impostazione path resources dir
m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
' Verifico indice di istanza
ManageInstance()
'' Imposto tipo di chiave
'EgtSetLockType(KEY_TYPE.HW)
'' Leggo e imposto chiave di protezione
'Dim sLicFileName As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
'Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
'Dim sKey As String = String.Empty
'EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
'EgtSetKey(sKey)
'' Recupero livello e opzioni della chiave
'Dim bKey As Boolean = EgtGetKeyLevel(5583, 2605, 1, m_nKeyLevel) And
' EgtGetKeyOptions(5583, 2605, 1, m_nKeyOptions)
'' Inizializzazione generale di EgtInterface
'm_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
' inizializzo log
m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString())
Lua_General.SetLogPath(m_sLogFile)
If File.Exists(m_sLogFile) Then
Try
File.Copy(m_sLogFile, m_sLogFile & ".bak", True)
File.Delete(m_sLogFile)
Catch ex As Exception
EgtOutLog("Old log delete failed!" & ex.Message)
End Try
End If
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()
EgtOutLog(sLogMsg)
'EgtInit(m_nDebug, m_sLogFile, sLogMsg)
'EgtSetTempDir(m_sTempDir)
'EgtSetIniFile(IniFile.m_sIniFile)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
'Dim sMsgDir As String = String.Empty
'If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
' sMsgDir = m_sConfigDir
'End If
''' Inizializzo OptionModule
''OptionModule.InitOptionModule()
'' Leggo lingua corrente
'Dim sLanguage As String = String.Empty
'GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage)
'' Recupero nome file dei messaggi della lingua corrente
'Dim sMsgName As String = "EgalTechIta.txt"
'Dim nIndex As Integer = 1
'While True
' Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
' If IsNothing(ReadLanguage) Then Exit While
' If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then
' sMsgName = ReadLanguage.FilePath
' Exit While
' End If
' nIndex += 1
'End While
'' Leggo file messaggi
'Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName
'If Not EgtLoadMessages(sMsgFilePath) Then
' EgtOutLog("Error in EgtLoadMessages")
'End If
' Leggo e imposto livello utilizzatore
' m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Info su opzioni chiave
'EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString())
' inizializzo ambiente Lua
LuaManager.Init()
End Sub
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\Supervisor", bCreated)
Catch
bCreated = False
End Try
m_bFirstInstance = bCreated
If bCreated Then
' Prima istanza
m_nInstance = 1
' Aggiorno stato istanze attive
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, m_nInstance.ToString())
Else
' Leggo il massimo numero di istanze ammesse
Dim nMaxInst As Integer = GetMaxInstances()
' Cerco il primo indice di istanza libero
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
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("SupervisorR32")
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("SupervisorR64")
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))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean
Return ((m_nKeyOptions And nKeyOpt) <> 0)
End Function
Friend Function GetMaxInstances() As Integer
' Leggo il massimo numero di istanze ammesse
' Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
Return 1 ' Max(1, Min(nMaxInst, MAX_INST))
End Function
Friend Sub Close()
'' Terminazione generale di EgtInterface
'EgtExit()
' Aggiorno istanze usate
m_objMutex.WaitOne(1000)
Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (m_nInstance - 1))
WriteMainPrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
m_objMutex.ReleaseMutex()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
End Sub
#End Region ' METHODS
End Class
+93
View File
@@ -0,0 +1,93 @@
<Window x:Class="MainWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Supervisor"
Title="MainWindow"
Style="{StaticResource MainWindow}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0"
Width="32"
Height="32"
Source="/Resources/Effector.ico" />
<ContentControl Grid.Column="1"
Content="{Binding ContentMenu}"/>
<TextBlock Grid.Column="2"
Margin="4 0 0 0"
VerticalAlignment="Center"
FontSize="14"
Text="{Binding WindowTitle}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button Grid.Column="3"
Click="OnMinimizeButtonClick"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBarButtonStyle}">
<Path Width="46"
Height="32"
Data="M 18,15 H 28"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
<Button Name="maximizeButton"
Grid.Column="4"
Click="OnMaximizeRestoreButtonClick"
Style="{StaticResource TitleBarButtonStyle}">
<Path Width="46"
Height="32"
Data="M 18.5,10.5 H 27.5 V 19.5 H 18.5 Z"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
<Button Name="restoreButton"
Grid.Column="4"
Click="OnMaximizeRestoreButtonClick"
Style="{StaticResource TitleBarButtonStyle}">
<Path Width="46"
Height="32"
Data="M 18.5,12.5 H 25.5 V 19.5 H 18.5 Z M 20.5,12.5 V 10.5 H 27.5 V 17.5 H 25.5"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
<Button Grid.Column="5"
Click="OnCloseButtonClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
</Grid>
<ContentControl Grid.Row="2"
Content="{Binding ContentMenu}"/>
<ContentControl Grid.Row="1"
Content="{Binding ContentPanel}"/>
</Grid>
</Window>
+79
View File
@@ -0,0 +1,79 @@
Imports System.Windows.Interop
Class MainWindowV
Private m_MainWindowVM As MainWindowVM
#Region "CONSTRUCTOR"
Sub New()
' Funzione che interpreta l'xaml
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
AddHandler Me.StateChanged, AddressOf Window_StateChanged
AddHandler Me.Closing, AddressOf MainWindowV_Closing
AddHandler Me.Closed, AddressOf MainWindowV_Closed
Me.RefreshMaximizeRestoreButton()
End Sub
#End Region ' CONSTRUCTOR
Private Sub RefreshMaximizeRestoreButton()
If Me.WindowState = WindowState.Maximized Then
Me.maximizeButton.Visibility = Visibility.Collapsed
Me.restoreButton.Visibility = Visibility.Visible
Else
Me.maximizeButton.Visibility = Visibility.Visible
Me.restoreButton.Visibility = Visibility.Collapsed
End If
End Sub
#Region "EVENTS"
Private Sub OnMinimizeButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.WindowState = WindowState.Minimized
End Sub
Private Sub OnMaximizeRestoreButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
If Me.WindowState = WindowState.Maximized Then
Me.WindowState = WindowState.Normal
Else
Me.WindowState = WindowState.Maximized
End If
End Sub
Private Sub Window_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
Me.RefreshMaximizeRestoreButton()
End Sub
Private Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.Close()
End Sub
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
End Sub
Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
e.Cancel = True
Return
End If
' Salvo posizione finestra (se non minimizzata)
If WindowState <> WindowState.Minimized Then
WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
End If
End Sub
Private Sub MainWindowV_Closed(sender As Object, e As EventArgs)
If Not IsNothing(m_MainWindowVM) AndAlso Not IsNothing(m_MainWindowVM.FiniteStateMachineManager) Then m_MainWindowVM.FiniteStateMachineManager.ResetFiniteStateMachineTimer()
LuaManager.Close()
EgtOutLog("Exit")
End Sub
#End Region ' EVENTS
End Class
+122
View File
@@ -0,0 +1,122 @@
Imports System.IO
Imports System.Windows.Threading
Imports Supervisor.Plugin.Interface
Public Class MainWindowVM
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 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 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 ReadOnly Property ContentPanel As Panel
Get
Return m_ContentPanel
End Get
End Property
Private m_ContentMenu As Panel
Public ReadOnly Property ContentMenu As Panel
Get
Return m_ContentMenu
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
' creo gestore della comunicazione
m_MachineManager = New MachineManager
m_MachineManager.Init()
' recupero nome del plugin
Dim sPluginName As String = ""
If GetMainPrivateProfileString(S_GENERAL, K_PLUGINNAME, "", sPluginName) > 0 AndAlso Not String.IsNullOrWhiteSpace(sPluginName) Then
' aggiungo Dictionary del plugin
Dim PluginDictionary As IPluginControl = GetDictionary(Of IPluginControl)(sPluginName)
Application.Current.Resources.MergedDictionaries.Add(PluginDictionary)
'' aggiungo MainMenu dal plugin
Dim PluginMainMenu As IPluginControl = GetControlByName(Of IPluginControl)(sPluginName, "MainMenu")
m_ContentMenu = PluginMainMenu
'' aggiungo manager delle funzioni Lua del Plugin
Dim PluginLuaManager As IPluginLuaManager = Map.refMainWindowVM.GetLuaManager(Of IPluginLuaManager)(sPluginName)
PluginLuaManager.PlgInit(LuaManager.state)
' aggiungo Project dal plugin
Dim ProjectPlugin As IPluginControl = GetControlByName(Of IPluginControl)(sPluginName, "Project")
m_ContentPanel = ProjectPlugin
End If
' 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
End Sub
#Region "Plugin"
Private m_Loader As MEFLoader = New MEFLoader()
Private Function GetPathByName(sPluginFileName As String) As String
Return MainWindowM.sDataRoot & "\Plugin\" & sPluginFileName
End Function
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)
End If
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
Friend Function GetLuaManager(Of T)(sPluginFileName As String) As IPluginLuaManager
Dim LuaManager As Object = m_Loader.LoadByTag(Of T)(GetPathByName(sPluginFileName), "LuaManager").FirstOrDefault()
Return LuaManager
End Function
#End Region ' Plugin
End Class
+59
View File
@@ -0,0 +1,59 @@
Imports System
Imports System.Globalization
Imports System.Reflection
Imports System.Resources
Imports System.Runtime.InteropServices
Imports System.Windows
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Supervisor")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("Supervisor")>
<Assembly: AssemblyCopyright("Copyright © 2024 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> to "en-US". Then uncomment the
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
'below to match the UICulture setting in the project file.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
'1st parameter: where theme specific resource dictionaries are located
'(used if a resource is not found in the page,
' or application resource dictionaries)
'2nd parameter: where the generic resource dictionary is located
'(used if a resource is not found in the page,
'app, and any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("565ef276-1f57-4d10-a1b4-9f13c6fd79b9")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.6.5.1")>
<Assembly: AssemblyFileVersion("2.6.5.1")>
@@ -0,0 +1,121 @@
#If _MyType <> "Empty" Then
Namespace My
''' <summary>
''' Module used to define the properties that are available in the My Namespace for WPF
''' </summary>
''' <remarks></remarks>
<Global.Microsoft.VisualBasic.HideModuleName()> _
Module MyWpfExtension
Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer)
Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User)
Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows)
Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log)
''' <summary>
''' Returns the application object for the running application
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Application() As Application
Get
Return CType(Global.System.Windows.Application.Current, Application)
End Get
End Property
''' <summary>
''' Returns information about the host computer.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer
Get
Return s_Computer.GetInstance()
End Get
End Property
''' <summary>
''' Returns information for the current user. If you wish to run the application with the current
''' Windows user credentials, call My.User.InitializeWithWindowsUser().
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User
Get
Return s_User.GetInstance()
End Get
End Property
''' <summary>
''' Returns the application log. The listeners can be configured by the application's configuration file.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log
Get
Return s_Log.GetInstance()
End Get
End Property
''' <summary>
''' Returns the collection of Windows defined in the project.
''' </summary>
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend ReadOnly Property Windows() As MyWindows
<Global.System.Diagnostics.DebuggerHidden()> _
Get
Return s_Windows.GetInstance()
End Get
End Property
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
<Global.Microsoft.VisualBasic.MyGroupCollection("System.Windows.Window", "Create__Instance__", "Dispose__Instance__", "My.MyWpfExtenstionModule.Windows")> _
Friend NotInheritable Class MyWindows
<Global.System.Diagnostics.DebuggerHidden()> _
Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T
If Instance Is Nothing Then
If s_WindowBeingCreated IsNot Nothing Then
If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then
Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.")
End If
Else
s_WindowBeingCreated = New Global.System.Collections.Hashtable()
End If
s_WindowBeingCreated.Add(GetType(T), Nothing)
Return New T()
s_WindowBeingCreated.Remove(GetType(T))
Else
Return Instance
End If
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.Diagnostics.DebuggerHidden()> _
Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T)
instance = Nothing
End Sub
<Global.System.Diagnostics.DebuggerHidden()> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Public Sub New()
MyBase.New()
End Sub
<Global.System.ThreadStatic()> Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function Equals(ByVal o As Object) As Boolean
Return MyBase.Equals(o)
End Function
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
Return MyBase.GetHashCode
End Function
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Friend Overloads Function [GetType]() As Global.System.Type
Return GetType(MyWindows)
End Function
<Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function ToString() As String
Return MyBase.ToString
End Function
End Class
End Module
End Namespace
Partial Class Application
Inherits Global.System.Windows.Application
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1822:MarkMembersAsStatic")> _
Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo
<Global.System.Diagnostics.DebuggerHidden()> _
Get
Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly())
End Get
End Property
End Class
#End If
+62
View File
@@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:$clrversion$
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("$safeprojectname$.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+73
View File
@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Supervisor.My.MySettings
Get
Return Global.Supervisor.My.MySettings.Default
End Get
End Property
End Module
End Namespace
+7
View File
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+287
View File
@@ -0,0 +1,287 @@
<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>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{38BEE4BF-9238-459F-AF89-4DD94C4FD0DA}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<OutputType>WinExe</OutputType>
<RootNamespace>Supervisor</RootNamespace>
<AssemblyName>Supervisor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<MyType>Custom</MyType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<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>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Debug\</OutputPath>
<DocumentationFile>Supervisor.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<DocumentationFile>Supervisor.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Debug\</OutputPath>
<DocumentationFile>Supervisor.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</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>Supervisor.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\Effector.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<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=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>
</Reference>
<Reference Include="NGP_COMM_DLL">
<HintPath>..\ExtLib\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>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.7.33\lib\net472\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<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>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<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=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>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Application.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Comms\MachineManager.vb" />
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="FiniteStateMachineManager\FiniteStateMachineManager.vb" />
<Compile Include="LUA\Lua_Aux.vb" />
<Compile Include="MainWindow\MainWindowM.vb" />
<Compile Include="LUA\LuaManager.vb" />
<Compile Include="MEFPlugin\MefPlugin.vb" />
<Compile Include="MEFPlugin\SupervisorFunctions.vb" />
<Compile Include="Utility\Dictionary.xaml.vb">
<DependentUpon>Dictionary.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\ExecProcessManager.vb" />
<Compile Include="Utility\GenInterface.vb" />
<Compile Include="Utility\IniFile.vb" />
<Compile Include="LUA\Lua_General.vb" />
<Compile Include="Utility\Map.vb" />
<Compile Include="Utility\RedisManager.vb" />
<Compile Include="Utility\WinPos.vb" />
<Page Include="MainWindow\MainWindowV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="Application.xaml.vb">
<DependentUpon>Application.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="FiniteStateMachine.vb" />
<Compile Include="MainWindow\MainWindowV.xaml.vb">
<DependentUpon>MainWindowV.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Utility\Dictionary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Shapes" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow\MainWindowVM.vb" />
<Compile Include="My Project\AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\MyExtensions\MyWpfExtension.vb">
<VBMyExtensionTemplateID>Microsoft.VisualBasic.WPF.MyExtension</VBMyExtensionTemplateID>
<VBMyExtensionTemplateVersion>1.0.0.0</VBMyExtensionTemplateVersion>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
</EmbeddedResource>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Supervisor.Plugin.Interface\Supervisor.Plugin.Interface.vbproj">
<Project>{7D14D864-2BDC-4785-80F4-320164C2D5E4}</Project>
<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>
<ItemGroup>
<Resource Include="Resources\Icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Effector.ico" />
</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">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\KeraLua.1.4.1\build\net46\KeraLua.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Supervisor\SupervisorR32.exe
IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\Supervisor\SupervisorD32.exe
IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Supervisor\SupervisorR64.exe
IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\Supervisor\SupervisorD64.exe</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" />
</Project>
+185
View File
@@ -0,0 +1,185 @@
<ResourceDictionary x:Class="Dictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
<!--
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<!--<local:FiveLakesUIVM x:Key="FiveLakesUIVM"/>
<local:DoorListPageVM x:Key="DoorListVM"/>
<local:MachinePageVM x:Key="MachinePageVM"/>-->
<!--Colori predefiniti-->
<SolidColorBrush x:Key="EgaltechBlue1" Color="#FF4D84C4" />
<SolidColorBrush x:Key="EgaltechBlue2" Color="#FF7096CE" />
<SolidColorBrush x:Key="EgaltechBlue3" Color="#FF90ABD9" />
<SolidColorBrush x:Key="EgaltechBlue4" Color="#FFB2C3E4" />
<SolidColorBrush x:Key="EgaltechWhite" Color="#FFFFFFFF" />
<SolidColorBrush x:Key="EgaltechGray" Color="#FF585858" />
<SolidColorBrush x:Key="EgaltechLightGray" Color="LightGray" />
<SolidColorBrush x:Key="EgaltechUltralightGray" Color="#FFF2F2F2" />
<SolidColorBrush x:Key="EgaltechGreen" Color="#FF00FF00" />
<!--#92908d-->
<Color x:Key="Icarus_Gray_Color" R="146" G="144" B="141" A="255"/>
<SolidColorBrush x:Key="Icarus_Gray" Color="{StaticResource Icarus_Gray_Color}" />
<!--#3c89c9-->
<Color x:Key="Icarus_LightBlue_Color" R="60" G="137" B="201" A="255"/>
<SolidColorBrush x:Key="Icarus_LightBlue" Color="{StaticResource Icarus_LightBlue_Color}" />
<!--#2e5a81-->
<Color x:Key="Icarus_Blue_Color" R="46" G="90" B="129" A="255"/>
<SolidColorBrush x:Key="Icarus_Blue" Color="{StaticResource Icarus_Blue_Color}" />
<!--#50A388-->
<Color x:Key="Icarus_Green_Color" R="80" G="163" B="136" A="255"/>
<SolidColorBrush x:Key="Icarus_Green" Color="{StaticResource Icarus_Green_Color}" />
<!--#BC373E-->
<Color x:Key="Icarus_Orange_Color" R="188" G="55" B="62" A="255"/>
<SolidColorBrush x:Key="Icarus_Orange" Color="{StaticResource Icarus_Orange_Color}" />
<!--#A74C77-->
<Color x:Key="Icarus_Purple_Color" R="167" G="76" B="119" A="255"/>
<SolidColorBrush x:Key="Icarus_Purple" Color="{StaticResource Icarus_Purple_Color}" />
<!--Colori per EgtWPFLib5-->
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
<!--Risorsa che toglie le animazioni dai menù popup per evitare che i menù mru di scelta dei file rimangano aperti se il file è grosso -->
<!--o viene eseguito un lua che non aggiorna l'interfaccia-->
<PopupAnimation x:Key="{x:Static SystemParameters.MenuPopupAnimationKey}">None</PopupAnimation>
<!--convertert per visibilita' stringa di testo con misure in StatusBar-->
<!--
<PrintApp:StringToVisibilityConverter x:Key="StringToVisibilityConverter"/>-->
<GridLength x:Key="TitleBarHeight">30</GridLength>
<Thickness x:Key="WindowBorder_Thickness">2</Thickness>
<sys:Double x:Key="WindowBorder_Height">2</sys:Double>
<Style x:Key="MainWindow" TargetType="{x:Type Window}">
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="32"
GlassFrameThickness="0"
CornerRadius="0"
ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border BorderThickness="0"
BorderBrush="LightGray"
Background="{TemplateBinding Background}">
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
</Grid>-->
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border BorderThickness="7"
BorderBrush="LightGray"
Background="{TemplateBinding Background}">
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
</Grid>-->
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="TitleBarButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource WindowTextBrush}" />
<Setter Property="Padding" Value="0" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
x:Name="border"
Background="Transparent"
BorderThickness="0"
SnapsToDevicePixels="true">
<ContentPresenter
x:Name="contentPresenter"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource MouseOverOverlayBackgroundBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource PressedOverlayBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TitleBarCloseButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Padding" Value="0" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border
x:Name="border"
Background="Transparent"
BorderThickness="0"
SnapsToDevicePixels="true">
<ContentPresenter
x:Name="contentPresenter"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource MouseOverWindowCloseButtonBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource MouseOverWindowCloseButtonForegroundBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource PressedWindowCloseButtonBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource MouseOverWindowCloseButtonForegroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+108
View File
@@ -0,0 +1,108 @@
Imports System.ComponentModel.Composition
Imports System.Globalization
Imports Supervisor.Plugin.Interface
<Export(GetType(IPluginControl))>
<ExportMetadata("Name", "Dictionary")>
Public Class Dictionary
Inherits ResourceDictionary
Implements IPluginControl
Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM"
#Region "Colors"
'Private m_Omag_Red As SolidColorBrush = Brushes.Red
'Public ReadOnly Property Omag_Red As SolidColorBrush
' Get
' Return m_Omag_Red
' End Get
'End Property
'Private Shared m_Button_Static_Background As SolidColorBrush = New BrushConverter().ConvertFrom("#FFDDDDDD")
'Public Shared ReadOnly Property Button_Static_Background As SolidColorBrush
' Get
' Return m_Button_Static_Background
' End Get
'End Property
'Private Shared m_TabControl_Header_Background As LinearGradientBrush = Application.Current.FindResource("TabItem.Static.Background")
'Public Shared ReadOnly Property TabControl_Header_Background As LinearGradientBrush
' Get
' Return m_TabControl_Header_Background
' End Get
'End Property
'Private Shared m_Icarus_Gray As SolidColorBrush = Application.Current.FindResource("Icarus_Gray")
'Public Shared ReadOnly Property Icarus_Gray As SolidColorBrush
' Get
' Return m_Icarus_Gray
' End Get
'End Property
'Private Shared m_Icarus_LightBlue As SolidColorBrush = Application.Current.FindResource("Icarus_LightBlue")
'Public Shared ReadOnly Property Icarus_LightBlue As SolidColorBrush
' Get
' Return m_Icarus_LightBlue
' End Get
'End Property
'Private Shared m_Icarus_Blue As SolidColorBrush = Application.Current.FindResource("Icarus_Blue")
'Public Shared ReadOnly Property Icarus_Blue As SolidColorBrush
' Get
' Return m_Icarus_Blue
' End Get
'End Property
'Private Shared m_Icarus_Green As SolidColorBrush = Application.Current.FindResource("Icarus_Green")
'Public Shared ReadOnly Property Icarus_Green As SolidColorBrush
' Get
' Return m_Icarus_Green
' End Get
'End Property
'Private Shared m_Icarus_Orange As SolidColorBrush = Application.Current.FindResource("Icarus_Orange")
'Public Shared ReadOnly Property Icarus_Orange As SolidColorBrush
' Get
' Return m_Icarus_Orange
' End Get
'End Property
'Private Shared m_Icarus_Purple As SolidColorBrush = Application.Current.FindResource("Icarus_Purple")
'Public Shared ReadOnly Property Icarus_Purple As SolidColorBrush
' Get
' Return m_Icarus_Purple
' End Get
'End Property
'<SolidColorBrush x : Key="Icarus_Gray" Color="#92908d" />
'<SolidColorBrush x : Key="Icarus_LightBlue" Color="#3c89c9" />
'<SolidColorBrush x : Key="Icarus_Blue" Color="#2e5a81" />
'<SolidColorBrush x : Key="Icarus_Green" Color="#40826d" />
'<SolidColorBrush x : Key="Icarus_Orange" Color="#C37636" />
'<SolidColorBrush x : Key="Icarus_Purple" Color="#990066" />
#End Region ' Colors
End Class
Public Class CenterToolTipConverter
Implements IMultiValueConverter
Public Function Convert(ByVal values As Object(), ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
For Each value In values
If TypeOf (value) IsNot Double Then
Return Double.NaN
End If
Next
Dim dPlacementTarget As Double = CDbl(values(0))
Dim dToolTip As Double = CDbl(values(1))
Return (dPlacementTarget / 2.0) - (dToolTip / 2.0)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetTypes As Type(), ByVal parameter As Object, ByVal culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Throw New NotSupportedException()
End Function
End Class
+58
View File
@@ -0,0 +1,58 @@
Module ExecProcessManager
Private m_ExecProcess As Process
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 >= 300 Then
bResult = False
Proc.Kill()
Exit While
End If
Threading.Thread.Sleep(100)
ExecCounter += 1
End While
End If
Return bResult
End Function
Friend Function ExecProcessAsync(sFileName As String, sMainLuaPath As String, sArguments As String) As Boolean
If Not IsNothing(m_ExecProcess) Then
If Not m_ExecProcess.HasExited Then
m_ExecProcess.Kill()
End If
End If
' lancio esecuzione programma
Dim bResult As Boolean = True
m_ExecProcess = New Process()
m_ExecProcess.StartInfo.FileName = sFileName
m_ExecProcess.StartInfo.RedirectStandardInput = False
m_ExecProcess.StartInfo.RedirectStandardOutput = False
m_ExecProcess.StartInfo.Arguments = 1.ToString() & " """ & sMainLuaPath & """ """ & sArguments & """"
m_ExecProcess.StartInfo.UseShellExecute = False
m_ExecProcess.StartInfo.CreateNoWindow = True
Return m_ExecProcess.Start()
End Function
Friend Function CheckExecProcessAsync(ByRef bHasExited As Boolean, ByRef nExitCode As Integer) As Boolean
If IsNothing(m_ExecProcess) Then Return False
bHasExited = m_ExecProcess.HasExited
If bHasExited Then
nExitCode = m_ExecProcess.ExitCode
End If
Threading.Thread.Sleep(100)
Return True
End Function
End Module
+129
View File
@@ -0,0 +1,129 @@
Imports System.Globalization
Imports System.Runtime.InteropServices
Imports System.Text
Public Module GenInterface
'-------------------------------- IniFile : Get --------------------------------------------------
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
Public Function GetPrivateProfileInt(
lpAppName As String,
lpKeyName As String,
nDefault As Integer,
lpFileName As String) As Integer
End Function
Public Function GetPrivateProfileDouble(
lpAppName As String,
lpKeyName As String,
dDefault As Double,
lpFileName As String) As Double
Dim sValue As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, dDefault.ToString(), sValue, lpFileName)
Dim nPos As Integer = sValue.IndexOf(";")
If nPos >= 0 Then
sValue = sValue.Remove(nPos)
End If
Dim dValue As Double
If Not Double.TryParse(sValue, NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, dValue) Then
dValue = dDefault
End If
Return dValue
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
Private Function GetPrivateProfileString(
lpAppName As String,
lpKeyName As String,
lpDefault As String,
lpReturnedString As StringBuilder,
nSize As Integer,
lpFileName As String) As Integer
End Function
Public Function GetPrivateProfileString(
lpAppName As String,
lpKeyName As String,
lpDefault As String,
ByRef lpString As String,
lpFileName As String) As Integer
Dim sb As New StringBuilder(1024)
Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
lpString = sb.ToString
Return nRet
End Function
Public Function GetPrivateProfileWinPos(
lpAppName As String,
lpKeyName As String,
ByRef nFlag As Integer,
ByRef nLeft As Integer,
ByRef nTop As Integer,
ByRef nWidth As Integer,
ByRef nHeight As Integer,
lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 5 Then
Dim bOk As Boolean = True
If Not Integer.TryParse(sItems(0), nFlag) Then
nFlag = 0
bOk = False
End If
If Not Integer.TryParse(sItems(1), nLeft) Then
nLeft = 0
bOk = False
End If
If Not Integer.TryParse(sItems(2), nTop) Then
nTop = 0
bOk = False
End If
If Not Integer.TryParse(sItems(3), nWidth) Then
nWidth = 1024
bOk = False
End If
If Not Integer.TryParse(sItems(4), nHeight) Then
nHeight = 768
bOk = False
End If
Return bOk
End If
Return False
End Function
'-------------------------------- IniFile : Write ------------------------------------------------
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
Public Function WritePrivateProfileString(
lpAppName As String,
lpKeyName As String,
lpString As String,
lpFileName As String) As Boolean
End Function
Public Function WritePrivateProfileWinPos(
lpAppName As String,
lpKeyName As String,
nFlag As Integer,
nLeft As Integer,
nTop As Integer,
nWidth As Integer,
nHeight As Integer,
lpFileName As String) As Boolean
Dim sVal As String
sVal = nFlag.ToString & "," & nLeft.ToString & "," & nTop.ToString & "," & nWidth.ToString & "," & nHeight.ToString
Return WritePrivateProfileString(lpAppName, lpKeyName, sVal, lpFileName)
End Function
'-------------------------------- Windows --------------------------------------------------------
Public Enum SW As Integer
HIDE = 0
SHOWMAXIMIZED = 3
RESTORE = 9
End Enum
<DllImport("user32.dll")>
Public Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
End Function
End Module
+74
View File
@@ -0,0 +1,74 @@
'----------------------------------------------------------------------------
' EgalTech 2017-2017
'----------------------------------------------------------------------------
' File : IniFile.vb Data : 08.05.24 Versione : 2.6e1
' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
'
'
'
' Modifiche : 08.05.24 ES Creazione modulo.
'
'
'----------------------------------------------------------------------------
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Module IniFile
Private m_sPath As String
Public ReadOnly Property sPath As String
Get
Return m_sPath
End Get
End Property
Friend Sub SetIniFile(sPath)
m_sPath = sPath
End Sub
Public Function GetMainPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer
Return GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sPath)
End Function
Public Function GetMainPrivateProfileDouble(IpAppName As String, IpKeyName As String, dDefault As Double) As Double
Return GetPrivateProfileDouble(IpAppName, IpKeyName, dDefault, m_sPath)
End Function
Public Function GetMainPrivateProfileString(IpAppName As String, IpKeyName As String, IpDefault As String, ByRef IpString As String) As Integer
Return GetPrivateProfileString(IpAppName, IpKeyName, IpDefault, IpString, m_sPath)
End Function
Public Function GetMainPrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean
Return GetPrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sPath)
End Function
'Public Function GetPrivateProfileLanguage(lpAppName As String, lpKeyName As String, lpFileName As String) As Language
' Dim sVal As String = String.Empty
' GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
' Dim sItems() As String = sVal.Split(",".ToCharArray)
' If sItems.Count() = 2 Then
' Return New Language(sItems(0), sItems(1))
' End If
' Return Nothing
'End Function
'Public Function GetMainPrivateProfileLanguage(lpAppName As String, lpKeyName As String) As Language
' Dim sVal As String = String.Empty
' GetMainPrivateProfileString(lpAppName, lpKeyName, "", sVal)
' Dim sItems() As String = sVal.Split(",".ToCharArray)
' If sItems.Count() = 2 Then
' Return New Language(sItems(0), sItems(1))
' End If
' Return Nothing
'End Function
Public Function WriteMainPrivateProfileString(IpAppName As String, IpKeyName As String, ByRef IpString As String) As Boolean
Return WritePrivateProfileString(IpAppName, IpKeyName, IpString, m_sPath)
End Function
Public Function WriteMainPrivateProfileWinPos(IpAppName As String, IpKeyName As String, ByRef nFlag As Integer, ByRef nLeft As Integer, ByRef nTop As Integer, ByRef nWidth As Integer, ByRef nHeight As Integer) As Boolean
Return WritePrivateProfileWinPos(IpAppName, IpKeyName, nFlag, nLeft, nTop, nWidth, nHeight, m_sPath)
End Function
End Module
+97
View File
@@ -0,0 +1,97 @@
Module Map
Private m_refMainWindowVM As MainWindowVM
'Private m_refProjectVM As ProjectVM
'Private m_refSecondaryWindowVM As SecondaryWindowVM
'Private m_refSecondaryWindowV As SecondaryWindowV
#Region "Get"
Public ReadOnly Property refMainWindowVM As MainWindowVM
Get
Return m_refMainWindowVM
End Get
End Property
'Public ReadOnly Property refMyStatusBarVM As MyStatusBarVM
' Get
' Return LibMap.refStatusBarVM
' End Get
'End Property
'Public ReadOnly Property refProjManagerVM As ProjManagerVM
' Get
' Return m_refProjManagerVM
' End Get
'End Property
'Public ReadOnly Property refProjectVM As ProjectVM
' Get
' Return m_refProjectVM
' End Get
'End Property
'Public ReadOnly Property refSecondaryWindowVM As SecondaryWindowVM
' Get
' Return m_refSecondaryWindowVM
' End Get
'End Property
'Public ReadOnly Property refSecondaryWindowV As SecondaryWindowV
' Get
' Return m_refSecondaryWindowV
' End Get
'End Property
#End Region ' Get
#Region "Set"
'Friend Function SetRefMyStatusBarVM(MyStatusBarVM As MyStatusBarVM) As Boolean
' LibMap.SetRefStatusBarVM(MyStatusBarVM)
' Return Not IsNothing(LibMap.refStatusBarVM)
'End Function
'Friend Function SetRefProjManagerVM(ProjManagerVM As ProjManagerVM) As Boolean
' m_refProjManagerVM = ProjManagerVM
' Return Not IsNothing(m_refProjManagerVM)
'End Function
'Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
' m_refProjectVM = ProjectVM
' Return Not IsNothing(m_refProjectVM)
'End Function
'Friend Function SetRefSecondaryWindowVM(SecondaryWindowVM As SecondaryWindowVM) As Boolean
' m_refSecondaryWindowVM = SecondaryWindowVM
' Return Not IsNothing(m_refSecondaryWindowVM)
'End Function
'Friend Function SetRefSecondaryWindowV(SecondaryWindowV As SecondaryWindowV) As Boolean
' m_refSecondaryWindowV = SecondaryWindowV
' Return Not IsNothing(m_refSecondaryWindowV)
'End Function
#End Region ' Set
#Region "Init"
Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
m_refMainWindowVM = MainWindowVM
Return Not IsNothing(m_refMainWindowVM)
End Function
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
'Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso
' Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectManagerVM) AndAlso
' Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso
' Not IsNothing(m_refVeinMatchPanelVM) AndAlso
' Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso
' Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso
' Not IsNothing(m_refMachiningTabVM) AndAlso
' LibMap.EndInit()
Return Not IsNothing(m_refMainWindowVM)
End Function
#End Region ' Init
End Module
+56
View File
@@ -0,0 +1,56 @@
Imports StackExchange
Imports StackExchange.Redis
Class RedisManager
' connessione al server Redis
Private m_RedisConnection As ConnectionMultiplexer
Public ReadOnly Property RedisConnection As ConnectionMultiplexer
Get
Return m_RedisConnection
End Get
End Property
' indice del Db Redis
Private m_nRedisDbIndex As Integer = 0
Public ReadOnly Property nRedisDbIndex As Integer
Get
Return m_nRedisDbIndex
End Get
End Property
' Database Redis
Private m_RedisDb As IDatabase
Public ReadOnly Property RedisDb As IDatabase
Get
Return m_RedisDb
End Get
End Property
' gestore sottoscrizioni
Private m_Subscriber As ISubscriber
Public ReadOnly Property Subscriber As ISubscriber
Get
Return m_Subscriber
End Get
End Property
Sub New()
Try
' inizializzo connessione al server Redis
m_RedisConnection = ConnectionMultiplexer.Connect("localhost")
m_nRedisDbIndex = GetMainPrivateProfileInt(S_REDIS, K_DBINDEX, 0)
m_RedisDb = m_RedisConnection.GetDatabase(m_nRedisDbIndex)
' inizializzo sottoscrizioni
m_Subscriber = m_RedisConnection.GetSubscriber()
m_Subscriber.Subscribe("Messages", AddressOf SubscribeHandler)
Catch ex As Exception
EgtOutLog("Redis connection error!! " & Environment.NewLine & ex.Message)
End Try
End Sub
Private Sub SubscribeHandler(RedisChannel As RedisChannel, RedisValue As RedisValue)
EgtOutLog("Ricevuto valore " & RedisValue.ToString() & " dal canale " & RedisChannel.ToString())
End Sub
End Class
+94
View File
@@ -0,0 +1,94 @@
'----------------------------------------------------------------------------
' EgalTech 2017-2017
'----------------------------------------------------------------------------
' File : WinPos.vb Data : 08.04.17 Versione : 1.8d1
' Contenuto : Classe WinPos per gestione posizione e dimensioni finestra.
'
'
'
' Modifiche : 08.04.17 ES Creazione modulo.
'
'
'----------------------------------------------------------------------------
Public Module WinPosition
Public Class WinPos
' Membri
Public nFlag As Integer
Public nLeft As Integer
Public nTop As Integer
Public nWidth As Integer
Public nHeight As Integer
Public Sub ToWindow(Window As Window)
' Verifico che il punto in alto a sinistra stia nello schermo
Dim PtTL = New System.Drawing.Point(nLeft, nTop)
Dim s As System.Windows.Forms.Screen = System.Windows.Forms.Screen.FromPoint(PtTL)
If Not s.Bounds.Contains(PtTL) Then Return
' Imposto posizione e dimensioni
Window.WindowStartupLocation = WindowStartupLocation.Manual
Window.Top = nTop
Window.Left = nLeft
Window.Height = nHeight
Window.Width = nWidth
Window.WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal)
End Sub
Public Sub FromWindow(Window As Window)
nTop = CInt(Window.Top)
nLeft = CInt(Window.Left)
nHeight = CInt(Window.Height)
nWidth = CInt(Window.Width)
nFlag = If(Window.WindowState = WindowState.Maximized, 1, 0)
If Window.WindowState = WindowState.Maximized Then
nHeight = CInt(Window.RestoreBounds.Height)
nWidth = CInt(Window.RestoreBounds.Width)
End If
End Sub
Public Overloads Function FromIni(sSection As String, sKey As String) As Boolean
Return GetMainPrivateProfileWinPos(sSection, sKey, nFlag, nLeft, nTop, nWidth, nHeight)
End Function
Public Overloads Function FromIni(sSection As String, sKey As String, IpFileName As String) As Boolean
Return GetMainPrivateProfileWinPos(sSection, sKey, nFlag, nLeft, nTop, nWidth, nHeight)
End Function
Public Overloads Function ToIni(sSection As String, sKey As String) As Boolean
Return WriteMainPrivateProfileWinPos(sSection, sKey, nFlag, nLeft, nTop, nWidth, nHeight)
End Function
Public Overloads Function ToIni(sSection As String, sKey As String, IpFileName As String) As Boolean
Return WriteMainPrivateProfileWinPos(sSection, sKey, nFlag, nLeft, nTop, nWidth, nHeight)
End Function
End Class
Public Function WinPosFromIniToWindow(sSection As String, sKey As String, Window As Window) As Boolean
Dim WinPos As New WinPos
If Not WinPos.FromIni(sSection, sKey) Then Return False
WinPos.ToWindow(Window)
Return True
End Function
Public Function WinPosFromIniToWindow(sSection As String, sKey As String, Window As Window, IpFileName As String) As Boolean
Dim WinPos As New WinPos
If Not WinPos.FromIni(sSection, sKey, IpFileName) Then Return False
WinPos.ToWindow(Window)
Return True
End Function
Public Function WinPosFromWindowToIni(Window As Window, sSection As String, sKey As String) As Boolean
Dim WinPos As New WinPos
WinPos.FromWindow(Window)
Return WinPos.ToIni(sSection, sKey)
End Function
Public Function WinPosFromWindowToIni(Window As Window, sSection As String, sKey As String, IpFileName As String) As Boolean
Dim WinPos As New WinPos
WinPos.FromWindow(Window)
Return WinPos.ToIni(sSection, sKey, IpFileName)
End Function
End Module
+16
View File
@@ -0,0 +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="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="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="6.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>