Extensions/ImageGlass.Feature/ImageGlass_IniFile.vb
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
Imports System.IO
Public Class ImageGlass_IniFile
Sub New()
' TODO: Complete member initialization
End Sub
Private Declare Ansi Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Private Declare Ansi Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
Private Declare Ansi Function GetPrivateProfileInt Lib "kernel32.dll" Alias "GetPrivateProfileIntA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer
Private Declare Ansi Function FlushPrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As Integer, ByVal lpKeyName As Integer, ByVal lpString As Integer, ByVal lpFileName As String) As Integer
Dim strFilename As String
' Constructor, accepting a filename
Public Sub New(ByVal Filename As String)
strFilename = Filename
End Sub
' Read-only filename property
ReadOnly Property FileName() As String
Get
Return strFilename
End Get
End Property
Public Function GetString(ByVal Section As String, ByVal Key As String, ByVal [Default] As String) As String
' Returns a string from your INI file
On Error Resume Next
Dim intCharCount As Integer
Dim objResult As New System.Text.StringBuilder(256)
intCharCount = GetPrivateProfileString(Section, Key, [Default], objResult, objResult.Capacity, strFilename)
If intCharCount > 0 Then GetString = Left(objResult.ToString, intCharCount)
End Function
Public Function GetInteger(ByVal Section As String, ByVal Key As String, ByVal [Default] As Integer) As Integer
' Returns an integer from your INI file
On Error Resume Next
Return GetPrivateProfileInt(Section, Key, [Default], strFilename)
End Function
Public Function GetBoolean(ByVal Section As String, ByVal Key As String, ByVal [Default] As Boolean) As Boolean
' Returns a boolean from your INI file
On Error Resume Next
Return (GetPrivateProfileInt(Section, Key, CInt([Default]), strFilename) = 1)
End Function
Public Sub WriteString(ByVal Section As String, ByVal Key As String, ByVal Value As String)
' Writes a string to your INI file
On Error Resume Next
WritePrivateProfileString(Section, Key, Value, strFilename)
后面还有 80 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。