diff --git a/EgtDOORCreatorDictionary.xaml b/EgtDOORCreatorDictionary.xaml
index f353521..8622070 100644
--- a/EgtDOORCreatorDictionary.xaml
+++ b/EgtDOORCreatorDictionary.xaml
@@ -398,31 +398,39 @@
-
+
diff --git a/HardwareManager/Hardware.vb b/HardwareManager/Hardware.vb
index a1935e9..287e992 100644
--- a/HardwareManager/Hardware.vb
+++ b/HardwareManager/Hardware.vb
@@ -335,6 +335,7 @@ Public Class Hardware
' il parametro cascade serve per riferisrsi al gruppo di parametri con l'indice indicato
' Se il gruppo di parametri con l'indice indicato è attvivo allora a casca rendo attivo anche questo gruppo di parametri
' attualmente non esiste nessuna struttura che garantisca il funzionamento
+
If StdTemplateGetPrivateProfileChapterCascaded(S_CHAPTER & ChapterIndex, K_CASCADED, IndexParam) Then
Chapter.Cascaded = IndexParam
End If
@@ -381,6 +382,13 @@ Public Class Hardware
Dim FileContent() As String
Dim CurrItemPath As String = CurrPath()
+ Dim Version As String = "2" ' 2 è la versione nuova, 1 la versione vecchia
+ Dim IsActiveVersion As Integer = 0
+ Dim MakeHole As Boolean = False
+ If StdTemplateGetPrivateProfileChapterVersioning("Versioning", "IsActive", IsActiveVersion) Then
+ Version = "1"
+ End If
+
If Not Path.HasExtension(CurrItemPath) Then CurrItemPath &= LUA_EXTENSION
Dim ErrorMsg As String = String.Empty
' se il file ha estensione o se ha estensione nge: esco
@@ -394,12 +402,67 @@ Public Class Hardware
If FileContent.Count = 0 Then
MessageBox.Show(EgtMsg(50107), EgtMsg(50101), MessageBoxButton.OK, MessageBoxImage.Error)
End If
- For IndexLine As Integer = 0 To FileContent.Count - 1
- Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
- Dim sLine() As String = CurrLine.Split("="c)
- If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
- FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
- Next
+
+ ' cerco la versione caricata
+ If IsActiveVersion = 1 Then
+ For Each Line In FileContent
+ Dim CurrLine As String = Utility.DeleteLuaComment(Line)
+ Dim sLine() As String = CurrLine.Split("="c)
+ If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ If sLine(0).Contains(".VER") Then
+ If Not IsNothing(sLine(1)) AndAlso IsNumeric(sLine(1).Replace("'", "")) Then
+ Version = Trim(sLine(1).Replace("'", ""))
+ End If
+ Exit For
+ End If
+ Next
+ End If
+
+ Select Case Version
+ Case "2"
+ For IndexLine As Integer = 0 To FileContent.Count - 1
+ Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
+ Dim sLine() As String = CurrLine.Split("="c)
+ If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
+ Next
+ ' nuova versione
+ Case "1"
+ ' se è una lock
+ If m_HardwareGeneral.DDFName = "locks" Then
+ ' cerco il Parametro mh per l'attivazione del foro
+ For Each Line In FileContent
+ Dim CurrLine As String = Utility.DeleteLuaComment(Line)
+ Dim sLine() As String = CurrLine.Split("="c)
+ If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ If Trim(sLine(0)) = "tLkmPar.mh" Then
+ If Not IsNothing(sLine(1)) AndAlso Trim(sLine(1)) = "true" Then
+ MakeHole = True
+ End If
+ Exit For
+ End If
+ Next
+ For IndexLine As Integer = 0 To FileContent.Count - 1
+ Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
+ Dim sLine() As String = CurrLine.Split("="c)
+ If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ FindParamTemplateInConfigListOldVersionLock(Trim(sLine(0)), Trim(sLine(1)), MakeHole)
+ Next
+ Return True
+ End If
+ For IndexLine As Integer = 0 To FileContent.Count - 1
+ Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
+ Dim sLine() As String = CurrLine.Split("="c)
+ If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
+ Next
+ End Select
+ 'For IndexLine As Integer = 0 To FileContent.Count - 1
+ ' Dim CurrLine As String = Utility.DeleteLuaComment(FileContent(IndexLine))
+ ' Dim sLine() As String = CurrLine.Split("="c)
+ ' If sLine.Count < 2 OrElse sLine.Count > 2 Then Continue For
+ ' FindParamTemplateInConfigList(Trim(sLine(0)), Trim(sLine(1)))
+ 'Next
Return True
End Function
@@ -456,6 +519,88 @@ Public Class Hardware
Return False
End Function
+ ' so già che il file contiene un foro al posto di una mortise
+ Private Function FindParamTemplateInConfigListOldVersionLock(sParam As String, sValue As String, MakeHole As Boolean) As Boolean
+ If MakeHole Then
+ Select Case sParam
+ Case "tLkmPar.L2"
+ sParam = ""
+ Case "tLkmPar.H2"
+ sParam = "tLkmPar.HB2"
+ Case "tLkmPar.T2"
+ sParam = "tLkmPar.TB2"
+ Case "tLkmPar.D_X"
+ sParam = "tLkmPar.DH_X"
+ Case "tLkmPar.LG2"
+ sParam = ""
+ Case "tLkmPar.LA"
+ sParam = ""
+ Case "tLkmPar.s"
+ sParam = ""
+ Case "tLkmPar.p2"
+ sParam = ""
+ Case "tLkmPar.d2"
+ sParam = ""
+ End Select
+ Else
+ Select Case sParam
+ Case "tLkmPar.LGH"
+ sParam = ""
+ End Select
+ End If
+ For IndexGroupChapters As Integer = 0 To m_GroupChapters.Count - 1
+ For IndexChapter As Integer = 0 To m_GroupChapters(IndexGroupChapters).CompoParamList.Count - 1
+ If m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter).DDFName = sParam Then
+ ' ho trovato una corrispondenza tra il valore de file ini e quello lua in lettura
+ ' allora significa che tutto il capitolo associato deve essere attivo
+ m_GroupChapters(IndexGroupChapters).SetIsActiveChapter(True)
+ If TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxDGCParam Then
+ Dim Text As TextBoxDGCParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxDGCParam)
+ Dim sItems() As String = sValue.Split("+"c)
+ Dim sLen As String = Trim(Utility.GetMeasure(sItems(0)))
+ Dim dVal As Double = 0.0
+ Text.SetValue(sLen)
+ Text.SetConst(Text.ConstList(0))
+ If sItems.Count >= 2 Then
+ For IndexConst As Integer = 0 To Text.ConstList.Count - 1
+ If Text.ConstList(IndexConst) = Trim(sItems(1)) Then Text.SetConst(Text.ConstList(IndexConst)) : Exit For
+ Next
+ End If
+ ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is TextBoxParam Then
+ Dim Text As TextBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), TextBoxParam)
+ ' controllo il tipo di dato che si aspetta
+ Select Case Text.TypeVar
+ Case ConstGen.INCHES
+ Dim sLen As String = Trim(Utility.GetMeasure(sValue))
+ Text.SetValue(sLen)
+ Case ConstGen.MM
+ Dim sLen As String = Trim(Utility.GetMeasure(sValue))
+ Text.SetValue(sLen)
+ Case ConstGen.VAL_DOUBLE
+ Dim dVal As Double = 0.0
+ If StringToDouble(sValue, dVal) Then Text.SetValue(sValue) Else Text.SetValue("0.000")
+ Case ConstGen.VAL_STING
+ Text.SetValue(Trim(Utility.DeleteSuperScript(sValue)))
+ End Select
+
+ ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is CheckBoxParam Then
+ Dim Text As CheckBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), CheckBoxParam)
+ Text.SetIsChecked(Utility.ConvertCheckBox(sValue))
+ ElseIf TypeOf m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter) Is ComboBoxParam Then
+ Dim Text As ComboBoxParam = DirectCast(m_GroupChapters(IndexGroupChapters).CompoParamList(IndexChapter), ComboBoxParam)
+ Text.SetSelItem(Text.ItemList(0))
+ For IndexCombo As Integer = 0 To Text.ItemListDDF.Count - 1
+ If Trim(Text.ItemListDDF(IndexCombo)) = Trim(Utility.DeleteSuperScript(sValue)) Then Text.SetSelItem(Text.ItemList(IndexCombo))
+ Next
+ End If
+ Return True
+ End If
+ Next
+ Next
+ Return False
+ Return True
+ End Function
+
#End Region ' Caricamneto
#Region "Salvataggio, Duplica, Nuovo, Aggiorna"
diff --git a/HardwareManager/HardwarePageV.xaml b/HardwareManager/HardwarePageV.xaml
index f05ceb5..fb4484e 100644
--- a/HardwareManager/HardwarePageV.xaml
+++ b/HardwareManager/HardwarePageV.xaml
@@ -15,7 +15,6 @@
-
@@ -165,7 +164,6 @@
-
diff --git a/IniFile.vb b/IniFile.vb
index 5cf2745..8ba518c 100644
--- a/IniFile.vb
+++ b/IniFile.vb
@@ -175,6 +175,12 @@ Friend Module IniFile
Return True
End Function
+ Public Function StdTemplateGetPrivateProfileChapterVersioning(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef nValue As Integer) As Boolean
+ ' se non trovo significa che è disattiva la versione
+ nValue = StdTemplateGetPrivateProfileInt(lpAppName, lpKeyName, 0)
+ Return True
+ End Function
+
Public Function StdTemplateGetPrivateProfileChapterIsOpened(ByVal lpAppName As String, ByVal lpKeyName As String, ByRef bValueLua As Boolean) As Boolean
Dim sVal As String = String.Empty
StdTemplateGetPrivateProfileString(lpAppName, lpKeyName, "", sVal)