diff --git a/terminale.sln b/terminale.sln
new file mode 100644
index 0000000..5dd13af
--- /dev/null
+++ b/terminale.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33723.286
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "terminale", "terminale\terminale.vbproj", "{C675B827-BA35-4C78-B3CE-71F85FD3B2AE}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C675B827-BA35-4C78-B3CE-71F85FD3B2AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C675B827-BA35-4C78-B3CE-71F85FD3B2AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C675B827-BA35-4C78-B3CE-71F85FD3B2AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C675B827-BA35-4C78-B3CE-71F85FD3B2AE}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AA4B23EE-7C1B-4D73-AABD-4AEE4AC8CF1A}
+ EndGlobalSection
+EndGlobal
diff --git a/terminale/App.config b/terminale/App.config
new file mode 100644
index 0000000..ffaf540
--- /dev/null
+++ b/terminale/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/terminale/Form1.Designer.vb b/terminale/Form1.Designer.vb
new file mode 100644
index 0000000..6e7e242
--- /dev/null
+++ b/terminale/Form1.Designer.vb
@@ -0,0 +1,51 @@
+ _
+Partial Class Form1
+ Inherits System.Windows.Forms.Form
+
+ 'Form esegue l'override del metodo Dispose per pulire l'elenco dei componenti.
+ _
+ 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
+
+ 'Richiesto da Progettazione Windows Form
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTA: la procedura che segue è richiesta da Progettazione Windows Form
+ 'Può essere modificata in Progettazione Windows Form.
+ 'Non modificarla mediante l'editor del codice.
+ _
+ Private Sub InitializeComponent()
+ Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
+ Me.SuspendLayout()
+ '
+ 'RichTextBox1
+ '
+ Me.RichTextBox1.BackColor = System.Drawing.Color.Black
+ Me.RichTextBox1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
+ Me.RichTextBox1.Location = New System.Drawing.Point(0, 0)
+ Me.RichTextBox1.Name = "RichTextBox1"
+ Me.RichTextBox1.Size = New System.Drawing.Size(802, 452)
+ Me.RichTextBox1.TabIndex = 0
+ Me.RichTextBox1.Text = ""
+ '
+ 'Form1
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(800, 450)
+ Me.Controls.Add(Me.RichTextBox1)
+ Me.Name = "Form1"
+ Me.Text = "Form1"
+ Me.ResumeLayout(False)
+
+ End Sub
+
+ Friend WithEvents RichTextBox1 As RichTextBox
+End Class
diff --git a/terminale/Form1.resx b/terminale/Form1.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/terminale/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/terminale/Form1.vb b/terminale/Form1.vb
new file mode 100644
index 0000000..982e7a1
--- /dev/null
+++ b/terminale/Form1.vb
@@ -0,0 +1,97 @@
+Imports System.Security.Cryptography
+
+Public Class Form1
+ Private lunghezzaFrase As Integer = 0
+ Private prezzoGiornaliero As Double = 15.0
+ Private prezzoSerale As Double = 20.0
+ Private orarioInizioSerale As DateTime = DateTime.ParseExact("19:00", "HH:mm", Nothing)
+ Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
+
+ End Sub
+
+ Private Sub RichTextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RichTextBox1.KeyPress
+
+ End Sub
+
+ Private Sub RichTextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles RichTextBox1.KeyUp
+
+
+ If e.KeyCode = Keys.Enter Then
+
+ e.SuppressKeyPress = True ' Per evitare che il carattere di invio venga inserito nella casella di testo
+
+ ' Ottieni l'indice della riga corrente
+ Dim indiceRigaCorrente As Integer = RichTextBox1.GetLineFromCharIndex(RichTextBox1.SelectionStart)
+
+ If indiceRigaCorrente >= 0 AndAlso indiceRigaCorrente < RichTextBox1.Lines.Length Then
+ ' Ottieni il testo della riga corrente
+ Dim testoRigaCorrente As String = RichTextBox1.Lines(indiceRigaCorrente - 1).Substring(lunghezzaFrase)
+ Dim orari() As DateTime = dividiOraioInizioFine(testoRigaCorrente)
+ Dim totOre As TimeSpan = Durata(orari)
+
+ RichTextBox1.Select(RichTextBox1.TextLength, 0)
+ domanda()
+ RichTextBox1.ScrollToCaret()
+ End If
+ End If
+ End Sub
+ Private Function DividiOraioInizioFine(str As String) As DateTime()
+ Dim orari(2) As DateTime
+ Dim oraI = str.Split(" ")(0)
+ Dim oraF = str.Split(" ")(1)
+ If oraI.Split(":").Length < 2 Then
+ oraI += ":00"
+ End If
+ If oraF.Split(":").Length < 2 Then
+ oraF += ":00"
+ End If
+ orari(0) = DateTime.ParseExact(oraI, "HH:mm", Nothing)
+ orari(1) = DateTime.ParseExact(oraF, "HH:mm", Nothing)
+ 'Console.WriteLine(String.Join(", ", orari))
+ Return orari
+ End Function
+ Private Function Durata(orari() As DateTime) As TimeSpan
+ Dim differenza = New TimeSpan(0, 0, 0)
+ differenza = orari(1) - orari(0)
+ Console.WriteLine(differenza.TotalHours.ToString())
+ Return differenza
+ End Function
+ Public Sub Errore(str As String)
+ RichTextBox1.SelectionColor = Color.Red
+ domanda(str + vbCrLf)
+ End Sub
+ Private Sub RichTextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles RichTextBox1.KeyDown
+ If e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Down OrElse e.KeyCode = Keys.Left OrElse e.KeyCode = Keys.Right Then
+ e.Handled = True ' Impedisce il normale movimento del cursore
+
+ ' Memorizza la posizione corrente del cursore
+ ultimoIndice = RichTextBox1.SelectionStart
+ End If
+ End Sub
+
+
+ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
+ RichTextBox1.SelectionFont = New Font("Arial", 10, FontStyle.Bold)
+ domanda("Come formato dell'orario usare hh:mm e tra l'orario di inizio e fine lasciare uno spazio" + vbCrLf + vbCrLf)
+ domanda()
+ End Sub
+ Private Sub domanda(Optional str As String = "digita l'orario di inizio e di fine: > ")
+ '"digita l'orario di inizio e di fine: 'hh:mm hh:mm' > "
+ RichTextBox1.AppendText(str)
+ lunghezzaFrase = str.Length
+ End Sub
+
+ Private Sub RichTextBox1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles RichTextBox1.PreviewKeyDown
+ Select Case e.KeyCode
+ Case Keys.Up, Keys.Down, Keys.Left, Keys.Right
+ e.IsInputKey = True ' Impedisce il movimento del cursore
+ End Select
+
+ End Sub
+ Private ultimoIndice As Integer ' Variabile per memorizzare l'ultimo indice del cursore
+
+ Private Sub RichTextBox1_SelectionChanged(sender As Object, e As EventArgs) Handles RichTextBox1.SelectionChanged
+ ' Reimposta il cursore all'ultimo indice noto per evitare lo spostamento indesiderato
+ RichTextBox1.SelectionStart = RichTextBox1.TextLength
+ End Sub
+End Class
diff --git a/terminale/My Project/Application.Designer.vb b/terminale/My Project/Application.Designer.vb
new file mode 100644
index 0000000..010aabc
--- /dev/null
+++ b/terminale/My Project/Application.Designer.vb
@@ -0,0 +1,38 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
+ ' or if you encounter build errors in this file, go to the Project Designer
+ ' (go to Project Properties or double-click the My Project node in
+ ' Solution Explorer), and make changes on the Application tab.
+ '
+ Partial Friend Class MyApplication
+
+ _
+ 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
+
+ _
+ Protected Overrides Sub OnCreateMainForm()
+ Me.MainForm = Global.terminale.Form1
+ End Sub
+ End Class
+End Namespace
diff --git a/terminale/My Project/Application.myapp b/terminale/My Project/Application.myapp
new file mode 100644
index 0000000..1243847
--- /dev/null
+++ b/terminale/My Project/Application.myapp
@@ -0,0 +1,11 @@
+
+
+ true
+ Form1
+ false
+ 0
+ true
+ 0
+ 0
+ true
+
diff --git a/terminale/My Project/AssemblyInfo.vb b/terminale/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..4b0a793
--- /dev/null
+++ b/terminale/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports 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.
+
+' Controllare i valori degli attributi degli assembly
+
+
+
+
+
+
+
+
+
+
+'Se il progetto viene esposto a COM, il GUID seguente verrà usato come ID del typelib
+
+
+' 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:
+'
+
+
+
diff --git a/terminale/My Project/Resources.Designer.vb b/terminale/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..d48e64e
--- /dev/null
+++ b/terminale/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ 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("terminale.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/terminale/My Project/Resources.resx b/terminale/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/terminale/My Project/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/terminale/My Project/Settings.Designer.vb b/terminale/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..a271d01
--- /dev/null
+++ b/terminale/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' 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.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ 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
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.terminale.My.MySettings
+ Get
+ Return Global.terminale.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/terminale/My Project/Settings.settings b/terminale/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/terminale/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/terminale/terminale.vbproj b/terminale/terminale.vbproj
new file mode 100644
index 0000000..090a807
--- /dev/null
+++ b/terminale/terminale.vbproj
@@ -0,0 +1,123 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {C675B827-BA35-4C78-B3CE-71F85FD3B2AE}
+ WinExe
+ terminale.My.MyApplication
+ terminale
+ terminale
+ 512
+ WindowsForms
+ v4.7.2
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ bin\Debug\
+ terminale.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ AnyCPU
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ terminale.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.vb
+ Form
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ Form1.vb
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file