|
2#
楼主 |
发表于 2010-10-12 21:37:04
|
只看该作者
内置 xdelta3.exe 与. INI 到 PECMD.EXE ,这是源代码:
_SUB w_autoini
Envi @label1=正在读取原始文件的MD5值,请稍等...
MD5C %old%,oldmd5
FDIR ph=%delta%
FEXT okzm=%old%
NAME oname=%old%
NAME dname=%delta%
NAME nname=%new%
EXEC =!cmd /c "echo Envi Prog2=Xdelta_Auto工具 by 网虫2008>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi oldmd5=%oldmd5%>>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi zkm=%okzm%>>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi oldfile=%oname%>>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi deltafile=^%CurDir^%\%dname%>>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi newfile=%nname%>>%ph%\XdeltaAuto.ini
EXEC =!cmd /c "echo Envi autoread=请确认原始文件没有被编辑,且MD5为:%oldmd5%>>%ph%\XdeltaAuto.ini
_END
_SUB ynautoini
TEAM MESS ▉ %read3% @通知:#YN *0 $N
FIND $%YESNO%=YES,TEAM Envi YESNO=|Call w_autoini
_END
_SUB w_ini
EXEC =!cmd /c "echo Envi old=%old%>%tempph%
FIND $%setbd%=y,Call ynautoini!MESS ▉ %read3% @通知:#ok *0
WAIT 500
TEAM FDIR Open=%delta%|FIND $%Open%=%CurDir%,!EXEC %Open%
_END
_SUB go,
FIND $%setbd%=y,TEAM Envi startcs=-e -s|Envi @label1=正在创建补丁文件,请稍等......!TEAM Envi startcs=-d -s|Envi @label1=正在创建新文件,请稍等......
WAIT 500
EXEC !=#101 %startcs% "%old%" "%new%" "%delta%"
WAIT 500
Envi @label1=通知:执行完毕!
FIND $%setbd%=y,Envi read3=已经成功生成补丁文件,\n\n是否创建自动补丁包的配置文件?!Envi read3=已经成功生成打好补丁的新文件!
Envi read4=操作没有成功,请注意文件点选!\n\n点击确认后重新启动程序,\n或尝试将主程序移到其他位置再次执行。
IFEX %delta%,Call w_ini!TEAM MESS ▉ %read4% @通知:#ok *0|FILE %tempph%
KILL \%Prog1%
_END
_SUB del_file
FILE %delta%
WAIT 500
IFEX %delta%,MESS 文件无法删除,\n请返回程序重新选择。@通知: #ok *0!TEAM Envi YESNO=|Call go
_END
_SUB yn_del
IFEX %delta%,MESS 文件已经存在,\n是否删除?@通知: #YN *0 $N!TEAM Envi YESNO=|Call go
FIND $%YESNO%=YES,Call del_file
_END
_SUB set_new2
FIND $%w_%all%%=y,TEAM Envi all=old|Call allName|Envi all=new|Call allName
FIND $%w_delta%=y,Envi @delta=%oldph%\%delta%.%oldkzm%!Envi @delta=%PF_Tag%
_END
_SUB set_new1
FIND $%w_%all%%=y,TEAM Envi all=old|Call allName|Envi all=new|Call allName
IFEX %new%,FIND $%file%=y,Envi @delta=%oldph%\新_%oldname%.%oldkzm%
FIND $%all%=new,FIND $%file%=n,Envi @delta=输入文件名或在补丁文件栏按“回车”或手动选择 >>
_END
_SUB set_delta2
FIND $%w_%all%%=y,TEAM Envi all=old|Call allName|Envi all=new|Call allName
FIND $%w_delta%=y,Envi @delta=%newph%\%delta%.%xkzm%!Envi @delta=%PF_Tag%
_END
_SUB set_delta1
FIND $%w_%all%%=y,TEAM Envi all=old|Call allName|Envi all=new|Call allName
IFEX %new%,FIND $%file%=y,Envi @delta=%newph%\%oldname%.%xkzm%
FIND $%all%=new,FIND $%file%=n,Envi @delta=输入文件名或在目标文件栏按“回车”或手动选择 >>
_END
_SUB allName
FEXT %all%kzm=%%all%%
NAME %all%name=%%all%%
Envi %all%file=%%all%name%\%%all%kzm%
FDIR %all%ph=%%all%%
_END
_SUB set_file
Envi oldts=请选择 原始文件所在目录与名称:
FIND $%setbd%=y,Envi newts=请选择 目标文件所在目录与名称:!Envi newts=请选择 补丁文件所在目录与名称:
FIND $%w_%all%%=y,!BROW PF_Tag,%RP%\*,%%all%ts%,%%all%kzm%
FIND $%PF_Tag%=,!TEAM Envi @%all%=%PF_Tag%|Call allName
IFEX %%all%%,Envi file=y!TEAM Envi @%all%=文件不存在,请重新选择或输入!|Envi file=n|Envi @read=
FIND $%setbd%=y,Call set_delta1!Call set_new1
_END
_SUB apply_file
FIND $%setbd%=y,Envi deltats=请选择 用来储存补丁文件的目录与名称:!Envi deltats=请选择 用来储存新建文件的目录与名称:
FIND $%w_%all%%=y,!BROW PF_Tag,&%RP%\*,%%all%ts%,%%all%kzm%
FIND $%PF_Tag%=,!TEAM Envi @%all%=%PF_Tag%|Call allName
FIND $%setbd%=y,Call set_delta2!Call set_new2
_END
_SUB savefile
FIND $%all%=new,Envi %all%kzm=%xkzm%
FIND $%all%=delta,TEAM FEXT oldkzm=%old%|Envi %all%kzm=%oldkzm%
FIND $%all%=delta,Call apply_file!Call set_file
_END
_SUB makedelta
FIND $%all%=delta,Envi %all%kzm=%xkzm%
FIND $%all%=delta,Call apply_file!Call set_file
_END
_SUB SelecRP
Envi PF_Tag=
IFEX X:\,Envi RP=D:!Envi RP=%CurDir%
IFEX %old%,FDIR RP=%old%
FEXT %all%kzm=%%all%%
FIND $%%all%kzm%=,Envi %all%kzm=*
FIND $%setbd%=y,Call makedelta!Call savefile
IFEX %new%,Envi @read=生成的文件将储存在:%delta%
Envi w_%all%=
Envi all=
_END
_SUB windows1,w453h335,%Prog1%,,XdeltaGui.EXE#1,5,
labe label1,l25t15w320h20,▉ 请按照以下步骤进行详细操作:
grou group1,l15t35w420h40,
labe label2,l25t53w140h20,01.请选择 执行目的:
radi radiobutton1,l155t50w65h20,制作补丁,TEAM Envi bdyn=y|Envi setbd=y|Call make0,%bdno%,
radi radiobutton2,l230t50w140h20,应用补丁(创建新文件),TEAM Envi bdyn=n|Envi setbd=n|Call make0,%newno%,
grou group2,l15t85w420h105,02.设置相关文件:
labe label3,l32t110w60h20,原始文件:
EDIT old,l91t105w305h20,%old%,TEAM Envi w_old=y|Envi md=|Envi all=old|CALL SelecRP,
ITEM Button1,l400t104w25h20,...,TEAM Envi w_old=|Envi md=o|Envi all=old|CALL SelecRP,
labe onebt,l32t138w60h20,%onebt%:
EDIT new,l91t133w305h20,%new%,TEAM Envi w_new=y|Envi md=|Envi all=new|CALL SelecRP,
ITEM Button2,l400t132w25h20,...,TEAM Envi w_new=|Envi md=n|Envi all=new|CALL SelecRP,
labe twobt,l32t164w60h20,%twobt%:
EDIT delta,l91t160w305h20,%delta%,TEAM Envi w_delta=y|Envi md=|Envi all=delta|CALL SelecRP,
ITEM Button3,l400t159w25h20,...,TEAM Envi w_delta=|Envi md=d|Envi all=delta|CALL SelecRP,
grou group3,l15t200w300h70,提示:
labe read,l25t225w280h40,%read%
grou group4,l-5t280w455h10,
ITEM MR_BB,l350t205w60h30,%MR_BB%,Call yn_del,
ITEM Button4,l350t240w60h30,关闭程序,KILL \%Prog1%,
_END
_SUB make2,
IFEX %oldph%\%oldname%.%xkzm%,Envi @new=%oldph%\%oldname%.%xkzm%!Envi %r_new%=拖放 补丁文件到窗口或手动选择 >>
IFEX %oldph%\%oldname%.%xkzm%,Envi @delta=%oldph%\新_%oldname%.%oldkzm%!Envi %r_delta%=输入 不加后缀的文件名称按“回车”或手动选择 >>
IFEX %oldph%\%oldname%.%xkzm%,Envi read=新文件将储存在:%delta%!Envi read=选择补丁文件后(如拖放文件需按回车),将自动设置新文件的储存目录为:原始文件的同级目录\新_原始文件名称
Envi %r_onebt%=补丁文件
Envi %r_twobt%=创建文件
Envi %r_MR_BB%=应用补丁
Envi setbd=n
_END
_SUB make1,
Envi %r_new%=拖放 目标文件到窗口或手动选择 >>
Envi %r_delta%=输入 不加后缀的文件名称按“回车”或手动选择 >>
Envi read=选择目标文件后(如拖放文件需按回车),将自动设置补丁文件的储存目录为:目标文件的同级目录\原始文件名称.%xkzm%
Envi %r_onebt%=目标文件
Envi %r_twobt%=制作补丁
Envi %r_MR_BB%=制作补丁
Envi setbd=y
_END
_SUB make0,
TEAM Envi r_old=old|Envi r_new=new|Envi r_delta=delta|Envi r_MR_BB=MR_BB|Envi r_onebt=onebt|Envi r_twobt=twobt
FIND $%setbd%=,!TEAM Envi [email=r_old=@old|Envi]r_old=@old|Envi[/email] [email=r_new=@new|Envi]r_new=@new|Envi[/email] [email=r_delta=@delta|Envi]r_delta=@delta|Envi[/email] [email=r_MR_BB=@MR_BB|Envi]r_MR_BB=@MR_BB|Envi[/email] [email=r_onebt=@onebt|Envi]r_onebt=@onebt|Envi[/email] [email=r_twobt=@twobt]r_twobt=@twobt[/email]
IFEX %old%,TEAM Envi all=old|Call allName|Envi %r_old%=%old%!Envi %r_old%=拖放 原始文件到窗口或手动选择 >>
FIND $%bdyn%=y,Call make1!Call make2
Envi @read=%read%
_END
_SUB Gui_Xdelta
Envi Prog1=Xdelta Gui版 by 网虫2008 20101020
Envi xkzm=delta
Envi tempph="%temp%\xdelta3_temp.ini"
LOAD %tempph%
TEAM Envi bdyn=y|Envi bdno=1|Envi newno=0
Call make0
call @windows1
_END
_SUB wa_ini
EXEC =!cmd /c "echo Envi old=%old%>%temp%\xdelta3_temp.ini
_END
_SUB windows2,w400h160,%Prog2%,,XdeltaGui.exe,10
NAME newname=%new%
NAME deltaname=%delta%
LABE LABE1,l30t20w390h30,←正在验证原始文件MD5值
LABE LABE2,l40t55w390h50,请稍候......,
LABE LABE3,l40t90w390h20,,
time t2,1000,Call md5yz
_END
_SUB md5yz
ENVI @t2=0
MD5C %old%,yzoldmd5
WAIT 500
FIND $%yzoldmd5%=%oldmd5%,Call a_go!TEAM MESS ▉ 操作没有成功,%autoread% @通知:#ok *0|FILE %tempph%|KILL \%Prog2%
_END
_SUB a_go,
Envi @LABE1=←正在应用补丁文件创建:
Envi @LABE2="%deltaname%.ISO"
Envi @LABE3=请稍候......
WAIT 500
EXEC =!#101 -d -s "%old%" "%new%" "%delta%"
WAIT 500
Call wa_ini
IFEX %delta%,MESS ▉ 已经成功生成打好补丁的“%delta%”文件! @通知:#ok *0
TEAM FDIR Open=%delta%|FIND $%Open%=%CurDir%,!EXEC %Open%
KILL \%Prog2%
_END
_SUB auto_delfile
FILE %delta%
WAIT 500
IFEX %delta%,TEAM MESS 文件无法删除,\n请重新选择。@通知: #ok *0|Call bb!Envi yngo=y
_END
_SUB auto_yndel
IFEX %delta%,MESS 文件已经存在,\n是否删除?@通知: #YN *0 $N
FIND $%YESNO%=YES,Call auto_delfile!Call bb
_END
_SUB a_make
IFEX %delta%,TEAM Envi yngo=n|Call auto_yndel!Envi yngo=y
_END
_SUB bb
IFEX %old%,FDIR RP=%old%!TEAM MESS ▉ 文件不存在,请重新选择! @通知:#ok *0|Call aa
BROW delta,&%RP%\%newfile%.%zkm%,请选择新文件的目录,并输入文件名称:,%zkm%
FIND $%delta%=,!Call a_make
_END
_SUB aa
BROW old,%RP%\%oldfile%.%zkm%,正在自动应用补丁,请选择“%oldfile%.%zkm%”文件,%zkm%
FIND $%old%=,!Call bb
_END
_SUB cc
TEAM MESS ▉ 补丁文件“%new%”不存在,请重新选择! @通知:#ok *0
BROW new,%CurDir%\*.delta,请选择补丁文件所在的目录与名称,delta
FIND $%new%=,!Call aa
_END
_SUB auto_Xdelta
IFEX D:\,Envi RP=D:!Envi RP=%CurDir%
Envi tempph=%temp%\xdelta3_temp.ini
IFEX %tempph%,TEAM LOAD %tempph%|FDIR RP=%old%|Envi old=
Envi new=%deltafile%.delta
IFEX %new%,Call aa!Call cc
FIND $%yngo%=y,Call @windows2
_END
_SUB openset
LOAD %CurDir%\XdeltaAuto.ini
IFEX %deltafile%.delta,Call auto_Xdelta!Call Gui_Xdelta
_END
IFEX %CurDir%\XdeltaAuto.ini,Call openset!Call Gui_Xdelta
Exit
[ 本帖最后由 网虫2008 于 2010-10-20 21:08 编辑 ] |
|