请问这段代码还能简化吗?
If $FileDX23<500000ThenIniWrite("XZ.ini", "XZ8","上传等待时间","500");写入上传等待时间
ElseIf $FileDX23<1000000Then;1M
IniWrite("XZ.ini", "XZ8","上传等待时间","550")
ElseIf $FileDX23<1500000Then;1.5M
IniWrite("XZ.ini", "XZ8","上传等待时间","580")
ElseIf $FileDX23<2000000Then;2M
IniWrite("XZ.ini", "XZ8","上传等待时间","600")
ElseIf $FileDX23<2500000Then;2.5M
IniWrite("XZ.ini", "XZ8","上传等待时间","640")
ElseIf $FileDX23<3000000Then;3M
IniWrite("XZ.ini", "XZ8","上传等待时间","700")
ElseIf $FileDX23<4000000Then;4M
IniWrite("XZ.ini", "XZ8","上传等待时间","720")
ElseIf $FileDX23<6000000Then;6M
IniWrite("XZ.ini", "XZ8","上传等待时间","760")
ElseIf $FileDX23<8000000Then;8M
IniWrite("XZ.ini", "XZ8","上传等待时间","800")
ElseIf $FileDX23<10000000Then;10M
IniWrite("XZ.ini", "XZ8","上传等待时间","840")
ElseIf $FileDX23>=10000000Then;10M
IniWrite("XZ.ini", "XZ8","上传等待时间","860")
EndIf
代码的意思是文件越大,上传等待时间越长.可是代码实在是太长了.上传时间在一个大体的范围内,不是一定在上面的时间,怎么办? 本帖最后由 kevinch 于 2013-9-15 19:51 编辑
Dim $arr=[,,,,,,,,,]
$FileDX23=Random(1,10000000,1)
$delay=860
For $i=0 To UBound($arr)-1
If $FileDX23<$arr[$i] Then
$delay=$arr[$i]
ExitLoop
EndIf
Next
IniWrite("XZ.ini", "XZ8","上传等待时间",$delay)不知道你是不是想要简化成这样 不知这样是否符合LZ的意思
Local $FileDX23
Local $size = 500000, $time = 500
Local $up = $time * $FileDX23 / $size
IniWrite("XZ.ini", "XZ8", "上传等待时间", $up);写入上传等待时间
页:
[1]