📄 config
字号:
Private xmlDoc
Private xmlRoot
Private blnModify
Private Sub Class_Initialize()
If IsEmpty(GetCache("WAPmo.Config")) Then
Set xmlDoc = xml.cloneNode(True)
xmlDoc.async = False
xmlDoc.Load GetMapPath("config/config.xml")
If xmlDoc.parseError.errorCode Then
xmlDoc.appendChild xmlDoc.createProcessingInstruction("xml", "version=""1.0"" encoding=""utf-8""")
xmlDoc.appendChild xmlDoc.createElement("root")
blnModify = True
Else
blnModify = False
End If
SetCache "WAPmo.Config", xmlDoc
Set xmlDoc = Nothing
Else
blnModify = False
End If
Set xmlDoc = GetCache("WAPmo.Config").cloneNode(True)
Set xmlRoot = xmlDoc.documentElement
End Sub
Private Sub Class_Terminate()
If blnModify Then
SetCache "WAPmo.Config", xmlDoc
XMLSaveToFile xmlDoc, GetMapPath("config/config.xml")
End If
Set xmlRoot = Nothing
Set xmlDoc = Nothing
End Sub
Public Default Property Get Item(ByVal strName)
Dim xmlNode
Set xmlNode = xmlRoot.selectSingleNode(strName)
If Not xmlNode Is Nothing Then
Item = xmlNode.Text
End If
Set xmlNode = Nothing
End Property
Public Property Let Item(ByVal strName, vtData)
Dim xmlNode
Set xmlNode = xmlRoot.selectSingleNode(strName)
If xmlNode Is Nothing Then
Set xmlNode = xmlDoc.createElement(strName)
xmlRoot.appendChild xmlNode
End If
xmlNode.Text = vtData
Set xmlNode = Nothing
blnModify = True
End Property
Public Sub Remove(ByVal strName)
Dim xmlNode
Set xmlNode = xmlRoot.selectSingleNode(strName)
If Not xmlNode Is Nothing Then
xmlRoot.removeChild xmlNode
End If
Set xmlNode = Nothing
blnModify = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -