检测函数 asp class

2018-09-06 11:46

阅读:454

  复制代码 代码如下:
<%
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.UnLock
EndFunction

PublicSubOutputJavaInfo(Message)
Response.Expires=0
Response.ExpiresAbsolute=Now()-1
Response.AddHeaderpragma,no-cache
Response.AddHeadercache-control,private
Response.CacheControl=no-cache
Response.ContentType=application/x-javascript
Response.End
EndSub

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


评论


亲,登录后才可以留言!