FS-4768 rest of garmts changes mostly cosmetic

This commit is contained in:
Jeff Lenk 2013-01-04 14:10:51 -06:00
parent dd25e7ea36
commit 40cbc5c0e5

View File

@ -59,23 +59,23 @@ End If
' ******************* ' *******************
Sub WgetSounds(PrimaryName, Freq, DestFolder, VersionFile) Sub WgetSounds(PrimaryName, Freq, DestFolder, VersionFile)
BaseURL = "http://files.freeswitch.org/freeswitch-sounds" BaseURL = "http://files.freeswitch.org/freeswitch-sounds"
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(VersionFile,1) Set objTextFile = objFSO.OpenTextFile(VersionFile,1)
Do Until objTextFile.AtEndOfStream Do Until objTextFile.AtEndOfStream
strLine = objTextFile.Readline strLine = objTextFile.Readline
if Len(strLine) > 2 then if Len(strLine) > 2 then
versionPos = InstrRev(strLine, " ", -1, 1) versionPos = InstrRev(strLine, " ", -1, 1)
name = Left(strLine, versionPos-1) name = Left(strLine, versionPos-1)
if name = PrimaryName Then if name = PrimaryName Then
version = Right(strLine, Len(strLine) - versionPos) version = Right(strLine, Len(strLine) - versionPos)
Wscript.Echo "Sound name: " & name & " Version " & version Wscript.Echo "Sound name: " & name & " Version " & version
URL = BaseURL & "-" & name & "-" & Freq &"-" & version & ".tar.gz" URL = BaseURL & "-" & name & "-" & Freq &"-" & version & ".tar.gz"
Wscript.Echo "URL: " & URL Wscript.Echo "URL: " & URL
WgetUnCompress URL, Showpath(DestFolder) WgetUnCompress URL, Showpath(DestFolder)
End If End If
End if End if
Loop Loop
End Sub End Sub
Sub WgetUnCompress(URL, DestFolder) Sub WgetUnCompress(URL, DestFolder)
@ -143,31 +143,40 @@ Sub UnCompress(Archive, DestFolder)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
If FSO.FileExists(Left(Archive, Len(Archive)-3))Then wscript.echo("Ready extracting: " & Archive)
Fn = Left(Archive, Len(Archive)-3)
If FSO.FileExists(Fn) Then
WScript.Sleep(100) WScript.Sleep(100)
wscript.echo("Processing: " & Fn & " - deleting " & batname)
FSO.DeleteFile UtilsDir & batname, True FSO.DeleteFile UtilsDir & batname, True
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & 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)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
wscript.echo("Ready extracting: " & Fn)
WScript.Sleep(500) WScript.Sleep(500)
FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true wscript.echo("Deleting: " & Fn)
FSO.DeleteFile Fn,true
End If End If
If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then Fn= Fn & tar
If FSO.FileExists(Fn) Then
WScript.Sleep(100) WScript.Sleep(100)
wscript.echo("Processing: " & Fn & " - deleting " & batname)
FSO.DeleteFile UtilsDir & batname, True FSO.DeleteFile UtilsDir & batname, True
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True) Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & 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)
Do Do
WScript.Echo OExec.StdOut.ReadLine() WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream Loop While Not OExec.StdOut.atEndOfStream
wscript.echo("Ready extracting: " & Fn )
WScript.Sleep(500) WScript.Sleep(500)
FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true wscript.echo("Deleting: " & Fn)
FSO.DeleteFile Fn,true
End If End If
WScript.Sleep(500) WScript.Sleep(500)
@ -182,33 +191,34 @@ Sub Wget(URL, DestFolder)
filename=Right(URL,strlength-StartPos) filename=Right(URL,strlength-StartPos)
If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
Wscript.echo("Downloading: " & URL) If UseWgetEXE Then
Wscript.echo("Downloading (wget): " & URL)
batname = "tmp" & CStr(Int(100000*Rnd)) & ".bat"
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@cd " & quote & DestFolder & quote)
MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & batname)
Do
WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream
If UseWgetEXE Then Else
batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat" Wscript.echo("Downloading (HTTP GET): " & URL)
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
MyFile.WriteLine("@cd " & quote & DestFolder & quote)
MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
MyFile.Close
Set oExec = WshShell.Exec(UtilsDir & batname)
Do
WScript.Echo OExec.StdOut.ReadLine()
Loop While Not OExec.StdOut.atEndOfStream
Else xml.Open "GET", URL, False
xml.Open "GET", URL, False xml.Send
xml.Send
Const adTypeBinary = 1 Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2 Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1 Const adSaveCreateNotExist = 1
oStream.type = adTypeBinary oStream.type = adTypeBinary
oStream.open oStream.open
oStream.write xml.responseBody oStream.write xml.responseBody
oStream.savetofile DestFolder & filename, adSaveCreateOverWrite oStream.savetofile DestFolder & filename, adSaveCreateOverWrite
oStream.close oStream.close
End If End If
End Sub End Sub
@ -223,11 +233,11 @@ Sub Slow_Wget(URL, DestFolder)
xml.Send xml.Send
const ForReading = 1 , ForWriting = 2 , ForAppending = 8 const ForReading = 1 , ForWriting = 2 , ForAppending = 8
Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True) Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)
For i = 1 to lenb(xml.responseBody) For i = 1 to lenb(xml.responseBody)
MyFile.write Chr(Ascb(midb(xml.responseBody,i,1))) MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))
Next Next
MyFile.Close() MyFile.Close()
End Sub End Sub
@ -239,22 +249,22 @@ End Function
Function FindVersionStringInConfigure(strConfigFile, strVersionString) Function FindVersionStringInConfigure(strConfigFile, strVersionString)
Set objRegEx = CreateObject("VBScript.RegExp") Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]" objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]"
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strConfigFile, 1) Set objFile = objFSO.OpenTextFile(strConfigFile, 1)
strSearchString = objFile.ReadAll strSearchString = objFile.ReadAll
objFile.Close objFile.Close
Set colMatches = objRegEx.Execute(strSearchString) Set colMatches = objRegEx.Execute(strSearchString)
strResult = "" strResult = ""
If colMatches.Count > 0 Then If colMatches.Count > 0 Then
For Each strMatch in colMatches For Each strMatch in colMatches
strResult = objRegEx.Replace(strMatch.Value, "$1") strResult = objRegEx.Replace(strMatch.Value, "$1")
Next Next
End If End If
FindVersionStringInConfigure = strResult FindVersionStringInConfigure = strResult
@ -279,7 +289,6 @@ Sub FindReplaceInFile(FileName, sFind, sReplace)
End Sub End Sub
Function ExecAndGetResult(tmpFolder, VersionDir, execStr) Function ExecAndGetResult(tmpFolder, VersionDir, execStr)
Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True) Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True)
MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote)
MyFile.WriteLine("@" & execStr) MyFile.WriteLine("@" & execStr)
@ -320,13 +329,13 @@ End Function
Function GetTimeUTC() Function GetTimeUTC()
iOffset = WshShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias") iOffset = WshShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
If IsNumeric(iOffset) Then If IsNumeric(iOffset) Then
GetTimeUTC = DateAdd("n", iOffset, Now()) GetTimeUTC = DateAdd("n", iOffset, Now())
Else Else
GetTimeUTC = Now() GetTimeUTC = Now()
End If End If
End Function End Function
@ -341,7 +350,7 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
'Set version to the one reported by configure.in 'Set version to the one reported by configure.in
If strVerRev <> "" Then If strVerRev <> "" Then
VERSION = strVerRev VERSION = strVerRev
End If End If
Dim sLastFile Dim sLastFile