diff --git a/StateMachine/src/MapoState/MapoState.sln b/StateMachine/src/MapoState/MapoState.sln index 0a8013d..2988fb6 100644 --- a/StateMachine/src/MapoState/MapoState.sln +++ b/StateMachine/src/MapoState/MapoState.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30320.27 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MapoState", "MapoState\MapoState.vbproj", "{492396EA-9B89-4318-879A-2DD7D0DBD1DD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapoStateCS", "MapoStateCS\MapoStateCS.csproj", "{02A1B587-B01B-42F5-9F68-68E2ADD40573}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,8 +17,15 @@ Global {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 + {02A1B587-B01B-42F5-9F68-68E2ADD40573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02A1B587-B01B-42F5-9F68-68E2ADD40573}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02A1B587-B01B-42F5-9F68-68E2ADD40573}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02A1B587-B01B-42F5-9F68-68E2ADD40573}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2BB8917B-F87D-4910-9F1E-F4924A753020} + EndGlobalSection EndGlobal diff --git a/StateMachine/src/MapoState/MapoState/MapoState.exe b/StateMachine/src/MapoState/MapoState/MapoState.exe new file mode 100644 index 0000000..944b209 Binary files /dev/null and b/StateMachine/src/MapoState/MapoState/MapoState.exe differ diff --git a/StateMachine/src/MapoState/MapoState/MapoState.vbproj b/StateMachine/src/MapoState/MapoState/MapoState.vbproj index a01bb2c..c4e836f 100644 --- a/StateMachine/src/MapoState/MapoState/MapoState.vbproj +++ b/StateMachine/src/MapoState/MapoState/MapoState.vbproj @@ -108,6 +108,7 @@ True Application.myapp + True True diff --git a/StateMachine/src/MapoState/MapoState/MapoState.xml b/StateMachine/src/MapoState/MapoState/MapoState.xml index 99b7f8e..bca0c63 100644 --- a/StateMachine/src/MapoState/MapoState/MapoState.xml +++ b/StateMachine/src/MapoState/MapoState/MapoState.xml @@ -6,6 +6,22 @@ MapoState + + + Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + + + + + Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + + + + + Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le + ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + + The INIReader class can read keys from and write keys to an INI file. @@ -293,21 +309,5 @@ MapoState The maximum number of bytes in a section buffer. - - - Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. - - - - - Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. - - - - - Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le - ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. - - diff --git a/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb b/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb index 6333807..4b5c8bd 100644 --- a/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb +++ b/StateMachine/src/MapoState/MapoState/My Project/Application.Designer.vb @@ -14,9 +14,9 @@ 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 + 'NOTA: questo file è generato automaticamente e non può essere modificato direttamente. Per apportare modifiche + ' o se vengono rilevati errori di compilazione nel file, passare a Creazione progetti + ' (aprire le proprietà del progetto o fare doppio clic sul nodo Progetti personali in ' Esplora soluzioni) e apportare le modifiche nella scheda Applicazione. ' Partial Friend Class MyApplication diff --git a/StateMachine/src/MapoState/MapoStateCS/App.config b/StateMachine/src/MapoState/MapoStateCS/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoStateCS/MainForm.Designer.cs b/StateMachine/src/MapoState/MapoStateCS/MainForm.Designer.cs new file mode 100644 index 0000000..7ba3a0b --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/MainForm.Designer.cs @@ -0,0 +1,130 @@ +namespace MapoStateCS +{ + partial class MainForm + { + /// + /// Variabile di progettazione necessaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Pulire le risorse in uso. + /// + /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Codice generato da Progettazione Windows Form + + /// + /// Metodo necessario per il supporto della finestra di progettazione. Non modificare + /// il contenuto del metodo con l'editor di codice. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnGenLev1 = new System.Windows.Forms.Button(); + this.btnGenLev2 = new System.Windows.Forms.Button(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.lblOut = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // btnGenLev1 + // + this.btnGenLev1.Location = new System.Drawing.Point(12, 12); + this.btnGenLev1.Name = "btnGenLev1"; + this.btnGenLev1.Size = new System.Drawing.Size(122, 61); + this.btnGenLev1.TabIndex = 0; + this.btnGenLev1.Text = "Macchina stati ingressi ( Livello 1 )"; + this.btnGenLev1.UseVisualStyleBackColor = true; + this.btnGenLev1.Click += new System.EventHandler(this.btnGenLev1_Click); + // + // btnGenLev2 + // + this.btnGenLev2.Location = new System.Drawing.Point(180, 12); + this.btnGenLev2.Name = "btnGenLev2"; + this.btnGenLev2.Size = new System.Drawing.Size(122, 61); + this.btnGenLev2.TabIndex = 1; + this.btnGenLev2.Text = "Macchina stati transiz. ( Livello 2 )"; + this.btnGenLev2.UseVisualStyleBackColor = true; + this.btnGenLev2.Visible = false; + // + // openFileDialog1 + // + this.openFileDialog1.FileName = "openFileDialog1"; + // + // lblOut + // + this.lblOut.AutoEllipsis = true; + this.lblOut.AutoSize = true; + this.lblOut.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblOut.ForeColor = System.Drawing.Color.DarkRed; + this.lblOut.Location = new System.Drawing.Point(3, 16); + this.lblOut.Name = "lblOut"; + this.lblOut.Size = new System.Drawing.Size(19, 25); + this.lblOut.TabIndex = 2; + this.lblOut.Text = "-"; + // + // panel1 + // + this.panel1.AutoSize = true; + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 287); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(611, 0); + this.panel1.TabIndex = 3; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.lblOut); + this.groupBox1.Location = new System.Drawing.Point(12, 80); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(587, 195); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "groupBox1"; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(611, 287); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.btnGenLev2); + this.Controls.Add(this.btnGenLev1); + this.Name = "MainForm"; + this.Text = "MapoState Generator C#"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnGenLev1; + private System.Windows.Forms.Button btnGenLev2; + private System.Windows.Forms.OpenFileDialog openFileDialog1; + private System.Windows.Forms.Label lblOut; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Timer timer1; + } +} + diff --git a/StateMachine/src/MapoState/MapoStateCS/MainForm.cs b/StateMachine/src/MapoState/MapoStateCS/MainForm.cs new file mode 100644 index 0000000..f88b01f --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/MainForm.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static MapoStateCS.Module.General; + +namespace MapoStateCS +{ + public partial class MainForm : Form + { + public MainForm() + { + InitializeComponent(); + openFileDialog1.FileOk += OpenFileDialog1_FileOk; + timer1.Interval = 2000; + timer1.Tick += Timer1_Tick; + timer1.Start(); + generatoreDiSensiDiColpa(); + } + + private void Timer1_Tick(object sender, EventArgs e) + { + generatoreDiSensiDiColpa(); + } + + private void generatoreDiSensiDiColpa() + { + lblOut.Text = $"Ciao Marco, sono le {DateTime.Now: HH:mm:ss}, stai ancora giocando con la stampante?"; + } + + private void OpenFileDialog1_FileOk(object sender, CancelEventArgs e) + { + timer1.Stop(); + timer1.Start(); + actual_level = LEVELS.LIVELLO_INGRESSI; + } + + private void btnGenLev1_Click(object sender, EventArgs e) + { + timer1.Stop(); + generatoreDiSensiDiColpa(); + openFileDialog1.InitialDirectory = @"C:\"; + openFileDialog1.CheckFileExists = true; + openFileDialog1.FileName = "Mapo.rul"; + openFileDialog1.Filter = "Rule files|*.rul|Text files|*.txt"; + openFileDialog1.ShowDialog(); + } + } +} diff --git a/StateMachine/src/MapoState/MapoStateCS/MainForm.resx b/StateMachine/src/MapoState/MapoStateCS/MainForm.resx new file mode 100644 index 0000000..dea6a18 --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/MainForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 157, 17 + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoStateCS/MapoStateCS.csproj b/StateMachine/src/MapoState/MapoStateCS/MapoStateCS.csproj new file mode 100644 index 0000000..008f8a5 --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/MapoStateCS.csproj @@ -0,0 +1,85 @@ + + + + + Debug + AnyCPU + {02A1B587-B01B-42F5-9F68-68E2ADD40573} + WinExe + MapoStateCS + MapoStateCS + v4.6.1 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + MainForm.cs + + + + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoStateCS/Module/General.cs b/StateMachine/src/MapoState/MapoStateCS/Module/General.cs new file mode 100644 index 0000000..23e200c --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Module/General.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MapoStateCS.Module +{ + public class General + { + #region "COSTANTI GLOBALI" + + public const double EPSILON = 0.05; + + #endregion + + #region "OGGETTI" + + #endregion Region + + #region "STRUTTURE" + + public struct Rule + { + public string state; + public string expression; + public string next_state; + public string event_to_send; + } + + + public enum LEVELS + { + ND = 0, + LIVELLO_INGRESSI = 1, + LIVELLO_TRANSIZIONI = 2 + } + + #endregion + + #region "VARIABILI GLOBALI" + + public List States { get; set; } = new List(); + public List Bits { get; set; } = new List(); + public List Events_to_send { get; set; } = new List(); + public List Rules = new List(); + public string sz_state_machine_name; + public int n_state_machine_index; + public int n_states; + public int n_bits; + public static LEVELS actual_level { get; set; } = LEVELS.ND; + public LEVELS read_level { get; set; } = LEVELS.LIVELLO_INGRESSI; + + #endregion + + } +} diff --git a/StateMachine/src/MapoState/MapoStateCS/Program.cs b/StateMachine/src/MapoState/MapoStateCS/Program.cs new file mode 100644 index 0000000..a225ca5 --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MapoStateCS +{ + static class Program + { + /// + /// Punto di ingresso principale dell'applicazione. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/StateMachine/src/MapoState/MapoStateCS/Properties/AssemblyInfo.cs b/StateMachine/src/MapoState/MapoStateCS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b9407d1 --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Le informazioni generali relative a un assembly sono controllate dal seguente +// set di attributi. Modificare i valori di questi attributi per modificare le informazioni +// associate a un assembly. +[assembly: AssemblyTitle("MapoStateCS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MapoStateCS")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili +// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da +// COM, impostare su true l'attributo ComVisible per tale tipo. +[assembly: ComVisible(false)] + +// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi +[assembly: Guid("02a1b587-b01b-42f5-9f68-68e2add40573")] + +// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: +// +// Versione principale +// Versione secondaria +// Numero di build +// Revisione +// +// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build +// usando l'asterisco '*' come illustrato di seguito: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.Designer.cs b/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.Designer.cs new file mode 100644 index 0000000..72e398f --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// Versione runtime:4.0.30319.42000 +// +// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace MapoStateCS.Properties +{ + + + /// + /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + /// + // 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 .ResX, quindi eseguire di nuovo ResGen + // con l'opzione /str oppure ricompilare il progetto VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MapoStateCS.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte + /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.resx b/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.Designer.cs b/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.Designer.cs new file mode 100644 index 0000000..50e59ad --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MapoStateCS.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.settings b/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/StateMachine/src/MapoState/MapoStateCS/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +