Merge branch 'master' into develop
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
Imports System.IO
|
||||
|
||||
Module M_transitions
|
||||
|
||||
#Region "variabili locali"
|
||||
|
||||
Private sz_tokens As String()
|
||||
|
||||
Private objWriter As StreamWriter
|
||||
|
||||
Private sz_file_name As String
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Strutture"
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Lettura file regole "
|
||||
|
||||
Sub Read_rule_file_transitions(ByVal sz_filename As String)
|
||||
|
||||
Dim sz_TextLine As String, sz_temp As String
|
||||
Dim temp_rule As Rule, b_rules_definition As Boolean
|
||||
Dim n_line As Int16
|
||||
|
||||
n_line = 0
|
||||
b_rules_definition = False
|
||||
|
||||
sz_file_name = sz_filename
|
||||
|
||||
If System.IO.File.Exists(sz_filename) = True Then
|
||||
|
||||
Dim objfile As New System.IO.StreamReader(sz_filename)
|
||||
|
||||
Do While objfile.Peek() <> -1 ' finche c'è vita
|
||||
|
||||
sz_TextLine = Trim(objfile.ReadLine())
|
||||
n_line = n_line + 1
|
||||
|
||||
If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ?
|
||||
|
||||
If (Trim(sz_TextLine).Chars(0) <> "#") Then
|
||||
|
||||
If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!!
|
||||
|
||||
sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":"
|
||||
|
||||
sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo
|
||||
|
||||
Select Case sz_temp
|
||||
|
||||
Case "$DEFINITIONS"
|
||||
b_rules_definition = False
|
||||
|
||||
Case "$NAME"
|
||||
sz_state_machine_name = UCase$(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$IDX"
|
||||
n_state_machine_index = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_STATES"
|
||||
n_states = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_BITS"
|
||||
n_bits = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$BIT"
|
||||
Bits.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$STATE"
|
||||
States.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$EVENT"
|
||||
Events_to_send.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$RULES"
|
||||
b_rules_definition = True
|
||||
|
||||
Case "$DO"
|
||||
b_rules_definition = False
|
||||
|
||||
Call evaluate_transitions()
|
||||
|
||||
Case Else
|
||||
|
||||
If (b_rules_definition) Then
|
||||
|
||||
temp_rule.state = sz_temp
|
||||
temp_rule.expression = (UCase$(Trim(sz_tokens(1))))
|
||||
temp_rule.next_state = (UCase$(Trim(sz_tokens(2))))
|
||||
temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3))))
|
||||
|
||||
Rules.Add(temp_rule)
|
||||
|
||||
Else
|
||||
MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString)
|
||||
End If
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End If ' commento
|
||||
End If ' linea vuota
|
||||
|
||||
Loop
|
||||
|
||||
objfile.Close()
|
||||
|
||||
Else
|
||||
MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste
|
||||
End If ' file exists
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "Evaluate"
|
||||
|
||||
Private Sub evaluate_transitions()
|
||||
|
||||
Dim sz_actual_state As String, sz_actual_bit As String, sz_line
|
||||
|
||||
Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16
|
||||
|
||||
|
||||
Dim b_bit(20) As Boolean, b_invert As Boolean
|
||||
|
||||
FrmMain.TextBox1.Text = ""
|
||||
|
||||
Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_transitions)
|
||||
|
||||
' ciclo per ogni stato
|
||||
For i = 0 To n_states - 1
|
||||
|
||||
sz_actual_state = States(i)
|
||||
|
||||
' ciclo per ogni ingresso
|
||||
For n_input = 0 To ((2 ^ n_bits) - 1)
|
||||
|
||||
' calcolo true false per ogni bit dell' ingresso
|
||||
n_mask = 1
|
||||
For n = 0 To (n_bits - 1)
|
||||
b_bit(n) = n_input And n_mask
|
||||
n_mask = n_mask << 1
|
||||
Next n
|
||||
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
|
||||
' ciclo per ogni regola
|
||||
For Each act_rule As Rule In Rules
|
||||
|
||||
n_bit = -1
|
||||
|
||||
' controllo se la regola attuale vale in questo stato
|
||||
If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then
|
||||
|
||||
If (act_rule.state = sz_actual_state) Then
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
|
||||
End If
|
||||
|
||||
'recupero il bit in questione
|
||||
b_invert = False
|
||||
|
||||
sz_actual_bit = act_rule.expression
|
||||
|
||||
If InStr(sz_actual_bit, "NOT") Then ' bit negato ???
|
||||
b_invert = True
|
||||
sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", ""))
|
||||
End If ' bit negato
|
||||
|
||||
' cerca il nome del bit e ne trova l' indice da 0
|
||||
n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo)))
|
||||
|
||||
If n_bit = -1 Then
|
||||
|
||||
MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state,
|
||||
MsgBoxStyle.Critical,
|
||||
"ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
' vera la espressione ?
|
||||
|
||||
If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit)
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf
|
||||
sz_line = ""
|
||||
|
||||
If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ?
|
||||
|
||||
' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato"
|
||||
|
||||
sz_line = n_state_machine_index.ToString & ";" &
|
||||
i.ToString & ";" &
|
||||
n_input.ToString & ";" &
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" &
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
|
||||
Call write_mac_file(sz_line)
|
||||
|
||||
Else
|
||||
sz_line = "----" & n_state_machine_index.ToString & ";" &
|
||||
i.ToString & ";" &
|
||||
n_input.ToString & ";" &
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" &
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
'Call write_mac_file(sz_line)
|
||||
|
||||
End If ' andrei allo stesso stato
|
||||
|
||||
Exit For ' esco da questo caso
|
||||
|
||||
End If ' vera la espressione
|
||||
|
||||
End If ' vale la regola
|
||||
|
||||
Next ' ciclo per tutte le regole
|
||||
|
||||
Next n_input ' ciclo per ogni ingresso
|
||||
|
||||
Next i ' ciclo per ogni stato
|
||||
|
||||
Call close_mac_file()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Module
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MapoState", "MapoState\MapoState.vbproj", "{492396EA-9B89-4318-879A-2DD7D0DBD1DD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{492396EA-9B89-4318-879A-2DD7D0DBD1DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,28 @@
|
||||
[General]
|
||||
|
||||
Program path = c:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\resource
|
||||
ext =
|
||||
|
||||
temp path = cd c:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\temp
|
||||
|
||||
[Debug]
|
||||
|
||||
debug = true
|
||||
verbose = true
|
||||
|
||||
[Log]
|
||||
enabled = true
|
||||
Log file = c:\CMS\aut_d20\temp\log
|
||||
|
||||
|
||||
[RUL]
|
||||
default = C:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\Resources\15.rul
|
||||
|
||||
inputs = IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato
|
||||
|
||||
transitions = IdxFamigliaIngresso;IdxStato;ValoreIngresso;next_IdxStato
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||
Partial Class FrmMain
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()>
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
Try
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
Finally
|
||||
MyBase.Dispose(disposing)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmMain))
|
||||
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
||||
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
|
||||
Me.CmdExit = New System.Windows.Forms.Button()
|
||||
Me.Btn_level_inputs = New System.Windows.Forms.Button()
|
||||
Me.Panel1 = New System.Windows.Forms.Panel()
|
||||
Me.Btn_level_transitions = New System.Windows.Forms.Button()
|
||||
Me.Panel1.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'TextBox1
|
||||
'
|
||||
Me.TextBox1.Location = New System.Drawing.Point(6, 12)
|
||||
Me.TextBox1.MaxLength = 1000000
|
||||
Me.TextBox1.Multiline = True
|
||||
Me.TextBox1.Name = "TextBox1"
|
||||
Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
|
||||
Me.TextBox1.Size = New System.Drawing.Size(705, 371)
|
||||
Me.TextBox1.TabIndex = 0
|
||||
'
|
||||
'OpenFileDialog1
|
||||
'
|
||||
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
|
||||
'
|
||||
'CmdExit
|
||||
'
|
||||
Me.CmdExit.Location = New System.Drawing.Point(623, 3)
|
||||
Me.CmdExit.Name = "CmdExit"
|
||||
Me.CmdExit.Size = New System.Drawing.Size(81, 35)
|
||||
Me.CmdExit.TabIndex = 18
|
||||
Me.CmdExit.Text = "Exit"
|
||||
Me.CmdExit.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Btn_level_inputs
|
||||
'
|
||||
Me.Btn_level_inputs.Location = New System.Drawing.Point(6, 3)
|
||||
Me.Btn_level_inputs.Name = "Btn_level_inputs"
|
||||
Me.Btn_level_inputs.Size = New System.Drawing.Size(126, 35)
|
||||
Me.Btn_level_inputs.TabIndex = 20
|
||||
Me.Btn_level_inputs.Text = "Macchina stati ingressi ( Livello 1 )"
|
||||
Me.Btn_level_inputs.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Panel1
|
||||
'
|
||||
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
|
||||
Me.Panel1.Controls.Add(Me.Btn_level_transitions)
|
||||
Me.Panel1.Controls.Add(Me.Btn_level_inputs)
|
||||
Me.Panel1.Controls.Add(Me.CmdExit)
|
||||
Me.Panel1.Location = New System.Drawing.Point(6, 400)
|
||||
Me.Panel1.Name = "Panel1"
|
||||
Me.Panel1.Size = New System.Drawing.Size(710, 43)
|
||||
Me.Panel1.TabIndex = 21
|
||||
'
|
||||
'Btn_level_transitions
|
||||
'
|
||||
Me.Btn_level_transitions.Location = New System.Drawing.Point(155, 3)
|
||||
Me.Btn_level_transitions.Name = "Btn_level_transitions"
|
||||
Me.Btn_level_transitions.Size = New System.Drawing.Size(126, 35)
|
||||
Me.Btn_level_transitions.TabIndex = 21
|
||||
Me.Btn_level_transitions.Text = "Macchina stati transiz. ( Livello 2 )"
|
||||
Me.Btn_level_transitions.UseVisualStyleBackColor = True
|
||||
'
|
||||
'FrmMain
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(723, 451)
|
||||
Me.Controls.Add(Me.Panel1)
|
||||
Me.Controls.Add(Me.TextBox1)
|
||||
Me.Cursor = System.Windows.Forms.Cursors.Default
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
|
||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||
Me.MaximizeBox = False
|
||||
Me.Name = "FrmMain"
|
||||
Me.Text = "Mapo state machine builder"
|
||||
Me.Panel1.ResumeLayout(False)
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
|
||||
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
|
||||
Friend WithEvents CmdExit As System.Windows.Forms.Button
|
||||
Friend WithEvents Btn_level_inputs As System.Windows.Forms.Button
|
||||
Friend WithEvents Panel1 As System.Windows.Forms.Panel
|
||||
Friend WithEvents Btn_level_transitions As Button
|
||||
End Class
|
||||
@@ -0,0 +1,166 @@
|
||||
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<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" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</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>
|
||||
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAgAQAAAAAAAAAAAAAAAEAAAAA
|
||||
AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAMDcwADwyqYAzP//AJn//wBm//8AM///AP/M
|
||||
/wDMzP8Amcz/AGbM/wAzzP8AAMz/AP+Z/wDMmf8AmZn/AGaZ/wAzmf8AAJn/AP9m/wDMZv8AmWb/AGZm
|
||||
/wAzZv8AAGb/AP8z/wDMM/8AmTP/AGYz/wAzM/8AADP/AMwA/wCZAP8AZgD/ADMA/wD//8wAzP/MAJn/
|
||||
zABm/8wAZv/MADP/zAAA/8wA/8zMAMzMzACZzMwAZszMADPMzAAAzMwA/5nMAMyZzACZmcwAZpnMADOZ
|
||||
zAAAmcwA/2bMAMxmzACZZswAZmbMADNmzAAAZswA/zPMAMwzzACZM8wAZjPMADMzzAAAM8wA/wDMAMwA
|
||||
zACZAMwAZgDMADMAzAAAAMwA//+ZAMz/mQCZ/5kAZv+ZADP/mQAA/5kA/8yZAMzMmQCZzJkAZsyZADPM
|
||||
mQAAzJkA/5mZAMyZmQCZmZkAZpmZADOZmQAAmZkA/2aZAMxmmQCZZpkAZmaZADNmmQAAZpkA/zOZAMwz
|
||||
mQCZM5kAZjOZADMzmQAAM5kA/wCZAMwAmQCZAJkAZgCZADMAmQAAAJkA//9mAMz/ZgCZ/2YAZv9mADP/
|
||||
ZgAA/2YA/8xmAMzMZgCZzGYAZsxmADPMZgAAzGYA/5lmAMyZZgCZmWYAZplmADOZZgAAmWYA/2ZmAMxm
|
||||
ZgCZZmYAZmZmADNmZgAAZmYA/zNmAMwzZgCZM2YAZjNmADMzZgAAM2YA/wBmAMwAZgCZAGYAZgBmADMA
|
||||
ZgAAAGYA//8zAMz/MwCZ/zMAZv8zADP/MwAA/zMA/8wzAMzMMwCZzDMAZswzADPMMwAAzDMA/5kzAMyZ
|
||||
MwCZmTMAZpkzADOZMwAAmTMA/2YzAMxmMwCZZjMAZmYzADNmMwAAZjMA/zMzAMwzMwCZMzMAZjMzADMz
|
||||
MwAAMzMA/wAzAMwAMwCZADMAZgAzADMAMwAAADMAzP8AAJn/AABm/wAAM/8AAP/MAADMzAAAmcwAAGbM
|
||||
AAAzzAAAAMwAAP+ZAADMmQAAmZkAAGaZAAAzmQAAAJkAAP9mAADMZgAAmWYAAGZmAAAAZgAAM2YAAP8z
|
||||
AADMMwAAmTMAAGYzAAAzMwAAADMAAMwAAACZAAAAZgAAADMAAAAAAN0AAAC7AAAAqgAAAIgAAAB3AAAA
|
||||
VQAAAEQAAAAiAADdAAAAuwAAAKoAAACIAAAAdwAAAFUAAABEAAAAIgAA3d3dAFVVVQB3d3cAd3d3AERE
|
||||
RAAiIiIAERERAHcAAABVAAAARAAAACIAAADw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
|
||||
AAD///8AAAAAAAAAAAAA7Ozs7Ozs7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7OwAAAAAAAAA7OwAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAOwAADo6OmRkj48A7OwAAAAAAAAAAAAAAAAAAAAAAOzsADo6Ojo6ZGRkj48A
|
||||
7AAAAAAAAAAAAAAAAAAAAADsAAA6Ojr/EBAQEBAQjwDs7AAAAAAAAAAAAAAAAAAA7AAQELM6/xAQEBAQ
|
||||
7BAQEADsAAAAAAAAAAAAAAAAAOwAEBAQEP8QEBAQEPjw//8QAOwAAAAAAAAAAAAAAAAAABAQ////EBAQ
|
||||
EBAQ+PgK9xAA7AAAAAAAAAAAAAAAAOwA//8KChAQEBAQEBAQ/////xAA7AAAAAAAAAAAAAAAAP8KCgoQ
|
||||
EBAQEBD/7P//Cvf/EADsAAAAAAAAAAAAAAAA/woKChAQEBD/+PjsiP////cQAOzs7AAAAAAAAAAAAAD/
|
||||
CgoKEBAQ+Pjs7IgHCgr3ChCPAADs7OwAAAAAAAAAAP8KCgoQEP//7IgH/wr3/////xCPZAAA7OwAAAAA
|
||||
AAAA/woKChAQ//8H//8K9/8K/////xAQOmQA7AAAAAAAAAAA/woKEBD/////Cvf/Cvf/Cv//////EADs
|
||||
AAAAAAAAAAAACgoQEBAQ/////wr3/wr3////AAD/AOwAAAAAAAAAAAAA/xAQEBAQEBD/Mv8K9/8AEAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAoKChAQEBD/CvcAAOGQ7OwAAAAAAAAAAAAAAAAAAAAAAAAAChAQEP//AOHh
|
||||
+OGQ7AAAAAAAAAAAAAAAAAAAAAAAAAAA/xAQEP//APjh+OHs7AAAAAAAAAAAAAAAAAAAAAAAAAAA/xAQ
|
||||
EBAAAPjh+ADs7AAAAAAAAAAAAAAAAAAAAAAAAAD/EBAQAOwAAPjh4QDs7AAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAD/EBAA7AAAAOHhiADsAAAAAAAAAAAAAAAAAAAAAAAAAAoQEI8A7AAAAIjh4ezsAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAoKCgDsAAAAAOHhAOzsAAAAAAAAAAAAAAAAAAAAAAAAAAAA7AAAAAAAAOHhAOzs7OwAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOHhAAAAAOwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOEAQUEA
|
||||
7OwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhBQUEA7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
ABgYQUEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIgHAAAYGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAACIiAAAAP+A///+AD///AAf//AAH//gAA//wAAP/4AAD/+AAA//AAAH/wAAB/8AAAH/AAAAfwAA
|
||||
AD8AAAA/gAAAP8AAAD/gAAZ/8AAD//wAA///gAH//8AA///AQH//4GB//+AwP//wOB//+HwD///+Af//
|
||||
/wD///+A////wP///4D////h
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,134 @@
|
||||
Imports System.IO
|
||||
|
||||
Public Class FrmMain
|
||||
|
||||
|
||||
|
||||
Public sz_import_file_name As String
|
||||
|
||||
|
||||
|
||||
Public Sub New()
|
||||
|
||||
' This call is required by the Windows Form Designer.
|
||||
InitializeComponent()
|
||||
|
||||
' Add any initialization after the InitializeComponent() call.
|
||||
|
||||
' Call My_initialize() NO !!! dà errore di ricursione sui componenti del form !!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub My_initialize() Handles Me.Load
|
||||
|
||||
Call L_my_convert.Init()
|
||||
|
||||
' read ini file & init global variables
|
||||
Call IniRead.Ini_read()
|
||||
|
||||
' read messages
|
||||
Call Message.init()
|
||||
|
||||
' inizializzazione variabili
|
||||
Call Init_Var()
|
||||
|
||||
' richiamo funzione che inizializza grafica e messaggi
|
||||
Call InitAspect()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Init_Var()
|
||||
|
||||
sz_import_file_name = IniRead.sz_program_path & "\"
|
||||
|
||||
|
||||
With OpenFileDialog1
|
||||
.Reset()
|
||||
.InitialDirectory = IniRead.sz_default_rul_filename
|
||||
|
||||
.AddExtension = True
|
||||
|
||||
' Check to ensure that the selected file exists. Dialog box displays
|
||||
|
||||
.CheckFileExists = True
|
||||
.CheckPathExists = True
|
||||
.DefaultExt = "rul"
|
||||
.DereferenceLinks = True
|
||||
.Filter = _
|
||||
"RUL files (*.rul)|*.rul|All files|*.*"
|
||||
.Multiselect = False
|
||||
.RestoreDirectory = True
|
||||
.ShowHelp = True
|
||||
.ShowReadOnly = False
|
||||
.ReadOnlyChecked = False
|
||||
.Title = "Select an RUL file to open"
|
||||
.ValidateNames = True
|
||||
End With
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Ask_file()
|
||||
|
||||
Try
|
||||
With OpenFileDialog1
|
||||
|
||||
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
' You have a choice here. You can either use the FileName or FileNames properties to get the name
|
||||
' you selected, or you can use the OpenFile method to open the file as a read-only Stream.
|
||||
' lstFiles.DataSource = .FileNames
|
||||
|
||||
sz_import_file_name = .FileName
|
||||
' You could also write code like this, to loop through the selected file names:
|
||||
'Dim strName As String
|
||||
'For Each strName In .FileNames
|
||||
' lstFiles.Items.Add(strName)
|
||||
'Next
|
||||
|
||||
Else
|
||||
sz_import_file_name = ""
|
||||
End If
|
||||
|
||||
End With
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Exclamation, Me.Text)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub ToDo()
|
||||
|
||||
' DONE
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdExit.Click
|
||||
|
||||
Application.Exit()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Btn_level_inputs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_level_inputs.Click
|
||||
|
||||
Call Ask_file()
|
||||
|
||||
actual_level = LEVELS.LIVELLO_INGRESSI
|
||||
|
||||
If sz_import_file_name <> "" Then Call M_files.Read_rule_file(sz_import_file_name)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Btn_level_transitions_Click(sender As Object, e As EventArgs) Handles Btn_level_transitions.Click
|
||||
|
||||
Call Ask_file()
|
||||
|
||||
actual_level = LEVELS.LIVELLO_TRANSIZIONI
|
||||
|
||||
If sz_import_file_name <> "" Then Call M_transitions.Read_rule_file_transitions(sz_import_file_name)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{492396EA-9B89-4318-879A-2DD7D0DBD1DD}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>MapoState.My.MyApplication</StartupObject>
|
||||
<RootNamespace>MapoState</RootNamespace>
|
||||
<AssemblyName>MapoState</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<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>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>.\</OutputPath>
|
||||
<DocumentationFile>MapoState.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>MapoState.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FrmMain.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrmMain.Designer.vb">
|
||||
<DependentUpon>FrmMain.vb</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Module\General.vb" />
|
||||
<Compile Include="Module\IniRead.vb" />
|
||||
<Compile Include="Module\IniReader.vb" />
|
||||
<Compile Include="Module\L_File_aux.vb" />
|
||||
<Compile Include="Module\Message.vb" />
|
||||
<Compile Include="Module\M_files.vb" />
|
||||
<Compile Include="Module\L_my_convert.vb" />
|
||||
<Compile Include="Module\M_transitions.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="FrmMain.resx">
|
||||
<DependentUpon>FrmMain.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Config\MapoState.ini" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,313 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>
|
||||
MapoState
|
||||
</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:MapoState.IniReader">
|
||||
<summary>
|
||||
The INIReader class can read keys from and write keys to an INI file.
|
||||
</summary>
|
||||
<remarks>
|
||||
This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD.
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.GetPrivateProfileInt(System.String@,System.String@,System.Int32,System.String@)">
|
||||
<summary>
|
||||
The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file.
|
||||
</summary>
|
||||
<param name="lpApplicationName">Pointer to a null-terminated string specifying the name of the section in the initialization file.</param>
|
||||
<param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer.</param>
|
||||
<param name="nDefault">Specifies the default value to return if the key name cannot be found in the initialization file.</param>
|
||||
<param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
<returns>The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.WritePrivateProfileString(System.String@,System.String@,System.String@,System.String@)">
|
||||
<summary>
|
||||
The WritePrivateProfileString function copies a string into the specified section of an initialization file.
|
||||
</summary>
|
||||
<param name="lpApplicationName">Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.</param>
|
||||
<param name="lpKeyName">Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted.</param>
|
||||
<param name="lpString">Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted.</param>
|
||||
<param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file.</param>
|
||||
<returns>If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.GetPrivateProfileString(System.String@,System.String@,System.String@,System.Text.StringBuilder,System.Int32,System.String@)">
|
||||
<summary>
|
||||
The GetPrivateProfileString function retrieves a string from the specified section in an initialization file.
|
||||
</summary>
|
||||
<param name="lpApplicationName">Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.</param>
|
||||
<param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.</param>
|
||||
<param name="lpDefault">Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL. <br>Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.</br></param>
|
||||
<param name="lpReturnedString">Pointer to the buffer that receives the retrieved string.</param>
|
||||
<param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter.</param>
|
||||
<param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
<returns>The return value is the number of characters copied to the buffer, not including the terminating null character.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.GetPrivateProfileSectionNames(System.Byte[],System.Int32,System.String@)">
|
||||
<summary>
|
||||
The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file.
|
||||
</summary>
|
||||
<param name="lpszReturnBuffer">Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.</param>
|
||||
<param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter.</param>
|
||||
<param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
<returns>The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.WritePrivateProfileSection(System.String@,System.String@,System.String@)">
|
||||
<summary>
|
||||
The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file.
|
||||
</summary>
|
||||
<param name="lpAppName">Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application.</param>
|
||||
<param name="lpString">Pointer to a buffer containing the new key names and associated values that are to be written to the named section.</param>
|
||||
<param name="lpFileName">Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist.</param>
|
||||
<returns>If the function succeeds, the return value is nonzero.<br>If the function fails, the return value is zero.</br></returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.#ctor(System.String)">
|
||||
<summary>Constructs a new IniReader instance.</summary>
|
||||
<param name="file">Specifies the full path to the INI file (the file doesn't have to exist).</param>
|
||||
</member>
|
||||
<member name="P:MapoState.IniReader.Filename">
|
||||
<summary>Gets or sets the full path to the INI file.</summary>
|
||||
<value>A String representing the full path to the INI file.</value>
|
||||
|
||||
</member>
|
||||
<member name="P:MapoState.IniReader.Section">
|
||||
<summary>Gets or sets the section you're working in. (aka 'the active section')</summary>
|
||||
<value>A String representing the section you're working in.</value>
|
||||
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadInteger(System.String,System.String,System.Int32)">
|
||||
<summary>Reads an Integer from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadInteger(System.String,System.String)">
|
||||
<summary>Reads an Integer from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadInteger(System.String,System.Int32)">
|
||||
<summary>Reads an Integer from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The section to search in.</param>
|
||||
<returns>Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadInteger(System.String)">
|
||||
<summary>Reads an Integer from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadString(System.String,System.String,System.String)">
|
||||
<summary>Reads a String from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadString(System.String,System.String)">
|
||||
<summary>Reads a String from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadString(System.String)">
|
||||
<summary>Reads a String from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadLong(System.String,System.String,System.Int64)">
|
||||
<summary>Reads a Long from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadLong(System.String,System.String)">
|
||||
<summary>Reads a Long from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadLong(System.String,System.Int64)">
|
||||
<summary>Reads a Long from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The section to search in.</param>
|
||||
<returns>Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadLong(System.String)">
|
||||
<summary>Reads a Long from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadByteArray(System.String,System.String)">
|
||||
<summary>Reads a Byte array from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadByteArray(System.String)">
|
||||
<summary>Reads a Byte array from the specified key of the active section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadBoolean(System.String,System.String,System.Boolean)">
|
||||
<summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadBoolean(System.String,System.String)">
|
||||
<summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
<param name="section">The section to search in.</param>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadBoolean(System.String,System.Boolean)">
|
||||
<summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
<returns>Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.ReadBoolean(System.String)">
|
||||
<summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
<param name="key">The key from which to return the value.</param>
|
||||
<returns>Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.Int32)">
|
||||
<summary>Writes an Integer to the specified key in the specified section.</summary>
|
||||
<param name="section">The section to write in.</param>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.Int32)">
|
||||
<summary>Writes an Integer to the specified key in the active section.</summary>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.String)">
|
||||
<summary>Writes a String to the specified key in the specified section.</summary>
|
||||
<param name="section">Specifies the section to write in.</param>
|
||||
<param name="key">Specifies the key to write to.</param>
|
||||
<param name="value">Specifies the value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String)">
|
||||
<summary>Writes a String to the specified key in the active section.</summary>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.Int64)">
|
||||
<summary>Writes a Long to the specified key in the specified section.</summary>
|
||||
<param name="section">The section to write in.</param>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.Int64)">
|
||||
<summary>Writes a Long to the specified key in the active section.</summary>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.Byte[])">
|
||||
<summary>Writes a Byte array to the specified key in the specified section.</summary>
|
||||
<param name="section">The section to write in.</param>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.Byte[])">
|
||||
<summary>Writes a Byte array to the specified key in the active section.</summary>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.Byte[],System.Int32,System.Int32)">
|
||||
<summary>Writes a Byte array to the specified key in the specified section.</summary>
|
||||
<param name="section">The section to write in.</param>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<param name="offset">An offset in <i>value</i>.</param>
|
||||
<param name="length">The number of elements of <i>value</i> to convert.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.String,System.Boolean)">
|
||||
<summary>Writes a Boolean to the specified key in the specified section.</summary>
|
||||
<param name="section">The section to write in.</param>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.Write(System.String,System.Boolean)">
|
||||
<summary>Writes a Boolean to the specified key in the active section.</summary>
|
||||
<param name="key">The key to write to.</param>
|
||||
<param name="value">The value to write.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.DeleteKey(System.String,System.String)">
|
||||
<summary>Deletes a key from the specified section.</summary>
|
||||
<param name="section">The section to delete from.</param>
|
||||
<param name="key">The key to delete.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.DeleteKey(System.String)">
|
||||
<summary>Deletes a key from the active section.</summary>
|
||||
<param name="key">The key to delete.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.DeleteSection(System.String)">
|
||||
<summary>Deletes a section from an INI file.</summary>
|
||||
<param name="section">The section to delete.</param>
|
||||
<returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
</member>
|
||||
<member name="M:MapoState.IniReader.GetSectionNames">
|
||||
<summary>
|
||||
Retrieves a list of all available sections in the INI file.
|
||||
</summary>
|
||||
<returns>
|
||||
Returns an ArrayList with all available sections.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="F:MapoState.IniReader.m_Filename">
|
||||
<summary>
|
||||
Holds the full path to the INI file.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:MapoState.IniReader.m_Section">
|
||||
<summary>
|
||||
Holds the active section name
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:MapoState.IniReader.MAX_ENTRY">
|
||||
<summary>
|
||||
The maximum number of bytes in a section buffer.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:MapoState.My.Resources.Resources">
|
||||
<summary>
|
||||
Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MapoState.My.Resources.Resources.ResourceManager">
|
||||
<summary>
|
||||
Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:MapoState.My.Resources.Resources.Culture">
|
||||
<summary>
|
||||
Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,72 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
' ----------------------------------------------------------------------------------------------------------
|
||||
' Modulo utilizzato per dichiarazioni variabili globali e funzioni comuni al progetto
|
||||
' ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
Module General
|
||||
|
||||
#Region "COSTANTI GLOBALI"
|
||||
|
||||
Public Const EPSILON = 0.05
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "OGGETTI"
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "STRUTTURE"
|
||||
|
||||
Public Structure Rule
|
||||
Public state As String
|
||||
Public expression As String
|
||||
Public next_state As String
|
||||
Public event_to_send As String
|
||||
End Structure
|
||||
|
||||
Public Enum LEVELS As Short
|
||||
LIVELLO_INGRESSI = 1
|
||||
LIVELLO_TRANSIZIONI = 2
|
||||
End Enum
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "VARIABILI GLOBALI"
|
||||
|
||||
Public States As New List(Of String)
|
||||
Public Bits As New List(Of String)
|
||||
Public Events_to_send As New List(Of String)
|
||||
Public Rules As New List(Of Rule)
|
||||
|
||||
Public sz_state_machine_name As String
|
||||
Public n_state_machine_index As Int16
|
||||
Public n_states As Int16
|
||||
Public n_bits As Int16
|
||||
|
||||
Public actual_level As LEVELS
|
||||
Public read_level As LEVELS = LEVELS.LIVELLO_INGRESSI
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "PROCEDURE E FUNZIONI GLOBALI"
|
||||
|
||||
|
||||
' ---------------------------------------------------------------------------------------------------
|
||||
' --------- Procedura utilizzata per Cambiare messaggi della finestra principale --------------------
|
||||
' ---------------------------------------------------------------------------------------------------
|
||||
Public Sub InitAspect()
|
||||
|
||||
FrmMain.Btn_level_inputs.Text = Message.Msg(21) ' livello 1
|
||||
|
||||
FrmMain.Btn_level_transitions.Text = Message.Msg(24) ' livello 2
|
||||
|
||||
FrmMain.CmdExit.Text = Message.Msg(23) ' Exit
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,77 @@
|
||||
Public Module IniRead
|
||||
|
||||
Public Const OVERWRITE As Boolean = True
|
||||
Public Const APPEND As Boolean = True
|
||||
Public Const DO_NOT_APPEND As Boolean = False
|
||||
|
||||
Public sz_program_path As String
|
||||
Public sz_temporary_path As String
|
||||
Public sz_allowed_extension As String
|
||||
|
||||
Public b_debug As Boolean
|
||||
Public b_verbose As Boolean
|
||||
|
||||
Public b_offline_mode As Boolean = False
|
||||
|
||||
Public b_log_enabled As Boolean
|
||||
Public szLogFileName As String
|
||||
|
||||
|
||||
Public lTimerInterval As Long
|
||||
|
||||
Public sz_default_rul_filename As String ' default rul file
|
||||
Public sz_file_init_inputs As String
|
||||
Public sz_file_init_transitions As String
|
||||
|
||||
|
||||
|
||||
Sub Ini_read()
|
||||
|
||||
Dim ini As New IniReader(Application.StartupPath & "\config\" & Application.ProductName & ".ini")
|
||||
|
||||
ini.Section = "General" '-----------------------------------------------------
|
||||
|
||||
sz_program_path = clear_ending_bar(ini.ReadString("Program path"))
|
||||
sz_temporary_path = clear_ending_bar(ini.ReadString("temp path"))
|
||||
sz_allowed_extension = clear_starting_point(ini.ReadString(ini.Section, "ext", "").ToUpper)
|
||||
|
||||
|
||||
lTimerInterval = ini.ReadLong("timer", 1000)
|
||||
|
||||
b_offline_mode = ini.ReadBoolean("offline mode", False)
|
||||
|
||||
|
||||
ini.Section = "Debug" '-----------------------------------------------------
|
||||
|
||||
b_debug = ini.ReadBoolean("debug", False)
|
||||
b_verbose = ini.ReadBoolean("verbose", False)
|
||||
|
||||
ini.Section = "Log" '-----------------------------------------------------
|
||||
|
||||
b_log_enabled = ini.ReadBoolean("enabled", False)
|
||||
szLogFileName = ini.ReadString("Log file")
|
||||
|
||||
|
||||
ini.Section = "RUL" '-----------------------------------------------------
|
||||
|
||||
sz_default_rul_filename = ini.ReadString("default")
|
||||
|
||||
sz_file_init_inputs = ini.ReadString("inputs")
|
||||
sz_file_init_transitions = ini.ReadString("transitions")
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function HexToStr(ByVal Data As String) As String
|
||||
Dim com As String = ""
|
||||
For x = 0 To Data.Length - 1 Step 2
|
||||
com &= ChrW(CInt("&H" & Data.Substring(x, 2)))
|
||||
Next
|
||||
Return com
|
||||
End Function
|
||||
|
||||
#Region "fuffa"
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,454 @@
|
||||
'
|
||||
' IniReader class
|
||||
|
||||
Imports System
|
||||
Imports System.Text
|
||||
Imports System.Collections
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' The INIReader class can read keys from and write keys to an INI file.
|
||||
''' </summary>
|
||||
''' <remarks>
|
||||
''' This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD.
|
||||
''' </remarks>
|
||||
|
||||
Public Class IniReader
|
||||
|
||||
''' <summary>
|
||||
''' The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file.
|
||||
''' </summary>
|
||||
''' <param name="lpApplicationName">Pointer to a null-terminated string specifying the name of the section in the initialization file.</param>
|
||||
''' <param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer.</param>
|
||||
''' <param name="nDefault">Specifies the default value to return if the key name cannot be found in the initialization file.</param>
|
||||
''' <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
''' <returns>The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero.</returns>
|
||||
|
||||
Private Declare Ansi Function GetPrivateProfileInt Lib "kernel32.dll" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer
|
||||
|
||||
''' <summary>
|
||||
''' The WritePrivateProfileString function copies a string into the specified section of an initialization file.
|
||||
''' </summary>
|
||||
''' <param name="lpApplicationName">Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.</param>
|
||||
''' <param name="lpKeyName">Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted.</param>
|
||||
''' <param name="lpString">Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted.</param>
|
||||
''' <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file.</param>
|
||||
''' <returns>If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero.</returns>
|
||||
|
||||
Private Declare Ansi Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
|
||||
|
||||
''' <summary>
|
||||
''' The GetPrivateProfileString function retrieves a string from the specified section in an initialization file.
|
||||
''' </summary>
|
||||
''' <param name="lpApplicationName">Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.</param>
|
||||
''' <param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.</param>
|
||||
''' <param name="lpDefault">Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL. <br>Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.</br></param>
|
||||
''' <param name="lpReturnedString">Pointer to the buffer that receives the retrieved string.</param>
|
||||
''' <param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter.</param>
|
||||
''' <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
''' <returns>The return value is the number of characters copied to the buffer, not including the terminating null character.</returns>
|
||||
|
||||
Private Declare Ansi Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
|
||||
|
||||
''' <summary>
|
||||
''' The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file.
|
||||
''' </summary>
|
||||
''' <param name="lpszReturnBuffer">Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.</param>
|
||||
''' <param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter.</param>
|
||||
''' <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
|
||||
''' <returns>The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two.</returns>
|
||||
|
||||
Private Declare Ansi Function GetPrivateProfileSectionNames Lib "kernel32" Alias "GetPrivateProfileSectionNamesA" (ByVal lpszReturnBuffer() As Byte, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
|
||||
|
||||
''' <summary>
|
||||
''' The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file.
|
||||
''' </summary>
|
||||
''' <param name="lpAppName">Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application.</param>
|
||||
''' <param name="lpString">Pointer to a buffer containing the new key names and associated values that are to be written to the named section.</param>
|
||||
''' <param name="lpFileName">Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist.</param>
|
||||
''' <returns>If the function succeeds, the return value is nonzero.<br>If the function fails, the return value is zero.</br></returns>
|
||||
|
||||
Private Declare Ansi Function WritePrivateProfileSection Lib "kernel32.dll" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
|
||||
|
||||
''' <summary>Constructs a new IniReader instance.</summary>
|
||||
''' <param name="file">Specifies the full path to the INI file (the file doesn't have to exist).</param>
|
||||
|
||||
Public Sub New(ByVal file As String)
|
||||
Filename = file
|
||||
End Sub
|
||||
|
||||
''' <summary>Gets or sets the full path to the INI file.</summary>
|
||||
''' <value>A String representing the full path to the INI file.</value>
|
||||
'''
|
||||
|
||||
Public Property Filename() As String
|
||||
Get
|
||||
Return m_Filename
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_Filename = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
''' <summary>Gets or sets the section you're working in. (aka 'the active section')</summary>
|
||||
''' <value>A String representing the section you're working in.</value>
|
||||
'''
|
||||
|
||||
Public Property Section() As String
|
||||
Get
|
||||
Return m_Section
|
||||
End Get
|
||||
Set(ByVal Value As String)
|
||||
m_Section = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
''' <summary>Reads an Integer from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadInteger(ByVal section As String, ByVal key As String, ByVal defVal As Integer) As Integer
|
||||
Return GetPrivateProfileInt(section, key, defVal, Filename)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads an Integer from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadInteger(ByVal section As String, ByVal key As String) As Integer
|
||||
Return ReadInteger(section, key, 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads an Integer from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The section to search in.</param>
|
||||
''' <returns>Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadInteger(ByVal key As String, ByVal defVal As Integer) As Integer
|
||||
Return ReadInteger(Section, key, defVal)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads an Integer from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadInteger(ByVal key As String) As Integer
|
||||
Return ReadInteger(key, 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a String from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadString(ByVal section As String, ByVal key As String, ByVal defVal As String) As String
|
||||
Dim sb As New StringBuilder(MAX_ENTRY)
|
||||
Dim Ret As Integer = GetPrivateProfileString(section, key, defVal, sb, MAX_ENTRY, Filename)
|
||||
Return sb.ToString()
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a String from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadString(ByVal section As String, ByVal key As String) As String
|
||||
Return ReadString(section, key, "")
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a String from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadString(ByVal key As String) As String
|
||||
Return ReadString(Section, key)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Long from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadLong(ByVal section As String, ByVal key As String, ByVal defVal As Long) As Long
|
||||
Return Long.Parse(ReadString(section, key, defVal.ToString()))
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Long from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadLong(ByVal section As String, ByVal key As String) As Long
|
||||
Return ReadLong(section, key, 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Long from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The section to search in.</param>
|
||||
''' <returns>Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadLong(ByVal key As String, ByVal defVal As Long) As Long
|
||||
Return ReadLong(Section, key, defVal)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Long from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadLong(ByVal key As String) As Long
|
||||
Return ReadLong(key, 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Byte array from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadByteArray(ByVal section As String, ByVal key As String) As Byte()
|
||||
Try
|
||||
Return Convert.FromBase64String(ReadString(section, key))
|
||||
Catch
|
||||
End Try
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Byte array from the specified key of the active section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadByteArray(ByVal key As String) As Byte()
|
||||
Return ReadByteArray(Section, key)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadBoolean(ByVal section As String, ByVal key As String, ByVal defVal As Boolean) As Boolean
|
||||
|
||||
Dim b_ret As Boolean = False
|
||||
|
||||
Try
|
||||
b_ret = Boolean.Parse(ReadString(section, key, defVal.ToString()))
|
||||
Catch
|
||||
b_ret = False
|
||||
End Try
|
||||
Return b_ret
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
''' <param name="section">The section to search in.</param>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file.</returns>
|
||||
|
||||
Public Function ReadBoolean(ByVal section As String, ByVal key As String) As Boolean
|
||||
Return ReadBoolean(section, key, False)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <param name="defVal">The value to return if the specified key isn't found.</param>
|
||||
''' <returns>Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadBoolean(ByVal key As String, ByVal defVal As Boolean) As Boolean
|
||||
Return ReadBoolean(Section, key, defVal)
|
||||
End Function
|
||||
|
||||
''' <summary>Reads a Boolean from the specified key of the specified section.</summary>
|
||||
''' <param name="key">The key from which to return the value.</param>
|
||||
''' <returns>Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file.</returns>
|
||||
|
||||
Public Function ReadBoolean(ByVal key As String) As Boolean
|
||||
Return ReadBoolean(Section, key)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes an Integer to the specified key in the specified section.</summary>
|
||||
''' <param name="section">The section to write in.</param>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Integer) As Boolean
|
||||
Return Write(section, key, value.ToString())
|
||||
End Function
|
||||
|
||||
''' <summary>Writes an Integer to the specified key in the active section.</summary>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal key As String, ByVal value As Integer) As Boolean
|
||||
Return Write(Section, key, value)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a String to the specified key in the specified section.</summary>
|
||||
''' <param name="section">Specifies the section to write in.</param>
|
||||
''' <param name="key">Specifies the key to write to.</param>
|
||||
''' <param name="value">Specifies the value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value As String) As Boolean
|
||||
Return (WritePrivateProfileString(section, key, value, Filename) <> 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a String to the specified key in the active section.</summary>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal key As String, ByVal value As String) As Boolean
|
||||
Return Write(Section, key, value)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Long to the specified key in the specified section.</summary>
|
||||
''' <param name="section">The section to write in.</param>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Long) As Boolean
|
||||
Return Write(section, key, value.ToString())
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Long to the specified key in the active section.</summary>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal key As String, ByVal value As Long) As Boolean
|
||||
Return Write(Section, key, value)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Byte array to the specified key in the specified section.</summary>
|
||||
''' <param name="section">The section to write in.</param>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value() As Byte) As Boolean
|
||||
If value Is Nothing Then
|
||||
Return Write(section, key, CType(Nothing, String))
|
||||
Else
|
||||
Return Write(section, key, value, 0, value.Length)
|
||||
End If
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Byte array to the specified key in the active section.</summary>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal key As String, ByVal value() As Byte) As Boolean
|
||||
Return Write(Section, key, value)
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Byte array to the specified key in the specified section.</summary>
|
||||
''' <param name="section">The section to write in.</param>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <param name="offset">An offset in <i>value</i>.</param>
|
||||
''' <param name="length">The number of elements of <i>value</i> to convert.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value() As Byte, ByVal offset As Integer, ByVal length As Integer) As Boolean
|
||||
If value Is Nothing Then
|
||||
Return Write(section, key, CType(Nothing, String))
|
||||
Else
|
||||
Return Write(section, key, Convert.ToBase64String(value, offset, length))
|
||||
End If
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Boolean to the specified key in the specified section.</summary>
|
||||
''' <param name="section">The section to write in.</param>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal section As String, ByVal key As String, ByVal value As Boolean) As Boolean
|
||||
Return Write(section, key, value.ToString())
|
||||
End Function
|
||||
|
||||
''' <summary>Writes a Boolean to the specified key in the active section.</summary>
|
||||
''' <param name="key">The key to write to.</param>
|
||||
''' <param name="value">The value to write.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function Write(ByVal key As String, ByVal value As Boolean) As Boolean
|
||||
Return Write(Section, key, value)
|
||||
End Function
|
||||
|
||||
''' <summary>Deletes a key from the specified section.</summary>
|
||||
''' <param name="section">The section to delete from.</param>
|
||||
''' <param name="key">The key to delete.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function DeleteKey(ByVal section As String, ByVal key As String) As Boolean
|
||||
Return (WritePrivateProfileString(section, key, Nothing, Filename) <> 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Deletes a key from the active section.</summary>
|
||||
''' <param name="key">The key to delete.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
'''
|
||||
|
||||
Public Function DeleteKey(ByVal key As String) As Boolean
|
||||
Return (WritePrivateProfileString(Section, key, Nothing, Filename) <> 0)
|
||||
End Function
|
||||
|
||||
''' <summary>Deletes a section from an INI file.</summary>
|
||||
''' <param name="section">The section to delete.</param>
|
||||
''' <returns>Returns true if the function succeeds, false otherwise.</returns>
|
||||
|
||||
Public Function DeleteSection(ByVal section As String) As Boolean
|
||||
Return WritePrivateProfileSection(section, Nothing, Filename) <> 0
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Retrieves a list of all available sections in the INI file.
|
||||
''' </summary>
|
||||
''' <returns>
|
||||
''' Returns an ArrayList with all available sections.
|
||||
''' </returns>
|
||||
|
||||
Public Function GetSectionNames() As ArrayList
|
||||
Try
|
||||
Dim buffer(MAX_ENTRY) As Byte
|
||||
GetPrivateProfileSectionNames(buffer, MAX_ENTRY, Filename)
|
||||
Dim parts() As String = Encoding.ASCII.GetString(buffer).Trim(ControlChars.NullChar).Split(ControlChars.NullChar)
|
||||
Return New ArrayList(parts)
|
||||
Catch
|
||||
End Try
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
'Private variables and constants
|
||||
|
||||
''' <summary>
|
||||
''' Holds the full path to the INI file.
|
||||
''' </summary>
|
||||
|
||||
Private m_Filename As String
|
||||
|
||||
''' <summary>
|
||||
''' Holds the active section name
|
||||
''' </summary>
|
||||
|
||||
Private m_Section As String
|
||||
|
||||
''' <summary>
|
||||
''' The maximum number of bytes in a section buffer.
|
||||
''' </summary>
|
||||
|
||||
Private Const MAX_ENTRY As Integer = 32768
|
||||
|
||||
End Class
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
Module L_File_aux
|
||||
|
||||
Function clear_ending_bar(ByVal a As String) As String ' clear the eventual ending "\" in a directory name
|
||||
a = Trim(a)
|
||||
If (Right$(a, 1) = "\") Then
|
||||
a = Left$(a, Len(a) - 1)
|
||||
End If
|
||||
clear_ending_bar = a
|
||||
End Function
|
||||
|
||||
Function clear_starting_point(ByVal a As String) As String ' clear the eventual starting "." in a file ext
|
||||
a = Trim(a)
|
||||
If (Left$(a, 1) = ".") Then
|
||||
a = Right$(a, Len(a) - 1)
|
||||
End If
|
||||
clear_starting_point = a
|
||||
End Function
|
||||
|
||||
Function true_false_from_yes_no(ByVal a As String) As Boolean
|
||||
a = UCase$(a)
|
||||
true_false_from_yes_no = False
|
||||
If InStr(a, "Y") Then true_false_from_yes_no = True
|
||||
If InStr(a, "S") Then true_false_from_yes_no = True
|
||||
End Function
|
||||
|
||||
Function clear_starting_forward_bar(ByVal a As String) As String ' clear the eventual initial "/"
|
||||
a = Trim(a)
|
||||
If (Left$(a, 1) = "/") Then
|
||||
a = Right$(a, Len(a) - 1)
|
||||
End If
|
||||
clear_starting_forward_bar = a
|
||||
End Function
|
||||
|
||||
Function trim_to_n_char(ByVal a As String, ByVal n As Integer) As String ' clear the eventual initial "/"
|
||||
a = Trim(a)
|
||||
If Len(a) > n Then a = Left$(a, n)
|
||||
trim_to_n_char = a
|
||||
End Function
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,63 @@
|
||||
Module L_my_convert
|
||||
|
||||
Private sz_dec_sep As String, sz_other As String, sz_a As String
|
||||
|
||||
Public Sub Init()
|
||||
|
||||
' simulates a format , to read the decimal separator character
|
||||
' and keep only the first character
|
||||
'
|
||||
sz_a = Format(0.1, ".#")
|
||||
sz_dec_sep = Left$(sz_a, 1)
|
||||
|
||||
If sz_dec_sep = "." Then
|
||||
sz_other = ","
|
||||
Else
|
||||
sz_other = "."
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function dec_separator() As String
|
||||
Return sz_dec_sep
|
||||
End Function
|
||||
|
||||
Public Function other_separator() As String
|
||||
Return sz_other
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------------------
|
||||
' my_Cint : non si fa fregare da stringhe vuote
|
||||
'---------------------------------------------------------------
|
||||
Public Function my_CInt(ByVal sz As String) As Integer
|
||||
|
||||
If sz <> "" Then
|
||||
Try
|
||||
my_CInt = CInt(Trim(sz))
|
||||
Catch
|
||||
my_CInt = -9998
|
||||
End Try
|
||||
Else
|
||||
my_CInt = -9999
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
'---------------------------------------------------------------
|
||||
' my_CDbl : non si fa fregare da stringhe vuote
|
||||
'---------------------------------------------------------------
|
||||
Public Function my_CDbl(ByVal sz As String) As Double
|
||||
|
||||
If sz <> "" Then
|
||||
Try
|
||||
my_CDbl = CDbl(Trim(sz))
|
||||
Catch
|
||||
my_CDbl = -9999998.0
|
||||
End Try
|
||||
Else
|
||||
my_CDbl = -9999999.0
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,283 @@
|
||||
Imports System.IO
|
||||
|
||||
Module M_files
|
||||
|
||||
#Region "variabili locali"
|
||||
|
||||
Private sz_tokens As String()
|
||||
|
||||
Private objWriter As StreamWriter
|
||||
|
||||
Private sz_file_name As String
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Strutture"
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Lettura file regole "
|
||||
|
||||
Sub Read_rule_file(ByVal sz_filename As String)
|
||||
|
||||
Dim sz_TextLine As String, sz_temp As String
|
||||
Dim temp_rule As Rule, b_rules_definition As Boolean
|
||||
Dim n_line As Int16
|
||||
|
||||
n_line = 0
|
||||
b_rules_definition = False
|
||||
|
||||
sz_file_name = sz_filename
|
||||
|
||||
If System.IO.File.Exists(sz_filename) = True Then
|
||||
|
||||
Dim objfile As New System.IO.StreamReader(sz_filename)
|
||||
|
||||
Do While objfile.Peek() <> -1 ' finche c'è vita
|
||||
|
||||
sz_TextLine = Trim(objfile.ReadLine())
|
||||
n_line = n_line + 1
|
||||
|
||||
If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ?
|
||||
|
||||
If (Trim(sz_TextLine).Chars(0) <> "#") Then
|
||||
|
||||
If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!!
|
||||
|
||||
sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":"
|
||||
|
||||
sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo
|
||||
|
||||
Select Case sz_temp
|
||||
|
||||
Case "$DEFINITIONS"
|
||||
b_rules_definition = False
|
||||
|
||||
Case "$NAME"
|
||||
sz_state_machine_name = UCase$(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$IDX"
|
||||
n_state_machine_index = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_STATES"
|
||||
n_states = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_BITS"
|
||||
n_bits = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$BIT"
|
||||
Bits.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$STATE"
|
||||
States.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$EVENT"
|
||||
Events_to_send.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$RULES"
|
||||
b_rules_definition = True
|
||||
|
||||
Case "$DO"
|
||||
b_rules_definition = False
|
||||
|
||||
Call evaluate()
|
||||
|
||||
Case Else
|
||||
|
||||
If (b_rules_definition) Then
|
||||
|
||||
temp_rule.state = sz_temp
|
||||
temp_rule.expression = (UCase$(Trim(sz_tokens(1))))
|
||||
temp_rule.next_state = (UCase$(Trim(sz_tokens(2))))
|
||||
temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3))))
|
||||
|
||||
Rules.Add(temp_rule)
|
||||
|
||||
Else
|
||||
MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString)
|
||||
End If
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End If ' commento
|
||||
End If ' linea vuota
|
||||
|
||||
Loop
|
||||
|
||||
objfile.Close()
|
||||
|
||||
Else
|
||||
MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste
|
||||
End If ' file exists
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "scrittura file Mac "
|
||||
|
||||
Sub open_mac_file(ByVal sz_filename As String, sz_init As String)
|
||||
|
||||
Dim sz_temp As String
|
||||
|
||||
Try
|
||||
|
||||
objWriter = New System.IO.StreamWriter(sz_filename)
|
||||
|
||||
sz_temp = sz_init
|
||||
|
||||
objWriter.WriteLine(sz_temp)
|
||||
|
||||
|
||||
Catch Ex As Exception
|
||||
|
||||
MsgBox(Ex.Message, MsgBoxStyle.Critical, sz_filename) '
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Sub write_mac_file(ByVal sz_line As String)
|
||||
|
||||
Try
|
||||
objWriter.WriteLine(sz_line)
|
||||
Catch Ex As Exception
|
||||
MsgBox(Ex.Message, MsgBoxStyle.Critical, " output file") '
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Sub close_mac_file()
|
||||
|
||||
Try
|
||||
objWriter.Close()
|
||||
Catch Ex As Exception
|
||||
MsgBox(Ex.Message, MsgBoxStyle.Critical, " output file (close)") '
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Evaluate"
|
||||
|
||||
Private Sub evaluate()
|
||||
|
||||
Dim sz_actual_state As String, sz_actual_bit As String, sz_line
|
||||
|
||||
Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16
|
||||
|
||||
|
||||
Dim b_bit(20) As Boolean, b_invert As Boolean
|
||||
|
||||
FrmMain.TextBox1.Text = ""
|
||||
|
||||
Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_inputs)
|
||||
|
||||
' ciclo per ogni stato
|
||||
For i = 0 To n_states - 1
|
||||
|
||||
sz_actual_state = States(i)
|
||||
|
||||
' ciclo per ogni ingresso
|
||||
For n_input = 0 To ((2 ^ n_bits) - 1)
|
||||
|
||||
' calcolo true false per ogni bit dell' ingresso
|
||||
n_mask = 1
|
||||
For n = 0 To (n_bits - 1)
|
||||
b_bit(n) = n_input And n_mask
|
||||
n_mask = n_mask << 1
|
||||
Next n
|
||||
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
|
||||
' ciclo per ogni regola
|
||||
For Each act_rule As Rule In Rules
|
||||
|
||||
n_bit = -1
|
||||
|
||||
' controllo se la regola attuale vale in questo stato
|
||||
If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then
|
||||
|
||||
If (act_rule.state = sz_actual_state) Then
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
|
||||
End If
|
||||
|
||||
'recupero il bit in questione
|
||||
b_invert = False
|
||||
|
||||
sz_actual_bit = act_rule.expression
|
||||
|
||||
If InStr(sz_actual_bit, "NOT") Then ' bit negato ???
|
||||
b_invert = True
|
||||
sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", ""))
|
||||
End If ' bit negato
|
||||
|
||||
' cerca il nome del bit e ne trova l' indice da 0
|
||||
n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo)))
|
||||
|
||||
If n_bit = -1 Then
|
||||
|
||||
MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state, _
|
||||
MsgBoxStyle.Critical, _
|
||||
"ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
' vera la espressione ?
|
||||
|
||||
If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit)
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf
|
||||
sz_line = ""
|
||||
|
||||
If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ?
|
||||
|
||||
' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato"
|
||||
|
||||
sz_line = n_state_machine_index.ToString & ";" & _
|
||||
i.ToString & ";" & _
|
||||
n_input.ToString & ";" & _
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & _
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
|
||||
Call write_mac_file(sz_line)
|
||||
|
||||
Else
|
||||
sz_line = "----" & n_state_machine_index.ToString & ";" & _
|
||||
i.ToString & ";" & _
|
||||
n_input.ToString & ";" & _
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" & _
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
'Call write_mac_file(sz_line)
|
||||
|
||||
End If ' andrei allo stesso stato
|
||||
|
||||
Exit For ' esco da questo caso
|
||||
|
||||
End If ' vera la espressione
|
||||
|
||||
End If ' vale la regola
|
||||
|
||||
Next ' ciclo per tutte le regole
|
||||
|
||||
Next n_input ' ciclo per ogni ingresso
|
||||
|
||||
Next i ' ciclo per ogni stato
|
||||
|
||||
Call close_mac_file()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,241 @@
|
||||
Imports System.IO
|
||||
|
||||
Module M_transitions
|
||||
|
||||
#Region "variabili locali"
|
||||
|
||||
Private sz_tokens As String()
|
||||
|
||||
Private objWriter As StreamWriter
|
||||
|
||||
Private sz_file_name As String
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Strutture"
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Lettura file regole "
|
||||
|
||||
Sub Read_rule_file_transitions(ByVal sz_filename As String)
|
||||
|
||||
Dim sz_TextLine As String, sz_temp As String
|
||||
Dim temp_rule As Rule, b_rules_definition As Boolean
|
||||
Dim n_line As Int16
|
||||
|
||||
n_line = 0
|
||||
b_rules_definition = False
|
||||
|
||||
sz_file_name = sz_filename
|
||||
|
||||
If System.IO.File.Exists(sz_filename) = True Then
|
||||
|
||||
Dim objfile As New System.IO.StreamReader(sz_filename)
|
||||
|
||||
Do While objfile.Peek() <> -1 ' finche c'è vita
|
||||
|
||||
sz_TextLine = Trim(objfile.ReadLine())
|
||||
n_line = n_line + 1
|
||||
|
||||
If (Not String.IsNullOrEmpty(sz_TextLine)) Then ' linea vuota o commento ?
|
||||
|
||||
If (Trim(sz_TextLine).Chars(0) <> "#") Then
|
||||
|
||||
If InStr(sz_TextLine, ControlChars.Tab) > 0 Then ' sostituzione dei tab !!!!
|
||||
|
||||
sz_TextLine = sz_TextLine.Replace(ControlChars.Tab, String.Empty)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
sz_tokens = sz_TextLine.Split(New Char() {":"c}) ' splitta sui ":"
|
||||
|
||||
sz_temp = Trim(UCase$(Trim(sz_tokens(0)))) ' primo campo
|
||||
|
||||
Select Case sz_temp
|
||||
|
||||
Case "$DEFINITIONS"
|
||||
b_rules_definition = False
|
||||
|
||||
Case "$NAME"
|
||||
sz_state_machine_name = UCase$(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$IDX"
|
||||
n_state_machine_index = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_STATES"
|
||||
n_states = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$N_BITS"
|
||||
n_bits = my_CInt(Trim(sz_tokens(1)))
|
||||
|
||||
Case "$BIT"
|
||||
Bits.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$STATE"
|
||||
States.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$EVENT"
|
||||
Events_to_send.Add(UCase$(Trim(sz_tokens(2))))
|
||||
|
||||
Case "$RULES"
|
||||
b_rules_definition = True
|
||||
|
||||
Case "$DO"
|
||||
b_rules_definition = False
|
||||
|
||||
Call evaluate_transitions()
|
||||
|
||||
Case Else
|
||||
|
||||
If (b_rules_definition) Then
|
||||
|
||||
temp_rule.state = sz_temp
|
||||
temp_rule.expression = (UCase$(Trim(sz_tokens(1))))
|
||||
temp_rule.next_state = (UCase$(Trim(sz_tokens(2))))
|
||||
temp_rule.event_to_send = (UCase$(Trim(sz_tokens(3))))
|
||||
|
||||
Rules.Add(temp_rule)
|
||||
|
||||
Else
|
||||
MsgBox("bad keyword or no rule on line : " & sz_TextLine, MsgBoxStyle.Critical, "ERROR on line : " & n_line.ToString)
|
||||
End If
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End If ' commento
|
||||
End If ' linea vuota
|
||||
|
||||
Loop
|
||||
|
||||
objfile.Close()
|
||||
|
||||
Else
|
||||
MsgBox(Message.Msg(4), MsgBoxStyle.Critical, sz_filename) ' file non esiste
|
||||
End If ' file exists
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "Evaluate"
|
||||
|
||||
Private Sub evaluate_transitions()
|
||||
|
||||
Dim sz_actual_state As String, sz_actual_bit As String, sz_line
|
||||
|
||||
Dim i As Int16, n_input As Int16, n As Int16, n_mask As Int16, n_bit As Int16
|
||||
|
||||
|
||||
Dim b_bit(20) As Boolean, b_invert As Boolean
|
||||
|
||||
FrmMain.TextBox1.Text = ""
|
||||
|
||||
Call open_mac_file(Path.GetDirectoryName(sz_file_name) & "\" & Path.GetFileNameWithoutExtension(sz_file_name) & ".csv", IniRead.sz_file_init_transitions)
|
||||
|
||||
' ciclo per ogni stato
|
||||
For i = 0 To n_states - 1
|
||||
|
||||
sz_actual_state = States(i)
|
||||
|
||||
' ciclo per ogni ingresso
|
||||
For n_input = 0 To ((2 ^ n_bits) - 1)
|
||||
|
||||
' calcolo true false per ogni bit dell' ingresso
|
||||
n_mask = 1
|
||||
For n = 0 To (n_bits - 1)
|
||||
b_bit(n) = n_input And n_mask
|
||||
n_mask = n_mask << 1
|
||||
Next n
|
||||
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
|
||||
' ciclo per ogni regola
|
||||
For Each act_rule As Rule In Rules
|
||||
|
||||
n_bit = -1
|
||||
|
||||
' controllo se la regola attuale vale in questo stato
|
||||
If ((act_rule.state = "ALL_STATES") Or (act_rule.state = sz_actual_state)) Then
|
||||
|
||||
If (act_rule.state = sz_actual_state) Then
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString
|
||||
FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
|
||||
End If
|
||||
|
||||
'recupero il bit in questione
|
||||
b_invert = False
|
||||
|
||||
sz_actual_bit = act_rule.expression
|
||||
|
||||
If InStr(sz_actual_bit, "NOT") Then ' bit negato ???
|
||||
b_invert = True
|
||||
sz_actual_bit = Trim(sz_actual_bit.Replace("NOT ", ""))
|
||||
End If ' bit negato
|
||||
|
||||
' cerca il nome del bit e ne trova l' indice da 0
|
||||
n_bit = Bits.FindIndex(Function(bittolo) (sz_actual_bit.Equals(bittolo)))
|
||||
|
||||
If n_bit = -1 Then
|
||||
|
||||
MsgBox("Bit name error - " & sz_actual_bit & vbCrLf & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state,
|
||||
MsgBoxStyle.Critical,
|
||||
"ERROR - bit " & n_bit.ToString & " -- " & " state " & i.ToString & " - " & sz_actual_state & " --- input : " & n_input.ToString)
|
||||
Exit For
|
||||
End If
|
||||
|
||||
' vera la espressione ?
|
||||
|
||||
If (((Not b_invert) And b_bit(n_bit)) Or (b_invert And (Not b_bit(n_bit)))) Then
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo della regola " & Rules.IndexOf(act_rule) & vbCrLf
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " parliamo del bit " & n_bit.ToString & " - " & Bits(n_bit)
|
||||
' FrmMain.TextBox1.Text = FrmMain.TextBox1.Text & " ------------->>scatta la regola " & act_rule.state & " - " & act_rule.expression & " next " & act_rule.next_state & vbCrLf & vbCrLf
|
||||
sz_line = ""
|
||||
|
||||
If (States.IndexOf(act_rule.next_state) <> i) Then ' andrei allo stesso stato ?
|
||||
|
||||
' "IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato"
|
||||
|
||||
sz_line = n_state_machine_index.ToString & ";" &
|
||||
i.ToString & ";" &
|
||||
n_input.ToString & ";" &
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" &
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
|
||||
Call write_mac_file(sz_line)
|
||||
|
||||
Else
|
||||
sz_line = "----" & n_state_machine_index.ToString & ";" &
|
||||
i.ToString & ";" &
|
||||
n_input.ToString & ";" &
|
||||
Events_to_send.IndexOf(act_rule.event_to_send).ToString & ";" &
|
||||
States.IndexOf(act_rule.next_state).ToString()
|
||||
'Call write_mac_file(sz_line)
|
||||
|
||||
End If ' andrei allo stesso stato
|
||||
|
||||
Exit For ' esco da questo caso
|
||||
|
||||
End If ' vera la espressione
|
||||
|
||||
End If ' vale la regola
|
||||
|
||||
Next ' ciclo per tutte le regole
|
||||
|
||||
Next n_input ' ciclo per ogni ingresso
|
||||
|
||||
Next i ' ciclo per ogni stato
|
||||
|
||||
Call close_mac_file()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Module
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
'
|
||||
' libreria : VBlib
|
||||
' file : Message
|
||||
'
|
||||
' funzioni : gestione messaggi
|
||||
'
|
||||
' copyright 2008-2018 C.Viviani
|
||||
'
|
||||
Imports System
|
||||
Imports System.IO
|
||||
Imports System.IO.File
|
||||
|
||||
Public Module Message
|
||||
|
||||
Public msg() As String
|
||||
|
||||
Sub init()
|
||||
|
||||
Dim sz_filename As String
|
||||
|
||||
sz_filename = Application.StartupPath & "\messages\" & Application.ProductName & ".msg"
|
||||
|
||||
If File.Exists(sz_filename) Then '
|
||||
Try
|
||||
msg = System.IO.File.ReadAllLines(sz_filename)
|
||||
Catch e As Exception
|
||||
MsgBox(e.Message, MsgBoxStyle.Critical, "Error !")
|
||||
End
|
||||
End Try
|
||||
Else
|
||||
MsgBox(" Missing message file :" & vbCrLf & sz_filename, MsgBoxStyle.Critical, "Error 3 :")
|
||||
End
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
'NOTA: il file è generato automaticamente e non può essere modificato direttamente. Per apportare modifiche
|
||||
' o se vengono rilevati errori di compilazione nel file, passare a Progettazione progetti
|
||||
' (aprire le proprietà del progetto o fare doppio clic sul nodo Progetto in
|
||||
' Esplora soluzioni) e apportare le modifiche nella scheda Applicazione.
|
||||
'
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Public Sub New()
|
||||
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
||||
Me.IsSingleInstance = false
|
||||
Me.EnableVisualStyles = true
|
||||
Me.SaveMySettingsOnExit = true
|
||||
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
|
||||
End Sub
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.MapoState.FrmMain
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-16"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>FrmMain</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
@@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' 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("MapoState")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("MapoState")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2011-2013")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("6de7da55-6332-486a-99e5-f539e089f915")>
|
||||
|
||||
' 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,63 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
|
||||
'tramite uno strumento quale ResGen o Visual Studio.
|
||||
'Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
|
||||
'con l'opzione /str oppure ricompilare il progetto VS.
|
||||
'''<summary>
|
||||
''' Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
'''</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>
|
||||
''' Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
'''</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("MapoState.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
''' ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
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>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' </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", "14.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 "Funzionalità di salvataggio automatico My.Settings"
|
||||
#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.MapoState.My.MySettings
|
||||
Get
|
||||
Return Global.MapoState.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,51 @@
|
||||
(0) - Message file !!!!
|
||||
(1)
|
||||
(2)
|
||||
Attenzione !!!
|
||||
Il File Non Esiste !!
|
||||
Dati non salvati : Vuoi salvarli ?
|
||||
(6)
|
||||
(7)
|
||||
(8)
|
||||
(9)
|
||||
(10)
|
||||
(11)
|
||||
(12)
|
||||
(13)
|
||||
(14)
|
||||
(15)
|
||||
(16)
|
||||
(17)
|
||||
(18)
|
||||
(19)
|
||||
(20)
|
||||
Macchina stati ingressi ( Livello 1 )
|
||||
|
||||
Esci
|
||||
Macchina stati transiz. ( Livello 2 )
|
||||
(25)
|
||||
(26)
|
||||
(27)
|
||||
(28)
|
||||
(29)
|
||||
(30)
|
||||
(31)
|
||||
(32)
|
||||
(33)
|
||||
(34)
|
||||
(35)
|
||||
(36)
|
||||
(37)
|
||||
(38)
|
||||
(39)
|
||||
(40)
|
||||
(41)
|
||||
(42)
|
||||
(43)
|
||||
(44)
|
||||
(45)
|
||||
(46)
|
||||
(47)
|
||||
(48)
|
||||
(49)
|
||||
(50)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
#
|
||||
# Donati Macchine Pul02,PUL03 ( PLC Enrico )
|
||||
# trebi con PLC nuovo
|
||||
#
|
||||
# v.2 28-X-2013 segnale contapezzo : non rimandare evento se già nello stato "Cycle end"
|
||||
# v.3 31-X-2013 ignora magazzino grezzi vuoti
|
||||
# v.4 9-XII-2013 rimessa regola : se segnale contapezzo, vale per tutti gli stati (eliminando v2)
|
||||
#
|
||||
# segnale contapezzo : non rimanda evento se già nello stato "Cycle end" <<<< no dalla versione 4
|
||||
# si faceva fottere da 3 o + campioni a 7 in ingresso
|
||||
# primo input a 7 --> stato end cycle
|
||||
# secondo input a 7 --> stato run !!! ( mancava la regola )
|
||||
# terzo input a 7 --> di nuovo stato end cycle ( e quindi un pezzo in più )
|
||||
#
|
||||
$DEFINITIONS
|
||||
|
||||
$NAME : enrico
|
||||
$IDX : 15
|
||||
$N_STATES : 10
|
||||
$N_BITS : 8
|
||||
|
||||
#definizione bit : obbligatorio iniziare da 0
|
||||
|
||||
$BIT : 0 : power_on
|
||||
$BIT : 1 : run
|
||||
$BIT : 2 : end_cycle
|
||||
$BIT : 3 : alarm
|
||||
$BIT : 4 : manual
|
||||
$BIT : 5 : output_full
|
||||
$BIT : 6 : input_empty
|
||||
$BIT : 7 : not_emergency
|
||||
|
||||
#definizione stati : obbligatorio iniziare da 0
|
||||
|
||||
$STATE : 0 : ST_Init
|
||||
$STATE : 1 : ST_Power off
|
||||
$STATE : 2 : ST_Machine ready
|
||||
$STATE : 3 : ST_Run
|
||||
$STATE : 4 : ST_Cycle end
|
||||
$STATE : 5 : ST_Alarm
|
||||
$STATE : 6 : ST_Manual
|
||||
$STATE : 7 : ST_Output full
|
||||
$STATE : 8 : ST_Input empty
|
||||
$STATE : 9 : ST_Emergency
|
||||
|
||||
#definizione eventi : obbligatorio iniziare da 0
|
||||
|
||||
$EVENT : 00 : EV_00
|
||||
$EVENT : 01 : EV_01
|
||||
$EVENT : 02 : EV_02
|
||||
$EVENT : 03 : EV_03
|
||||
$EVENT : 04 : EV_04
|
||||
$EVENT : 05 : EV_05
|
||||
$EVENT : 06 : EV_06
|
||||
$EVENT : 07 : EV_07
|
||||
$EVENT : 08 : EV_08
|
||||
$EVENT : 09 : EV_09
|
||||
$EVENT : 10 : EV_10
|
||||
$EVENT : 11 : EV_11
|
||||
$EVENT : 12 : EV_12
|
||||
$EVENT : 13 : HW - init
|
||||
$EVENT : 14 : HW - power off
|
||||
$EVENT : 15 : HW - power on
|
||||
$EVENT : 16 : HW - machining
|
||||
$EVENT : 17 : HW - end machining
|
||||
$EVENT : 18 : HW - error
|
||||
$EVENT : 19 : Barcode - cambio operatore
|
||||
$EVENT : 20 : Contapezzi
|
||||
$EVENT : 21 : HW - start pallet
|
||||
$EVENT : 22 : HW - end pallet
|
||||
$EVENT : 23 : HW rottura nastro abrasivo
|
||||
$EVENT : 24 : HW manuale
|
||||
$EVENT : 25 : HW nastro scarico pieno
|
||||
$EVENT : 26 : Barcode - Manca Riforn. MPD
|
||||
$EVENT : 27 : Timer - timeout tempo ciclo
|
||||
$EVENT : 28 : Timer - timeout TURNO by tempo ciclo
|
||||
$EVENT : 29 : HW - magazzino grezzi vuoto
|
||||
$EVENT : 30 : HW - emergenza
|
||||
|
||||
|
||||
$RULES
|
||||
|
||||
# state : input : next state : event -------------------------------------------------
|
||||
|
||||
ALL_STATES : NOT power_on : ST_Power off : HW - power off
|
||||
ALL_STATES : NOT not_emergency : ST_Emergency : HW - emergenza
|
||||
ALL_STATES : manual : ST_Manual : HW manuale
|
||||
|
||||
#### ALL_STATES : input_empty : ST_Input empty : HW - magazzino grezzi vuoto
|
||||
|
||||
ALL_STATES : output_full : ST_Output full : HW nastro scarico pieno
|
||||
ALL_STATES : alarm : ST_Alarm : HW - error
|
||||
|
||||
# rimetta a posto la candela !
|
||||
|
||||
ALL_STATES : end_cycle : ST_Cycle end : HW - end pallet
|
||||
|
||||
ALL_STATES : run : ST_Run : HW - machining
|
||||
ALL_STATES : power_on : ST_Machine ready : HW - power on
|
||||
|
||||
$DO
|
||||
@@ -0,0 +1,101 @@
|
||||
#
|
||||
# Donati Macchine Pul02,PUL03 ( PLC Enrico )
|
||||
# trebi con PLC nuovo
|
||||
#
|
||||
# v.2 28-X-2013 segnale contapezzo : non rimandare evento se già nello stato "Cycle end"
|
||||
# v.3 31-X-2013 ignora magazzino grezzi vuoti
|
||||
# v.4 9-XII-2013 rimessa regola : se segnale contapezzo, vale per tutti gli stati (eliminando v2)
|
||||
#
|
||||
# segnale contapezzo : non rimanda evento se già nello stato "Cycle end" <<<< no dalla versione 4
|
||||
# si faceva fottere da 3 o + campioni a 7 in ingresso
|
||||
# primo input a 7 --> stato end cycle
|
||||
# secondo input a 7 --> stato run !!! ( mancava la regola )
|
||||
# terzo input a 7 --> di nuovo stato end cycle ( e quindi un pezzo in più )
|
||||
#
|
||||
$DEFINITIONS
|
||||
|
||||
$NAME : enrico
|
||||
$IDX : 15
|
||||
$N_STATES : 10
|
||||
$N_BITS : 8
|
||||
|
||||
#definizione bit : obbligatorio iniziare da 0
|
||||
|
||||
$BIT : 0 : power_on
|
||||
$BIT : 1 : run
|
||||
$BIT : 2 : end_cycle
|
||||
$BIT : 3 : alarm
|
||||
$BIT : 4 : manual
|
||||
$BIT : 5 : output_full
|
||||
$BIT : 6 : input_empty
|
||||
$BIT : 7 : not_emergency
|
||||
|
||||
#definizione stati : obbligatorio iniziare da 0
|
||||
|
||||
$STATE : 0 : ST_Init
|
||||
$STATE : 1 : ST_Power off
|
||||
$STATE : 2 : ST_Machine ready
|
||||
$STATE : 3 : ST_Run
|
||||
$STATE : 4 : ST_Cycle end
|
||||
$STATE : 5 : ST_Alarm
|
||||
$STATE : 6 : ST_Manual
|
||||
$STATE : 7 : ST_Output full
|
||||
$STATE : 8 : ST_Input empty
|
||||
$STATE : 9 : ST_Emergency
|
||||
|
||||
#definizione eventi : obbligatorio iniziare da 0
|
||||
|
||||
$EVENT : 00 : EV_00
|
||||
$EVENT : 01 : EV_01
|
||||
$EVENT : 02 : EV_02
|
||||
$EVENT : 03 : EV_03
|
||||
$EVENT : 04 : EV_04
|
||||
$EVENT : 05 : EV_05
|
||||
$EVENT : 06 : EV_06
|
||||
$EVENT : 07 : EV_07
|
||||
$EVENT : 08 : EV_08
|
||||
$EVENT : 09 : EV_09
|
||||
$EVENT : 10 : EV_10
|
||||
$EVENT : 11 : EV_11
|
||||
$EVENT : 12 : EV_12
|
||||
$EVENT : 13 : HW - init
|
||||
$EVENT : 14 : HW - power off
|
||||
$EVENT : 15 : HW - power on
|
||||
$EVENT : 16 : HW - machining
|
||||
$EVENT : 17 : HW - end machining
|
||||
$EVENT : 18 : HW - error
|
||||
$EVENT : 19 : Barcode - cambio operatore
|
||||
$EVENT : 20 : Contapezzi
|
||||
$EVENT : 21 : HW - start pallet
|
||||
$EVENT : 22 : HW - end pallet
|
||||
$EVENT : 23 : HW rottura nastro abrasivo
|
||||
$EVENT : 24 : HW manuale
|
||||
$EVENT : 25 : HW nastro scarico pieno
|
||||
$EVENT : 26 : Barcode - Manca Riforn. MPD
|
||||
$EVENT : 27 : Timer - timeout tempo ciclo
|
||||
$EVENT : 28 : Timer - timeout TURNO by tempo ciclo
|
||||
$EVENT : 29 : HW - magazzino grezzi vuoto
|
||||
$EVENT : 30 : HW - emergenza
|
||||
|
||||
|
||||
$RULES
|
||||
|
||||
# state : input : next state : event -------------------------------------------------
|
||||
|
||||
ALL_STATES : NOT power_on : ST_Power off : HW - power off
|
||||
ALL_STATES : NOT not_emergency : ST_Emergency : HW - emergenza
|
||||
ALL_STATES : manual : ST_Manual : HW manuale
|
||||
|
||||
#### ALL_STATES : input_empty : ST_Input empty : HW - magazzino grezzi vuoto
|
||||
|
||||
ALL_STATES : output_full : ST_Output full : HW nastro scarico pieno
|
||||
ALL_STATES : alarm : ST_Alarm : HW - error
|
||||
|
||||
# rimetta a posto la candela !
|
||||
|
||||
ALL_STATES : end_cycle : ST_Cycle end : HW - end pallet
|
||||
|
||||
ALL_STATES : run : ST_Run : HW - machining
|
||||
ALL_STATES : power_on : ST_Machine ready : HW - power on
|
||||
|
||||
$DO
|
||||
@@ -0,0 +1,10 @@
|
||||
[GENERAL]
|
||||
|
||||
Language=ITA
|
||||
inputpath = C:\Lavori\Mapo\Donati\macchine a stati\
|
||||
|
||||
Debug = 0
|
||||
|
||||
[RUL]
|
||||
edefault=C:\Users\carlo\Documents\Projects\vs2008\MapoState\MapoState\Resources\15.rul
|
||||
default = C:\Lavori\Mapo\Donati\macchine a stati\15.rul
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,130 @@
|
||||
1: (1)
|
||||
2: (2)
|
||||
3: Attention !!!
|
||||
4: File Does Not Exist
|
||||
5: Data modified but not saved ! Do you want to save ?
|
||||
6: (6)
|
||||
7: (7)
|
||||
8: (8)
|
||||
9: (9)
|
||||
10: (10)
|
||||
11: (11)
|
||||
12: (12)
|
||||
13: (13)
|
||||
14: (14)
|
||||
15: (15)
|
||||
16: (16)
|
||||
17: (17)
|
||||
18: (18)
|
||||
19: (19)
|
||||
20: (20)
|
||||
21: Load Typ File
|
||||
22: Save Typ File
|
||||
23: Exit
|
||||
24: Load ACD File
|
||||
25: (25)
|
||||
26: (26)
|
||||
27: (27)
|
||||
28: (28)
|
||||
29: (29)
|
||||
30: (30)
|
||||
31: OverStock
|
||||
32: Machining
|
||||
33: Actual ACD File :
|
||||
34: (34)
|
||||
35: (35)
|
||||
36: (36)
|
||||
37: (37)
|
||||
38: (38)
|
||||
39: (39)
|
||||
40: (40)
|
||||
41: (41)
|
||||
42: (42)
|
||||
43: (43)
|
||||
44: (44)
|
||||
45: (45)
|
||||
46: (46)
|
||||
47: (47)
|
||||
48: (48)
|
||||
49: (49)
|
||||
50: (50)
|
||||
51:
|
||||
52:
|
||||
53:
|
||||
54:
|
||||
55:
|
||||
56:
|
||||
57:
|
||||
58:
|
||||
59:
|
||||
60:
|
||||
61:
|
||||
62:
|
||||
63:
|
||||
64:
|
||||
65:
|
||||
66:
|
||||
67:
|
||||
68:
|
||||
69:
|
||||
70:
|
||||
71:
|
||||
72:
|
||||
73:
|
||||
74:
|
||||
75:
|
||||
76:
|
||||
77:
|
||||
78:
|
||||
79: Problem reading Alarm
|
||||
80:
|
||||
81:
|
||||
82:
|
||||
83:
|
||||
84:
|
||||
85:
|
||||
86:
|
||||
87:
|
||||
88:
|
||||
89:
|
||||
90: Ok
|
||||
91: Cancel
|
||||
92: Wrong Data in
|
||||
93:
|
||||
94:
|
||||
95:
|
||||
96:
|
||||
97:
|
||||
98:
|
||||
99:
|
||||
100:
|
||||
101:
|
||||
102:
|
||||
103:
|
||||
104:
|
||||
105:
|
||||
106:
|
||||
107:
|
||||
108:
|
||||
109:
|
||||
110:
|
||||
111:
|
||||
112:
|
||||
113:
|
||||
114:
|
||||
115:
|
||||
116:
|
||||
117: Yes
|
||||
118: No
|
||||
119:
|
||||
120:
|
||||
121:
|
||||
122:
|
||||
123:
|
||||
124:
|
||||
125:
|
||||
126:
|
||||
127:
|
||||
128:
|
||||
129: Already exists
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
1: (1)
|
||||
2: (2)
|
||||
3: Attenzione !!!
|
||||
4: File Does Not Exist
|
||||
5: Dati non salvati : Vuoi salvarli ?
|
||||
6: (6)
|
||||
7: (7)
|
||||
8: (8)
|
||||
9: (9)
|
||||
10: (10)
|
||||
11: (11)
|
||||
12: (12)
|
||||
13: (13)
|
||||
14: (14)
|
||||
15: (15)
|
||||
16: (16)
|
||||
17: (17)
|
||||
18: (18)
|
||||
19: (19)
|
||||
20: (20)
|
||||
21: Carica File regole
|
||||
22:
|
||||
23: Esci
|
||||
24: (24)
|
||||
25: (25)
|
||||
26: (26)
|
||||
27: (27)
|
||||
28: (28)
|
||||
29: (29)
|
||||
30: (30)
|
||||
31: (31)
|
||||
32: (32)
|
||||
33: (33)
|
||||
34: (34)
|
||||
35: (35)
|
||||
36: (36)
|
||||
37: (37)
|
||||
38: (38)
|
||||
39: (39)
|
||||
40: (40)
|
||||
41: (41)
|
||||
42: (42)
|
||||
43: (43)
|
||||
44: (44)
|
||||
45: (45)
|
||||
46: (46)
|
||||
47: (47)
|
||||
48: (48)
|
||||
49: (49)
|
||||
50: (50)
|
||||
51:
|
||||
52:
|
||||
53:
|
||||
54:
|
||||
55:
|
||||
56:
|
||||
57:
|
||||
58:
|
||||
59:
|
||||
60:
|
||||
61:
|
||||
62:
|
||||
63:
|
||||
64:
|
||||
65:
|
||||
66:
|
||||
67:
|
||||
68:
|
||||
69:
|
||||
70:
|
||||
71:
|
||||
72:
|
||||
73:
|
||||
74:
|
||||
75:
|
||||
76:
|
||||
77:
|
||||
78:
|
||||
79: Problem reading Alarm
|
||||
80:
|
||||
81:
|
||||
82:
|
||||
83:
|
||||
84:
|
||||
85:
|
||||
86:
|
||||
87:
|
||||
88:
|
||||
89:
|
||||
90: Ok
|
||||
91: Cancel
|
||||
92: Wrong Data in
|
||||
93:
|
||||
94:
|
||||
95:
|
||||
96:
|
||||
97:
|
||||
98:
|
||||
99:
|
||||
100:
|
||||
101:
|
||||
102:
|
||||
103:
|
||||
104:
|
||||
105:
|
||||
106:
|
||||
107:
|
||||
108:
|
||||
109:
|
||||
110:
|
||||
111:
|
||||
112:
|
||||
113:
|
||||
114:
|
||||
115:
|
||||
116:
|
||||
117: Yes
|
||||
118: No
|
||||
119:
|
||||
120:
|
||||
121:
|
||||
122:
|
||||
123:
|
||||
124:
|
||||
125:
|
||||
126:
|
||||
127:
|
||||
128:
|
||||
129: Already exists
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user