
<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<%
response.Charset="GBK"
class AppFSO

'读取文件
Public Function FSOFileRead(Template_Name) 
Dim objFSO,objCountFile,FiletempData 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(Template_Name),1,True) 
If objCountFile.AtEndOfStream = false Then FSOFileRead = objCountFile.ReadAll 
objCountFile.Close 
Set objCountFile=Nothing 
Set objFSO = Nothing 
End Function

'创建文件夹
Public Function CreateFolder(fldr) 
on error resume next
	Dim fso, f
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set f = fso.CreateFolder(Server.MapPath(fldr))
	CreateFolder = f.Path
	Set f=nothing
	Set fso=nothing
End Function

'创建文件
Public Function createhtml(path,str)

Dim GetFold,e,fldr,fso,fout
GetFold=split(path,"/")
For e=0 to Ubound(GetFold)-1
    if fldr="" then
	    fldr= GetFold(e)
    else
	    fldr= fldr&"/"&GetFold(e)
    end if
	If IsFolder(fldr)=false then
	
		CreateFolder fldr
	End if
Next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(path))
fout.Write str
fout.close
set fso = nothing
End Function

'删除文件夹
Public Function delfolder(path)
If IsFolder(path)=True Then
	Set fso = CreateObject("Scripting.FileSystemObject")
	fso.DeleteFolder(server.mappath(path))
	set fso = Nothing
End If 
End Function 

'删除文件
Public Function delfile(path)
dim fso
If IsExists(path)=True Then 
	set fso = server.CreateObject("Scripting.FileSystemObject")
	fso.DeleteFile(server.mappath(path))
	set fso = nothing
End If
End Function 

'检测文件是否存在
Public Function IsExists(filespec) 
	Dim fso
	Set fso = CreateObject("Scripting.FileSystemObject")
	If (fso.FileExists(server.MapPath(filespec))) Then
	IsExists = True
	Else
	IsExists = False
	End If
	Set fso=nothing
End Function

'检测文件夹是否存在
Public Function IsFolder(Folder)
    Dim fso
    Set fso = CreateObject("Scripting.FileSystemObject")
	If FSO.FolderExists(server.MapPath(Folder)) Then  
	IsFolder = True
	Else
	IsFolder = False
	End If
	Set fso=nothing
End Function

Public Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	If 0 = Err Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function

Public Function  getfolders(folderpath_template)
dim objFS,objFolder,folder,dirstr,str
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFolder = objFS.GetFolder(server.MapPath(folderpath_template))
for each folder in objFolder.SubFolders
	str = folder.name
	dirstr = str & ","&dirstr
next
getfolders = dirstr
set objFolder = nothing
set objFS = nothing
end Function

End class
%>