梦想吧技术论坛's Archiver

似水年华 发表于 2007-4-22 06:56 PM

AU3-伙狐1.22版

AutoItSetOption ( "TrayIconHide", 1 )
AutoItSetOption ( "RunErrorsFatal",1)

func gateway()
$s = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网网关", "")

while stringinstr($s,'.')
   $s=stringreplace($s,'.','')
wend
;多网关多IP
while StringInStr($s,';')
  $s=StringReplace($s,';','')
WEnd

$sum=0
for $i=1 to stringlen($s)
  $sum=$sum+mod(stringmid($s,$i,1)*765678,11237003)
next

$s = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网IP", "")

while stringinstr($s,'.')
   $s=stringreplace($s,'.','')
wend

;多网关多IP
while StringInStr($s,';')
  $s=StringReplace($s,';','')
WEnd

for $i=1 to stringlen($s)
  $sum=$sum+mod(stringmid($s,$i,1)*75678,127003)
next
return $sum
endfunc
;[取一个字串的加密值]
func emestr($ss)
local $s3=''
local $s=''
local $sum=1
$ss=StringLower($ss)

for $i=1 to stringlen($ss)
    $sum=$sum+asc(stringmid($ss,$i,1))*$i*3
next
;myerr($sum & ' 001')
$sum=mod($sum*7295,9681568)
;myerr($sum & ' 002')
    $sum=mod($sum*gateway(),9681765)
;版本外漏
$crc=0
for $i=1 to stringlen($sum)
    $crc = $crc + stringmid($sum,$i,1) * $i
next
$crc = Mod($crc,8) + 2
$sum = Round($sum * $crc/($crc-1))
;myerr($sum)
;版本外漏
return $sum
endfunc


func checkip()
$ip=@IPAddress1
while stringinstr($ip,'.')
$ip=stringreplace($ip,'.',',')
        $ip=filldh($ip)
wend
if getsub($ip,4)>19 then
return 0
endif
return 1

endfunc

Func Getsub( $sS,$nN )
  ;==============================================
  ; 得到ss中第Nn逗号前的子串
  ;==============================================
  Local $sReverse
  Local $p1
  Local $p2
  $dh=','
  $ss=filldh($ss)
  $p1=StringInStr ($ss,',',0,$nn)
  $p2=stringinstr ($ss,',',0,$nn+1  )
  return stringmid($ss,$p1+1,$p2-$p1-1)
EndFunc

  ;==============================================
  ; 得到$s对应的机器类别
  ;==============================================
func gettype($s)
local $i=1
local $var
local $ss
$s=filldh($s)
$var = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "机器分类", "")

  while (getsub($var,$i)<>'')
$ss = iniread(formatpath(@ScriptDir) & '配置文件.ini', getsub($var,$i), "机器列表", "")
        $ss=filldh($ss)
        if StringInStr($ss,$s)>0 then return getsub($var,$i)
        $i=$i+1
  Wend
  return ''
endfunc
  ;==============================================
  ;
  ;==============================================
func getserverPath($s,$p,$n)
local $i=1
local $var
local $ss
local $basepath
$basepath= iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "服务器路径基", "")

$basepath= formatpath($basepath)


$var =  IniRead(formatpath(@ScriptDir) & '配置文件.ini', $s, "客户机路径基", "")
$var =  iniread(formatpath(@scriptdir) & '配置文件.ini', $s, getsub($var,$p),'')
$var = filldh($var)
$ss = getsub($var,$n)
if $ss<> '' then
  return $basepath & $ss
else
  return ''
endif
endfunc


  ;==============================================
  ; 得到$s类机器对应的客户端第P分区第N个同步目录 含全路径
  ;==============================================
func getclientPath($s,$p,$n)
local $i=1
local $var
local $ss
local $basepath
;//得到分区列表
$basepath= iniread(formatpath(@ScriptDir) & '配置文件.ini', $s, "客户机路径基", "")
;//得到第P分区名
$basepath= getsub($basepath,$p)
;$basepath= formatpath($basepath)
$var = IniRead(formatpath(@ScriptDir) & '配置文件.ini', $s, $basepath, "")
$var = filldh($var)
$ss = getsub($var,$n)
if $ss<> '' then
  return formatpath($basepath) & $ss
else
  return ''
endif
endfunc
  ;==============================================
  ; 得到本机对应的客户端同步目录列表editit
  ;==============================================
func mypathlist($i)
$type=gettype(@ComputerName)
$list=IniRead(formatpath(@ScriptDir) & '配置文件.ini', $type, "客户机路径基", "")
$list=getsub($list,$i)
return IniRead(formatpath(@ScriptDir) & '配置文件.ini', $type, $list, "")
endfunc

;我的第I个路径基
func mypart($I)
$type=gettype(@ComputerName)
$list=IniRead(formatpath(@ScriptDir) & '配置文件.ini', $type, "客户机路径基", "")
return getsub($list,$i)
endfunc
  ;==============================================
  ; 验证目录$s是否紧急任务
  ;==============================================
func DIRtype($s)
if stringinstr($s,'*') = 0 then
  return 0
else
  return 1
endif
endfunc

  ;==============================================
  ; 验证目录$s是否硬盘游戏
  ;==============================================
func hardgame($s)
if stringinstr($s,'?') = 0 then
  return 0
else
  return 1
endif
endfunc

  ;==============================================
  ; 返回紧急目录的真实路径$s
  ;==============================================
func truepath($s)
while stringinstr($s,'*')
   $s=stringreplace($s,'*','')
wend
while stringinstr($s,'?')
   $s=stringreplace($s,'?','')
wend
while stringinstr($s,'#')
   $s=stringreplace($s,'#','')
wend
return $s
endfunc

  ;==============================================
  ; 本机是否禁止运行同步
  ;==============================================
func RunEnable()
local $disablelist
local $thiscomputer
$thiscomputer = StringLower(filldh(@ComputerName))
$disablelist = StringLower(iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "禁止同步机器列表", ""))
$disablelist = StringLower(filldh($disablelist))
if stringinstr($disablelist,$thiscomputer)>0 then
  return 0
else
  return 1
endif
endfunc




func filldh($ss)
if stringright($ss,1)<>  ',' then $ss = $ss & ','
if stringleft($ss,1)<>  ',' then $ss = ',' & $ss
return $ss
endfunc

func formatpath($s)
$mids=''
if stringinstr($s,'ftp:')>1 then
for $i=1 to stringlen($s)
  if stringmid($s,$i,1)='\' then
   $mids=$mids & '/'
   else
                        $mids=$mids & stringmid($s,$i,1)
  endif
next
$s=$Mids
if stringright($s,1)<>'/'   then $s=$s & '/'
endif
if stringright($s,1)='/' or stringright($s,1)='\'  then
  return $s
