<% ' -------------------------- ' This page not in the cache ' ' (should be re-read each time ' to see the eventual new files) ' -------------------------- Response.Expires = 0 sCanalNumber = Request.QueryString("Canal") If sCanalNumber = "" Then sCanalNumber= "0" sCanalName = "Canal" & sCanalNumber ' ------------------------------------------------------------------ ' HTML ' ------------------------------------------------------------------ %> Tv-art


<% On Error Resume Next Set MyFileObject = CreateObject("Scripting.FileSystemObject") Set MyFolder = MyFileObject.GetFolder(Server.MapPath(sCanalName + "/")) Set AllFiles = MyFolder.Files iCounter = 0 Response.Write "" sPreviousDate = "" For Each fFile in AllFiles If UCase(Right(fFile.Name, 2)) = "RM" Then ' ----------------------------------- ' Create the ram if it doesn't exist ' ----------------------------------- 'subWriteRamFile MyFileObject, fFile.Name, sMessage 'If sMessage <> "" Then Response.Write "Erreur détectée : " + sMessage + "
" ' ------------------------- ' displays the list of the ' rm files found ' ------------------------ iCounter = iCounter +1 Response.Write Cstr(iCounter) Response.Write " : " 'Response.Write Cstr(Day(fFile.DateCreated)) + "/" + Cstr(Month(fFile.DateCreated)) + "/" + Cstr(Year(fFile.DateCreated)) Response.Write Cstr(Day(fFile.DateLastModified)) + "/" + Cstr(Month(fFile.DateLastModified)) + "/" + Cstr(Year(fFile.DateLastModified)) Response.Write "" Response.Write "Cliquez ici" Response.Write "" If fFile.DateCreated >= sPreviousDate Then 'response.Write "ultérieure à " & Cstr(sPreviousDate) Else 'response.Write "antérieure à " & Cstr(sPreviousDate) End If Response.Write "
" sPreviousDate = fFile.DateCreated End If Next Response.Write "
" MyFolder.Close AllFiles.Close Set MyFileObject = Nothing %> <% ' ------------------------------------------------------------------ ' ------------------------------------------------------------------ ' --------------------------- ' Procedure funWriteRamFile ' ' This writes a ram file if it doesn't already exists. ' ' INPUT : The name of the physical path and name of the rm file ' The Name Of the File System Object ' OUTPUT : The Error Message (empty if no error) ' --------------------------- Sub subWriteRamFile (MyFileObject, sFileName, byRef sErrMessage) On Error Resume Next ' --------- ' Constants ' --------- ForReading=1 ForWriting=2 ForAppending=3 sErrMessage = "" sFullRmFileName = Server.MapPath(sCanalName + "/" + sFileName) sRamFile = funChangeExtension(sFileName, "ram") sFullRamFileName = funChangeExtension(sFullRmFileName, "ram") If IsObject(MyFileObject) Then If NOT MyFileObject.FileExists(sFullRamFileName) Then If Err.Number <> 0 Then sErrMessage = "Could't not decide if the file " + sFullRamFileName + " exists." Exit Sub End If Set MyFile = MyFileObject.OpenTextFile (sFullRamFileName, ForWriting, True) If Err.Number <> 0 Then sErrMessage = "Don't have the write access to create the file " + sFullRamFileName + "." Exit Sub End If sLine = "pnm://www.tv-art.net/bewac/" + sCanalName + "/" + sFileName MyFile.Write(sLine) If Err.Number <> 0 Then sErrMessage = "Could not write a new line into the file " + sFullRamFileName + "." Exit Sub End If MyFile.Close End If Else sErrMessage = "Not an object" End If End Sub ' --------------------------- ' Procedure funChangeExtension ' ' This writes changes the extension of a file name. ' ' INPUT : File name ' OUTPUT : File name with new extension ' --------------------------- Function funChangeExtension (sFileName, sFinalExt) funChangeExtension = Left(sFileName, InstrRev(sFileName, ".")) + sFinalExt End Function ' --------------------------- ' Procedure QSort ' ' QuickSort algorithm for sorting ' ' INPUT : array to sort, min index, max index ' OUTPUT : array sorted ' --------------------------- Public Sub QSort(strList(), lLbound, lUbound) Dim strTemp Dim strBuffer Dim lngCurLow Dim lngCurHigh Dim lngCurMidpoint lngCurLow = lLbound ' Start current low and high at actual low/high lngCurHigh = lUbound If lUbound <= lLbound Then Exit Sub ' Error! lngCurMidpoint = (lLbound + lUbound) \ 2 ' Find the approx midpoint of the array strTemp = strList(lngCurMidpoint) ' Pick as a starting point (we are making ' an assumption that the data *might* be ' in semi-sorted order already! Do While (lngCurLow <= lngCurHigh) Do While strList(lngCurLow) < strTemp lngCurLow = lngCurLow + 1 If lngCurLow = lUbound Then Exit Do Loop Do While strTemp < strList(lngCurHigh) lngCurHigh = lngCurHigh - 1 If lngCurHigh = lLbound Then Exit Do Loop If (lngCurLow <= lngCurHigh) Then ' if low is <= high then swap strBuffer = strList(lngCurLow) strList(lngCurLow) = strList(lngCurHigh) strList(lngCurHigh) = strBuffer ' lngCurLow = lngCurLow + 1 ' CurLow++ lngCurHigh = lngCurHigh - 1 ' CurLow-- End If Loop If lLbound < lngCurHigh Then ' Recurse if necessary QSort strList(), lLbound, lngCurHigh End If If lngCurLow < lUbound Then ' Recurse if necessary QSort strList(), lngCurLow, lUbound End If End Sub ' ------------------------------------------------------------------ ' ------------------------------------------------------------------ %>