0532c0c486
- gestione ribs completata - nuove funzionalita' introdotte su tabella TFS - correzioni e migliorie varie
174 lines
7.4 KiB
VB.net
174 lines
7.4 KiB
VB.net
'----------------------------------------------------------------------------
|
|
' EgalTech 2017-2017
|
|
'----------------------------------------------------------------------------
|
|
' File : IniFile.vb Data : 08.04.17 Versione : 1.8d1
|
|
' Contenuto : Modulo IniFile per gestione lettura/scrittura da file INI.
|
|
'
|
|
'
|
|
'
|
|
' Modifiche : 08.04.17 ES Creazione modulo.
|
|
'
|
|
'
|
|
'----------------------------------------------------------------------------
|
|
|
|
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Module BTLIniFile
|
|
|
|
Public m_sBTLIniFile As String
|
|
|
|
Public Function GetBeamPrivateProfileProcessList(IpGRPType As GRPType, ByRef IpProcessList As ObservableCollection(Of Integer)) As Boolean
|
|
Dim PRCList As New ObservableCollection(Of Integer)
|
|
Dim sProcess As String = String.Empty
|
|
If EgtUILib.GetPrivateProfileString(PROCESSINGS, IpGRPType, String.Empty, sProcess, m_sBTLIniFile) > 0 Then
|
|
Dim sProcesses() As String = sProcess.Split(","c)
|
|
' verifico ce ne sia almeno uno
|
|
If sProcesses.Count >= 0 Then
|
|
' cancello spazi
|
|
For Index = 0 To sProcesses.Count - 1
|
|
sProcesses(Index) = sProcesses(Index).Trim()
|
|
Dim nProcess As Integer
|
|
Integer.TryParse(sProcesses(Index), nProcess)
|
|
PRCList.Add(nProcess)
|
|
Next
|
|
IpProcessList = PRCList
|
|
Return True
|
|
End If
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Public Function GetBeamPrivateProfileGRPList(IpGRP As Integer, IpPRC As Integer, ByRef IpGRPList As ObservableCollection(Of Integer)) As Boolean
|
|
IpGRPList.Clear()
|
|
' ciclo sui tipi di gruppo
|
|
Dim sBTLGroup As String = String.Empty
|
|
If EgtUILib.GetPrivateProfileString(IpGRP & "." & IpPRC, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
|
|
Dim sBTLGroups() As String = sBTLGroup.Split(","c)
|
|
' verifico numero minimo di parametri
|
|
If sBTLGroups.Count >= 0 Then
|
|
' cancello spazi
|
|
For Index = 0 To sBTLGroups.Count - 1
|
|
sBTLGroups(Index) = sBTLGroups(Index).Trim()
|
|
Next
|
|
' creo parametro
|
|
For Each Group In sBTLGroups
|
|
Dim nGroup As Integer = -1
|
|
Integer.TryParse(Group, nGroup)
|
|
If IpGRP = GRPType.L And (nGroup = 0 OrElse nGroup = 3 OrElse nGroup = 4) Then
|
|
IpGRPList.Add(nGroup)
|
|
ElseIf IpGRP = GRPType.T And (nGroup = 1 OrElse nGroup = 2) Then
|
|
IpGRPList.Add(nGroup)
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
Return IpGRPList.Count > 0
|
|
End Function
|
|
|
|
'Public Function GetBeamPrivateProfileVerifyGRP(IpAppName As String, IpGPRtoVerify As String) As Boolean
|
|
' ' ciclo sui tipi di gruppo
|
|
' Dim sBTLGroup As String = String.Empty
|
|
' If EgtUILib.GetPrivateProfileString(IpAppName, BTL_FTR_GRP, String.Empty, sBTLGroup, m_sBTLIniFile) > 0 Then
|
|
' Dim sBTLGroups() As String = sBTLGroup.Split(","c)
|
|
' ' verifico numero minimo di parametri
|
|
' If sBTLGroups.Count >= 0 Then
|
|
' ' cancello spazi
|
|
' For Index = 0 To sBTLGroups.Count - 1
|
|
' sBTLGroups(Index) = sBTLGroups(Index).Trim()
|
|
' Next
|
|
' End If
|
|
' Return sBTLGroups.Contains(IpGPRtoVerify)
|
|
' End If
|
|
' Return False
|
|
'End Function
|
|
|
|
Public Function CalcBeamPrivateProfileGRP(nGRP As Integer) As Integer
|
|
If nGRP = 1 Or nGRP = 2 Then
|
|
Return 1
|
|
ElseIf nGRP = 0 Or nGRP = 3 Or nGRP = 4 Then
|
|
Return 0
|
|
Else
|
|
Return nGRP
|
|
End If
|
|
End Function
|
|
|
|
Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer, ByRef IpBTLFeature As BTLFeatureVM) As Boolean
|
|
Dim sBTLName As String = String.Empty
|
|
' creo lista GRP e leggo nome
|
|
If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
|
|
' verifico numero minimo di parametri
|
|
If Not String.IsNullOrEmpty(sBTLName) Then
|
|
Dim nNameMsg As Integer
|
|
Integer.TryParse(sBTLName, nNameMsg)
|
|
IpBTLFeature.SetName(EgtMsg(nNameMsg))
|
|
Return True
|
|
End If
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Public Function GetBeamPrivateProfileName(IpGRP As Integer, IpPRC As Integer) As String
|
|
Dim sBTLName As String = String.Empty
|
|
' creo lista GRP e leggo nome
|
|
If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, BTL_FTR_NAME, String.Empty, sBTLName, m_sBTLIniFile) > 0 Then
|
|
' verifico numero minimo di parametri
|
|
If Not String.IsNullOrEmpty(sBTLName) Then
|
|
Dim nNameMsg As Integer
|
|
Integer.TryParse(sBTLName, nNameMsg)
|
|
Return EgtMsg(nNameMsg)
|
|
Return True
|
|
End If
|
|
End If
|
|
Return ""
|
|
End Function
|
|
|
|
Public Function GetBeamPrivateProfileParam(IpGRP As Integer, IpPRC As Integer, IsP As Boolean, IpFeatureParamIndex As String, IpParentFeature As BTLFeatureVM, ByRef IpBTLParam As BTLParamVM) As Boolean
|
|
Dim sBTLParam As String = String.Empty
|
|
If EgtUILib.GetPrivateProfileString(CalcBeamPrivateProfileGRP(IpGRP) & "." & IpPRC, If(IsP, "P", "Q") & IpFeatureParamIndex, String.Empty, sBTLParam, m_sBTLIniFile) > 0 Then
|
|
Dim sBTLParamParams() As String = sBTLParam.Split(","c)
|
|
' verifico numero minimo di parametri
|
|
If sBTLParamParams.Count >= 6 Then
|
|
' cancello spazi
|
|
For Index = 0 To sBTLParamParams.Count - 1
|
|
sBTLParamParams(Index) = sBTLParamParams(Index).Trim()
|
|
Next
|
|
' creo parametro
|
|
If sBTLParamParams(0) = "d" OrElse sBTLParamParams(0) = "l" Then
|
|
Dim dMin As Double
|
|
Dim dMax As Double
|
|
Dim dDefault As Double
|
|
StringToDouble(sBTLParamParams(2), dMin)
|
|
StringToDouble(sBTLParamParams(3), dMax)
|
|
StringToDouble(sBTLParamParams(4), dDefault)
|
|
Dim ParamType As BTLParamType
|
|
If sBTLParamParams(0) = "d" Then
|
|
ParamType = BTLParamType.DOUBLE_
|
|
Else
|
|
ParamType = BTLParamType.LENGTH
|
|
End If
|
|
IpBTLParam = New BTLParamVM(IpParentFeature, IsP, ParamType, sBTLParamParams(1), dMin, dMax, dDefault, sBTLParamParams(5))
|
|
Return Not IsNothing(IpBTLParam)
|
|
ElseIf sBTLParamParams(0) = "s" Then
|
|
IpBTLParam = New BTLParamVM(IpParentFeature, IsP, BTLParamType.STRING_, sBTLParamParams(1), sBTLParamParams(5))
|
|
Return Not IsNothing(IpBTLParam)
|
|
ElseIf sBTLParamParams(0) = "c" Then
|
|
Dim nMin As Integer
|
|
Dim nMax As Integer
|
|
Dim nDefault As Integer
|
|
Integer.TryParse(sBTLParamParams(2), nMin)
|
|
Integer.TryParse(sBTLParamParams(3), nMax)
|
|
Integer.TryParse(sBTLParamParams(4), nDefault)
|
|
' recupero lista valori
|
|
Dim ValueList As New List(Of String)
|
|
IpBTLParam = New BTLParamVM(IpParentFeature, IsP, BTLParamType.COMBO, sBTLParamParams(1), nMin, nMax, nDefault, sBTLParamParams(5), ValueList)
|
|
Return Not IsNothing(IpBTLParam)
|
|
End If
|
|
End If
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
End Module
|