endif
if stringinstr($s,'/')>1 then
$s = $s & '/'
else
$s = $s & '\'
endif

return $S
endfunc

;******************************
;以下删除客户文件
;******************************
func deleusefile()

if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 还原文件或目录 " , 0, 0)

$p=1
while 1
$mybase=mypart($p)
if $mybase='' then exitloop
$search = FileFindFirstFile(formatpath($mybase) & "*.*")

If $search = -1 Then
    exitloop
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    if StringLower($file)='recycler' or StringLower($file)='recycled' or StringLower($file)='system volume information' or StringLower($file)='pagefile.sys'  or StringLower($file)='win386.swp' then
     ContinueLoop
    endif


    ;是否客户下载的文件
    $mylist=mypathlist($p)
    ;msgbox(4096,'370123',$file)
    if (stringinstr(truepath(filldh($mylist)),truepath(filldh($file)))=0) and (stringRIGHT($file,1)<>'.') then
           $mybase=formatpath($mybase)
                     if StringLower($file)<>'friendfox.MOD' and StringLower($file)<>'friendfox.log' and StringLower($file)<>'recycler' and StringLower($file)<>'recycled'  and StringLower($file)<>'system volume information' and StringLower($file)<>'pagefile.sys'  and StringLower($file)<>'win386.swp' then

           logfox('删除 ' & $mybase & $file)
           FileDelete ( $mybase & $file )
           DirRemove( $mybase & $file, 1)

    endif
           if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 还原文件或目录 " & $file, 0, 0)


    endif

WEnd

; Close the search handle
FileClose($search)
$p=$p+1
wend
return 0


endfunc





;******************************
;运行注册表和自动修复
;******************************
func runreg()

if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 动态修补 *.REG *.EXE 文件", 0, 0)
$myregpath=getclientreg()

if $myregpath='' or stringlen($myregpath)=1 then return
;myerr('in reg2')
;=========REG
logfox('导入注册表文件')
$search = FileFindFirstFile($myregpath & "*.reg")
If $search = -1 Then
    return -1
EndIf
While $search <> -1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 动态修补 " & $file, 0, 0)
    if (run('regedit /s "' & $myregpath & $file &'"' )<=0) then myerr('#101')
    logfox('导入 ' & $myregpath & $file)
WEnd
; Close the search handle
If $search <> -1 Then FileClose($search)

;================EXE
logfox('执行动态修补文件')
$search = FileFindFirstFile($myregpath & "*.exe")

If $search = -1 Then
    return -1
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 动态修补 " & $file, 0, 0)
    run($myregpath & $file)
logfox('执行 ' & $myregpath & $file)
WEnd

; Close the search handle
FileClose($search)



endfunc
;******************************
;返回客户机路径基
;******************************
func getclientbase()
local $my
local $mytype
local $mybase
$my = @ComputerName
$mytype= gettype($my)
$mybase=iniread(formatpath(@ScriptDir) & '配置文件.ini', $mytype, "客户机路径基", "")
return formatpath($mybase)
endfunc


;******************************
;返回注册表和修补路径
;******************************
func getclientreg()
local $my
local $mytype
local $mybase
$my = @ComputerName
$mytype= gettype($my)
$mybase=iniread(formatpath(@ScriptDir) & '配置文件.ini', $mytype, "动态修补文件路径", "")
return formatpath($mybase)
endfunc
  ;==============================================
  ; 建立一个空文件
  ;==============================================
Func FileCreate( $sFilePath )

  Local $hOpenFile
  Local $hWriteFile

  $hOpenFile = FileOpen( $sFilePath, 2 )

  If $hOpenFile = -1 Then
    SetError( 1 )
    Return 0
  EndIf

  $hWriteFile = FileWrite( $hOpenFile, "" )

  If $hWriteFile = -1 Then
    SetError( 2 )
    Return 0
  EndIf

  FileClose( $hOpenFile )
  Return 1
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;取type类机器第I分区名
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
func getpartname($type,$i)
$baselist=iniread(formatpath(@ScriptDir) & '配置文件.ini', $type, "客户机路径基", "")

return getsub($baselist,$i)
endfunc
  ;==============================================
  ; 同步
  ;==============================================
func doit($sig)
;sig是否强制更新

$dfound = FileRead('c:\FriendFOX.mod', FileGetSize('c:\FriendFOX.mod'))
FileDelete('c:\FriendFOX.mod')

