日期:2010-02-03 浏览次数:20844 次
Class Template
Private m_FileName, m_Root, m_Unknowns, m_LastError, m_HaltOnErr
Private m_ValueList, m_BlockList
Private m_RegExp
Private Sub Class_Initialize
Set m_ValueList = CreateObject("Scripting.Dictionary")
Set m_BlockList = CreateObject("Scripting.Dictionary")
set m_RegExp = New RegExp
m_RegExp.IgnoreCase = True
m_RegExp.Global = True
m_FileName = ""
m_Root = "."
m_Unknowns = "remove"
m_LastError = ""
m_HaltOnErr = true
End Sub
Private Sub Class_Terminate
Set m_RegExp = Nothing
Set m_BlockMatches = Nothing
Set m_ValueMatches = nothing
End Sub
Public Property Get ClassName()
ClassName = "Template"
End Property
Public Property Get Version()
Version = "1.0"
End Property
Private Function LoadFile(ByVal chartype)
Dim Filename, fso, hndFile
Filename = m_Root
If Right(Filename, 1)<>"/" And Right(Filename, 1)<>"\" Then Filename = Filename & "/"
Filename = Server.MapPath(Filename & m_FileName)
Set StreamObject = Server.CreateObject("Adodb.Stream")
StreamObject.Type = 1
StreamObject.Mode = 3
StreamObject.Open
StreamObject.Position = 0
StreamObject.LoadFromFile Filename
StreamObject.Position = 0
StreamObject.Type = 2
StreamObject.CharSet = chartype
LoadFile = StreamObject.readtext()
If LoadFile = "" Then ShowError("0x11<br>Could Not Load The File " & m_FileName & "!")
End Function
Private Sub ShowError(ByVal msg)
m_LastError = msg
Response.Write "<span style=""font-size:12px;color:red"">Error ID : " & msg & "</span>"
If m_HaltOnErr Then Response.End
End Sub
Public Sub set_root(ByVal Value)
m_Root = Value
End Sub
Public Function get_root()
get