config.asp

来自「WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品」· ASP 代码 · 共 73 行

ASP
73
字号
<%
Class ImplMocomWAPmoConfig
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

Public Function newInstance()
    Set newInstance = New ImplMocomWAPmoConfig
End Function
End Class
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?