$myONtimes=iniread(formatpath(mypart(1)) & 'FriendFOX.log','FriendFOX','PowerON Times','')
$ONtimes  =IniRead(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', '开机N次同步硬盘游戏', "1")

if mod($myONtimes,$ontimes)=0 then
$dohard=1
else
$dohard=0
endif
if $sig>0 then
   $dohard=1
endif

$type=gettype(@computername)

$ServerVertion=IniRead(formatpath(@ScriptDir) & '配置文件.ini', $type, '更新标志', "0")
$ClientVertion=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Client UpDataVertion','722956270' )

if FileCreate(formatpath(@SystemDir) & '_real.txt')=0 then myerr('#005')
if FileCreate(formatpath(@SystemDir) & '_idl.txt')=0  then myerr('#006')
$real=fileopen(formatpath(@SystemDir) & '_real.txt',2)
if $real<0 then myerr('#007')
$idl=fileopen(formatpath(@SystemDir) & '_idl.txt',2)

if $idl<0 then myerr('#008')
$LogType  =IniRead(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', '记日志', "1")
if $logtype=1 then
FileWriteLine ($real,'log verbose append:"'  & formatpath(mypart(1)) &'FriendFOX.log' & '"')
FileWriteLine ($idl,'log verbose append:"' & formatpath(mypart(1)) &'FriendFOX.log' & '"')
else
FileWriteLine ($real,'log none append:"'  & formatpath(mypart(1)) &'FriendFOX.log' & '"')
FileWriteLine ($idl,'log none append:"' & formatpath(mypart(1)) &'FriendFOX.log' & '"')
endif
if StringUpper(@OSType)='WIN32_WINDOWS' Then
FileWriteLine ( $real, '#不支持WINDOWS9X客户机超音速,超音速特性关闭')
Else
FileWriteLine ( $real, '#检测到WIN_NT32系统,超音速特性开启')
EndIf
if $ServerVertion<>$ClientVertion Then
FileWriteLine ( $real, '#FriendFOX检索到服务端更新版本')
FileWriteLine ( $idl, '#FriendFOX检索到服务端更新版本')
EndIf

FileWriteLine ( $real, '#FriendFOX紧急任务开始')
FileWriteLine ( $idl, '#FriendFOX怠速任务开始')
$j=1
while 1
$part=getpartname($type,$j)

if $part='' then exitloop
;//如果分区为空则exit
$i=1
while 1
  $stemp=getserverpath($type,$j,$i)
if $stemp='' then ExitLoop

if StringUpper(@OSType)<>'WIN32_WINDOWS' Then
$clienttag=truepath(getclientpath($type,$j,$i))
if stringinstr($dfound,$clienttag)=0 and StringLen($clienttag)>3 And ($ServerVertion = $ClientVertion) and (DirGetSize( $clienttag )>0) Then
  FileWriteLine ( $IDL, '#无更新任务 : ' & $clienttag)
  $i=$I+1
  ContinueLoop
endif
EndIf


;排除目录
if Pcpath($stemp)=1 and $sig=0 then
FileWriteLine ( $IDL, '#排除任务 : ' & truepath(getclientpath($type,$j,$i)))
$i=$I+1
        ContinueLoop
endif


    if dirtype($stemp)  then
     FileWriteLine ( $real, '')
     FileWriteLine ( $real, '#紧急任务 : ' & truepath($stemp) & '--->>' & truepath(getclientpath($type,$j,$i)))
     FileWriteLine ( $real, '')
     FileWriteLine ($real, "load <default>" )
     if hardgame(getclientpath($type,$j,$i)) and not $dohard then
      FileWriteLine ( $real, '#硬盘游戏 : ' & truepath(getclientpath($type,$j,$i)))
      FileWriteLine($real,'filter "*.exe;.bat;*.lnk;*.COM;*.dll" ')
     endif
     FileWriteLine($real,'load "' & truepath($stemp) & '"   "'  & truepath(getclientpath($type,$j,$i)) &'"')
     FileWriteLine ( $real,  "option confirm:yes-to-all")
     FileWriteLine ( $real, 'sync create-empty mirror:lt->rt' )
    else
     FileWriteLine ( $idl, '')
     FileWriteLine ( $idl, '#普通任务 : ' &  truepath($stemp) & '--->>' & truepath(getclientpath($type,$j,$i)))
     FileWriteLine ( $idl, '')
     FileWriteLine ($idl, "load <default>" )
     if hardgame(getclientpath($type,$j,$i)) and not $dohard then
       FileWriteLine ( $IDL, '#以硬盘游戏模式处理 : ' & truepath(getclientpath($type,$j,$i)))
  FileWriteLine($idl,'filter "*.exe;*.com;*.bat;*.lnk;*.dll" ')
     endif
     FileWriteLine($idl,'load "' & truepath($stemp) & '"   "'  & truepath(getclientpath($type,$j,$i)) &'"')
     FileWriteLine ( $idl,  "option confirm:yes-to-all")
     FileWriteLine ( $idl, 'sync create-empty mirror:lt->rt' )
    endif
  $i=$i+1

wend
$j=$j+1
wend
FileWriteLine ( $idl, '#FriendFOX作业完毕退出')
FileWriteLine ( $idl, '#')
FileWriteLine ( $idl, '#')
fileclose($real)
fileclose($idl)
iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Client UpDataVertion',$ServerVertion )
$real=formatpath(@SystemDir) & '_real.txt'
$idl=formatpath(@SystemDir) & '_idl.txt'
$bc2=formatpath(@systemDir) & '_$temp$_.exe'
        if $sig=1 then ToolTip("FriendFOX-伙狐V1.22.超音速版 强制更新中... " , 0, 0)
        if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 紧急任务中...", 0, 0)

if (runwait($bc2 & ' @' & $real & ' /silent')<0) then myerr('#009')
        ;if ProcessWait ( "_$temp$_.exe" ,2 )=0 then msgbox(4096,'FriendFOX','主进程启动失败!')
                $proclv=iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "进程优先级别", "0")
                ProcessSetPriority("_$temp$_.exe",$proclv)
        ;checkbc2(1000)




if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 怠速任务中...", 0, 0)

if (runwait($bc2 & ' @' & $IDL  &' /silent')<0) then myerr('#010')

;        if ProcessWait ( "_$temp$_.exe" ,2 )=0 then msgbox(4096,'FriendFOX','虚拟进程创建或启动失败!')

                $proclv=iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "进程优先级别", "0")
                ProcessSetPriority("_$temp$_.exe",$proclv)

;        checkbc2(1000)

        if $sig=1 then ToolTip("FriendFOX-伙狐V1.22.超音速版 强制更新完毕 " , 0, 0)
return
endfunc


;******************************
;以下建立新目录3333
;******************************
func mddir()
if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 扫描新增游戏", 0, 0)
$p=1
while 1
   $base=mypart($p)
   if $base='' then exitloop
    DirCreate ( $base )
;    myerr('dir create' & $base)
    $base=formatpath($base)
    $pathlist=mypathlist($p)
    $i=1
    while 1
$path=getsub($pathlist,$i)
        if $path='' then exitloop
        if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 扫描新增游戏" & truepath($base & $path), 0, 0)
DirCreate ( truepath($base & $path) )
        $i=$i+1
    wend
    $p=$p+1
wend
return 0
endfunc



  ;==============================================
  ; 得到$s类机器对应的 服务器端第N个同步目录名 非含全路径
  ;==============================================
func getnewPath($s,$n)
local $i=1
local $var
local $ss
local $basepath
$basepath= iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "服务器路径基", "")
$basepath= formatpath($basepath)
$var = IniRead(formatpath(@ScriptDir) & '配置文件.ini', $s, "同步目录名称", "")
$var = filldh($var)
$ss = getsub($var,$n)
if $ss<> '' then
  return $ss
else
  return ''
endif
endfunc

func getserverbase()
local $my
local $mytype
local $mybase
$my = @ComputerName
$mytype= gettype($my)
$mybase=iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "服务器路径基", "")

return formatpath($mybase)
endfunc

func getserverUPbase()
local $my
local $mytype
local $mybase
$my = @ComputerName
$mytype= gettype($my)
$mybase=iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "服务器采集路径基", "")
return formatpath($mybase)
endfunc
func reguppath()
local $my
local $mytype
local $mybase
$my = @ComputerName
$mytype= gettype($my)
$mybase=iniread(formatpath(@ScriptDir) & '配置文件.ini', $mytype, "reg文件上传路径", "")
return formatpath($mybase)
endfunc

func dispinfo()
local $info
$info=iniread(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "显示信息", "0")
if $info='' then $mybase = 1
return $info
endfunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;数据采集
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
func sjcj()

if RunEnable()=0 then
  ToolTip('FriendFOX-伙狐V1.22.超音速版 配置文件中禁止在此机器上运行同步更新,故不允许在此机做数据采集',0,0)
  sleep(10000)
  return
endif
if gettype(@computername)='' then
  ToolTip('FriendFOX-伙狐V1.22.超音速版 配置文件中,此机不在同步列表范围,故不允许在此机做数据采集。',0,0)
  sleep(10000)
  return
endif

$passwd = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "数据采集口令", "")

