break on$root = dirplus('C:\Program Files','/ad') dim $folders[ubound($root)] for $i = 0 to ubound($root) $n = $root[$i].name $s = val($root[$i].size) $folders[$i] = $n,$snext $folders = quicksort($folders,1) for each $item in $folders ? $item[0] " " $item[1]next Function DirPlus($path,optional $Options, optional $f, optional $sfflag) If not vartype($f) DIM $f EndIf If not vartype($sfflag) DIM $sfflag EndIf DIM $file, $i, $temp, $item, $ex1, $mask,$mask1,$maskArray,$maskarray1, $ex2, $code, $CodeWeight, $targetWeight, $weight, $masktrue DIM $tarray[0] $ex1 = SetOption(Explicit,on) $ex2 = SetOption(NoVarsInStrings,on) $codeWeight = 0 If not Exist($path) $temp = SetOption(Explicit,$ex1) $temp = SetOption(NoVarsInStrings,$ex2) Exit @ERROR EndIf If not vartype($f) $f = CreateObject("Scripting.FileSystemObject").getfolder($path) EndIf If @ERROR $temp = SetOption(Explicit,$ex1) $temp = SetOption(NoVarsInStrings,$ex2) Exit @ERROR EndIf For Each $temp In Split($options,"/") $temp=Trim($temp) Select Case left($temp,1) = "s" If not vartype($sfflag) If Val(right($temp,-1)) = 0 $sfflag = -1 Else $sfflag = Val(right($temp,-1)) EndIf EndIf Case Left($temp,1) = "a" Select Case Right($temp,-1)="d" $codeWeight = $codeWeight + 1 $temp = "if $file.attributes & 16 " ;"if $file.type = 'File Folder' " Case Right($temp,-1)="-d" $codeWeight = $codeWeight + 1 $temp = "if ($file.attributes & 16)=0 " ;"if $file.type <> 'File Folder' " Case Right($temp,-1)="s" $codeWeight = $codeWeight + 1 $temp = "if $file.attributes & 4 " Case Right($temp,-1)="-s" $codeWeight = $codeWeight + 1 $temp = "if ($file.attributes & 4)=0 " Case Right($temp,-1)="h" $codeWeight = $codeWeight + 1 $temp = "if $file.attributes & 2 " Case Right($temp,-1)="-h" $codeWeight = $codeWeight + 1 $temp = "if ($file.attributes & 2)=0 " Case Right($temp,-1)="r" $codeWeight = $codeWeight + 1 $temp = "if $file.attributes & 1 " Case Right($temp,-1)="-r" $codeWeight = $codeWeight + 1 $temp = "if ($file.attributes & 1)=0 " Case Right($temp,-1)="a" $codeWeight = $codeWeight + 1 $temp = "if $file.attributes & 32 " Case Right($temp,-1)="-a" $codeWeight = $codeWeight + 1 $temp = "if ($file.attributes & 32)=0 " EndSelect $code = $temp + "$weight=$weight+1 endif" +@CRLF + $code Case Left($temp,1) = "m" $maskarray = Split(Right($temp,-2),"|") $codeweight = $codeweight + 1 $code = "$masktrue=0 for Each $mask in $maskarray if instr($file.name,$mask) $masktrue=1 " + "EndIf Next If $masktrue $weight=$weight+1 endif" + @CRLF +$code Case Left($temp,1) = "f" $maskarray1 = Split(Right($temp,-2)," ") $codeweight = $codeweight + 1 $code = "$masktrue=0 for Each $mask1 in $maskarray1 if substr($file.name,Instrrev($file.name,'.')+1)" + "=$mask1 $masktrue=1 EndIf Next If $masktrue $weight=$weight+1 endif" + @CRLF +$code EndSelect Next $code = "$weight = 0 $targetWeight = " + $codeweight + @CRLF + $code $code = $code + "if $weight = $targetweight Exit 1 endif" For Each $file In $f.subfolders If Execute($code) $tarray[$i] = $file $i = $i + 1 ReDIM preserve $tarray[$i] EndIf If $sfflag $temp = dirplus($file,$options,$file,$sfflag-1) For Each $item In $temp $tarray[$i] = $item $i = $i + 1 ReDIM preserve $tarray[$i] Next EndIf Next For Each $file In $f.files If Execute($code) $tarray[$i] = $file $i = $i + 1 ReDIM preserve $tarray[$i] EndIf Next If $i ReDIM preserve $tarray[$i-1] $i=0 Else $tarray = 0 EndIf $dirplus = $tarray $temp = SetOption(Explicit,$ex1) $temp = SetOption(NoVarsInStrings,$ex2) Exit @ERROREndFunction function quicksort($a, optional $indexcol ) ;$a array to be sorted ;$indexcol index of subitem to sort on ;$LowerIndexStack lower index stack ;$UpperIndexStack upper index stack ;$StackPointer stack pointer ;$LowerIndex lower index ;$UpperIndex upper index ;$Pivot value of pivot ;$TempSwappingValue temp variable for swapping elements ;$index stores either lower or upper index of unsorted segment of the array ;$i counter moving from lower index to the right ;$j counter moving from upper index to the left ;$LowerItem value to compare with dim $StackSize, $StackIncr $StackSize = 8 $StackIncr = $StackSize dim $LowerIndexStack[$StackSize],$UpperIndexStack[$StackSize] dim $StackPointer, $LowerIndex, $UpperIndex, $Pivot, $TempSwappingValue, $index, $i, $j, $LowerItem dim $ExitLoop if $indexcol $indexcol = CStr($indexcol) if indexcol < 0 $indexcol = 0 endif else $indexcol = 0 endif $LowerIndexStack[0]=0 $UpperIndexStack[0]=UBOUND($a) $StackPointer=0 While $StackPointer >= 0 $LowerIndex=$LowerIndexStack[$StackPointer] $UpperIndex=$UpperIndexStack[$StackPointer] While $LowerIndex < $UpperIndex $Pivot=$LowerIndex+($UpperIndex-$LowerIndex)/2 $TempSwappingValue=$a[$LowerIndex] $A[$LowerIndex]=$A[$Pivot] $A[$Pivot]=$TempSwappingValue $i=$LowerIndex+1 $j=$UpperIndex $ExitLoop=0 Do $LowerItem = QuickSortItem( $A[$LowerIndex],$indexcol ) While ($i<$j) AND ( QuickSortItem( $A[$i],$indexcol ) < $LowerItem) $i=$i+1 Loop While ($j>=$i) AND ($LowerItem < QuickSortItem( $A[$j],$indexcol )) $j=$j-1 Loop if $i>=$j $ExitLoop=1 else $TempSwappingValue=$A[$i] $A[$i]=$A[$j] $A[$j]=$TempSwappingValue $j=$j-1 $i=$i+1 endif Until $ExitLoop=1 $TempSwappingValue=$a[$LowerIndex] $a[$LowerIndex]=$a[$j] $a[$j]=$TempSwappingValue $index=$j if $index - $LowerIndex <= $UpperIndex - $index if $index+1 < $UpperIndex if $StackPointer>$StackSize $StackSize = $StackSize + $StackIncr Redim preserve $LowerIndexStack[$StackSize] Redim preserve $UpperIndexStack[$StackSize] endif $LowerIndexStack[$StackPointer]=$index+1 $UpperIndexStack[$StackPointer]=$UpperIndex $StackPointer=$StackPointer+1 endif $UpperIndex=$index-1 else if $index-1 > $LowerIndex if $StackPointer>$StackSize $StackSize = $StackSize + $StackIncr Redim preserve $LowerIndexStack[$StackSize] Redim preserve $UpperIndexStack[$StackSize] endif $LowerIndexStack[$StackPointer]=$LowerIndex $UpperIndexStack[$StackPointer]=$index-1 $StackPointer=$StackPointer+1 endif $LowerIndex=$index+1 endif Loop $StackPointer=$StackPointer-1 Loop $quicksort=$aEndfunction Function QuickSortItem( $value, $index ) if vartype($value) & 8192 if ($index <= UBound($value)) $QuickSortItem = $value[$index] else $QuickSortItem = "" endif else $QuickSortItem = $value endifendfunction
Generated in 0.155 seconds in which 0.081 seconds were spent on a total of 13 queries. Zlib compression enabled.
") !=-1) { tempah=tempah.substring(tempah.indexOf("")+5,tempah.indexOf("")); codes[i].innerHTML="" + dotag(tempah.substring()) + ""; } } //var pres = document.getElementsByTagName("pre"); //for (var i=0, maxi = pres.length; i < maxi; i++) { // var tempah = pres[i].innerHTML; // if (tempah.indexOf("[postprep") !=-1) { // tempah=tempah.substring((tempah.indexOf("]",tempah.indexOf("[postprep"))+1)); // pres[i].innerHTML=dotag(tempah); // } //} function ytag(which_one) { var codes = document.getElementsByClassName("ubbcode-body"); var thisone = codes[which_one].innerHTML; codes[which_one].innerHTML = "" + dotag(thisone.substring(5+thisone.indexOf(""),thisone.indexOf(""))) + ""; var heads = document.getElementsByClassName("ubbcode-header"); heads[which_one].innerHTML = "Code:" + ' '; } function ttag(which_one) { var codes = document.getElementsByClassName("ubbcode-body"); var thisone = ""; if (codes[which_one].innerText != undefined) { thisone += codes[which_one].innerText; } else { thisone += codes[which_one].textContent; } codes[which_one].innerHTML = thisone + ""; var heads = document.getElementsByClassName("ubbcode-header"); heads[which_one].innerHTML = "Code:" + ' '; }
")+5,tempah.indexOf("
" + dotag(tempah.substring()) + "
" + dotag(thisone.substring(5+thisone.indexOf(""),thisone.indexOf(""))) + "
"),thisone.indexOf("
"; if (codes[which_one].innerText != undefined) { thisone += codes[which_one].innerText; } else { thisone += codes[which_one].textContent; } codes[which_one].innerHTML = thisone + "