检测函数 asp class

时间:2021-05-18

复制代码 代码如下:
<%
DimCmd
SetCmd=NewCls_Command
ClassCls_Command
PrivateRe

PublicFunctionIsPositiveInteger(value)
SetRe=NewRegExp
Re.Pattern="^[1-9][\d]*$"
Re.IgnoreCase=True
Re.Global=True
IsPositiveInteger=Re.Test(value)
SetRe=Nothing
EndFunction

PublicFunctionIsDigit(vString)
IfvString=""ThenIsDigit=False:ExitFunction
SetRe=NewRegExp
Re.Pattern="^[a-z]+$"
Re.Global=True
Re.IgnoreCase=True
Re.MultiLine=True
IsDigit=Re.Test(vString)
SetRe=Nothing
EndFunction

PublicFunctionIsAlpha(vString)
IfvString=""ThenIsAlpha=False:ExitFunction
SetRe=NewRegExp
Re.Pattern="^[\d]+$"
Re.Global=True
Re.IgnoreCase=True
Re.MultiLine=True
IsAlpha=Re.Test(vString)
SetRe=Nothing
EndFunction

PublicFunctionIsAlphaDigit(vString)
IfvString=""ThenIsAlphaDigit=False:ExitFunction
SetRe=NewRegExp
Re.Pattern="^[a-zA-Z\d]+$"
Re.Global=True
Re.IgnoreCase=True
Re.MultiLine=True
IsAlphaDigit=Re.Test(vString)
SetRe=Nothing
EndFunction

DimTemplateContent,TemplateDeBug
PublicSubLoadTemplate(TemplateName)
OnErrorResumeNext
DimTemplateObject,TemplateFile
SetTemplateObject=Server.CreateObject("Scripting.FileSystemObject")
SetTemplateFile=TemplateObject.OpenTextFile(Server.MapPath(TemplateName))
IfErr.Number<>0Then
Err.Clear
SetTemplateFile=Nothing
SetTemplateObject=Nothing
TemplateDeBug=1
EndIf
TemplateContent=TemplateFile.ReadAll
TemplateFile.Close
SetTemplateFile=Nothing
SetTemplateObject=Nothing
EndSub

DimHtmlContent,CreatDeBug
PublicSubBuildFile(Catalogue,HtmlName)
OnErrorResumeNext
IfNotCheckFolder(Catalogue)Then
CreatDeBug=1
ExitSub
EndIf
DimCreatObject,CreatFile
SetCreatObject=Server.CreateObject("Scripting.FileSystemObject")
SetCreatFile=CreatObject.CreateTextFile(Server.MapPath(Catalogue&HtmlName),True,False)
IfErr.Number<>0Then
SetCreatFile=Nothing
SetCreatObject=Nothing
Err.Clear
CreatDeBug=1
ExitSub
EndIf
CreatFile.Write(HtmlContent)
CreatFile.Close
SetCreatFile=Nothing
SetCreatObject=Nothing
EndSub

PrivateFunctionCheckFolder(byvalLocalPath)
OnErrorResumeNext
DimFileObject
Dimpatharr,path_level,pathtmp,cpath
LocalPath=Replace(LocalPath,"\","/")
SetFileObject=Server.CreateObject("Scripting.FileSystemObject")
patharr=Split(LocalPath,"/")
path_level=Ubound(patharr)
Dimi
Fori=0topath_level
Ifi=0Then
pathtmp=patharr(0)&"/"
Else
pathtmp=pathtmp&patharr(i)&"/"
EndIf
cpath=Left(pathtmp,Len(pathtmp)-1)
IfNotFileObject.FolderExists(Server.MapPath(cpath))ThenFileObject.CreateFolder(Server.MapPath(cpath))
Next
SetFileObject=Nothing
IfErr.Number<>0then
Err.Clear
CheckFolder=False
Else
CheckFolder=True
EndIf
EndFunction

PublicFunctionWriteCache(appName,Value)
Application.Lock
Application(appName)=Value
Application.Unlock
EndFunction

PublicFunctionClearCache(appName)
Application.Lock
Application.Contents.Remove(appName)
Application.UnLock
EndFunction

PublicSubOutputJavaInfo(Message)
Response.Expires=0
Response.ExpiresAbsolute=Now()-1
Response.AddHeader"pragma","no-cache"
Response.AddHeader"cache-control","private"
Response.CacheControl="no-cache"
Response.ContentType="application/x-javascript"
Response.Write"document.getElementById(""updateinfo"").innerHTML="""&Message&""";"
Response.End
EndSub

PublicSubOutputinterHtml(Message,ShowType)
Response.WriteMessage
IfShowType=1Then
Response.Flush
Else
Response.End
EndIf
EndSub
EndClass
%>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章