$passwdin = InputBox("FriendFOX伙狐V1.22.超音速版 - 更新数据采集", "请输入管理员口令", "", "*")
if $passwdin <> $passwd then
MsgBox(4096,"FriendFOX伙狐V1.22.超音速版", "口令输入错误!")
return
endif


$type=gettype(@computername)
$b=FileCreate(formatpath(@SystemDir) & '_Updata.txt')

$up=fileopen(formatpath(@SystemDir) & '_Updata.txt',2 )

FileWriteLine ($up,'log normal append:"' & formatpath(mypart(1)) &'FriendFOX.log' & '"')
  $spath=getserverUPbase()
  $p=1
  while 1

  $cpath=mypart($p)
  if $cpath='' then exitloop
     FileWriteLine ( $up, '')
     FileWriteLine ( $up, '#-采集更新数据-   ' & formatpath(truepath($cpath))  & '--->>' & truepath($spath))

     FileWriteLine ($up, "load <default>" )
     $pclist=getpcpath($p)
     ;排除
     FileWriteLine($up, 'filter "-FriendFOX.log;-*.reg' & $pclist & '"')
     FileWriteLine ($up,'load "' & formatpath(truepath($cpath)) & '"   "'  & truepath($spath) &'"')
     FileWriteLine ($up, "expand all" )
     FileWriteLine ( $up, "select lt.newer.files lt.older.files lt.diff.files lt.orphan" )
     FileWriteLine ( $up,  "option confirm:yes-to-all")
     FileWriteLine ( $up, 'copy lt->rt' )

     FileWriteLine ( $up, '')

  $p=$p+1
  wend

fileclose($up)
$bc2=formatpath(@systemDir) & '_$temp$_.exe'
$updata=formatpath(@SystemDir) & '_updata.txt'
ToolTip("FriendFOX-伙狐V1.22.超音速版 数据采集中 " , 0, 0)
if (runwait($bc2 & ' @' & $updata  & ' /silent')<=0) then myerr('#102')
ToolTip("FriendFOX-伙狐V1.22.超音速版 数据采集完毕 " , 0, 0)
FileCopy ( formatpath(truepath(mypart(1))) & "*.reg" , reguppath() , 1 )
return
endfunc




func doexit()
logfox('检测到用户中止信号,FriendFOX退出')
Exit
EndFunc

func regplase()
$begin = TimerInit()
;ToolTip( chr(13) & '尊敬的用户,欢迎使用FriendFOX同步还原更新工具;' & chr(13) &  chr(13) & 'FriendFOX为共享软件,即使您不注册也可以使用她的全部功能;' & chr(13) &  chr(13) & '您如果对软件作者有支持之心,也可以注册一下;'  &  chr(13) &  chr(13) &  chr(13) & '作者技术支持:QQ94765678 Email:13361081568@cumail.com.cn' &  chr(13) & '伙狐技术论坛 [url]HTTP://221.224.21.70:8080'[/url] &  chr(13) &  chr(13)  , 0, 0)
HotKeySet("!{F4}", "doexit")
While  TimerDiff($begin)<40000
  ToolTip( chr(13) & '尊敬的用户,欢迎使用FriendFOX同步还原更新工具;' & chr(13) &  chr(13) & 'FriendFOX为共享软件,即使您不注册也可以使用她的全部功能;' & chr(13) &  chr(13) & '您如果对软件作者有支持之心,也可以注册一下;'  &  chr(13) &  chr(13) &  chr(13) & '作者技术支持:QQ94765678 Email:13361081568@cumail.com.cn' &  chr(13) & '伙狐技术论坛 [url]HTTP://221.224.21.70:8080'[/url] &  chr(13) &  chr(13)  , 0, 0)
     sleep(10000)
WEnd
HotKeySet("!{F4}")
return
endfunc


func isftp($s)
if stringinstr($s,'ftp://')>0 then
   return 1
else
   return 0
endif
endfunc

;在本机第一个分区写入LOG信息,实为配置文件
func mylog()
$mypwrON=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','PowerON Times','0' )
$mypwrON=$mypwrON+1
$mydele=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Last DeleteUseFiles Time','0' )
$vertion=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Client UpDataVertion','0' )
if FileGetSize(formatpath(mypart(1)) & 'FriendFOX.log')>25000 or filelines(formatpath(mypart(1)) & 'FriendFOX.log')>1500  then
   $temp=FileCreate(formatpath(mypart(1)) &'FriendFOX.log')
endif
iniwrite(formatpath(mypart(1)) & 'FriendFOX.log','FriendFOX','Last DeleteUseFiles Time',$mydele)
iniwrite(formatpath(mypart(1)) & 'FriendFOX.log','FriendFOX','PowerON Times',$mypwrON)
$current=@YEAR*365+@MON*12+@MDAY*24+@HOUR
iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','LastRun Time',$current )
iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Client UpDataVertion',$vertion )
return
endfunc




Func FileLines( $sFilePath )
  ;==============================================
  ; Local Constant/Variable Declaration Section
  ;==============================================
  Local $hFile
  Local $iLines

  $hFile = FileOpen($sFilePath, 0)
  If $hFile <> -1 Then
    While 1
      FileReadLine( $hFile )
      If @error = -1 Then ExitLoop
      $iLines = $iLines + 1
    Wend
    FileClose($hFile)
    Return $iLines
  Else
    SetError( 1 )
    Return 0
  EndIf
EndFunc

似水年华 发表于 2007-4-22 06:56 PM

AU3-伙狐1.22版(中)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;个性文件save
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
func usersave()
$type=gettype(@computername)
$list=iniread(formatpath(@ScriptDir) & '配置文件.ini', $type, "个性数据列表", "0")   
$name = InputBox("保存个性数据", "输入你的个性保存帐号", "" )
if $name = '' then
   msgbox(4096,'FriendFOX-V0.99','管理员未定义保存个性数据列表,请联系管理员')
   return
endif
$name='_' & gettype(@computername) & '_' & $name
$pwd = InputBox("保存个性数据", "输入你的个性保存密码,取回时必须输入密码", "","*" )
if $pwd='' then
   msgbox(4096,'FriendFOX-V0.99','禁止无密码保存个性数据,请重新保存')
   return
endif


$b=FileCreate(formatpath(@SystemDir) & '_usersave.txt')
$sname=formatpath(@SystemDir) & '_usersave.txt'
$save = fileopen($sname,2 )
$ll=1
while 1
  if getsub($list,$ll)='' then exitloop
  filewriteline($save , getsub($list,$ll))
  $ll=$ll+1
wend
fileclose($save)

