Files
OmagCUT/Utility.vb
T
Emmanuele Sassi c93e032fea OmagCUT:
- Cambiata gestione lingue.
- Iniziato sviluppo DirectCut.
2015-11-20 13:34:55 +00:00

82 lines
2.3 KiB
VB.net

Imports System.Globalization
Imports EgtUILib
Module Utility
Friend Sub HideParkedParts()
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
EgtSetStatus(nPartId, GDB_ST.OFF)
nPartId = EgtGetNextPart(nPartId)
End While
End Sub
Friend Sub ShowParkedParts()
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
EgtSetStatus(nPartId, GDB_ST.ON_)
nPartId = EgtGetNextPart(nPartId)
End While
End Sub
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As UInteger) As String
Dim sFormat As String = "F" + nNumDec.ToString()
Dim sVal As String = dVal.ToString(sFormat, CultureInfo.InvariantCulture)
If nNumDec > 0 Then
Return sVal.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray)
Else
Return sVal
End If
End Function
Friend Function StringToDouble(ByVal sVal As String, ByRef dVal As Double) As Boolean
Return EgtLuaEvalNumExpr(sVal, dVal)
End Function
Public Class Language
Private m_sLanguageName As String
Private m_sFileName As String
Public Property LanguageName As String
Get
Return m_sLanguageName
End Get
Set(value As String)
m_sLanguageName = value
End Set
End Property
Public Property FileName As String
Get
Return m_sFileName
End Get
Set(value As String)
m_sFileName = value
End Set
End Property
Sub New(LanguageName As String, FileName As String)
Me.LanguageName = LanguageName
Me.FileName = FileName
End Sub
End Class
Public Function GetPrivateProfileLanguage(
ByVal lpAppName As String,
ByVal lpKeyName As String,
ByVal lpFileName As String) As Language
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() = 2 Then
Return New Language(sItems(0), sItems(1))
End If
Return Nothing
End Function
End Module