EgtUILib 2.4b2 :

- rese più robuste alcune funzioni di lettura dati da ini.
This commit is contained in:
DarioS
2022-02-07 18:07:56 +01:00
parent f7f2d2b2a7
commit 899df7ccec
2 changed files with 44 additions and 26 deletions
+42 -24
View File
@@ -45,7 +45,7 @@ Public Function GetPrivateProfileString(
lpAppName As String,
lpKeyName As String,
lpDefault As String,
ByRef lpString As String,
ByRef lpString As String,
lpFileName As String) As Integer
Dim sb As New StringBuilder(1024)
Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
@@ -56,17 +56,17 @@ End Function
Public Function GetPrivateProfileColor(
lpAppName As String,
lpKeyName As String,
ByRef Col As Color3d,
ByRef Col As Color3d,
lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 3 Then
Col.R = Int(sItems(0))
Col.G = Int(sItems(1))
Col.B = Int(sItems(2))
If Not Integer.TryParse(sItems(0), Col.R) Then Col.R = 0
If Not Integer.TryParse(sItems(1), Col.G) Then Col.G = 0
If Not Integer.TryParse(sItems(2), Col.B) Then Col.B = 0
If sItems.Count() >= 4 Then
Col.A = Int(sItems(3))
If Not Integer.TryParse(sItems(3), Col.A) Then Col.A = 0
End If
Return True
End If
@@ -76,18 +76,20 @@ End Function
Public Function GetPrivateProfileZoomWin(
lpAppName As String,
lpKeyName As String,
ByRef bOutline As Boolean,
ByRef Col As Color3d,
ByRef bOutline As Boolean,
ByRef Col As Color3d,
lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 5 Then
bOutline = (Int(sItems(0)) <> 0)
Col.R = Int(sItems(1))
Col.G = Int(sItems(2))
Col.B = Int(sItems(3))
Col.A = Int(sItems(4))
Dim nOutline As Integer
If Not Integer.TryParse(sItems(0), nOutline) Then nOutline = 0
bOutline = (nOutline <> 0)
If Not Integer.TryParse(sItems(1), Col.R) Then Col.R = 0
If Not Integer.TryParse(sItems(2), Col.G) Then Col.G = 0
If Not Integer.TryParse(sItems(3), Col.B) Then Col.B = 0
If Not Integer.TryParse(sItems(4), Col.A) Then Col.A = 0
Return True
End If
Return False
@@ -96,22 +98,38 @@ End Function
Public Function GetPrivateProfileWinPos(
lpAppName As String,
lpKeyName As String,
ByRef nFlag As Integer,
ByRef nLeft As Integer,
ByRef nTop As Integer,
ByRef nWidth As Integer,
ByRef nHeight As Integer,
ByRef nFlag As Integer,
ByRef nLeft As Integer,
ByRef nTop As Integer,
ByRef nWidth As Integer,
ByRef nHeight As Integer,
lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
Dim sItems() As String = sVal.Split(",".ToCharArray)
If sItems.Count() >= 5 Then
nFlag = Int(sItems(0))
nLeft = Int(sItems(1))
nTop = Int(sItems(2))
nWidth = Int(sItems(3))
nHeight = Int(sItems(4))
Return True
Dim bOk As Boolean = True
If Not Integer.TryParse(sItems(0), nFlag) Then
nFlag = 0
bOk = False
End If
If Not Integer.TryParse(sItems(1), nLeft) Then
nLeft = 0
bOk = False
End If
If Not Integer.TryParse(sItems(2), nTop) Then
nTop = 0
bOk = False
End If
If Not Integer.TryParse(sItems(3), nWidth) Then
nWidth = 1024
bOk = False
End If
If Not Integer.TryParse(sItems(4), nHeight) Then
nHeight = 768
bOk = False
End If
Return bOk
End If
Return False
End Function
+2 -2
View File
@@ -35,5 +35,5 @@ Imports System.Runtime.InteropServices
' È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
' utilizzando l'asterisco (*) come descritto di seguito:
<Assembly: AssemblyVersion("2.4.2.1")>
<Assembly: AssemblyFileVersion("2.4.2.1")>
<Assembly: AssemblyVersion("2.4.2.2")>
<Assembly: AssemblyFileVersion("2.4.2.2")>