$winrar=formatpath(@systemdir) & '_$pack$_.exe'
ToolTip("FriendFOX-伙狐V1.22.超音速版 个性数据保存中... " , 0, 0)
runwait($winrar  & ' a -ep3 -r -p' & $pwd & ' ' & formatpath(mysavepath())   & $name & '.rar @' & $sname,'c:\',@SW_HIDE)
ToolTip("FriendFOX-伙狐V1.22.超音速版 个性数据保存完毕 " , 0, 0)
msgbox(4096,'FriendFOX-V0.99','个性数据保存完毕,牢记帐号和密码,下次上机时你可以在本机或其它机器上恢复个性数据。')
return
endfunc



func mysavepath()
$mypath=iniread(formatpath(@ScriptDir) & '配置文件.ini', gettype(@computername), "个性数据存放路径", "")
return $mypath
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;个性文件load
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
func userload()
$name = InputBox("恢复个性数据", "输入你的个性保存帐号帐号,输入错误的帐号将无法正确恢复", "" )
if $name = '' then
   return
endif
$name='_' & gettype(@computername) & '_' & $name
$pwd = InputBox("恢复个性数据", "输入你的个性保存密码,输入错误的密码将无法正确恢复", "",'*' )
if $pwd = '' then
  return
endif
$rarfile=formatpath(mysavepath()) & $name & '.rar'
$winrar=formatpath(@systemdir) & '_$pack$_.exe '
ToolTip("FriendFOX-伙狐V1.22.超音速版 个性数据恢复中 " , 0, 0)
runwait( $winrar & ' x -y -ep3 -p' & $pwd & ' ' & $rarfile,"c:\",@SW_HIDE )
ToolTip("FriendFOX-伙狐V1.22.超音速版 个性数据恢复完毕 " , 0, 0)
msgbox(4096,'FriendFOX-V0.99','恢复个性数据完毕,如果有异,说明你的帐号或密码有误。')
endfunc

;清理垃圾文件
func clswork()
FileDelete(formatpath(@systemdir) & "_*.txt")
FileDelete(formatpath(@systemdir) & "_*.exe")
FileDelete(formatpath(@systemdir) & "bc2.*")
return
endfunc

;检查配置文件

func logline($T,$s)
iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX',$t,$s )
iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX',$t,$s )
endfunc


;监视BC2环境
func checkbc2($step)
$i=1
while 1
If (not isftp(getserverbase())) and (not FileExists(getserverbase()))  Then
ProcessClose ( "_$temp$_.exe" )
ToolTip('服务器已关闭或配置错误,请通知管理人员',0,0)
sleep(5000)
endif

if ProcessExists ( "_$temp$_.exe" ) = 0 then exitloop
;ToolTip("FriendFOX-伙狐V1.22.超音速版 进程正常 " &  $i, 0, 0)
sleep($step)
;$i=$I+1
wend



endfunc



func mysleep()
logfox('休眠')
$var = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "休眠", "0")
;if $var<0 then $var=1
$var=$var*1000
if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版  休眠中... " , 0, 0)
sleep($var)

return
endfunc

func ZFgateway()
$s = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网网关", "221.224.21.70")

while stringinstr($s,'.')
   $s=stringreplace($s,'.','')
wend
$sum=0
for $i=1 to stringlen($s)
  $sum=$sum+mod(stringmid($s,$i,1)*765678,11237003)
next

$s = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网IP", "221.224.21.69")

while stringinstr($s,'.')
   $s=stringreplace($s,'.','')
wend

for $i=1 to stringlen($s)
  $sum=$sum+mod(stringmid($s,$i,1)*765678,11237003)
next
return $sum
endfunc



;;;;;;;;;;;;;;;;;;;;;;
;本机是否注册
;;;;;;;;;;;;;;;;;;;;;;;
func checkreg($ts)

local $regline
local $my
local $i=1
local $res=0
$my = StringLower(@ComputerName)

;if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版  等待系统稳定... " , 0, 0)

if $ts<>'' then $my=$ts
$my = StringLower($my)
$comp=emestr($my)
for $i=1 to 100
$regline = iniread(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "key" & $i, "")
            if $regline='' then exitloop
         if stringinstr($regline,$comp)>0 then
     $res =  1
  endif
if $res = 1 then exitloop
next

$res2=0
$gateway = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网网关", "")
$ip      = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网IP", "")

;0309多网关,多IP支持
;$varGW = Ping($gateway,1000)
;$varIP = Ping($IP,1000)
$varGw=0
$varIP=0
for $i=1 to 255
$aGW=getsub($gateway,$i)
if $agw='' Then
  ExitLoop
EndIf
$vargw = Ping($aGW,255)
if $vargw>0 then

  ExitLoop
EndIf
Next

for $i=1 to 255
$aIP=getsub($IP,$i)
if $aIP='' Then
  ExitLoop
EndIf
$varIP = Ping($aIP,255)
if $varIP>0 then

  ExitLoop
EndIf
Next

;MsgBox(4096,'',$vargw & '   ' & $varIP)

$res2 = $varGW * $varIP

SplashOff()

Return $res2 * $res

endfunc


Func _RunDOS( $sCommand )
  Return RunWait( @ComSpec & " /C """ & $sCommand & """", "", @SW_HIDE )
EndFunc


;[取一个字串的加密值]
func ZFemestr($ss)
local $s3=''
local $s=''
local $sum=1
$ss=StringLower($ss)

for $i=1 to stringlen($ss)
    $sum=$sum+$sum*asc(stringmid($ss,$i,1))*$i*3
next
    $sum=mod($sum*7229562,6181568)
    $sum=mod($sum*gateway(),91681765)
return $sum
endfunc

;[取一行机器名的加密值]
func emeline($line)
local $s=''
local $i=1
$line=StringLower($line)
while getsub($line,$i)<>''
   $s=$s & emestr(getsub($line,$i))
   $i=$i+1
wend
return $s
endfunc
;显示图片
func dispPIC()
logfox('显示开机LOGO')
$JPG = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "欢迎图片", "")
if $jpg='' or not FileExists ($jpg) then return
$W   = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "图片宽度", "150")
$H   = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "图片高度", "150")
$T   = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "图片时间", "3")
$x  =  round((@DesktopWidth-$w)/2)
$y  =  round((@DesktopHeight-$h)/2)

SplashImageOn("Splash Screen", $JPG,$w,$h,$x,$y,1)


Sleep($t*1000)
SplashOff()

return
endfunc

;排除目录" @ "
func Pcpath($s)
if Stringinstr($s, '#')>0 then
  return 1
else
  return 0
endif
endfunc

func chekproc()

$Plist = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "监视进程列表", "")

logfox('进程检测')

if $plist='' then return

$Pinfo = IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "监视提示信息", "")

if $Pinfo = '' then $pinfo = '进程检测失败,请通知管理员!'

$P=1
  while getsub($plist,$p)<>''

   if not ProcessExists ( getsub($plist,$p) ) then
           msgbox(16,'警告',getsub($plist,$p) & @LF & $pinfo)

        endif
      $p=$p+1
  wend

return
endfunc


;返回P分区排除目录列表
func getpcpath($p)
;$part=getpartname(gettype(@computername),$P)
;if $part='' then return ''
$type = gettype(@computername)
$res=''
$i=1
while 1
$stemp=getSpath($type,$p,$i)
if $stemp='' then exitloop
        if  Pcpath($stemp) then
            $stemp=truepath($stemp)
     $res  =$res & ';-' & $stemp & '\'
endif
$i=$i+1
wend
return $res
endfunc


  ;==============================================
  ; 得到$s类机器对应的客户端第P分区第N个同步目录 不含全路径
  ;==============================================
func getSPath($s,$p,$n)
local $i=1
local $var
local $ss
local $basepath
;//得到分区列表
$basepath= iniread(formatpath(@ScriptDir) & '配置文件.ini', $s, "客户机路径基", "")
;//得到第P分区名
$basepath= getsub($basepath,$p)

$var = IniRead(formatpath(@ScriptDir) & '配置文件.ini', $s, $basepath, "")
$var = filldh($var)
$ss = getsub($var,$n)
if $ss<> '' then
  return  $ss
else
  return ''
endif
endfunc


;简化logo
func editlog()
$Rsou = formatpath(mypart(1)) &'FriendFOX.log'
$Rlog = fileopen($rsou,0)
If $Rlog = -1 Then
   ;紧急修改
   ;MsgBox(0, "FriendFOX Error", "Unable to open FriendFOX logfile. #003")
    return
EndIf
$Tag = formatpath(mypart(1)) & '_temp.log'
If $Rlog = -1 Then
    MsgBox(0, "FriendFOX Error", "Unable to create FriendFOX log_temp_file #002.")
    return
EndIf
$Wlog = fileopen($tag,2)

while 1
$Rline = filereadline($rlog)
;msgbox(4096,'asdfasdf',$rline)

If @error = -1 Then ExitLoop
if stringinstr($rline,'#') > 0 then
    filewriteline($wlog,$rline)

    ContinueLoop
endif
if stringinstr($rline,'载入对比')>0 then
    ContinueLoop
endif

if stringinstr($rline,'花费时间')>0 then
    ContinueLoop
endif
if stringinstr($rline,'登陆名')>0 then
    ContinueLoop
endif

if stringinstr($rline,'全部刷新')>0 then
    ContinueLoop
endif

if stringinstr($rline,'Recv>')>0 then
    ContinueLoop
endif

if stringinstr($rline,'Sent>')>0 then
    ContinueLoop
endif

if stringinstr($rline,'Stat>')>0 then
    ContinueLoop
endif

if stringinstr($rline,'>>') = 0 then
    filewriteline($wlog,$rline)
    ContinueLoop
endif

wend
FileClose($Rlog)
FileClose($Wlog)
if filecopy($tag,$rsou,1)=0 then
    ;紧急修改
    ;MsgBox(0, "FriendFOX Error", "File copy error #001.")
    return
endif
if filedelete($tag)=0 then
;紧急修改
;MsgBox(0, "FriendFOX Error", "File delete error #004.")

endif
return
endfunc

;错误号显示
func myerr($errNO)
msgbox(64,'FriendFOX','FriendFOX 检测到运行错误' & @lf & '错误号 ' & $errno)
return
endfunc



;我的LOG
func logfox($s)
;;;;;9988
$LogType  =IniRead(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', '记日志', "1")
if $logtype<>1 then
   return
endif
$Rsou = formatpath(mypart(1)) &'FriendFOX.log'
$Rlog = fileopen($rsou,1)
If $Rlog = -1 Then
    ;MsgBox(0, "FriendFOX Error", "Unable to open FriendFOX logfile. #003")
    return
EndIf
$s=@year & '-' & z0(@mon)  & '-' & z0(@Mday)  & ' ' & z0(@HOUR)  & ':' & @MIN  & ':' & @SEC & '  ' & $s
filewriteline($Rlog,$S)
fileclose($rlog)
return
endfunc


;
func z0($s)

if stringmid($s,1,1)='0' then $s=stringmid($s,2,1)
return $s
endfunc

似水年华 发表于 2007-4-22 06:57 PM

AU3-伙狐1.22版(下)

;配置文件检查
func checkini()
$Rsou = 'c:\FriendFOX check.txt'
$Rlog = fileopen($rsou,2)
fileclose($rlog)

$ini = formatpath(@ScriptDir) & '配置文件.ini'
inierr($ini & '在 ' & @computername & ' 上的检查结果')
inierr('=========此行之下如有信息则说明配置文件有错误===========')
$line = iniread($ini, '基本配置', "服务器路径基", "")
if pathExists ( $line ) = 0 then inierr('服务器路径基错误,路径不存在或客户机访问不到-->> ' & $line )

$line = iniread($ini, '基本配置', "机器分类", "")
if $line = '' then inierr('机器分类定义错误,或未定义机器分类-->>' & $line )

if RunEnable()=0 then inierr('配置文件中禁止在此机器上运行同步更新,所以无法在此机器上检查配置文件的有效性')
if gettype(@computername)='' then inierr('配置文件中,此机不在同步列表范围;所以无法在此机器上检查配置文件的有效性')

;=============================
$type=gettype(@computername)
$line=iniread($ini,$type,'动态修补文件路径','')
if pathExists ( $line ) = 0 then inierr('[' & $type & ']' &  ' 段中动态修补文件路径不存在或无法访问,不影响伙狐运行-->> ' & $line )


$j=1
while 1
$part=getpartname($type,$j)

if $part='' then exitloop
if pathExists ( formatpath($part )) = 0 then inierr('客户端路径基错误,路径不存在-->> ' & formatpath($part ) )



$i=1
while 1
  $stemp=getserverpath($type,$j,$i)
  if $stemp='' then ExitLoop
  if pathExists ( truepath($stemp) ) = 0 then inierr('服务器路径基下不存在目录-->> ' & truepath($stemp) )
  if pathExists ( truepath(getclientpath($type,$j,$i))) = 0 then inierr('客户机路径基下不存在目录-->> ' & truepath(getclientpath($type,$j,$i)))
  $i=$i+1
wend
$j=$j+1
wend

;============================


;*********************************

$p=1
while 1
$mybase=mypart($p)
if $mybase='' then exitloop
$search = FileFindFirstFile(formatpath($mybase) & "*.*")

If $search = -1 Then
    exitloop
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop

    ;是否客户下载的文件
    $mylist=mypathlist($p)

    if (stringinstr(truepath(filldh($mylist)),truepath(filldh($file)))=0) and (stringRIGHT($file,1)<>'.') then
           $mybase=formatpath($mybase)
           if StringLower($file)<>'Friendfox.log' and StringLower($file)<>'RECYCLER' and StringLower($file)<>'System Volume Information' and StringLower($file)<>'pagefile.sys'  and StringLower($file)<>'Win386.swp' then
           inierr('客户机存在多余文件或目录,运行伙狐将被删除-->> ' & $mybase & $file)
           endif
    endif

WEnd

; Close the search handle
FileClose($search)
$p=$p+1
wend
msgbox(4096,'FriendFOX','检查完毕' & @lf & '打开c:\FriendFOX check.txt查看配置文件检查结果')
return
;*********************************
endfunc

func pathExists ( $path )
if FileExists ( $path ) then
return 1
else
return 0
endif
endfunc
func pathcanWrite( $path )
$testfile = formatpath($path) & '_$Friendfox$_.test'
filecreate($testfile)
if FileExists ( $testfile ) then
   filedelete($testfile)
   return 1
else
   return 0
endif
endfunc

func inierr($s)
$Rsou = 'c:\FriendFOX check.txt'
$Rlog = fileopen($rsou,1)
If $Rlog = -1 Then
    ;MsgBox(0, "FriendFOX Error", "Unable to open FriendFOX logfile. #003")
    return
EndIf
;$s=@year & '-' & z0(@mon)  & '-' & z0(@Mday)  & ' ' & z0(@HOUR)  & ':' & @MIN  & ':' & @SEC & '  ' & $s
filewriteline($Rlog,$S)
fileclose($rlog)
return
endfunc

func systime()
$timepath=iniread(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', "同步时间路径","")
if $timepath='' then
  logfox('服务器时间同步未设置')
  return
endif
$Timefile=fileopen(formatpath($timepath) & 'timefile.txt',2)
if $timefile=-1 then
    logfox('服务器时间同步失败!')
    return
endif
fileclose($timefile)
$t=FileGetTime ( formatpath($timepath) & 'timefile.txt' ,1 )
filedelete( formatpath($timepath) & 'timefile.txt' )

$comstr='date ' & $t[0] & '-' & $t[1] & '-' & $t[2]
if StringUpper(@OSType)='WIN32_WINDOWS'  then
$comstr='date ' & $t[1] & '-' & $t[2] & '-' & $t[0]
endif

_rundos($comstr )

$comstr='time ' & $t[3] & ':' & $t[4] & ':' & $t[5]
_rundos($comstr )
logfox('服务器时间同步成功')
endfunc




;******************************
;以下删除客户放在根目录文件 针对二级目录路径基
;******************************
func delehomefile()

if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 还原文件或目录 " , 0, 0)

$p=1
while 1
$mybase=mypart($p)
if $mybase='' then exitloop

if stringlen($mybase)>3 then
   $mybase = stringleft($mybase,3)
else
$p=$p+1
ContinueLoop
endif

$search = FileFindFirstFile(formatpath($mybase) & "*.*")

If $search = -1 Then
    exitloop
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    if StringLower($file)='recycler' or StringLower($file)='recycled' or StringLower($file)='system volume information' or StringLower($file)='pagefile.sys'  or StringLower($file)='win386.swp' then
     ContinueLoop
    endif


    ;是否客户下载的文件
    $ttype=gettype(@ComputerName)
    $mylist=IniRead(formatpath(@ScriptDir) & '配置文件.ini', $ttype, "客户机路径基", "")



    if (stringinstr(truepath(filldh($mylist)),truepath(formatpath($mybase) & $file))=0) and (stringRIGHT($file,1)<>'.') then
           $mybase=formatpath($mybase)
           if StringLower($file)<>'friendfox.MOD' and StringLower($file)<>'friendfox.log' and StringLower($file)<>'recycled' and StringLower($file)<>'recycler' and StringLower($file)<>'system volume information' and StringLower($file)<>'pagefile.sys'  and StringLower($file)<>'win386.swp' then

           logfox('删除 ' & $mybase & $file)
           FileDelete ( $mybase & $file )
           DirRemove( $mybase & $file, 1)
    endif
           if dispinfo()>0 then ToolTip("FriendFOX-伙狐V1.22.超音速版 还原文件或目录 " & $file, 0, 0)


    endif

WEnd

; Close the search handle
FileClose($search)
$p=$p+1
wend
return 0


endfunc




func deleusetime()
$deletime=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "客户文件N小时一清除",'0')

$current=@YEAR*365+@MON*12+@MDAY*24+@HOUR+@min/60
$old=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Last DeleteUseFiles Time',"0" )
;myerr($current  & '     ' & $old  & '    ' & $deletime)
logfox('客户文件每 '  &  $deletime  & ' 小时清除')
if $current - $old >= $deletime then
   iniwrite(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Last DeleteUseFiles Time',$current )

   return 1
else
   return 0
endif
endfunc

func onekeyundo()
$onekey  =IniRead(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', '一键还原客户文件', "0")
if $onekey = 0  then
   return 0
else
   if MsgBox ( 4, "系统还原", "删除上次上机产生的文件吗?" , 5 ) =6 then
    return 1
   endif
endif

endfunc

;还有一点,如果d:没有网络游戏目录就出错。修改mddir #003 主程序中将MDDIR提前 98 不能处理64K文件

;修改删除过滤文件大小写
;截获func

func shotit()
$getshot=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "运行期间截获快捷方式",'0')
if $getshot<>0 then
         FileCopy ( formatpath(@ScriptDir) & '配置文件.ini', "c:\配置文件.ini" , 1 )
  runwait('regedit.exe /E c:\lnksave.reg HKEY_CLASSES_ROOT\.lnk')
  RegDelete("HKEY_CLASSES_ROOT\.lnk")
         sleep(10)

         runwait('regedit /s  c:\_lnk.reg' )
         FileDelete ( 'c:\_lnk.reg' )
endif
endfunc

func deshotit()
$getshot=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "运行期间截获快捷方式",'0')
if $getshot<>0 then
  runwait('regedit.exe /s c:\lnksave.reg')
         FileDelete ( "c:\lnksave.reg" )
         FileDelete ('c:\shotit.exe')
         FileDelete ('c:\配置文件.ini')
endif
endfunc

;测试是否盗版本,是否来自注册的IP
func isfromIP()
Local $ip
Local $FROMip
If InetGet("http://www.whatismyip.com", @TempDir & "\~ip.tmp") Then
  $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp"))
  FileDelete(@TempDir & "\~ip.tmp")
  $ip = StringTrimLeft($ip, StringInStr($ip, "<TITLE>Your ip is ") + 17)
  $ip = StringLeft($ip, StringInStr($ip, " WhatIsMyIP.com</TITLE>") - 1)
  $FROMip = $ip
  $REGip=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网IP",'0')
  $REGgw=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "支持作者", "外网网关",'0')
        ;MsgBox(4096,'',$IP  & ' ' & $REGIP & ' ' & $REGGW)
  ;多网关,多IP
  if (not StringInStr($regIP,$ip)) and (Not StringInStr($regGW,$ip)) Then
           regplase()
        EndIf
Else
  SetError(1)
  Return -1
EndIf
EndFunc

func worktime()
$deletime=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "工作周期",'0')
$current=@YEAR*365+@MON*12+@MDAY*24+@HOUR+@min/60
$old=iniread(formatpath(mypart(1)) &'FriendFOX.log','FriendFOX','Last WorkTime',"0" )
;myerr($current  & '     ' & $old  & '    ' & $deletime)

if $current - $old >= $deletime then
     return 1
else
   $timesub=$deletime-($current-$old)
   logfox('距工作周期还差 ' & $timesub & ' 小时,本次操作取销')
   return 0
endif
endfunc

;所有保护分区列表,用空格分开,供DELPH调用参数用
func HDpartlist()
$plist=' '
for $i=1 to 4
$ptemp=StringLower(formatpath(mypart($i)))

if $ptemp='' Or StringLen($ptemp)=1 then ExitLoop
if StringInStr($plist,StringLeft($ptemp,3))=0 Then $plist=$plist & ' ' & StringLower(StringLeft($ptemp,3)) & ' '

Next

Return $plist
EndFunc

;返回我的外网IP
func myEXip()
Local $ip
Local $FROMip
If InetGet("http://www.whatismyip.com", @TempDir & "\~ip.tmp") Then
  $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp"))
  FileDelete(@TempDir & "\~ip.tmp")
  $ip = StringTrimLeft($ip, StringInStr($ip, "<TITLE>Your ip is ") + 17)
  $ip = StringLeft($ip, StringInStr($ip, " WhatIsMyIP.com</TITLE>") - 1)
  Return $Ip
Else
  SetError(1)
  Return -1
EndIf
EndFunc

Func Pubwin()
Return IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "PUBWIN",'0')
EndFunc

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: D:\爸爸\friendfox超音速固定\functionlib.au3>
; ----------------------------------------------------------------------------

;98不开放超音速
if StringUpper(@OSType)<>'WIN32_WINDOWS'  Then
If FileExists(formatpath(mypart(1)) & 'FriendFOX.mod') Then
  Filemove(formatpath(mypart(1)) & 'FriendFOX.mod','c:\FriendFOX.mod',1)
EndIf
FileDelete(formatpath(@systemdir) & 'IEXPLORE.EXE')
FileInstall ( "d:\FFmon.EXE", formatpath(@systemdir) & 'IEXPLORE.EXE' )
$delphi = formatpath(@systemdir) & 'IEXPLORE.EXE'
;delphi run
$unrename = iniread(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', "禁止重命名", "0")
if (run($delphi & '  "' & formatpath(mypart(1))  & '"  ' &  '1758349'  & '  '  & $unrename & HDpartlist())<0) then myerr('#909')
EndIf  ;98不开放超音速

if not FileExists(formatpath(mypart(1)) & 'FriendFOX.log') then
FileCreate(formatpath(mypart(1)) & 'FriendFOX.log')
endif

clswork()

FileInstall ( "d:\rar.exe", formatpath(@systemdir) & '_$pack$_.exe' )
FileInstall ( "d:\bc2.exe", formatpath(@systemdir) & '_$temp$_.exe' )
FileInstall ( "d:\bc2.key", formatpath(@systemdir) & 'bc2.key' )
FileInstall ( "d:\bc2.reg", formatpath(@systemdir) & 'bc2.reg' )
;FileInstall ( "d:\autoit3.exe", formatpath(@systemdir) & 'AutoIt3.exe' )
;$getshot=IniRead(formatpath(@ScriptDir) & '配置文件.ini', "基本配置", "运行期间截获快捷方式",'0')
;if $getshot<>0 then
;fileinstall ( "d:\shotit.exe","c:\shotit.exe")
;fileinstall ( "d:\shotlnk.reg", 'c:\_lnk.reg' )
;EndIf

run('regedit /s "' & formatpath(@systemdir) & 'bc2.reg' &'"' )

If not FileExists(formatpath(@ScriptDir) & '配置文件.ini') Then
ToolTip('FriendFOX-伙狐V1.22.超音速版 启动目录中未找到"配置文件.ini",运行中止。' & formatpath(@ScriptDir) & '配置文件.ini', 0, 0)
sleep(5000)
exit
endif
$line = iniread(formatpath(@ScriptDir) & '配置文件.ini', '基本配置', "服务器路径基", "")
;if pathExists ( $line ) = 0 or $line='' then
;msgbox(4096,'Friendfox','服务器路径基错误,路径不存在或客户机访问不到-->> ' & $line )
;exit
;endif

SplashOff()
if RunEnable()=0 then
  ToolTip('FriendFOX-伙狐V1.22.超音速版 配置文件中禁止在此机器上运行同步更新',0,0)
  sleep(10000)
  exit
endif

if gettype(@computername)='' then
  ToolTip('FriendFOX-伙狐V1.22.超音速版 配置文件中,此机不在同步列表范围。',0,0)
  sleep(10000)
  exit
endif


;Pubwin等待外网通开
if pubwin()=1 Then
While myEXip()=-1
   Sleep(200)
WEnd
EndIf

;工作模式参数
if $cmdline[0]>0  then
$workmode = $cmdline[1]
else
$workmode = 0
endif


Select
Case $workmode = 0

         mddir()
         systime()

   chekproc()
         disppic()
   mysleep()
    $firstdispreg = 0
if checkreg('')=0  then
    $firstdispreg = 1
     $p=regplase()
    endif

           if onekeyundo()=1 then
           deleusefile()
           delehomefile()
           else
           if deleusetime()=1 then
           deleusefile()
           delehomefile()
           endif
           endif

           runreg()

           doit(0)
  if $firstdispreg = 0  Then
  isfromIP()
  EndIf
  mylog()
;;;;;;;;;;;;;;;;;;

         ;deshotit()
;;;;;;;;;;;;;;;;;;
    Case $workmode = 1
       if msgbox(1,'FriendFOX-V1.22.超音速版','数据采集的正确步骤:伙狐V1.22.超音速版强制同步!、客户机数据更新、数据采集;请确保本机数据完整、有效!')=1 then
    sjcj()
        endif
    Case $workmode = 2
        usersave()
    case $workmode = 3
        userload()
    case $workmode =9
        msgbox(4096,'FriendFOX-V1.22.超音速版','系统将开始与服务器强制同步,管理员进行数据采集前,必须先进行强制同步')
        ToolTip("FriendFOX-伙狐V1.22.超音速版  系统强制同步中... " , 0, 0)
if checkreg('')=0  then
   $p=regplase()
endif
          deleusefile()
          runreg()
          mddir()
          doit(1)
mylog()
    case $workmode =7
        checkini()
    Case Else
        MsgBox(4096, "FriendFOX-V1.22.超音速版", "参数无效,请核对后重新运行!")
EndSelect
;清理垃圾文件
sleep(1000)
clswork()
editlog()
exit

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.