|
楼主 |
发表于 2008-5-8 15:52:51
|
显示全部楼层
源代码
#include <GUIConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <ListViewConstants.au3>
#include <Process.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <date.au3>
#include <file.au3>
#Include <Constants.au3>
$g_szVersion = "duxing47 1.2"
If WinExists($g_szVersion) = 1 Then
MsgBox(32, "duxing47提示", "注意已经运行一个了")
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
;;;;托盘菜单
Opt("TrayMenuMode",1)
TraySetPauseIcon("shell32.dll",41)
#Region ### START Koda GUI section ### Form=
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $Gamegs,$XTgs,$GameDX
RegWrite ( "HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare\Scripting" ,"CloseWhenDone", "REG_DWORD", 1)
$cfg = @ScriptDir &"\update.dat"
$cfg1 = @ScriptDir &"\updata.dat"
if not FileExists ($cfg) Then
$CF = FileOpen($cfg, 1)
FileClose($CF)
IniWrite($cfg, "网络设置","地址","")
IniWrite($cfg, "网络设置","帐号","")
IniWrite($cfg, "网络设置","密码","")
IniWrite($cfg, "路径设置","本地路径","G:\NetGame1\")
IniWrite($cfg, "路径设置","服务器路径","/NetGame1/")
endif
$Ftpdz = iniRead($cfg, "网络设置","地址","")
$Ftpzh = iniRead($cfg, "网络设置","帐号","")
$Ftpmm = iniRead($cfg, "网络设置","密码","")
$Bdlj = iniRead($cfg, "路径设置","本地路径","")
$Hwqlj = iniRead($cfg, "路径设置","服务器路径","")
if not FileExists ($Bdlj) Then
DirCreate ($Bdlj)
endif
$Ckbt = "书生三层游戏更新 V1.0"
$Form1 = GUICreate($Ckbt, 814, 574, 193, 115)
$Group1 = GUICtrlCreateGroup("更新设置", 0, 0, 809, 57)
$Button1 = GUICtrlCreateButton("系统设置", 32, 16, 73, 33, 0)
$Button2 = GUICtrlCreateButton("检查更新", 152, 16, 89, 33, 0)
$Button3 = GUICtrlCreateButton("开始更新", 288, 16, 81, 33, 0)
$Button4 = GUICtrlCreateButton("停止更新", 416, 16, 89, 33, 0)
$Button5 = GUICtrlCreateButton("退出更新", 560, 16, 89, 33, 0)
$Button6 = GUICtrlCreateButton("关 于", 688, 16, 89, 33, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TreeView1 = GUICtrlCreateTreeView(8, 72, 233, 177,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
$generalitem = GUICtrlCreateTreeViewItem($Ckbt, $TreeView1)
GUICtrlSetColor(-1, 0x0000C0)
$Newgx = GUICtrlCreateTreeViewItem("今日更新", $TreeView1)
$Sygame = GUICtrlCreateTreeViewItem("所有游戏", $TreeView1)
$QT = GUICtrlCreateTreeViewItem("其它", $TreeView1)
$Label = GUICtrlCreateLabel("当前游戏类型:", 280, 75, 80, 24)
$Label1 = GUICtrlCreateLabel("", 360, 75, 100, 24)
GUICtrlSetColor(-1, 0x0000C0)
$ListView1 = GUICtrlCreateListView(" 游戏名称 |游戏大小|是否有更新|版本|状态",272, 94, 529, 201,$LVS_SINGLESEL,BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
$ListView2 = GUICtrlCreateListView("任务类型|游戏名称|大小|版本|状态", 272, 425, 529, 110,$iExWindowStyle)
$Group3 = GUICtrlCreateGroup("正在更新", 270, 300, 530, 120)
$Label2 = GUICtrlCreateLabel("游戏名称:", 280, 320, 77, 24)
$Label3 = GUICtrlCreateLabel("", 340, 320, 77, 24)
GUICtrlSetColor(-1, 0xFF0000)
$Label8 = GUICtrlCreateLabel("总计大小:", 440, 320, 77, 24)
$Label9 = GUICtrlCreateLabel("", 500, 320, 77, 24)
GUICtrlSetColor(-1, 0xFF0000)
$Label4 = GUICtrlCreateLabel("已完成:", 540, 320, 77, 24)
$Label5 = GUICtrlCreateLabel("", 590, 320, 77, 24)
GUICtrlSetColor(-1, 0xFF0000)
$Label6 = GUICtrlCreateLabel("更新速度:", 640, 320, 77, 24)
$Label7 = GUICtrlCreateLabel("", 700, 320, 77, 24)
GUICtrlSetColor(-1, 0xFF0000)
$Group3 = GUICtrlCreateGroup("更新信息", 8, 264, 233, 273)
$Input1 = GUICtrlCreateInput("", 16, 280, 217, 245,$LVS_SINGLESEL,BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Tmp = @TempDir &"/ver4.tmp"
FileRecycle ($Tmp)
InetGet("ftp://"& $Ftpzh &":"& $Ftpmm &"@"& $Ftpdz &"/"& $Hwqlj &"/update.txt", $Tmp, 1, 1)
sleep(2000)
if not FileExists ($Tmp) Then
GUICtrlSetData ($Input1,"信息: 欢迎使用书生三层游戏更新"&@CRLF&"错误: 无法连接上更新服务器!"&@CRLF&"错误: 获取更新信息失败!")
GUICtrlSetColor ( $Input1, 0xFF0000)
else
FileRecycle ($Tmp)
if FileExists (""& @ScriptDir &"\updata.old") Then
FileRecycle (""& @ScriptDir &"\updata.old")
endif
if FileExists ($cfg1) Then
_rundos ("ren "& $cfg1 &" updata.old")
endif
InetGet("ftp://"& $Ftpzh &":"& $Ftpmm &"@"& $Ftpdz &"/"& $Hwqlj &"/update.txt", $cfg1, 1, 1)
ProgressOn("检查游戏更新,请稍等...", "正在下载游戏更新配置文件.", "0 % ")
For $i = 10 to 100 step 10
sleep(200)
ProgressSet( $i, $i & " % ")
Next
sleep(2000)
ProgressSet(100 , "下载完成", "完成")
sleep(500)
ProgressOff()
GUICtrlSetData ($Input1,"信息: 欢迎使用书生三层游戏更新"&@CRLF&"信息: 成功连接到更新服务器"&@CRLF&"信息: 获取更新版本信息文件成功!"&@CRLF&"信息: 从服务器获取新游戏列表成功."&@CRLF&"信息: 获取更新信息成功."&@CRLF&"信息: 正在检查版本信息,请稍候..."&@CRLF&"信息: 检查版本完毕."&@CRLF&"信息: 正在显示更新项目..."&@CRLF&"信息: 显示更新项目完毕.")
endif
$PZ = IniReadSection($cfg1, "game")
For $i = 1 To $PZ[0][0]
$GameSl = IniReadSection ($cfg1,$PZ[$i][0])
$Item = GUICtrlCreateTreeViewItem(""& $PZ[$i][0] &"["& $GameSl[0][0] &"个]", $Sygame)
GUICtrlSetState($Sygame, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
IniWrite($cfg1, "newgame",""& $PZ[$i][0] &"["& $GameSl[0][0] &"个]",$Item)
$Gamegs = $Gamegs + $GameSl[0][0]
$Game = IniReadSection($cfg1, $PZ[$i][0])
For $a = 1 To $Game[0][0]
$ReadBb = StringSplit($Game[$a][1],"|")
if $ReadBb[1] = _nowdate() Then
$XTgs = $XTgs +1
IniWrite ($cfg1,"dategame",$Game[$a][0],$Game[$a][1])
endif
next
if $XTgs = "" Then
$Xtgs = 0
endif
next
$fl=32
GUICtrlSetData ($Sygame,"所有游戏["& $Gamegs &"个]")
GUICtrlSetData ($Newgx,"今日更新["& $XTgs &"个]")
#EndRegion ### END Koda GUI section ###
While 1
$Tray = TrayGetMsg()
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
setup()
Case $Button2
GUICtrlSetData ($Input1,"")
Jcgamegx()
Case $Button3
Ksgamegx()
Case $Button4
Tzgamegx()
Case $fl
$Read =StringSplit(GUICtrlRead ($TreeView1, 1),"[")
$Game = IniReadSection($cfg1, $Read[1])
GUICtrlSetData ($Label1,GUICtrlRead ($TreeView1, 1))
_GUICtrlListView_DeleteAllItems($listview1)
For $i = 1 to $Game[0][0]
$ReadBb = StringSplit(iniRead ($cfg1, $Read[1],$Game[$i][0],""),"|")
$GameBb = $ReadBb[1]
$GameDX0 = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
if $GameDX0 < 1 Then
$GameDX1 = Round($ReadBb[2] /1024 /1024,2)
if $GameDX1 < 1 Then
$GameDX = Round($ReadBb[2] /1024,2)
$DXdw = "KB"
else
$GameDX = Round($ReadBb[2] /1024 /1024,2)
$DXdw = "M"
endif
else
$GameDX = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
Endif
$JC1 = ""& $Bdlj &""& $Game[$i][0] &"\ver.txt"
$GameDb = FileReadLine ($JC1,1)
if $GameBb = $GameDb Then
$Gxbt = ""
$ZT = "--"
else
$Gxbt = "有新的更新"
$ZT = "等待更新"
endif
$GXXX = GUICtrlCreateListViewItem(""& $Game[$i][0] &"|"& $GameDX &""& $DXdw &"|"& $Gxbt &"|"& $GameBb &"|"& $ZT &"",$listview1)
if $Gxbt = "有新的更新" Then
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetState ( $GXXX, $GUI_CHECKED )
endif
Next
Case $Sygame
_GUICtrlListView_DeleteAllItems($listview1)
GUICtrlSetData ($Label1,GUICtrlRead ($TreeView1, 1))
For $a = 1 To $PZ[0][0]
$Game = IniReadSection($cfg1, $PZ[$a][0])
For $i = 1 To $Game[0][0]
$ReadBb = StringSplit($Game[$i][1],"|")
$GameBb = $ReadBb[1]
$GameDX0 = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
if $GameDX0 < 1 Then
$GameDX1 = Round($ReadBb[2] /1024 /1024,2)
if $GameDX1 < 1 Then
$GameDX = Round($ReadBb[2] /1024,2)
$DXdw = "KB"
else
$GameDX = Round($ReadBb[2] /1024 /1024,2)
$DXdw = "M"
endif
else
$GameDX = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
Endif
$JC1 = ""& $Bdlj &""& $Game[$i][0] &"\ver.txt"
$GameDb = FileReadLine ($JC1,1)
if $GameBb = $GameDb Then
$Gxbt = ""
$ZT = "--"
else
$Gxbt = "有新的更新"
$ZT = "等待更新"
endif
$GXXX = GUICtrlCreateListViewItem(""& $Game[$i][0] &"|"& $GameDX &""& $DXdw &"|"& $Gxbt &"|"& $GameBb &"|"& $ZT &"",$listview1)
if $Gxbt = "有新的更新" Then
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetState ( $GXXX, $GUI_CHECKED )
GUICtrlSetData ($Label1,GUICtrlRead ($TreeView1, 1))
endif
Next
Next
Case $Newgx
_GUICtrlListView_DeleteAllItems($listview1)
GUICtrlSetData ($Label1,GUICtrlRead ($TreeView1, 1))
$Game = IniReadSection("updata.dat", "dategame")
For $i = 1 To $Game[0][0]
$ReadBb = StringSplit($Game[$i][1],"|")
$GameBb = $ReadBb[1]
$GameDX0 = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
if $GameDX0 < 1 Then
$GameDX1 = Round($ReadBb[2] /1024 /1024,2)
if $GameDX1 < 1 Then
$GameDX = Round($ReadBb[2] /1024,2)
$DXdw = "KB"
else
$GameDX = Round($ReadBb[2] /1024 /1024,2)
$DXdw = "M"
endif
else
$GameDX = Round($ReadBb[2] /1024 /1024 /1024,2)
$DXdw = "G"
Endif
$JC1 = ""& $Bdlj &""& $Game[$i][0] &"\ver.txt"
$GameDb = FileReadLine ($JC1,1)
if $GameBb = $GameDb Then
$Gxbt = ""
$ZT = "--"
else
$Gxbt = "有新的更新"
$ZT = "等待更新"
endif
$GXXX = GUICtrlCreateListViewItem(""& $Game[$i][0] &"|"& $GameDX &""& $DXdw &"|"& $Gxbt &"|"& $GameBb &"|"& $ZT &"",$listview1)
if $Gxbt = "有新的更新" Then
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetState ( $GXXX, $GUI_CHECKED )
GUICtrlSetData ($Label1,GUICtrlRead ($TreeView1, 1))
endif
Next
Case $Button5
ProcessWaitClose ("BC2.exe",1)
ProcessClose("BC2.exe")
$BPID = ProcessExists("BC2.exe")
If $BPID Then ProcessClose($BPID)
exit
Case $Button6
Msgbox ("64","关于","书生三层游戏更新 V1.0 "&@CRLF&""&@CRLF&"=============================="&@CRLF&""&@CRLF&"天帅书生(QQ:281599249) 版权所有")
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MINIMIZE
opt("TrayIconHide",0)
Opt("TrayMenuMode",1)
GUISetState(@SW_HIDE,$Form1)
TrayTip("书生三层更新 V1.0","书生三层更新 V1.0",10,1)
EndSwitch
Switch $Tray
Case $TRAY_EVENT_PRIMARYDOWN
GUISetState(@SW_SHOW)
EndSwitch
WEnd
Func setup()
$Ftpdz = iniRead($cfg, "网络设置","地址","")
$Ftpzh = iniRead($cfg, "网络设置","帐号","")
$Ftpmm = iniRead($cfg, "网络设置","密码","")
$Bdlj = iniRead($cfg, "路径设置","本地路径","")
$Hwqlj = iniRead($cfg, "路径设置","服务器路径","")
$gui3 = GUICreate("系统设置", 460, 300, 380, 300)
$Group3 = GUICtrlCreateGroup("FTP 网络设置", 8, 8, 441, 89)
$Input2 = GUICtrlCreateInput($Ftpdz, 72, 32, 129, 21)
$Label2 = GUICtrlCreateLabel("地址:", 24, 32, 40, 17)
$Label3 = GUICtrlCreateLabel("帐号:", 24, 64, 40, 17)
$Input3 = GUICtrlCreateInput($Ftpzh, 72, 64, 129, 21)
$Label4 = GUICtrlCreateLabel("密码:", 248, 64, 40, 17)
$Input4 = GUICtrlCreateInput($Ftpmm, 288, 64, 129, 21,$ES_PASSWORD)
$Label5 = GUICtrlCreateLabel("注:默认端口为[21]", 216, 32, 116, 17)
GUICtrlSetColor(-1, 0xFF0000)
$Button7 = GUICtrlCreateButton("清除信息", 336, 24, 81, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("路径设置", 8, 120, 441, 105)
$Label6 = GUICtrlCreateLabel("本地路径:", 32, 144, 64, 17)
$Input5 = GUICtrlCreateInput($Bdlj, 104, 144, 185, 21)
$Label7 = GUICtrlCreateLabel("服务器路径:", 24, 184, 76, 17)
$Input6 = GUICtrlCreateInput($Hwqlj, 104, 184, 185, 21)
$Button8 = GUICtrlCreateButton("。。。", 304, 144, 49, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label8 = GUICtrlCreateLabel("注:设置将在下次启动时生效!", 8, 248, 186, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Button9 = GUICtrlCreateButton("保存", 288, 264, 65, 25, 0)
$Button10 = GUICtrlCreateButton("取消", 384, 264, 65, 25, 0)
GUISwitch($gui3)
GUISetState (@SW_SHOW,$gui3)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
exitloop
Case $Button7
msgbox ("32","提示","你确定要清除当前FTP设置信息?")
IniDelete($cfg, "网络设置","地址")
IniDelete($cfg, "网络设置","帐号")
IniDelete($cfg, "网络设置","密码")
iniRead($cfg, "网络设置","地址","")
iniRead($cfg, "网络设置","帐号","")
iniRead($cfg, "网络设置","密码","")
GUISetState(@SW_HIDE)
exitloop
Case $Button8
if not FileExists ($Bdlj) Then
$var = FileSelectFolder("请选择本地游戏主文件夹", "游戏主文件夹",1+8,"我的电脑")
else
$var = FileSelectFolder("请选择本地游戏主文件夹", "游戏主文件夹",1+8,$Bdlj)
endif
GUICtrlSetData($Input5,""& $var &"\")
Case $Button9
$Ftpdz = GUICtrlRead($Input2)
$Ftpzh = GUICtrlRead($Input3)
$Ftpmm = GUICtrlRead($Input4)
$Bdlj = GUICtrlRead($Input5)
$Hwqlj = GUICtrlRead($Input6)
IniWrite($cfg, "网络设置","地址",$Ftpdz)
IniWrite($cfg, "网络设置","帐号",$Ftpzh)
IniWrite($cfg, "网络设置","密码",$Ftpmm)
IniWrite($cfg, "路径设置","本地路径",$Bdlj)
IniWrite($cfg, "路径设置","服务器路径",$Hwqlj)
Msgbox ("64","保存完成","保存成功"&@CRLF&""&@CRLF&"注:设置将在下次启动时生效!")
GUISetState(@SW_HIDE)
exitloop
Case $Button10
GUISetState(@SW_HIDE)
exitloop
EndSwitch
WEnd
EndFunc ;======>>系统设置
Func Jcgamegx()
$Ftpdz = iniRead($cfg, "网络设置","地址","")
$Ftpzh = iniRead($cfg, "网络设置","帐号","")
$Ftpmm = iniRead($cfg, "网络设置","密码","")
$Pzwj = iniRead($cfg, "网络设置","配置文件","")
$Bdlj = iniRead($cfg, "路径设置","本地路径","")
$Hwqlj = iniRead($cfg, "路径设置","服务器路径","")
_GUICtrlTreeView_DeleteChildren($TreeView1,0x0005FFA0)
_GUICtrlListView_DeleteAllItems($listview1)
$Gamegs = 0
$XTgs = 0
$Tmp = @TempDir &"/ver4.tmp"
FileRecycle ($Tmp)
InetGet("ftp://"& $Ftpzh &":"& $Ftpmm &"@"& $Ftpdz &"/"& $Hwqlj &"/update.txt", $Tmp, 1, 1)
sleep(2000)
if not FileExists ($Tmp) Then
GUICtrlSetData ($Input1,"信息: 欢迎使用书生三层游戏更新"&@CRLF&"错误: 无法连接上更新服务器!"&@CRLF&"错误: 获取更新信息失败!")
GUICtrlSetColor ( $Input1, 0xFF0000)
else
FileRecycle ($Tmp)
if FileExists (""& @ScriptDir &"\updata.old") Then
FileRecycle (""& @ScriptDir &"\updata.old")
endif
if FileExists ($cfg1) Then
_rundos ("ren "& $cfg1 &" updata.old")
endif
InetGet("ftp://"& $Ftpzh &":"& $Ftpmm &"@"& $Ftpdz &"/"& $Hwqlj &"/update.txt", $cfg1, 1, 1)
ProgressOn("检查游戏更新,请稍等...", "正在下载游戏更新配置文件.", "0 % ")
For $i = 10 to 100 step 10
sleep(200)
ProgressSet( $i, $i & " % ")
Next
sleep(2000)
ProgressSet(100 , "下载完成", "完成")
sleep(500)
ProgressOff()
GUICtrlSetData ($Input1,"信息: 欢迎使用书生三层游戏更新"&@CRLF&"信息: 成功连接到更新服务器"&@CRLF&"信息: 获取更新版本信息文件成功!"&@CRLF&"信息: 从服务器获取新游戏列表成功."&@CRLF&"信息: 获取更新信息成功."&@CRLF&"信息: 正在检查版本信息,请稍候..."&@CRLF&"信息: 检查版本完毕."&@CRLF&"信息: 正在显示更新项目..."&@CRLF&"信息: 显示更新项目完毕.")
endif
$PZ = IniReadSection($cfg1, "game")
For $i = 1 To $PZ[0][0]
$GameSl = IniReadSection ($cfg1,$PZ[$i][0])
$Item = GUICtrlCreateTreeViewItem(""& $PZ[$i][0] &"["& $GameSl[0][0] &"个]", $Sygame)
GUICtrlSetState($Sygame, BitOr($GUI_EXPAND,$GUI_DEFBUTTON))
IniWrite($cfg1, "newgame",""& $PZ[$i][0] &"["& $GameSl[0][0] &"个]",$Item)
$Gamegs = $Gamegs + $GameSl[0][0]
$Game = IniReadSection($cfg1, $PZ[$i][0])
For $a = 1 To $Game[0][0]
$ReadBb = StringSplit($Game[$a][1],"|")
if $ReadBb[1] = _nowdate() Then
$XTgs = $XTgs +1
IniWrite ($cfg1,"dategame",$Game[$a][0],$Game[$a][1])
endif
next
if $XTgs = "" Then
$Xtgs = 0
endif
next
$fl=32
GUICtrlSetData ($Sygame,"所有游戏["& $Gamegs &"个]")
GUICtrlSetData ($Newgx,"今日更新["& $XTgs &"个]")
EndFunc ;========>>检查游戏更新
Func Ksgamegx()
$Ftpdz = iniRead($cfg, "网络设置","地址","")
$Ftpzh = iniRead($cfg, "网络设置","帐号","")
$Ftpmm = iniRead($cfg, "网络设置","密码","")
$Bdlj = iniRead($cfg, "路径设置","本地路径","")
$Hwqlj = iniRead($cfg, "路径设置","服务器路径","")
$GxRZ = "C:\WINDOWS\temp\更新日志.txt"
$Vbc = @WindowsDir &"/temp/bc.txt"
$sl = _GUICtrlListView_GetItemCount($ListView1)
$sl = $sl -1
for $i = 0 to $sl
FileRecycle ($GxRZ)
if not FileExists ($GxRZ) Then
$RZtxt = FileOpen($GxRZ, 1)
FileClose ($RZtxt)
endif
$GameDX = 0
$game = StringSplit(_GUICtrlListView_GetItemTextString($ListView1, $i), "|")
GUICtrlSetData ($Label3,$game[1])
GUICtrlSetData ($Label9,$game[2])
if $game[3] = "有新的更新" Then
FileRecycle ($Vbc)
$Bctxt = FileOpen($Vbc, 1)
FileWriteLine ($Bctxt,"log verbose append:"& $GxRZ &"")
FileWriteLine ($Bctxt,"load ftp://"& $Ftpzh &":"& $Ftpmm &"@"& $Ftpdz &"/"& $Hwqlj &"/"& $game[1] &" "& $Bdlj &""& $game[1] &"")
FileWriteLine ($Bctxt,"expand all")
FileWriteLine ($Bctxt,"select rt.orphan")
FileWriteLine ($Bctxt,"delete rt")
FileWriteLine ($Bctxt,"option confirm:yes-to-all")
FileWriteLine ($Bctxt,"select lt.newer.files lt.older.files lt.orphan lt.diff.files")
FileWriteLine ($Bctxt,"copy lt->rt")
FileClose ($Bctxt)
If not FileExists (""& $Bdlj &""& $game[1] &"") Then
DirCreate (""& $Bdlj &""& $game[1] &"")
Endif
_rundos ("del /f /s /q %temp%\*.*")
sleep(2000)
Run ("C:\WINDOWS\temp\BC2.exe @"& $Vbc &"")
sleep(1000)
$Handle = WinGetHandle ( "Beyond Compare", "")
ControlHide ( "Beyond Compare", "", "TBCPanel1")
ControlHide ( "Beyond Compare", "", "TPageControl1")
WinMove ( "Beyond Compare", "",520, 462 , 366, 90)
WinSetOnTop ( "Beyond Compare", "",1)
WinSetState ( "Beyond Compare", "", @SW_DISABLE)
ProcessExists("BC2.exe")
ProcessWaitClose ("BC2.exe")
GUICtrlCreateListViewItem("游戏更新|《"& $game[1] &"》|"& $game[2] &"|"& $game[4] &"|完成",$ListView2)
$Vop = FileOpen(""& $Bdlj &""& $game[1] &"\ver.txt", 2)
FileWriteLine (""& $Bdlj &""& $game[1] &"\ver.txt",$game[4])
FileClose($Vop)
else
endif
next
EndFunc ;========>>开始游戏更新
Func Tzgamegx()
ProcessClose("BC2.exe")
ControlEnable ( $Ckbt, "", $Button2)
ControlDisable ( $Ckbt, "", $Button4)
EndFunc ;========>>停止游戏更新
Func _AddRow($hWnd, $sItem, $aIcons, $iPlus = 0)
Local $aItem = StringSplit($sItem, "|")
Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $aIcons[0] + $iPlus, _GUICtrlListView_GetItemCount($hWnd) + 9999)
_GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)
For $x = 2 To $aItem[0]
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $aIcons[$x - 1] + $iPlus)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
Next
EndFunc ;==>_AddRow
Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local Const $NM_FIRST = 0
Local Const $NM_LAST = (-99)
Local Const $NM_OUTOFMEMORY = ($NM_FIRST - 1)
Local Const $NM_CLICK = ($NM_FIRST - 2)
Local Const $NM_DBLCLK = ($NM_FIRST - 3)
Local Const $NM_RETURN = ($NM_FIRST - 4)
Local Const $NM_RCLICK = ($NM_FIRST - 5)
Local Const $NM_RDBLCLK = ($NM_FIRST - 6)
Local Const $NM_SETFOCUS = ($NM_FIRST - 7)
Local Const $NM_KILLFOCUS = ($NM_FIRST - 8)
Local Const $NM_CUSTOMDRAW = ($NM_FIRST - 12)
Local Const $NM_HOVER = ($NM_FIRST - 13)
Local Const $NM_NCHITTEST = ($NM_FIRST - 14)
Local Const $NM_KEYDOWN = ($NM_FIRST - 15)
Local Const $NM_RELEASEDCAPTURE = ($NM_FIRST - 16)
Local Const $NM_SETCURSOR = ($NM_FIRST - 17)
Local Const $NM_CHAR = ($NM_FIRST - 18)
Local Const $NM_TOOLTIPSCREATED = ($NM_FIRST - 19)
Local $tagNMHDR, $event, $hwndFrom, $code
$tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$event = DllStructGetData($tagNMHDR, 3)
;$wParam为控件ID,$event为事件
If $event= $NM_CLICK Then
$fl0 = GUICtrlRead ($TreeView1, 1)
$fl1 = iniRead($cfg1, "newgame",$fl0,"")
if $fl1 < $fl then
$fl = 32
else
$fl = $fl1
endif
endif
;;;上面的事件你可以一一试试看
$tagNMHDR = 0
$event = 0
$lParam = 0
EndFunc |
|