All pastes #391537 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-12 06:17 UTC
rendered paste body
<%

	dim fso, folder, files, f, path, txtStream
	dim interval_speed, fileArr(), count, size
	
	sub bubbleSort(byref arr)
		dim count, i, j, bound, temp
		
		bound = uBound(arr)
		i = bound
		
		for count = 0 to bound
			j = 1
			do while j <= i
				if arr(j - 1) > arr(j) then
					temp = arr(j - 1)
					
					arr(j - 1) = arr(j)
					arr(j) = temp
				end if
				j = j + 1
			loop
			i = i - 1
		next
	end sub
	
	if isempty( request("name") ) then
		response.write "[{err:""Invalid Parameters""}]"
		response.flush
		response.end
	end if
	
	interval_speed = 0
	
	set fso = server.createObject("Scripting.FileSystemObject")
	
	path = server.mapPath(request("name") &"\")
	if fso.folderExists(path) then
		set folder = fso.getFolder(path)
		set files = folder.files
		
		count = 0
		for each f in files
			if f.name = "noclick.txt" then
				'' do not slide per click, slide on an interval
				'' read the file to find out how often to change images
				'' speed is set in milliseconds, 1000 is 1 second.
				
				set txtStream = fso.openTextFile(path &"\noclick.txt")
				
				interval_speed = txtStream.readAll()
				
				txtStream.close
				set txtStream = nothing
			elseif f.name <> "." and f.name <> ".." then
				redim preserve fileArr( count )
				
				set fileArr( uBound(fileArr) ) = f
				
				count = count + 1
			end if
		next
		
		bubbleSort fileArr
		
		size = 0
		for count = 0 to uBound(fileArr)
			if count > 0 then response.write "&"
			
			response.write "f_"& count &"="& escape( fileArr(count).name )
			
			size = size + fileArr(count).size
		next
		
		if interval_speed <> 0 then
			response.write "&intv_speed="& interval_speed
		end if
		
		response.write "&count="& count &"&total_size="& size
		
		set files = nothing
		set folder = nothing
	end if
	
	set fso = nothing

%>