Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1a3323a9
提交
1a3323a9
authored
1月 09, 2013
作者:
Jeff Lenk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4768 4768-again applied
上级
8e892abd
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
48 行增加
和
44 行删除
+48
-44
util.vbs
libs/win32/util.vbs
+48
-44
没有找到文件。
libs/win32/util.vbs
浏览文件 @
1a3323a9
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
' David A. Horner http://dave.thehorners.com
' David A. Horner http://dave.thehorners.com
'----------------------------------------------
'----------------------------------------------
'On Error Resume Next
' **************
' **************
' Initialization
' Initialization
' **************
' **************
...
@@ -36,9 +35,6 @@ If UseWgetEXE Then
...
@@ -36,9 +35,6 @@ If UseWgetEXE Then
GetWgetEXE
UtilsDir
GetWgetEXE
UtilsDir
End
If
End
If
GetCompressionTools
UtilsDir
If
objArgs
.
Count
>=
3
Then
If
objArgs
.
Count
>=
3
Then
Select
Case
objArgs
(
0
)
Select
Case
objArgs
(
0
)
Case
"Get"
Case
"Get"
...
@@ -96,26 +92,34 @@ Sub WgetUnCompress(URL, DestFolder)
...
@@ -96,26 +92,34 @@ Sub WgetUnCompress(URL, DestFolder)
End
Sub
End
Sub
Sub
GetCompressionTools
(
DestFolder
)
Sub
GetCompressionTools
(
DestFolder
)
Dim
oExec
Dim
tries
Dim
tries
Dim
max_tries
If
Right
(
DestFolder
,
1
)
<>
"\"
Then
DestFolder
=
DestFolder
&
"\"
End
If
tries
=
0
tries
=
0
While
Not
FSO
.
FileExists
(
DestFolder
&
"7za.exe"
)
And
tries
<
2
max_tries
=
10
WScript
.
Sleep
(
Int
(
10000
*
Rnd
))
If
Right
(
DestFolder
,
1
)
<>
"\"
Then
DestFolder
=
DestFolder
&
"\"
End
If
If
Not
FSO
.
FileExists
(
DestFolder
&
"7za.tag"
)
And
Not
FSO
.
FileExists
(
DestFolder
&
"7za.exe"
)
Then
If
Not
FSO
.
FileExists
(
DestFolder
&
"7za.exe"
)
Then
Set
MyFile
=
fso
.
CreateTextFile
(
DestFolder
&
"7za.tag"
,
True
)
On
Error
Resume
Next
Set
MyFile
=
FSO
.
CreateTextFile
(
DestFolder
&
"7za.tag"
,
False
)
If
Err
<>
0
Then
Wscript
.
echo
(
"Downloading 7za: "
&
DestFolder
&
"7za.tag - "
&
Err
.
Description
)
End
If
On
Error
Goto
0
If
Not
IsEmpty
(
MyFile
)
Then
MyFile
.
WriteLine
(
"This file marks a pending download for 7za.exe so we don't download it twice at the same time"
)
MyFile
.
WriteLine
(
"This file marks a pending download for 7za.exe so we don't download it twice at the same time"
)
MyFile
.
Close
MyFile
.
Close
Wget
ToolsBase
&
"7za.exe"
,
DestFolder
Wget
ToolsBase
&
"7za.exe"
,
DestFolder
FSO
.
DeleteFile
DestFolder
&
"7za.tag"
,
true
FSO
.
DeleteFile
DestFolder
&
"7za.tag"
,
true
Wscript
.
echo
(
"Downloaded 7za.exe"
)
Else
End
If
WScript
.
Sleep
(
5000
)
WScript
.
Sleep
(
500
)
End
If
Do
While
FSO
.
FileExists
(
DestFolder
&
"7za.tag"
)
And
tries
<
max_tries
Wscript
.
echo
(
"Waiting for 7za.exe to be downloaded"
)
WScript
.
Sleep
(
1000
)
tries
=
tries
+
1
tries
=
tries
+
1
Loop
If
tries
=
max_tries
Then
Wscript
.
echo
(
"ERROR: Download of 7za.exe takes too much time"
)
Wscript
.
quit
99
End
If
End
If
WEnd
End
Sub
End
Sub
Sub
GetWgetEXE
(
DestFolder
)
Sub
GetWgetEXE
(
DestFolder
)
...
@@ -130,10 +134,15 @@ Function Strip(Str)
...
@@ -130,10 +134,15 @@ Function Strip(Str)
Set
oRE
=
New
Regexp
Set
oRE
=
New
Regexp
oRE
.
Pattern
=
"[\W_]"
oRE
.
Pattern
=
"[\W_]"
oRE
.
Global
=
True
oRE
.
Global
=
True
Strip
=
oRE
.
Replace
(
Str
,
""
)
Strip
=
Right
(
oRE
.
Replace
(
Str
,
""
),
20
)
End
Function
End
Function
Sub
UnCompress
(
Archive
,
DestFolder
)
Sub
UnCompress
(
Archive
,
DestFolder
)
Dim
Fn
Dim
batname
GetCompressionTools
UtilsDir
batname
=
"tmp"
&
Strip
(
Archive
)
&
CStr
(
Int
(
10000
*
Rnd
))
&
".bat"
batname
=
"tmp"
&
Strip
(
Archive
)
&
CStr
(
Int
(
10000
*
Rnd
))
&
".bat"
wscript
.
echo
(
"Extracting: "
&
Archive
&
" - using: "
&
batname
)
wscript
.
echo
(
"Extracting: "
&
Archive
&
" - using: "
&
batname
)
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
...
@@ -146,10 +155,7 @@ Sub UnCompress(Archive, DestFolder)
...
@@ -146,10 +155,7 @@ Sub UnCompress(Archive, DestFolder)
wscript
.
echo
(
"Ready extracting: "
&
Archive
)
wscript
.
echo
(
"Ready extracting: "
&
Archive
)
Fn
=
Left
(
Archive
,
Len
(
Archive
)
-
3
)
Fn
=
Left
(
Archive
,
Len
(
Archive
)
-
3
)
If
FSO
.
FileExists
(
Fn
)
Then
If
FSO
.
FileExists
(
Fn
)
Then
WScript
.
Sleep
(
100
)
Set
MyFile
=
FSO
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
wscript
.
echo
(
"Processing: "
&
Fn
&
" - deleting "
&
batname
)
FSO
.
DeleteFile
UtilsDir
&
batname
,
True
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"7za.exe"
&
quote
&
" x "
&
quote
&
Fn
&
quote
&
" -y -o"
&
quote
&
DestFolder
&
quote
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"7za.exe"
&
quote
&
" x "
&
quote
&
Fn
&
quote
&
" -y -o"
&
quote
&
DestFolder
&
quote
)
MyFile
.
Close
MyFile
.
Close
Set
oExec
=
WshShell
.
Exec
(
UtilsDir
&
batname
)
Set
oExec
=
WshShell
.
Exec
(
UtilsDir
&
batname
)
...
@@ -161,12 +167,9 @@ Sub UnCompress(Archive, DestFolder)
...
@@ -161,12 +167,9 @@ Sub UnCompress(Archive, DestFolder)
wscript
.
echo
(
"Deleting: "
&
Fn
)
wscript
.
echo
(
"Deleting: "
&
Fn
)
FSO
.
DeleteFile
Fn
,
true
FSO
.
DeleteFile
Fn
,
true
End
If
End
If
Fn
=
Fn
&
tar
Fn
=
Fn
&
tar
If
FSO
.
FileExists
(
Fn
)
Then
If
FSO
.
FileExists
(
Fn
)
Then
WScript
.
Sleep
(
100
)
Set
MyFile
=
FSO
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
wscript
.
echo
(
"Processing: "
&
Fn
&
" - deleting "
&
batname
)
FSO
.
DeleteFile
UtilsDir
&
batname
,
True
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"7za.exe"
&
quote
&
" x "
&
quote
&
Fn
&
quote
&
" -y -o"
&
quote
&
DestFolder
&
quote
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"7za.exe"
&
quote
&
" x "
&
quote
&
Fn
&
quote
&
" -y -o"
&
quote
&
DestFolder
&
quote
)
MyFile
.
Close
MyFile
.
Close
Set
oExec
=
WshShell
.
Exec
(
UtilsDir
&
batname
)
Set
oExec
=
WshShell
.
Exec
(
UtilsDir
&
batname
)
...
@@ -180,7 +183,7 @@ Sub UnCompress(Archive, DestFolder)
...
@@ -180,7 +183,7 @@ Sub UnCompress(Archive, DestFolder)
End
If
End
If
WScript
.
Sleep
(
500
)
WScript
.
Sleep
(
500
)
If
FSO
.
FileExists
(
UtilsDir
&
batname
)
Then
If
FSO
.
FileExists
(
UtilsDir
&
batname
)
Then
FSO
.
DeleteFile
UtilsDir
&
batname
,
True
FSO
.
DeleteFile
UtilsDir
&
batname
,
True
End
If
End
If
End
Sub
End
Sub
...
@@ -192,8 +195,8 @@ Sub Wget(URL, DestFolder)
...
@@ -192,8 +195,8 @@ Sub Wget(URL, DestFolder)
If
Right
(
DestFolder
,
1
)
<>
"\"
Then
DestFolder
=
DestFolder
&
"\"
End
If
If
Right
(
DestFolder
,
1
)
<>
"\"
Then
DestFolder
=
DestFolder
&
"\"
End
If
If
UseWgetEXE
Then
If
UseWgetEXE
Then
Wscript
.
echo
(
"
Downloading (wget)
: "
&
URL
)
Wscript
.
echo
(
"
wget
: "
&
URL
)
batname
=
"tmp"
&
CStr
(
Int
(
10000
0
*
Rnd
))
&
".bat"
batname
=
"tmp"
&
CStr
(
Int
(
10000
*
Rnd
))
&
".bat"
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
Set
MyFile
=
fso
.
CreateTextFile
(
UtilsDir
&
batname
,
True
)
MyFile
.
WriteLine
(
"@cd "
&
quote
&
DestFolder
&
quote
)
MyFile
.
WriteLine
(
"@cd "
&
quote
&
DestFolder
&
quote
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"wget.exe"
&
quote
&
" "
&
URL
)
MyFile
.
WriteLine
(
"@"
&
quote
&
UtilsDir
&
"wget.exe"
&
quote
&
" "
&
URL
)
...
@@ -204,7 +207,7 @@ Sub Wget(URL, DestFolder)
...
@@ -204,7 +207,7 @@ Sub Wget(URL, DestFolder)
Loop
While
Not
OExec
.
StdOut
.
atEndOfStream
Loop
While
Not
OExec
.
StdOut
.
atEndOfStream
Else
Else
Wscript
.
echo
(
"
Downloading (HTTP GET)
: "
&
URL
)
Wscript
.
echo
(
"
XMLHTTP GET
: "
&
URL
)
xml
.
Open
"GET"
,
URL
,
False
xml
.
Open
"GET"
,
URL
,
False
xml
.
Send
xml
.
Send
...
@@ -416,3 +419,4 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
...
@@ -416,3 +419,4 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
End
If
End
If
End
Sub
End
Sub
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论