找回密碼
 立即注册

CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閱讀模式

3 ?5 W( w2 a7 y: t! M7 s, K8 J
  1. / RevApp.cpp : Defines the class behaviors for the application.
    6 [$ C4 w9 j. {; C2 P
  2. //
    2 F! O/ j+ a+ ~; `$ s
  3. 7 g3 |! I+ u# U" A( u' L
  4. #include "stdafx.h"; @7 I0 V# u. H1 q( O1 d1 G' b

  5. ( [9 H2 W' _* l4 D8 O& j
  6. //#define UNICODE
    % D$ N8 N8 ]% y  C- V; H
  7. //#include <gdiplus.h>
    5 b; e# h/ s7 y* b' W
  8. //using namespace Gdiplus;- ]* N# a$ |1 L9 ~: y
  9. 8 p5 O5 r% S4 [5 k* Q8 I( o2 @
  10. #include "RevApp.h"% D* T/ ^( y& K; a
  11. #include "RevAppDlg.h"8 g2 w, c7 Q% O9 `# ~6 W
  12. ( |; t3 v1 q& @8 z/ F0 o
  13. #pragma warning(disable:4786)5 x' x' \3 T( u
  14. #include <map>
    / K& r* S8 k3 N- n6 P
  15. #include <list>
    - Q$ L2 k- J4 N( q+ Y! C
  16. #include <direct.h>
    & U' p: X' R. G, T& k" J" D

  17. , a  k- y* {% N) s
  18. #ifdef _DEBUG
    % O2 J, F+ j7 Y9 R: J, ]! ]
  19. #define new DEBUG_NEW
    7 M9 ]) E/ j+ W% I
  20. #undef THIS_FILE
    1 _: r2 I4 e6 t, A9 i
  21. static char THIS_FILE[] = __FILE__;
    & s1 D; x* x& C7 ]+ f
  22. #endif
    * D. Y) ]2 p  h: V5 ]; S& G0 s. R
  23. #include "SkinResDef.h"0 s% m2 T% S( f8 ^8 ~
  24. #include "ChangeBG.h", n2 ^0 M, ^+ _( @
  25. #include "AFXINET.H"
    7 V/ W: J' `& L
  26. " j9 H% Z8 R, ^1 |1 `6 I* M
  27. #define TRADITIONAL_CHINESE 0
    ) k0 V4 x3 y2 w5 p( D0 d7 _
  28. #define SIMPLIFY_CHINESE 1- S% i8 J/ F( t6 `. _
  29. #define ENGLISH 25 w4 y- f* V- Y
  30. int m_iLanguage = ENGLISH;
    ' s  h( Y0 t2 s! i/ L
  31. /////////////////////////////////////////////////////////////////////////////
    ; \0 ?7 D) E2 |, }
  32. // CRevAppApp
      l) f, q3 ?' C: N; G
  33. ; k9 H  {6 `( ]( k- H$ e
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    $ h/ c" m- A# n0 c$ ]8 Y
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    / m, ^% _1 r$ j0 t% U# _
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.0 A' t# M! I1 w: d/ R
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    8 w: Q6 B3 }1 F! A. t3 l. R4 x
  38.         //}}AFX_MSG& `2 o( F2 ]# e% s, j8 F$ L/ E! h
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)8 n1 d0 y6 R) ~4 y) C
  40. END_MESSAGE_MAP()
    4 B5 [: l& H/ I
  41. ! {4 v( N! s# _
  42. /////////////////////////////////////////////////////////////////////////////( e3 Q: R, f0 k/ X8 ]. ~
  43. // CRevAppApp construction
    ( m( {* j5 r. G% M8 p/ K0 o$ m: U$ r
  44. 7 b8 U: L% z& u" `
  45. CRevAppApp::CRevAppApp()+ X; L3 d, j* t: u
  46. {! h5 X/ r7 e' h7 _0 W0 g# n' a% G
  47.         // TODO: add construction code here,
    0 `* B/ I: B8 E/ z6 p
  48.         // Place all significant initialization in InitInstance
    " v+ W9 R0 G' h3 r% z6 A+ P
  49.   bDisplayIsBig5=FALSE;8 u3 }/ X: z1 }% u: N1 a- ?$ K
  50.   bRestartUpdater=FALSE;8 L8 u7 E1 Q% B1 y% P
  51.   bFinishUpdated=FALSE;' h% C* B2 l$ `( U( D
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    2 o; O3 H7 o$ t! D5 l6 {/ Y$ b
  53.   InitChangeDataBig52GBKS();
    : ~1 F1 N8 U* a. _
  54.   InitChangeDataGBKS2Big5();) Z% x2 H) G6 `5 K- J- |% j7 X$ Y
  55.         //- A( ~% N) U/ b/ J7 Q0 Q6 f
  56.         bClickRunExe = FALSE;! V5 U2 D; a6 g0 ~$ p  p' {
  57.         //
    3 W3 {! e0 ~5 _+ S& Z
  58. }
    , _1 c+ `5 k$ }- C
  59. 6 t8 J' \6 d; I$ I  b/ J
  60. CRevAppApp::~CRevAppApp()" S  _# J2 `) f* o
  61. {6 j9 q+ L: q/ U7 H
  62.         // TODO: add construction code here,
    ' k8 Z% q! U/ I! a2 s( v% d% Y
  63.         // Place all significant initialization in InitInstance. X3 T. d+ T% [2 l+ ~
  64.   EndChangeData();
    . ]  v' b9 Q  p9 O6 a( C9 C/ H
  65. }7 q" D6 c) r3 `- U; |" H+ |
  66. 6 s" t3 w) j  T! [3 R
  67. /////////////////////////////////////////////////////////////////////////////
    ; Y+ \) [) W( G2 ~( S; S
  68. // The one and only CRevAppApp object& H6 v1 E8 i( s- W2 c
  69. ( c) s& }# o, @7 V$ a
  70. CRevAppApp theApp;+ j# H1 k/ W+ x/ z

  71. 7 `. p7 L& C/ O  C& N# A" V
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    + t: y7 c" v. Y- o8 p+ L2 Y6 C) v# a
  73. {
    5 b0 ?$ F& j: K8 Z0 S! d
  74.   int iEOF=0;
    & B3 o: }8 S9 f" p* l
  75.   char szTempName[MAX_PATH];4 J2 [; B( K6 W
  76.   *szFileName=0;
    + f' D! f) `/ }2 ?2 I3 U
  77.   iEOF=fscanf(fp,"%s",szTempName);- H. O( |1 y* d0 ]! x# T4 ]
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')9 W$ E6 o$ Q. {; m2 v
  79.   {
    + u4 t. Z2 f, i; U+ a
  80.     strcpy(szFileName,&szTempName[1]);
    2 l2 t3 f6 n( {, l
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    4 u; R) E/ t$ r, r+ j& z
  82.     {9 [9 I- A% |3 f2 P; x
  83.       iEOF=fscanf(fp,"%s",szTempName);
    4 {" ?( e1 y/ d9 s5 K
  84.       strcat(szFileName," ");' F7 {8 j& a; v
  85.       strcat(szFileName,szTempName);3 r& s- r+ j7 ?+ Y" d" T
  86.     }6 K4 ]; u9 \2 ^  g
  87.     if(strlen(szFileName)>=1)# a# B8 _/ T& V- ?. s7 _
  88.     {7 o$ w. c$ Y2 s
  89.       szFileName[strlen(szFileName)-1]=0;( z& v9 Q; x8 d8 n" E6 U3 L
  90.     }
    ) V5 U4 u2 J9 |, X5 l9 I
  91.   }) c) @6 k) @2 z# J' d9 D) k0 H9 \
  92.   return szFileName;
    / C& O' o, s* g* A
  93. }8 w. v1 }3 w3 J- A5 D

  94. 9 _% y; l- q! W8 A$ |
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)9 U  f: l0 _0 f  X0 `6 a, i
  96. {
    $ N- I$ B1 a7 |7 i8 a- `( Y) Q
  97.   FILE *fp;' W+ Y) o* s! e3 ~! t1 Y2 G
  98.   char *key=NULL;
    9 F3 W" j: D! {' Q; f2 C
  99.   char version[MAX_PATH];
    ; c* u5 D8 b' ]' d: }7 A
  100.   LPUPDATEFILE file,olds;. `  j" e& ]( P3 ^7 S
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    7 J7 B; A. t' b

  102. 9 m4 z9 ^$ n* {" l
  103.   UpdateList.clear();
    " x% R& I8 F; x3 I
  104.   UpdateFile.clear();
    ! w7 U6 l) S6 y: R, {5 d
  105.   if(GetFileAttributes(filename)==-1) return false;, |, |: R7 ~4 B4 s% u2 k. s/ D- V$ U
  106.   if(!(fp=fopen(filename,"r"))) return false;
    # j' d, W$ L, ~* o* a  F
  107.   fscanf(fp,"%s",version);
    1 m. s2 y. w. d3 B! y) B1 W9 I# Z3 I+ {
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }( x0 A" u. J$ x+ s% p
  109.   while(fscanf(fp,"%s",version)!=EOF)
    8 M" v  ]6 P/ Y- r! Y
  110.   {
    ; t, w3 o) M" Y$ _) n
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));6 z- _2 `3 X+ q1 H" L) b" Y$ H, X4 I
  112.     fscanf(fp,"%s",file->path);2 w$ V# Q9 ?' ~+ D' |; X
  113.     ReadFileNames(fp,file->file);
    ( ^3 _7 {# }5 i( c6 h) N9 u
  114.     strcpy(file->full,".");9 w. \# I6 l& P5 o
  115.     strcat(file->full,file->path);9 {* i5 n( P. c, c# b1 q
  116.     strcat(file->full,file->file);
    2 ]" c$ N$ y+ p  _" h( O3 ]
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    5 U. C0 U+ _5 h9 I' n/ R2 c4 J2 @  h
  118.     {
    & k! i3 Y- y) a- H! j' A
  119.       file->vers=(float)atof(version);
    ( ^  J; H/ [: E% y
  120.       UpdateList.push_back(file->full);
    ! T& `4 k) t1 ?6 X+ z% W
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    1 l: G' F8 r  c* G8 k' ~- z+ A
  122.     }6 Q; w8 a! [, G
  123.     else
    ; D; S$ T8 U* v. ^+ _/ U0 y
  124.     {
    4 t* m  `! Q) v+ t9 ^
  125.       olds=(*p).second;4 @+ E! k6 r* V& s% ?- A
  126.       if(olds->vers<(float)atof(version))! H& U/ W$ j2 \9 `: m
  127.       {
    ( Q- |& X2 |9 B5 `3 l
  128.         olds->vers=(float)atof(version);) w+ b; Y8 @( m# u
  129.       }
    # Q% W/ P" ^/ O$ V- ^  Y/ r7 j
  130.       free(file);
    , t8 t- ~0 p4 ^( J
  131.     }
    - V4 N1 `: Z9 \, Q( }4 }1 E
  132.   }
    $ L- ]* ~0 \( L5 s
  133.   fclose(fp);
    0 ^3 i$ g+ F3 C+ I" y3 |
  134.   return true;
    9 _9 O  Y3 Y' x+ X; N. o* U' V/ v
  135. }6 V$ T2 r, x1 _) c$ f* }

  136. $ u. D9 k. z& H$ d7 ~6 g' ^
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)8 I% S' F' D/ f: u, y
  138. {# O% ^& ]; ~8 e' Y( F
  139.   TCHAR  szFull[MAX_PATH];- d$ A. H  v# r( d- O) ~  I( u
  140.   TCHAR *token,*inter;
      p' v' z) O- j' j$ O+ J
  141.   *szPath=0;
    9 V! X7 }9 M, p# n) F
  142.   strcpy(szFull,szFullPath);0 A+ ~. E8 }0 A0 t9 W) U& [
  143.   token=strtok(szFull,"\\/");
    , @8 @0 A- H# `
  144.   inter=token;
    9 \# q; C% t8 k$ R/ J+ N( N, h9 P& n0 y
  145.   while(token=strtok(NULL,"\\/"))
    1 ^$ j! \# u4 N% T5 C- \
  146.   {# A2 B: F+ x+ N/ l
  147.     strcat(szPath,inter);
    $ V; J! g1 ?- C: j
  148.     strcat(szPath,"\");+ j, p- {  j3 w- N* |. v
  149.     inter=token;( |! p0 p& h/ W* R& |# q% h
  150.   }
    5 b( E+ k' O) G: B  N& i' i
  151.   return strlen(szPath);
    ) ^% t" @! {1 r) a* L2 N
  152. }
    8 Q* h$ x/ j$ M6 m- _

  153. 4 }$ }" a. w1 Z2 Y, h' _, _' T$ Q) ]& }1 M
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase), `% _  ]+ e9 `8 ]9 L5 R; I4 f! d
  155. {' W! h" A% X" h
  156.   DWORD attrib=GetFileAttributes(Target);
    & `* A! M. E/ w: o, K
  157.   if(attrib!=-1), [% [& d) z, Y3 r, u& U. K" s! J1 A
  158.   {
    3 ]. Y- \! ]8 X/ v" q
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))& T+ m7 A# B0 P6 p& f+ l/ J; N4 O
  160.     {$ s+ o8 U* L. `+ t
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    ) G- W+ y, ^: M' n
  162.       SetFileAttributes(Target,attrib);7 ]! ?8 ]/ `/ o" d
  163.     }
    . a6 M$ w$ D; }0 ~: H& H" S
  164.   }
    , T% K7 ^4 H8 h  P
  165.   CopyFile(Source,Target,Erase);$ r; U' n6 I& W/ e; Q
  166. }
    6 i) b# o: p, r% S) g
  167. ' k7 D% q: J- Y% h0 Y1 \: _
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    5 m" o" G& f- D' c% J8 G2 p# o/ p
  169. {
    ; k# K: C/ C: B+ {8 z
  170.      FILE *fp;4 z: N2 Y; W5 \; [+ K. j3 a
  171.      char  szBuffer[8192];/ M( m: g# I4 h# W8 Z3 j
  172.   va_list  argptr;6 n' T# e# b3 O- C

  173. ) V' u( o( ?' x* Z: L! e! i
  174.         va_start(argptr,message);
    6 c! s& o+ \* V% n- Y9 d+ I, b
  175.         vsprintf(szBuffer,message,argptr);3 o) s# r. C9 {' T, g! e
  176.         va_end(argptr);
    ! _9 S5 B# I* W! ]0 `# C1 U3 H
  177.   fp=fopen(FileName,"a");
    : {+ N/ f! Z& [# J5 g% U* m& y
  178.   if(fp)4 u7 d# W6 L8 `" I# v# [( @: h
  179.   {; g" P3 T8 Q5 t+ @+ ~
  180.     fprintf(fp,szBuffer);9 |1 J4 [/ U4 Q
  181.     fclose(fp);
    1 _$ G, G: y! c3 v9 m( Q  g) [9 ?
  182.           _flushall();
      K( a) r" B, h9 b1 B5 K1 i
  183.   }! R/ B9 O  `! t% f5 J) L9 d
  184. }
    / ^; w; Z, q- c9 i; {, r# Q  m4 z

  185. 9 }4 A% z. _% }( @1 i
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    " b7 Z5 u( e* c8 L- h' E4 g( B& a  ~
  187. {
    * k, e9 r$ m( I
  188.      FILE *fp;3 _8 [8 ^1 B. J
  189.     DWORD  attrib;
    ! f  w5 }* q- e' C! {
  190.   attrib=GetFileAttributes(FileName);
    2 C3 P$ M# K) {
  191.   if(attrib!=-1)
    8 ]6 x; i5 ~$ ]7 M; f. g
  192.   {
    ' n+ t: l' a4 I  f
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);( G( @( g& W/ W+ {
  194.     if(!SetFileAttributes(FileName,attrib))
    . X- W/ T$ z" ]/ l9 s
  195.     {9 A  v8 B& A" Z. \! j7 ~  [
  196.       return FALSE;
    3 L* U" k7 @; [/ j/ ]
  197.     }) v: |# c: Y1 V, T0 S$ g
  198.   }; a5 s8 k' v/ _7 L
  199.   fp=fopen(FileName,"wb");8 I1 C: d0 V4 f' w+ B$ n# P, L9 y
  200.   if(fp)
    4 r. t8 Q" W' ~
  201.   {
      T+ x( [+ }7 e9 s" W
  202.     fclose(fp);
    ( A8 a% _. _4 e: j/ s# _' c* x
  203.   }
    9 K, M5 F9 _! z: L* q* s! t- p4 Z
  204.   return TRUE;
    8 W! Q+ d/ M' y* R8 [; @8 b
  205. }
    4 W3 `- _5 _) U" U3 x! S4 e! z

  206. & x+ `. I+ D7 h
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    , Z! Z  \( A  B& y
  208. {
    + P- d+ F8 z2 T3 ~3 I1 I
  209.   char filename[MAX_PATH];8 m" i2 D2 C' W- w% Z4 ?7 R: U3 N- }
  210.   LPUPDATEFILE file,olds;3 s2 z3 X# K- o; ]" }
  211.   std::map<int,CString>::iterator i;
    3 N4 t5 D- L- m/ w
  212.   std::map<CString,LPUPDATEFILE>::iterator p;
    5 z* M( K7 H$ ~9 ~+ v
  213.   std::list<CString>::iterator l;
    0 G: s- G! s  d" b0 i- H
  214. 3 r. h# R4 S" B! T
  215.   if(bFirstUpdate)2 Z  C9 z/ i1 S" G) }! A2 ?) e
  216.   {4 w9 [# U1 [$ W8 G
  217.     dwCurrFile=0;+ p" c& v' _3 [# f2 [' y2 \, w
  218.     bFirstUpdate=FALSE;
    % B4 M. w& ]  e" ^! q+ \
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())& m6 ~5 x, c% f* E" W4 @, H
  220.     {
    2 J- f2 q  K* ?; y2 k/ Y: i7 A/ x7 e! q
  221.       dwTotalFiles=UpdateLocal.size();0 G4 }: h4 `6 \6 m2 _# s: O
  222.       dwDownLoaded=0;4 M) Z7 ~2 }5 O9 B$ w2 d6 A
  223.       bSilentStep=FALSE;: `' W4 b  Y6 H- z* q+ ]. T/ z
  224.       bCompressed=TRUE;
    ! A  w$ ]# V6 {$ Y
  225.       strExtLocal.Empty();7 v9 q( x! b, A
  226.       strFullName=(*i).second;6 I+ i; R6 A9 w' M# ]/ i5 V
  227.       dwProgramState=AP_CONNECT;
    $ }9 n/ C5 _/ }3 _4 z: _
  228.       return TRUE;
    # ]! G9 C& Y" R7 U7 q6 N7 Y4 M
  229.     }1 B4 W% Y# `& W( ^( c  e
  230.   }
      t; L) L& u5 f3 O" M% k
  231.   else if(bRestartUpdater==FALSE)( ?) @: T2 V+ N3 L
  232.   {
    ( P5 X+ s' h% ~2 H+ @- ~
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end()); l3 K( G! G7 b; ^4 ]2 J+ r
  234.     {
    0 _8 H4 |! @  g' @! f) \1 L
  235.       file=(*p).second;
    6 l" q5 t( U. y9 Y2 b
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())( R7 j7 Z) c7 Y: ~6 q
  237.       {& X* |: E! u1 W+ F6 [, O& q
  238.         olds=(*p).second;, S5 O6 p! v3 b, d& a
  239.         olds->vers=file->vers;
    * Q0 k! i8 ]4 N9 u% W
  240.       }6 a. C9 L4 K/ E9 y. D2 \
  241.       else5 a' F& z2 [) Q' c$ }9 I
  242.       {
    ; y( b5 \9 m% }* i
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    % h) _: R* |, D  v4 b  f
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    / b: n' q' Z+ B7 V
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    * U1 w& K! L: B0 N! s0 }  S' w
  246.       }
    % l) y. A9 k  m% z* [0 L& E
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
    & s' q  F& C" r% z# r, X! A- s
  248.       sprintf(filename,"(%s)",file->file);
    . G! |7 {& j, d# o$ D
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    & H) d; b% X6 Z9 P/ p  `
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    5 r, f4 i; `; P2 V$ a
  251.     }
    + P9 q8 z5 B, D; W5 `" T
  252.     dwCurrFile++;( Q7 E" V8 P: M* j
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    6 V1 d! ~! Z0 X5 f2 a- G6 k
  254.     {
    ( u, n5 b( N8 l5 W
  255.       bSilentStep=FALSE;5 i0 ?1 B% Z% d; t% X$ d  D
  256.       bCompressed=TRUE;( G) T$ ?# A* r
  257.       strExtLocal.Empty();+ H7 t6 f2 a  `. i
  258.       strFullName=(*i).second;
    0 S& m; h- m$ V0 R2 I
  259.       dwProgramState=AP_CONNECT;
    - U. L, ^8 H' h! W
  260.       return TRUE;) D2 L3 j! e% U. `8 B, {' C  `" ?
  261.     }" i" y1 l- J% k( [
  262.     if(!bRestartUpdater)4 i. T; W6 l8 a4 R8 p
  263.     {4 l" f3 r6 a1 [/ G
  264.       int iCurrSize,iFileSize;5 b8 A. I: _2 \+ ?+ r# l5 o
  265.       iCurrSize=0;
    + j% ~* V$ {* e4 j
  266.       iFileSize=UpdateList2.size();
    2 W+ z, l' ?; t  l6 Y* B3 r  G
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");. d! b3 ?% Z  X( P) J/ V
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    5 c3 H! n7 `* o- N+ p' f$ [
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");6 h$ A6 [: [7 ^+ f! z2 p8 l, U
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    5 |3 w# |- Q+ D8 t* [
  271.       Fclearf(".\\update.dat");1 S$ p& ~. O9 l
  272.       Fprintf(".\\update.dat","Bloodyf\n");
      d4 j2 t. A4 D2 r& u+ `8 ]5 B9 q
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    , E$ J7 ?3 R& M& i' M+ D$ C" D- R# z
  274.       {- E# E( d0 R: u) ]5 r
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    3 l0 R% h3 ^/ o( F& D' w) h
  276.         {8 l5 G) O) O' m& ?- c
  277.           file=(*p).second;) V6 N+ `1 n+ P7 S' u1 e/ c
  278.           sprintf(filename,"(%s)",file->file);  m8 x+ j) ^+ j# j0 X8 k
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    ' Z: [( a3 O. G" c' _! J( }
  280.           iCurrSize++;
    % Y& b& x+ [' P
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));+ ]$ c* D9 t% Q. H0 ?
  282.         }
    8 U  H/ [4 P# j/ R. L
  283.       }
    5 l# r, j+ V! Y  d
  284.       unlink(".\\update.txt");
    $ k3 ~+ r9 a6 W2 ~4 G/ F
  285.       unlink(".\\update.tmp");
    ; B/ Z/ V; w1 l' ~0 K9 s. @
  286.       Fclearf(".\\checkversion.dat");
    2 M$ h4 Y; p, e1 G" q" N, N
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    $ I% @6 {: r1 J% G3 Z
  288.       if(UpdateLocal.size())8 u+ P2 h6 G' s4 A# Q1 h( [
  289.       {3 v& F3 Q6 b1 m7 }4 z: R. a8 ]
  290.         UpdateLocal.clear();
    " B, p& d8 L# K/ s
  291.       }
    1 J7 U( ?2 e  B2 v- Q; l% {$ A
  292.       if(UpdateFile3.size())
    5 ]% f8 @6 Z  J. h" s# z
  293.       {& Z( `5 k& \6 y; d9 Y5 q
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)4 A+ E. H- C1 {4 C4 q0 ~0 w
  295.         {
    - I+ `( l0 I. |
  296.           file=(*p).second;
    # `8 J8 U5 p6 C! G; @
  297.           free(file);7 d$ P! y* G& ]" ]
  298.         }
    / X- N2 l& q6 w: |4 _
  299.         UpdateFile3.clear();/ O# C- o+ K' m9 B7 q9 }  N4 p8 [
  300.         UpdateList3.clear();: O/ i( P7 |% a* Y9 d
  301.       }  r( z; ]' z2 J: d/ j% g
  302.       if(UpdateFile2.size())
    + t2 v1 ]/ e1 \' Y
  303.       {# ]5 ^2 p( D* o
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    5 c' V, Q. X( i
  305.         {" ]& k5 ]) o! h' ~3 S0 o* e
  306.           file=(*p).second;
    & A6 a4 }& h4 T1 e1 E7 d
  307.           free(file);
    8 M2 h$ b2 M9 R! a8 Y7 ~
  308.         }
    & O% s1 h; l/ W  ?9 G& y
  309.         UpdateFile2.clear();
    ; {  h& N- Y5 m1 w9 j
  310.         UpdateList2.clear();; E( r2 s- i) v5 x5 T! h. r
  311.       }& }. u+ E) C. ?. Q
  312.       if(UpdateFile1.size())
    ' i5 Y, }0 i0 X" C5 `5 ?
  313.       {
    2 J# i7 j! l' ]
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)" w) w$ f' C9 w8 I. |
  315.         {# e  W: \% I+ f6 `# s4 r1 @  g: _
  316.           file=(*p).second;1 ~5 E: \* f2 t1 H7 e0 @$ U) r9 c
  317.           free(file);9 Z1 Y$ p5 ]$ ^. l" Z+ y# o. F9 C, c
  318.         }
    & r6 h; {* [5 [+ R
  319.         UpdateFile1.clear();# o+ t8 \4 P+ r7 p9 g$ Y
  320.         UpdateList1.clear();. C0 E* }4 G( J7 c& ^
  321.       }
    / v0 J! m1 S- N  K' }
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    4 X# k$ S; |* [8 l
  323.     }
    5 E! r0 x- `2 z' Z9 b, h
  324.   }5 s; w' X8 [' f* c1 c% F4 ~" W
  325.   return FALSE;, {: L% ?  e1 e8 ^# d4 u  V0 T
  326. }
    5 \4 l5 g) F1 G% V+ J9 p
  327. 8 f5 ], M, A+ k: f
  328. void CRevAppApp::ClearAll(void)- g6 s& \( A5 N' \- q
  329. {1 `. W5 q0 f3 g( ^0 ]' A
  330.   LPUPDATEFILE file;
    / O& o# ^5 w* Z  n! }+ ?- |' E
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    2 t* x% r7 k$ s! d, _# t5 t
  332. % k) {2 ?4 f. ^* ^1 D/ ^) H# J8 R1 E
  333.   if(UpdateLocal.size())
    + V. G7 D- K! v% m: H0 L) w# g: t
  334.   {
    : N, H7 p' n1 V- I5 Q# w$ S( G0 f
  335.     UpdateLocal.clear();( v+ K5 b+ j4 V
  336.   }
    + o% C5 b/ Z+ e  @5 u$ E1 O+ F
  337.   if(UpdateFile3.size())
    ' U. x! t/ I. S" I
  338.   {; p! K- Q. l3 Q* a7 A. e
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)" A  v: f. R; i1 L$ y
  340.     {8 J9 A1 v9 o4 f+ W
  341.       file=(*p).second;
    + {/ [1 a9 p) o2 q: \" f6 q" |5 H
  342.       free(file);3 h3 w" c2 U9 }8 x; H
  343.     }) E$ r7 G% A& D/ D6 ~# P0 F8 a1 d
  344.     UpdateFile3.clear();
    1 c: O# S0 h! w5 o- e% h
  345.     UpdateList3.clear();/ R, r7 w% E& [: S! n
  346.   }6 t5 @  m$ t2 O- T8 J
  347.   if(UpdateFile2.size())9 ~6 |; N, `2 Z# W. U2 }8 S+ r
  348.   {
    , _. H/ Q4 ]3 W8 ?+ x$ p& ]
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)4 f- y1 @! @0 I6 x1 T
  350.     {, y5 `* w9 M  N& X
  351.       file=(*p).second;/ h+ ^6 s% {, m0 y
  352.       free(file);
    $ J* F$ D! w: k& W7 b
  353.     }
    + Z# A& Y% B( y0 r5 `9 V
  354.     UpdateFile2.clear();
    " B' R  U" o$ j6 F
  355.     UpdateList2.clear();+ ]' i5 y& \% v
  356.   }
    $ e% A$ B5 D- W3 j3 X) J# H, l+ S
  357.   if(UpdateFile1.size()); R2 K. o% u7 E6 Z
  358.   {
    8 B) ?% D' S9 I: C
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++), X2 j0 \" |$ U7 i- D* q( \
  360.     {
    ; ^7 C4 q- D8 b! d. [9 G9 \
  361.       file=(*p).second;
    $ I8 ^# `7 l% `. G6 @. ?* W
  362.       free(file);+ O* ?! }; Y% `0 m
  363.     }, }% ?0 ~) J& X) I" }: l* p
  364.     UpdateFile1.clear();* ~6 y/ @7 v. f" A/ h# ?
  365.     UpdateList1.clear();
    * n$ X4 S3 M: v) s+ F2 Q
  366.   }
    , w; Z2 N6 w0 c$ c+ G. ~4 z( S' Q
  367. }  
    8 a" g: ^8 Q3 Q$ i
  368.   7 n3 O! U( u# \6 ~
  369. BOOL CRevAppApp::CheckLocalVersion(void)8 z5 H' E: O  W( I1 A/ x/ n
  370. {
    , q' i) v; R* [1 }
  371.   int c;
    8 G8 Q4 t1 Q% s9 N. M5 s3 x- F- o* [
  372.   LPUPDATEFILE file1,file2;) w. B) ?) Q' c% ?$ n( |  z8 Q: K
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    & o8 }* i/ x. f$ Q+ n
  374.   std::list<CString>::iterator l;9 q1 a' Z% f6 P( g$ L: \, p+ q
  375. ) E5 v1 Z! R+ E  r
  376.   UpdateLocal.clear();2 @9 `9 G+ Q( K5 K
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    % M1 K& J5 Z: ?* Q
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    # m' i8 |2 i" K
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    0 p! s9 M$ {0 _8 b) b4 p! n
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);9 e9 m, ]  Q- Y( C+ q
  381.   if(UpdateFile3.size())
    3 m% d5 J  b( d5 s) j% Y" v
  382.   {  f) O& |% E% k" n! T; @
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)8 x" ^' o" V. `5 |: ?
  384.     {
    7 \6 F$ V6 W1 @) i
  385.       file2=(LPUPDATEFILE)(*i).second;# t7 t. Y. ^' k! ~+ q; u% Y- N
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())7 b# D. J) H. z* i9 K% `( A
  387.       {% j  O5 n  @$ O6 l5 T" T9 u
  388.         file1=(LPUPDATEFILE)(*p).second;
    6 ^# ]9 o) s' |0 x! C3 Q* c1 z
  389.         file1->vers=file2->vers;
    $ P& m& ^- {4 t+ `; |3 Q5 u
  390.       }
    $ P. A) P" F% P, J
  391.       else+ V6 V7 i# U* F& _" m. E
  392.       {3 o& O  F/ c" z, m* e* {# T
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));: [" E# M$ m: c6 f7 H, m; P
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));1 `2 K) ]0 i. z
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));( ]: Z8 s3 g- j" t' r
  396.       }
    ! @9 r3 {2 [9 Q( n4 ^
  397.     }
    4 o9 ^- ~. }0 P0 t3 ~& I
  398.   }/ G" d3 m3 O. F9 I4 v0 d% g4 R. @
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    6 h1 |* |% y6 r9 W" L
  400.   {
    % `( o6 D3 C6 }/ Q# F' q; \/ b
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())$ g/ v, B; M! i
  402.     {
    $ ?, L7 J+ F1 O6 ?  ^6 {1 s$ r
  403.       file2=(LPUPDATEFILE)(*i).second;
      \! U% i3 i7 p) j- l
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())' j* |$ o: }& _4 K* _% L
  405.       {5 ^' [- M- h) q* V; G8 I4 @, o
  406.         file1=(LPUPDATEFILE)(*p).second;4 `- Y  g: ~# {: X/ t9 h
  407.         if(file1->vers!=file2->vers)
    + U/ b( c; Q. g- I- O" z
  408.         {5 ~8 B4 {, k% u- K5 n
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    # z% M) g! H: C- m. s3 P* q4 v
  410.           c++;
    9 Y9 @' |5 }1 S$ ]8 F, B
  411.         }  F* n- S0 ?2 j$ a8 K: w
  412.       }
    ; p8 ~- w: h7 y& G. \2 a6 s
  413.       else
    . f3 ^7 y" M0 p& l! Y
  414.       {
    ( }4 g" [' u5 V- b
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));% i3 H8 R" w& g# \8 s
  416.         c++;; A% x2 y% j) v, S; P; ]
  417.       }
    ) g0 m2 b" V5 a* F% I
  418.     }
    7 g" p2 M8 I  c- Z  V! I
  419.   }2 W- ?: }8 t3 p8 ^
  420.   unlink(".\\DownLoad\\update.txt");+ T) q8 A: r1 l* c7 ]9 [
  421.   if(UpdateLocal.size()) return TRUE;
    5 z) M, e% Y+ O/ `6 x
  422.   else                   return FALSE;- h, ?; s" l! z) o3 o+ m
  423. }8 B# R; ?! Z# V3 S/ A9 r$ r: y# O
  424. 2 z3 T# _! T2 h: T" |( Z1 t. C
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    ) ?- m. s, N, L+ M
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
      K, n9 h) w0 M1 t, N

  427.   Y4 k9 a, V6 _6 d
  428. ( B3 s4 K8 {' {& o  |% O

  429. ( z! D; L  c- b8 ^$ t3 M  p& C* V: F
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)- J' `, K& G7 v8 q5 v- l0 v
  431. {
    + p+ s; P: x* x$ u0 H5 T# D' m8 d
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;) t- }# Z' j3 N- x
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    % G  W3 v1 g' t- G* n# {1 j
  434.   {
    4 @# L7 R8 V0 B" g
  435.     char szLanguage[50];
    . p, P3 C, Y+ `" @6 X  B8 M1 C+ ?
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    4 [* u; \( I. t. c0 d/ E  p% P# E
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;4 E" f7 f8 c  F. X4 w4 N0 y: T# q
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
      p: t  \4 `& F0 m( V) H
  439.     else                                   m_iLanguage=ENGLISH;
    - T6 f& d, v% f6 a' p. G
  440.     char szRegister[100];2 x0 I2 R3 z2 }" z% Z& v
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    6 J* r7 c2 \" P( S% W, d
  442.     strRegsName=szRegister;* F- O. m2 ~! O
  443.     char szPatchURL[100];
    7 z! h, W* ?% s* o3 }$ t
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    : a6 O7 t3 g  a) B! r6 Q3 i
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    + p$ V) e( H! V0 I
  446.   }: A; E) ~8 P2 {2 r
  447.   else
    - m3 V1 i' R6 B- O- [* q, p+ l3 s
  448.   {
    & Z* Y7 Q5 s2 ^. V/ [8 D
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    # a) _+ N. s( R+ S
  450.     strRegsName=DEFAULT_REG_URL;; y0 R' l* o  h
  451.   }
    . g- O# u( U4 B9 w  g
  452.   if(GetFileAttributes("hosts.ini")!=-1)
      g1 G/ z( G% F! B7 J
  453.   {
    ' |4 x# v  a, a/ Y+ X* G0 T  l
  454.     char szIP[50];0 e: e, W/ R% v4 o
  455.     char szDIR[300];
    ' k$ K: [9 J4 Z; {' }% u
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))5 P  K9 e( D3 E& r7 L
  457.     {1 s: A+ \6 ]2 H2 u! n
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    / Z7 J" `( q. u( Z
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");5 I: U' ]! `8 T/ {1 v6 F
  460.       strHostName=szIP;
    + S  Q8 p( d: r8 @" Z- h8 [$ x
  461.       strHostPath.Format("/%s",szDIR);
    $ N0 C1 ?) b- K2 U* R8 ^5 k: ~
  462.     }
    ( p$ a) b2 v4 I. v+ L0 G
  463.     else
      b" G" R( Y9 w+ y; V
  464.     {3 Q* w: Y- e, j& c6 M  Q" Y
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    $ Q! r6 V7 _6 p8 v
  466.       {8 L( ?/ }; k' B3 F* E0 A
  467.         char szLanguage[50];
    " x; X, k# o  v$ z( P" [
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");6 V& Y2 M! }# e- B. V9 f
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    * R- c( f5 w4 ^2 F) a( }* k
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    5 V! c, c8 ~6 q. @/ R  S" t6 n
  471.         else                                   m_iLanguage=ENGLISH;; r* |5 E9 Y) L/ N# V, T
  472.         char szRegister[100];4 ^4 d1 q5 \# h8 V& L
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    7 L9 D  Y6 l. e+ r- c
  474.         strRegsName=szRegister;* g" X2 C! u# j
  475.         char szPatchURL[100];0 l3 P- \0 w! J7 _2 W6 e
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
      @- s0 C# v; H" J" U
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    / g2 x; h, ]6 K' F
  478.       }: ]* r. L( y- \) Y
  479.       else
    ! T  U! N& ^& Y! g
  480.       {! @  a3 D5 a' U6 w+ |
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    , n% L) k/ ?% m, F
  482.         strRegsName=DEFAULT_REG_URL;6 R# s' t- \6 `3 Z  q/ d1 G
  483.       }2 g9 \% [. p4 Z$ P
  484.     }
    : A5 K/ O+ \0 {( H. G" R+ W( n
  485.   }
    5 X4 P3 }! G, |7 ?
  486.   return true;
    1 h/ ]  ?' N, e7 K4 U4 s1 e
  487. }
    0 P1 q! G5 }6 L  R

  488. : N* V8 E& S  \: r6 x
  489. #include ".\ZLib\unzip.h"% K: R/ r; l, ?  o
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);; H8 Q- F" L# \, L6 L" Z
  491. /////////////////////////////////////////////////////////////////////////////1 _$ x0 P( ?2 K
  492. // CRevAppApp initialization' F5 M1 K; u6 L# P. G: x
  493. ; h$ J9 D" @2 \+ e9 F  s
  494. BOOL CRevAppApp::InitInstance(); I9 p( o+ g/ u9 {' k' Y. a& \
  495. {/ [8 v4 n  W; r
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];% `9 i) x& j2 p# q

  497. $ d0 a; b9 q2 M* ?9 T
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);9 R1 M- d9 g; k! m5 W
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    # F% i$ n4 G) A' t
  500.   {
    . [6 n* v! [# v  H5 n
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    5 P2 E* p! q3 @
  502.     GetPathFromFullPath(szPathTarget,szPathSource);' d: n. O3 o$ \' t* w% _& u
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    6 D4 M+ C0 c0 E/ y! b6 e
  504.     {/ @. w  r" l$ d* P* ^9 V/ @2 s# D
  505.       strcpy(szPath,szPathTarget);
    ( v0 q9 Y; _& I3 p0 A5 L- X+ n
  506.       SetCurrentDirectory(szPath);3 P2 {6 F" f: L2 T2 H+ }/ l
  507.     }
    , n( ~. P+ t4 |% o
  508.   }
    . B3 i( Z% B  H$ ^1 N# J- Z
  509. #ifdef _DEBUG
    : q& ~5 j) ~+ ^  Q2 D4 U
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))8 d. ?  }& l# L2 W
  511. #else
    * g5 ^* c" J5 G- s
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    " W) ?4 S, Z$ j: Z% y
  513. #endif' L0 r- J: z9 [6 w6 R
  514.   {
    9 Z( L1 j# O( N$ t4 ]
  515.     char tempFileName[MAX_PATH];6 u0 ]! k8 R' S2 o1 J
  516.     strcpy(tempFileName,szPathSource);
    6 Z" _& g% \. E  a, f! G
  517.     tempFileName[strlen(szPathSource)-12]=0;
    3 T: m8 l% e3 n. N7 e- ^
  518.     strcat(tempFileName,"\\$CSUpdate.exe");' y1 s3 S6 W/ k" t
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    ; n2 K- P+ Z4 e, K
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);3 m4 y  w  |% |7 t/ ]
  521.     return TRUE;* h5 f  ~. s# R$ u
  522.   }
    0 Z" @8 O+ R8 }) [' x2 V
  523.   // Nuke 0118: Delete run.exe
    ; z& g% E- m# D: c" h8 d! P
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );" R1 A; b' `5 a; F
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");% w9 P  G( t* g/ r+ V
  526.   if(!ReadCfgFile("Config.ini"))9 C# G4 t. S% B9 r; c0 I/ H5 U
  527.   {
    $ _( j4 M. r% L( P* n! U
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);( v# x: k% ]$ O! I# m! T
  529.     return TRUE;( j, \- W  ^% n7 b
  530.   }! |2 \" v2 q4 l9 F5 E, c
  531.   HANDLE mutex;! O/ Y) x/ H; E+ O1 r2 }
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    % `) V4 F; F6 H& p3 T; Q
  533.   {- E7 k' I( j) O. A3 K( h: o2 N
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)$ A! \0 }3 O& V4 z% D" S/ K
  535.     {- _3 c/ q2 k6 h$ I1 G- u
  536.       CloseHandle(mutex);
    + Y, E# s* W/ z1 i3 p* y
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);! O1 A2 I; X; j4 B/ O& N
  538.       return TRUE;
    & |, G4 D5 c: E6 r  }- K
  539.     }
    , D! O" ~2 G' Y: e  C8 U
  540.   }  5 x8 d) S3 c# i
  541.   CloseHandle(mutex);
    ( p+ L4 t2 }! m8 e( `; ^3 E7 q& R
  542. 9 h2 ~% h9 ^( C4 t$ O( L- y3 ?  ]
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);) j/ z; U7 E/ g, w2 P- [5 e
  544. $ L# I- F, y5 x% w
  545.         AfxEnableControlContainer();$ {1 U4 l7 ?  o2 l

  546. 4 ?2 u" Q/ e5 \" C
  547.   bCanUpdate=FALSE;* D: p$ I$ k/ |7 \! t6 Q
  548.   dwStartUpSteps=1;2 w8 Q+ J) \1 Y. C. V; a
  549.   dwProgramState=AP_NOTHING;
    ; A, C6 U4 A+ x7 W7 A/ J( c

  550. # {. B/ I" A" H
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);+ T! o' `- X3 B8 D+ `" E1 z1 c7 j
  552. & K* i$ B; G- ]6 ^$ K9 n
  553.         // Standard initialization4 g: v7 K4 k  {# |: W% }
  554.         // If you are not using these features and wish to reduce the size3 a$ @- ?. z% v' w
  555.         //  of your final executable, you should remove from the following
    : G0 B: ~4 F$ ^* u2 p
  556.         //  the specific initialization routines you do not need.
    7 F! ^2 v3 F$ p8 X. j+ p) G

  557. 3 Y3 l9 e1 J# }( p
  558. #ifdef _AFXDLL# b2 _5 I& R1 Z
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL" L5 m+ N# _; L8 _* V
  560. #else8 Q) m6 n* I6 X6 b9 L7 g( s8 R! N
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    % |1 A5 Y; a% g+ E' g
  562. #endif
    / G  D7 |9 x# R9 l9 Y- G* G4 u
  563. 6 {. I, h% \1 x1 I1 c
  564.   dlg=new CRevAppDlg;
    & h, z3 H; r' ?. s$ _
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    ' ]1 B1 [6 `. J! R: W5 R$ q
  566.   dlg->ShowWindow(SW_SHOWNORMAL);3 u$ E, T2 t5 d& G
  567.   m_pMainWnd=dlg;" O. u4 `( Y& z6 _; N+ m
  568. 6 t) ?$ C, E4 [5 s4 i# j$ r
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);8 ?" I: ~* }. w

  570. ; y/ L4 ]+ R" S+ @( x2 J% p5 B
  571. //  GdiplusStartupInput gdiplusStartupInput;2 C3 S7 k3 h, w, _. H8 y
  572. //  ULONG_PTR gdiplusToken;5 q5 c! J+ x# X8 T* e
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);" o5 ^9 ?( U6 m; p0 t
  574. ( n. x7 h: @0 F8 c, ~
  575. //        CRevAppDlg dlg;; g1 N( P$ V/ k7 p* J: P
  576. //        int nResponse = dlg.DoModal();( G2 V4 k. r7 g  J9 ^
  577. //        if (nResponse == IDOK)
    " ^7 x9 u& n- d+ p- D6 T3 u( i0 I
  578. //        {7 H! {, s( q2 Y. ?; l
  579. //                // TODO: Place code here to handle when the dialog is
    - L- @. ?. B7 r0 \0 I8 d- O- j
  580. //                //  dismissed with OK3 [9 m3 O$ F/ I" |9 P1 [. S1 a* |
  581. //        }0 E9 l/ A$ K8 U5 u6 W
  582. //        else if (nResponse == IDCANCEL)5 p! Y9 a( t. z2 |0 c" e& N
  583. //        {* d5 s* R2 n' Q7 i$ P+ H
  584. //                // TODO: Place code here to handle when the dialog is. P# y) H9 O+ b. N1 h  ]$ D- @) R
  585. //                //  dismissed with Cancel
    + V! _2 f4 T6 h  `# X$ g  A
  586. //        }
    " T# t/ @8 e, u( O9 g3 n: B4 g

  587. 4 y+ o! L- Q: V' g# P" n
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    2 S7 N1 N/ t5 ?, c$ J& J
  589.         //  application, rather than start the application's message pump.) i$ G& B  c% |9 P6 u7 |' `
  590.         return TRUE;
    , u% y6 v* |& I
  591. }
    ; ]# h6 \* g2 ^6 U2 w5 s

  592. . ]9 C9 r8 j5 b& e: n
  593. char *CRevAppApp::strtok3(char *pSource,char *token); E6 c5 b! T' j# F+ T7 [8 k
  594. {
    / x% j" r+ ~/ `5 Y9 X2 ?
  595.   int i;* L; M- m* N, O+ j; v
  596.   char *szRet;
    7 w; L' {) j& c$ i4 U% `' A
  597. / q  L: W+ k* j: [
  598.   if(pSource) { itoken=0; sztoken=pSource; }
      N" @5 }# Q- P9 ^9 M  U* p) J
  599.   if(sztoken)+ R: ^% ]) \9 ~. H+ _) R6 R" K
  600.   {
    9 E5 g! l+ Z+ b5 G( P* }  e
  601.     szRet=&sztoken[itoken];+ d2 J! y; e4 G' q* J/ F3 q  ?
  602.     while(sztoken[itoken])& @1 |- L* N5 k7 ]- [! ]
  603.     {
    ( z# `8 I% M/ o. {/ j* l6 |/ I
  604.       for(i=0;i<(int)strlen(token);i++)
    * p9 C+ r% `% H& t% G
  605.       {
    3 \: Q" O/ d! F$ G
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    . p6 |' @+ m8 S  _9 r# P
  607.         {; e% V6 s2 _  A2 w8 J: B' Y
  608.           sztoken[itoken++]=0;
    1 m. q5 k3 F4 A0 N
  609.           sztoken[itoken++]=0;
    9 \' T$ ^7 N1 G) S4 @
  610.           return szRet;
    " A- u0 A# T$ g7 [  `
  611.         }( C* ]1 b# D& i/ _
  612.       }4 u7 c. X- |+ Z
  613.       itoken++;
    0 D& w' E1 d  O3 ^5 J6 a
  614.     }
    . X+ u( T  n$ L# m1 E
  615.   }
    8 o5 q0 Z+ t- Z; x! q4 |
  616.   return NULL;' y: p0 c# a9 h1 e" p0 {
  617. }
    / b0 {# L0 N/ i& U! B# I9 P$ @

  618. ; B* A* P0 k0 m
  619. void ProcessProc(long Total,long Current)" q+ O" {- L2 H% ~6 ]: K) X4 E5 v
  620. {
    , E* @* i/ j# e
  621.         MSG msg;+ I* s2 |6 `! J/ @" H4 a2 H
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    & G# I' l+ w  D) u9 n5 a
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));+ \9 z1 z. C2 A' c, c! h5 z8 K
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))' U( F% X' u' j: q% K7 z+ x7 u
  625.         {
    1 B7 q3 m7 m2 |, x7 _. u
  626.                 if(!GetMessage(&msg,NULL,0,0))2 v# t6 c4 W0 y, y
  627.                 {" I7 {" x: _: o
  628.                         return;
    0 s1 t1 @$ T  I+ t
  629.                 }
    : }. Q+ I: M% V9 e' M% F
  630.                 TranslateMessage(&msg);
    7 g, t$ L" y; K9 l
  631.                 DispatchMessage(&msg);; H4 J+ m2 @+ X
  632.         }        7 A* M& S' \, Q/ t
  633. }& r1 X) C+ d3 S9 F

  634. , ]' L8 m/ G0 t! U0 f
  635. BOOL bFirstChar=TRUE;
    + P, u2 @# C; `: P, Y7 @
  636. , g; G5 k6 f% }! [
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    ) D% A' b1 T% ?2 T, \  P$ P/ c
  638. {
    . p3 w7 r6 i1 V3 z5 b7 o/ A+ X
  639.         // TODO: Add your specialized code here and/or call the base class) C# }( `) c. p) o  t$ W
  640.   switch(dwProgramState)
    ( S: Y% r5 ]7 s
  641.   {
    4 v' l4 l4 }) H3 o6 a; M
  642.   case AP_NOTHING:
    - c' |! n; q: `0 v3 s0 G
  643.     switch(dwStartUpSteps)
    ) ~+ Z! w# t3 ~9 d/ ~$ V
  644.     {6 u' s! ~; K7 b, |* y# Q
  645.     case 1:
    9 M0 ]& m9 v3 M; S( r) Q
  646.       {: K. }/ G, a# H- l8 d( A3 D0 b- P
  647.         int i;- \- b( e$ B- s, O/ r( C: @! j: J
  648.         CDC *pCDC=dlg->GetDC();
    1 v: I( t- @6 @0 t$ a
  649.         HDC hdcwnd=pCDC->m_hDC;6 Q) N5 M: n3 z  w- S) g
  650. //        Graphics graphics(hdcwnd);
    % e# M3 N7 E" b  _8 d% J# L1 ^1 c
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");1 x7 M3 o9 G8 j' ~) W5 t
  652. //        INT iWidth=bitmap.GetWidth();" l; [& V7 k+ \, O/ z. l+ ]0 ]
  653. //        INT iHeight=bitmap.GetHeight();
    ' g1 T- X+ w: D7 U, u% Z
  654. //        Color color,colorTemp;
    % X, ]$ n3 _/ E  a! G) E" q
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)8 [/ q9 w1 n9 Y2 L4 F4 ^: t
  656. //        {/ ~! C! T' W& P% x0 B( c$ B
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)3 B! {/ m- e9 w# J- c2 J- {
  658. //          {) J- Y' n; B" ?* o5 s: U7 H  ]3 T: J
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    8 B0 j5 ^# ^* o- G' `+ O, x
  660. //            colorTemp.SetValue(color.MakeARGB(
    7 f6 o; r7 a. `1 z$ h+ U2 [8 e
  661. //              (BYTE)(255*iColumn/iWidth),
    4 m0 i% J4 G$ ^* ^( \- U
  662. //              color.GetRed(),# }9 [2 G/ ]' M8 B6 O! j  \7 l
  663. //              color.GetGreen()," W9 I- s0 R" I5 s( k% d
  664. //              color.GetBlue()));
    8 a( q$ r& e6 N& `3 [% Z7 ]0 P
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);9 h2 P9 J+ L- C- R8 }$ O3 @
  666. //          }
    ) p% y2 a3 x& e8 o+ V5 l1 E
  667. //        }9 y. q: U! k. M: U9 F6 p5 o0 l3 R4 J
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);- ?6 N5 w1 O* v( m7 c, t' G
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");4 c) J# p# L& p* Z, J4 i  ?- O
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    4 j8 e8 M- L& y
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    / B0 i# x3 G6 W, G% ?
  672.         for(i=0;i<240;i+=8)5 ?$ A) m  ?8 _+ Y
  673.         {
    ' l, W8 z) Q0 j, v4 v9 J8 G
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    2 ^8 }' Z5 P% l1 |
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);% ~1 u: w! q/ x
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);  y: T/ {( t8 F' }
  677.           Sleep(33);/ n1 ?6 x7 Z3 R' k
  678.         }- U/ T" ]+ }& H2 y! E
  679.         Sleep(1000);
    7 O5 @( W7 v3 x. D" d
  680.         for(i=240;i>0;i-=8)+ D/ M* B4 a! D. v- P9 t
  681.         {
    6 I; m' E1 E+ _
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    7 V: g2 w5 Q( T+ N
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);9 G' j" e, v( p2 p! w& f: c& T
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    : f( e  f0 A6 t1 [
  685.           Sleep(33);6 o3 c# i' C0 k$ f7 Q
  686.         }. E- R; `5 _6 m  O1 j; k
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    + p) P  F1 F  e  t
  688.         dlg->ReleaseDC(pCDC);/ e+ K/ l  y8 B  j5 p; \
  689.         DeleteDC(hdctar);
    6 E# P8 j' R& I: n8 u
  690.         DeleteDC(hdcsrc);
    : `) c% s) D4 |7 `1 n0 u
  691.         DeleteDC(hdcorg);
    9 N: ~, @! ~% N& b4 L; g/ G: m8 V
  692.       }
    . k* |% T  N# r+ B$ l& s8 ]  W
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    - v( k8 v, k+ a% d8 V6 M. ?2 ]/ q  G
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");# i( g1 B% l/ N9 ]: f, Y
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");! b* X+ F5 N7 q" u  p+ Q7 E: s
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    0 t: _1 D) \4 _  }3 a
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    , s+ \+ O/ z# D  ?: W7 v- y  P
  698.       if(!Dn.Connected()). V- `) Q) I8 f; O7 p
  699.       {
    ) V. C5 u9 P; h" N
  700.         dwTotalFiles=1;
    7 O* g. [4 e6 K/ ?" ]: G
  701.         dwDownLoaded=0;
    ( D8 J0 K/ R4 T$ R8 R
  702.         bSilentStep=TRUE;
    3 L) b, `4 A% s7 c
  703.         bCompressed=FALSE;, g; y0 i8 t: {. R  \6 T
  704.         strExtLocal.Empty();! q$ R6 H4 D& E' r) _2 w
  705.         strFullName="readme.txt";+ e5 T( ]9 d: h) x# p5 Q2 G
  706.         dwProgramState=AP_CONNECT;
    + ^" t6 p9 {3 _
  707.       }6 C9 D- I4 Q5 q% C* k( m/ |. I
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    * B3 x3 @. v7 V7 `
  709.       dwStartUpSteps=2;
    ; Y& \9 Y/ P+ c, j, R; ^, \5 ]
  710.       break;
    : ~: L! ?# p5 d4 r  R+ I0 R( _0 J: P
  711.     case 2:1 V/ M' F0 q5 ^/ @" |
  712.       {
    % O8 D/ ^1 l: n
  713.         int iEOF;
    + Q- B$ z& {" n$ [5 e
  714.         FILE *fp;( y: u( U) Y' g$ ]$ J1 |
  715.         char szString[512];
    4 O6 M$ X9 T, L( P0 g# K$ A- p
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    0 F0 t; T; Y# k5 ]) F7 D
  717.         if(fp)
    5 g( g1 @1 C- i9 u4 M
  718.         {
    - V2 k" [( t; G4 a9 i: p: r
  719.           do
    1 M1 `+ ]4 z6 Y
  720.           {2 i- I0 u5 V* T$ \5 L3 t0 Y
  721.             iEOF=fscanf(fp,"%s",szString);
    + P6 Q! s2 ~8 b7 c- V: N
  722.             if(strlen(szString))
    1 g. j% C5 Q$ ^: h; s  M2 J
  723.             {
    ( P4 `0 p& y+ t5 B& J$ p4 j% W  S5 _
  724.               if(bFirstChar)
    / o& v8 D) O" e6 ]8 S% M7 ^0 p
  725.               {! |- N% R" ?. [& O
  726.                 bFirstChar=FALSE;
    % E1 I# k) H& V3 e- d
  727.                 bConnectIsBig5=FALSE;3 u8 G7 J% G! V3 Q+ P0 Y/ m9 s
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    - M% n/ }+ j* V& g" T: W' n
  729.               }
    % i) s- |$ ]5 o! j
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));* k( |; t0 X% [( g1 U7 H5 @, d/ @
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));- W" @$ B# f  a! ]2 K
  732.               dlg->m_ListText.AddString(szString);; s, W0 q/ L/ n! E/ R, ]# d* i
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);, H0 Z8 C& x5 I5 d& u
  734.               *szString=0;. a* D/ w- h/ V7 K0 U# K7 z& x% U
  735.             }
    + g+ C, o! Z% b" ^* i
  736.           } while(iEOF!=EOF);2 X" G- l8 g. K* f! D
  737.           fclose(fp);, X6 p( N- j4 Y/ q- _% Q0 m7 v; P8 `
  738.           unlink(".\\DownLoad\\readme.txt");
    % V) b2 a- t6 t; ~- t7 s+ r- T
  739.           dwStartUpSteps=3;, a1 ~4 O: v- z: ]$ K
  740.         }
    0 q  @8 N" I! P1 W0 {0 |
  741.       }" p6 t; }  ^, d! R9 S
  742.       break;0 a% b9 d4 Q' x( e- e1 G+ d0 Q% `7 `
  743.     case 3:8 W8 c& _8 l+ g& x
  744.       if(!Dn.Connected())6 k% @$ S  @/ a% G
  745.       {. N3 O& H2 M: H" W6 ?; v0 c- z% o
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);3 n, ~4 c  |) `- l3 J9 Q
  747.         dwTotalFiles=1;
    9 U! g$ `2 v2 T9 ~$ `: l
  748.         dwDownLoaded=0;
    9 |: n9 i7 u& Q) U0 V2 F! }
  749.         bSilentStep=TRUE;
      O! C/ Y: `3 _) A* R
  750.         bCompressed=FALSE;
    * i% f! y$ z; L! C1 j
  751.         strExtLocal.Empty();& }3 N, m$ {# p* _8 P
  752.         strFullName="checkversion.txt";+ c8 d- O1 [6 Q) n- j( b
  753.         dwProgramState=AP_CONNECT;) s# n( o" P2 J, ]9 Z+ h" A
  754.       }
    5 F9 p1 x( `  `+ s& S! v
  755.       dwStartUpSteps=4;
    1 e+ M7 q$ J8 }0 i: J0 I
  756.       break;
    ; h6 @! _! j: E& _, y# J+ [9 \- n
  757.     case 4:
    8 K+ v0 a0 \/ Y3 H. p# Q# z) A% r
  758.       {; T/ P0 w" d! Z+ V8 Q7 [
  759.         FILE *fp;
    5 _; o$ k1 B6 ~/ w6 ]
  760.         char szString1[128];* o; h2 x; ~: K+ V
  761.         char szString2[128];$ ]% w0 h$ H% h/ l/ w2 ?  e& _
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");% L  A8 k/ X: G3 k
  763.         if(fp); t1 r% ]7 C( J3 c" g9 w4 O; G' F
  764.         {
    $ }5 @* N8 d0 F, u+ \$ m
  765.           fscanf(fp,"%s",szString1);
    : a$ r$ _  q+ R. A, \  L
  766.           fclose(fp);
    ( ?! v0 x5 |) t  x) J' P
  767.           fCheckVersion=atof(szString1);9 l' Z' w5 b% ~. K
  768.           fp=fopen(".\\checkversion.dat","r");' v; V9 P: E7 y; M' t
  769.           if(fp)
    2 [/ K/ p' H  d/ y) m/ q3 b
  770.           {" X) T! Q0 q' m6 d
  771.             fscanf(fp,"%s",szString2);4 O" ?/ G! T0 v" H
  772.             fclose(fp);$ M# {' D: v7 M2 I' ~/ ~7 X+ L7 K
  773.             if(atof(szString1)!=atof(szString2))7 \% v. ?: y/ |& x* p) B
  774.             {
    " m- g( q# d5 L0 D. E
  775.               if(!Dn.Connected()), O- r" M! S7 Q0 d+ `2 m  L- D5 x
  776.               {( N3 L1 ^& ]7 `/ [$ P2 f
  777.                 bFirstUpdate=TRUE;$ A* F$ Z1 U% ^6 a1 y+ l2 p  S
  778.                 dwTotalFiles=1;( F' y2 }" A( B( K9 w
  779.                 dwDownLoaded=0;6 c& N- a: m9 ^
  780.                 bSilentStep=FALSE;# L+ f' S% k4 l* o: e! V: C
  781.                 bCompressed=TRUE;
    0 b: D" q# M9 F0 y
  782.                 strExtLocal=".\\DownLoad\";
    ' y) q/ I- ]8 z0 |& u* Z  y
  783.                 strFullName="update.txt";
    . ?4 F2 ?1 I0 i9 A
  784.                 dwProgramState=AP_CONNECT;
    3 T, {$ a" p! n- r8 R2 h0 S
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    " W- n; H# n1 V/ h: j4 [
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
      b$ J$ G; R# F8 ^3 G- V# D
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");* o: U) R- J) t$ ]* _

  788. , \2 B% ^/ s9 s1 D( O3 c
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);  n# P! _' i2 C& \8 R
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    9 ^+ f( z* [; {0 N+ x
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
      W0 i& n6 t# s& r
  792.                 {
    / `6 P3 T+ Q8 V
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    ) {' H& \0 R8 H2 l- F% M
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    % f$ O. h$ M# E; Q4 m1 E( x) J
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");4 w6 }  T' k& |, s' W
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 R) c$ D# _; K% k

  797. . r0 \# O+ m% M5 N: y% Q1 [
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");" d+ z* B! T6 t( _  f' J  U9 Q: s
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    " m7 {/ z# J  q8 l
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");5 ]: h6 U# F* [( ^6 a+ ]7 A7 K
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ; A$ [2 Q3 N* S
  802.                 }" p$ i( p% L, @
  803.                 dwStartUpSteps=5;4 i3 j4 J- w  G: u7 \
  804.               }, H, i5 k9 z/ i) W
  805.             }
    5 \! r* B8 x& X6 B% p& O
  806.             else7 ]: A' `! \& _* l$ f" h
  807.             {
    6 h' @% i5 y/ Q8 i5 N
  808.               unlink(".\\DownLoad\\checkversion.txt");4 W$ d, l3 z. |2 `1 s) h2 w. t& b
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");; k. d: L# J  E3 L- b( O7 l
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    6 {  X" W" \+ C, Z3 X
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    ! h9 k3 m' \2 ?: w( |

  812. + U2 r6 l+ t( J) m! d
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / E5 |; f' ?% {, e7 l- T
  814.               dwStartUpSteps=99;: p; c8 t' k8 G9 D3 q
  815.               bFinishUpdated=TRUE;' y, ?4 T$ b/ @; A; b7 k3 D
  816.               bCanUpdate=TRUE;" ]2 i: Y% r) s- W* y
  817.             }; I1 Y) p( H- l$ O. E, U+ @5 ]
  818.           }  o2 ^' ~# y2 C$ s, j" W
  819.           else4 D1 S7 o8 q6 B1 a8 [7 S
  820.           {8 n7 }0 t/ D- P$ `
  821.             if(!Dn.Connected())& T( N$ x. Q- a* C4 s
  822.             {
    ! Z6 Q, S- E9 Z4 u$ X) g: I: @$ g
  823.               bFirstUpdate=TRUE;
    & k9 J' ]* y3 C5 z; m, p
  824.               dwTotalFiles=1;
    ) R' Q, a+ n2 I7 s6 _1 m
  825.               dwDownLoaded=0;3 j5 i8 f8 C- r
  826.               bSilentStep=FALSE;
    * D3 e) N2 z' C& n- Y
  827.               bCompressed=TRUE;) D/ W, p' \. o) E8 J5 z. t
  828.               strExtLocal=".\\DownLoad\";
    , _. q# O8 r9 U
  829.               strFullName="update.txt";- h1 n  N( g  B. ~& j
  830.               dwProgramState=AP_CONNECT;
    : d" S( I- X& f3 q2 H
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");+ t  R  X# m9 E0 h9 ~
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    / W( @" d$ h1 v) d& W
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");& R4 ~" y. N: A+ t& i0 u- |. g$ C6 ]
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);( J! `! x* o: U% T5 r
  835.               unlink(".\\DownLoad\\checkversion.txt");
    & |/ G$ `5 x( v$ E3 v0 i
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    ! }3 \5 \; O; Q: A5 V
  837.               {
    . P  G- M0 z" N' y( u
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");. l" d( V8 I* o; a1 C6 g, Q
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ! ~9 _) P( a" b! N% B% _
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    % R8 T! R5 w# S9 Q& p
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);' d  K" w( x9 D3 E8 I8 y  w7 e
  842.                
    ; ^& o2 d8 |7 m( M
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");+ g% H% h+ [$ C  P' F0 ]% R
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");# L" |# b4 e# y0 R9 }
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");7 F4 y  b) P2 i9 R3 H% [' Z( f2 G
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    % U3 T) ~4 N; ~3 o+ v' }
  847.               }9 l4 j! h, w2 v- c1 t" o4 T
  848.               dwStartUpSteps=5;0 K7 f, v8 M2 t" a0 ^6 F
  849.             }
    ' g" x9 V+ }5 h7 N* F+ \" u
  850.           }2 Y" {6 n' }8 s3 q, G8 q& r& P+ R
  851.         }. k/ @1 @# X. B  d+ U' ?
  852.         else" G8 b" l. L) O: b$ F7 K8 y: C
  853.         {
    / H4 `, I3 l$ g# c
  854.           dwStartUpSteps=3;8 U( k% d7 v( Q' z- G
  855.         }3 l, g7 j- ^& A
  856.       }! u( F- h# j2 P- b
  857.       break;
    2 Y- x* D, C, u3 W4 Q! `$ g
  858.     case 5:
    " k$ ]2 i1 K+ k9 U
  859.       {8 p7 m: t0 Z' R! ~
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    , M: X( F5 |) B5 ]# U
  861.         {) W& Q8 l$ p; v% @& n5 M6 C
  862.           int opt_overwrite=1;
    1 G8 I: H: U* F
  863.           int opt_do_extract_withoutpath=0;
    " o6 H$ d6 C9 S/ |  u: Q" A/ }
  864.           unzFile uf=NULL;
    & A+ y& o6 N: `* Y3 y: [

  865. , B+ s' S% h8 J1 z( z
  866.           uf=unzOpen("Wsa.zip");% e$ e9 m1 _: h3 z" {* t
  867.           if(uf)
    7 v6 s. R8 Y: E
  868.           {* D8 s8 r7 x5 F5 `/ T4 s9 Q
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);; n5 U4 s1 u( m4 m' \: B5 \+ h7 Q
  870.             unzClose(uf);) {, v, P  |0 i, K$ I) m  f8 H/ T; k
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    2 M; D( U$ {: ^9 D- M
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");) k/ t* x& D! m8 v; T- R8 h
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");9 J1 k. [. Z4 f) u3 S0 A) b
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% V1 W2 B0 ]% u) ]
  875.           }; w8 ?/ ^% v, l# `9 K' X% M+ q
  876.           DeleteFile("Wsa.zip" );
    % E1 r. f1 y$ V. X( d& V. ]7 w9 k( Z
  877.         }& Y  b" V1 T4 h/ G1 K0 _

  878. / c' ?% v2 j; \2 J1 R( G
  879.         if(CheckLocalVersion())4 V9 C& i6 V0 p
  880.         {0 R: u, f1 p' E# i
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");
    ! v9 Q; ^, L- @/ @, n: x: P( |
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");
    ! c+ `* y; U" u3 b0 ]( B( X6 U9 m9 l
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");4 a- W3 n* G; i6 l& J
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);! i+ X8 a2 s% u; H  H( c
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);& A" g' C$ d9 j3 h8 H
  886.           dwStartUpSteps=99;( S# y- E) ]9 i1 H- M9 k# K
  887.         }
    : M" f( B% U/ B
  888.         else
    8 L, Q" X7 ?2 P/ K& _
  889.         {+ Y3 Y" f; {# I% p) r! G
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    ' p% T% ?/ ?0 d% I, }6 P# ^
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");2 p3 m; f. b$ s* {* k! N5 q6 ^. q
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");: {8 f% R- k5 Z+ S

  893. / e( ~+ J0 u' v2 e; J
  894.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ! M4 t$ ^: H3 s* S5 u; r
  895.           dwStartUpSteps=99;
    ) O+ J3 T& q2 A  ?' x: S
  896.           bFinishUpdated=TRUE;  Z. N( r( J( _5 v1 t! N. R
  897.         }
    . e' ?0 ^8 C: |) f% a# F/ M+ D( n8 @
  898.         bCanUpdate=TRUE;
    2 a( D5 J0 ?9 ?' s4 ?. I! i
  899.       }. c" k# I3 [7 a3 c- M, ]1 p
  900.       break;
    5 w! S; s+ x$ R$ y
  901.     case 6:
    4 C6 \5 Q; l4 Y
  902.       {
    - g3 ^/ r4 y3 Y4 Q
  903.         if(!UpdateLocalVersion())
      s5 n4 N. b' J0 k7 ]) K
  904.         {& |) s# q8 t0 u& M# X+ {
  905.           if(bRestartUpdater)
    9 r. y+ D/ I2 |
  906.           {% C$ k( f( \4 c, d# Q# U
  907.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             MessageBox(GetActiveWindow(),"叫穝磅︽穝祘Α.....","Elysium Updater",MB_OK|MB_ICONERROR);
    / q3 `. F' M0 w# E5 g! E/ o
  908.             else if( m_iLanguage == SIMPLIFY_CHINESE )                MessageBox(GetActiveWindow(),"请重新执行更新程式.....","Elysium Updater",MB_OK|MB_ICONERROR);
    $ t( ]# C; b4 a) W+ m  |
  909.             else                                                      MessageBox(GetActiveWindow(),"Please Restart Elysium.....","Elysium Updater",MB_OK|MB_ICONERROR);
    7 G( v2 z- L6 T0 g
  910.             DestroyWindow(m_pMainWnd->GetSafeHwnd());( P2 ^* T7 t# v* g
  911.             dwStartUpSteps=99;/ ^& l( d( V5 e- l1 Q: ~
  912.           }
    ; z# Q0 F: ~- w% k( i: t% G7 x
  913.           else
    / V& q; W0 U6 m
  914.           {( [' T1 @1 Z, `1 @. y
  915.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈竒ЧΘ.....");
    2 S$ i3 N5 W, s3 o( e) q
  916.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新的资料已经完成.....");, O( z, W) J1 y+ ?5 K6 Q, u
  917.             else                                                      dlg->m_ListText.AddString("updated file ok.....");
    # N3 P: c2 `; q' R& W
  918.             dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    & q$ G; a0 A3 x  G0 z$ A& {9 k! [& w
  919.             SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,0,0);
    5 s: V. T8 i- w  ~+ ^* f. @7 {  O& }
  920.             dwStartUpSteps=7;
    : \9 E* I+ E) D# p3 e
  921.             bFinishUpdated=TRUE;
    . j" p% \5 O7 M6 V( {; m- s
  922.           }
    . F! ^; ~2 _; O1 L* B/ k0 X% ^( s
  923.         }! A: q; @3 h+ u( r2 Q0 j
  924.         else$ f, F) |) V. J& J+ \( ~6 X
  925.         {
    : {% A, L# |( f' @2 V+ j
  926.           if(bRestartUpdater)
    ) ?" [) ?1 g9 V2 R, I, f
  927.           {; W' P, J( K8 {4 y3 n8 A4 x+ S
  928.                                                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             MessageBox(GetActiveWindow(),"叫穝磅︽穝祘Α.....","Elysium Updater",MB_OK|MB_ICONERROR);$ M5 c8 ?% q% V* A2 L  e8 {4 v
  929.                                                 else if( m_iLanguage == SIMPLIFY_CHINESE )                MessageBox(GetActiveWindow(),"请重新执行更新程式.....","Elysium Updater",MB_OK|MB_ICONERROR);0 J% G) {- B; E( D2 _; x% t# X' S4 x
  930.                                                 else                                                      MessageBox(GetActiveWindow(),"Please Restart Elysium.....","Elysium Updater",MB_OK|MB_ICONERROR);/ U/ h6 L$ c; T$ s
  931.                                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());
      y! J% y5 n+ `( K. ^$ F
  932.             dwStartUpSteps=99;
      y. T9 S) J4 q4 {" N. D
  933.           }
    8 q! z: S- k. f2 _. k" C* `9 I2 Y
  934.         }9 A( h$ ^. }% A+ q. s# w
  935.       }
    9 Z6 _1 ]0 ]; {' v6 L  Y! k2 U
  936.       break;+ P: g! G' m1 i
  937.     case 7:* C, e2 t! m! _2 M" G5 L# d1 B
  938.       {9 \' X: ]: }7 g& F* W
  939.         char szExecuteFile[14]="Bf_Client.exe";
      q8 k( M5 i0 B
  940.         if(GetFileAttributes("Run.exe")!=-1) strcpy(szExecuteFile,"Run.exe");
    , s1 D3 p% U* w  N0 I
  941.         if(m_iLanguage==TRADITIONAL_CHINESE)   ShellExecute(NULL,"open",szExecuteFile,"updated" ,NULL,SW_SHOW);, s. G5 d2 k2 C1 D7 h! i
  942.         else if(m_iLanguage==SIMPLIFY_CHINESE) ShellExecute(NULL,"open",szExecuteFile,"updated2",NULL,SW_SHOW);; i' F+ O' V5 z9 d/ H; @2 z3 G
  943.         else                                   ShellExecute(NULL,"open",szExecuteFile,"updated" ,NULL,SW_SHOW);: p0 N  i; P9 a2 ?" C
  944.         DestroyWindow(m_pMainWnd->GetSafeHwnd());0 n9 y" d+ G9 ^6 K% ?/ L$ K; k& ?  P
  945.         dwStartUpSteps=99;1 J7 W* o! v/ F# a' m) ~' E8 Z9 f
  946.       }8 p9 e5 g: ?* @, l8 J' k. ~
  947.       break;
    & m# i: u& y3 r7 V! _
  948.                 //add by cece( {7 q2 G" I& P' ~3 P1 J
  949.                 case 8:8 Q3 n+ V; M. X% o+ s+ l$ O
  950.                         {
    7 c3 ?# i5 x8 y8 O  `# U' U
  951.                                 if(!Dn.Connected())1 K/ m. ~" c6 c' ?; U
  952.                                 {
      X: ~2 i# e6 U
  953.                                         dwTotalFiles=1;. i) D( `9 Z+ W% _! J
  954.                                         dwDownLoaded=0;8 {  B+ y" U& @" Z/ G
  955.                                         bSilentStep=TRUE;
    7 z# f- k8 P4 G3 j& a1 h
  956.                                         bCompressed=TRUE;
    # a) W( `9 s% V/ m1 @7 l. Q
  957.                                         strExtLocal.Empty();
    6 W: p  x7 x. N* k  h2 m  a7 F
  958.                                         strFullName="download/CRCTable.txt";
    : U6 \, d$ B- F
  959.                                         dwProgramState=AP_CONNECT;2 ?, s  S2 H8 p
  960.                                 }6 F2 _* C# @8 J
  961.                                 //
    : e# w) M- K. `0 Y3 R# a( U2 h, n
  962.                                 dwStartUpSteps = 9;4 }1 {# I# m, v2 Q5 k5 E
  963.                         }7 z9 [6 d: b* b9 H- x9 b2 ~
  964.                         break;7 i5 }% B+ l- A( Y7 f' M
  965.                 case 9:
    8 t8 y" p5 t$ X+ T
  966.                         {
    - J8 K- Z% d# B" ~! A: V
  967.                                 if(!Dn.Connected())
    / \8 f0 O, `2 x) P
  968.                                 {
    & B$ P& m5 _% |% A; D2 A  j) W. K6 R
  969.                                         dwTotalFiles=1;+ F1 B. D4 d0 N" O( A8 d
  970.                                         dwDownLoaded=0;
    ( h7 n9 i8 N8 Q/ ]1 C
  971.                                         bSilentStep=TRUE;0 t: N  G$ L& L
  972.                                         bCompressed=TRUE;
    % q2 J2 d' |8 D* e. f
  973.                                         strExtLocal.Empty();
    5 X1 v# K. c# D
  974.                                         strFullName="Run.exe";
    . e* }) k9 v% i" F+ P
  975.                                         dwProgramState=AP_CONNECT;
    * q9 H2 A7 D& D# X5 ^; Y+ |6 c$ F, w
  976.                                 }5 x/ b2 f  m, K7 u! H, Z! H6 U
  977.                                 //4 m% q" s% @& ?, F7 O' R
  978.                                 dwStartUpSteps = 10;
      m  s, c7 i  C
  979.                         }
    % r' {8 P/ s" i$ d: F/ j/ S
  980.                         break;5 D" D7 m1 A, a$ V( T' Y4 |
  981.                 case 10:6 D: `' R4 a& ~& I* b
  982.                         {
    - ?# _/ B& F# g' o: @
  983.                                 if(m_iLanguage==TRADITIONAL_CHINESE)   ShellExecute(NULL,"open","Run.exe","updated" ,NULL,SW_SHOW);
    * g: c& n+ x; R9 Z9 P
  984.         else if(m_iLanguage==SIMPLIFY_CHINESE) ShellExecute(NULL,"open","Run.exe","updated2",NULL,SW_SHOW);0 `9 s' }4 U  p# d
  985.         else                                   ShellExecute(NULL,"open","Run.exe","updated" ,NULL,SW_SHOW);
    & x) b+ F! s5 K" w  o% O/ q
  986.                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());1 g8 j5 w* o. _, {5 Z$ z, {
  987.                                 theApp.bClickRunExe = FALSE;5 r# R8 H3 w- ~7 Z) {8 {+ j. b
  988.         dwStartUpSteps = 99;- Y/ t8 v! s2 F. V7 e, t8 p1 ?2 M
  989.                                 //8 o7 S; Y& g3 S  a
  990.                         }7 ~8 ~, Q) Y# `7 e6 a/ w  F* w
  991.                         break;; m( ~6 j! Y: f: P- y4 |; m
  992.                 //1 x( ?# _+ w0 e6 b
  993.     }
    ! B: w+ N; f! \# g6 B! [
  994.     break;, j* S, B) u9 }% X* r( P
  995.   case AP_CONNECT:
    3 p% S8 e3 b) O9 H0 y1 T7 N# t
  996.           if(Dn.InitNWSSock(4096,4096))( t* I3 B! G% ^- E* `
  997.     {) D9 C; M$ ?+ P) u; q* n- M
  998.       char szPathName[MAX_PATH];
    ' }  a/ B5 j% f" Y+ G" y0 I3 |; Q7 C
  999.       dwLastSize=0;. t; E8 o0 T! {' K1 R4 @
  1000.       GetPathFromFullPath(szPathName,(char*)(LPCTSTR)strFullName);; O; L6 R9 X" F8 P+ G  E
  1001.       strFilePath=strExtLocal+szPathName;
    ) H% A' \7 ^8 d$ P2 c0 E3 r  p) d
  1002.       strFileName=strFullName.Right(strFullName.GetLength()-strlen(szPathName));
    4 Y" Q- j4 t/ Q3 w2 H8 w
  1003.       dwResumeNums=0;
    ; T$ ^) k5 s0 T% o& \& A( a  V
  1004.       CString strTempName;
    . c7 l, e: \, T$ G  B1 d% e5 S
  1005.       if(!bSilentStep) dlg->m_FileName.SetWindowText(strFileName);7 k2 _. x. b" V9 x1 S
  1006.       CString strCountData;( X9 l( k6 B! h1 ~5 p  ?' K" m" l% m
  1007.       strCountData.Format("%d/%d",dwDownLoaded+1,dwTotalFiles);; I' e: H! H' X9 z
  1008.       dlg->m_FileNumber.SetWindowText(strCountData);0 R1 r' {% R/ I/ n1 Z4 J. y
  1009.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    : [7 o7 E  O; K" x- F
  1010.       if(bCompressed)4 Z* d  Y9 o3 N9 w
  1011.       {
    ! |: g' Q  o# ]' D; V) c
  1012.         strTempName.Format("GET %s%s.zip HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName);
    9 d# O4 S. h) ~1 i
  1013.       }
    ! W1 ?  c; V( V7 G6 Y
  1014.       else* b; A2 J6 C0 z0 t
  1015.       {
    : h+ C! x; n0 Y1 w* k# B
  1016.         strTempName.Format("GET %s%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName);  l* ^  Q, X7 b7 J
  1017.       }
    ! X4 A' W% m5 i3 n6 v& f7 U
  1018.                   Dn.Connect((char*)(LPCTSTR)strHostName,wPort);# w5 i3 C9 o* p+ s# @% ~2 l
  1019.       Dn.AddSendData((char*)(LPCTSTR)strTempName,strTempName.GetLength());! o! O1 U; V- p9 r6 b
  1020.       LastTickCount=GetTickCount();
    ; A3 Z) B8 \1 a
  1021.       dwProgramState=AP_SENDING;2 s# A& \: t% f& y% ]
  1022.     }; Y/ c) A! X1 ~5 L# e! I
  1023.     else% G5 O, I6 j( U* i/ Y# c$ U( @
  1024.     {
    % W& O! ^& {# ?) \, f
  1025.       Dn.QuitNWSSock();
    ! N. Y5 t8 l: m# ]' h9 }9 t
  1026.       dwProgramState=AP_NOTHING;
    # o9 q6 {0 d1 x/ C" s$ D
  1027.     }
    9 |. r! @8 S/ T4 S4 H5 l
  1028.     break;* B6 |4 V4 f  q5 d( P, m
  1029.   case AP_RESUMED:
    7 `0 x( e2 @' t6 w
  1030.           if(Dn.InitNWSSock(4096,4096))7 N3 J4 C3 c7 W, C- |
  1031.     {
    ; t  P" E/ f+ C  V/ m
  1032.       dwResumeNums++;
    / L  H& ]# M8 l2 w+ y5 w3 u
  1033.       CString strTempName;# {9 g) Y" C3 M1 x
  1034.       if(!bSilentStep) dlg->m_FileName.SetWindowText(strFileName);
    7 i6 j: f/ z0 X& Z- |
  1035.       CString strCountData;$ q( _7 O! `$ ?7 ~/ q
  1036.       strCountData.Format("%d/%d",dwDownLoaded,dwTotalFiles);( F; `( p$ ^" `9 p
  1037.       dlg->m_FileNumber.SetWindowText(strCountData);
    ! m! M% ^+ k1 V, g% k
  1038.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));0 E6 h% ^& {& ^% |4 v2 v8 E0 |
  1039.       if(bCompressed)7 T9 P2 T  Z& b$ t
  1040.       {: s, l$ V; W3 {
  1041.         strTempName.Format("GET %s%s.zip HTTP/1.1\r\nHost: %s\r\nRange: bytes=%d-\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName,dwCurrSize);
    5 D1 P7 i+ `; W8 c: f/ Z/ j; P9 N1 Y
  1042.       }
    ( P; W; c0 K: g; _) Q
  1043.       else
    ; h& c- T. T5 ^1 _
  1044.       {6 V# ]% T0 P$ K
  1045.         strTempName.Format("GET %s%s HTTP/1.1\r\nHost: %s\r\nRange: bytes=%d-\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName,dwCurrSize);
    3 F4 B. r) Z# V7 o* `: _
  1046.       }7 s* L1 {! O% t/ N& j2 n8 _
  1047.                   Dn.Connect((char*)(LPCTSTR)strHostName,wPort);- g5 N' W- m  m% j9 n0 K0 \. l
  1048.       Dn.AddSendData((char*)(LPCTSTR)strTempName,strTempName.GetLength());. V6 n. D( g6 n
  1049.       LastTickCount=GetTickCount();
    & q8 U3 f4 q4 D3 G; u% |% t
  1050.       dwProgramState=AP_SENDING;( [6 o+ Z( N$ `& A& O
  1051.     }
    ( d0 F1 N  X# ~1 P8 L, k+ t
  1052.     else0 @$ V% e; [) k8 j3 c6 F
  1053.     {1 T& y9 \# h. F6 O; E
  1054.       Dn.QuitNWSSock();. h" _6 R4 Y9 }9 T0 L0 Y1 t
  1055.       dwProgramState=AP_NOTHING;: i: o( J, c' v
  1056.     }0 i- }  s5 g) E8 p$ U+ k
  1057.     break;7 |' n* n8 p3 j0 h5 W1 ^/ P7 J" {4 B
  1058.   case AP_SENDING:
    & {8 |; K) K' p
  1059.     {
    6 d% J3 W. @# y% z+ x
  1060.       DWORD RecvLen,SendLen;
    5 W' F4 |& T) c& y5 {9 H* x4 G
  1061.       if(Dn.NetworkLoop(RecvLen,SendLen))5 h4 ]- V  H4 D4 P1 y! h
  1062.       {( n5 @' R2 W7 t7 e
  1063.         LastTickCount=GetTickCount();% A. L9 N$ d9 s! ~( _# ]
  1064.         if(SendLen)4 c* X  V4 G- Z( _8 @5 @
  1065.         {
    # ?4 z1 m# W3 x# q3 u) [
  1066.           bReadHeaders=FALSE;
    " U5 B) q+ s  I, T1 V: |/ j2 E
  1067.           dwProgramState=AP_RECEIVE;( y. v% S& b- r8 V  J, l
  1068.         }# Y/ Y2 n; ]; v
  1069.       }
    + \' T, J% O7 q3 t4 R4 G
  1070.       else# Z: M2 n4 x8 N$ z/ O
  1071.       {
    3 M  a9 N+ p3 m6 ?5 f8 `
  1072.         if(GetTickCount()-LastTickCount>3000)
    , W: T! \3 T7 M% K0 p! U
  1073.         {1 C% ^9 g  ~2 {) G
  1074.           Dn.QuitNWSSock();3 g' v1 c( }" O9 `
  1075.           dwProgramState=AP_CONNECT;( }! Q1 x6 M& v% C: @
  1076.                                         //2 b  n6 i( O) S; R3 e
  1077.                                         static DWORD s_dwCount = 0;' ?# b4 h, R9 l5 l# n: Q
  1078.                                         s_dwCount++;
    % {" D! @! f% I5 Z+ w* Y
  1079.                                         if( s_dwCount > 10 )
      |( u' D5 O, Y. ?  K. F% b% ?+ r
  1080.                                         {/ O) G  i2 J/ _0 _6 W3 n; `( `' W
  1081.                                                 if(m_iLanguage==TRADITIONAL_CHINESE)   MessageBox(GetActiveWindow(),"硈钡穝狝竟ア毖叫浪琩眤呼蹈砞竚   ","Error",MB_OK|MB_ICONERROR);
      J/ @0 K1 i( T" Z# Q6 _
  1082.                                                 else if(m_iLanguage==SIMPLIFY_CHINESE) MessageBox(GetActiveWindow(),"连接更新伺服器失败,请检查您的网络设置   ","Error",MB_OK|MB_ICONERROR);) H& ]5 l6 w5 y/ A, l* y
  1083.                                                 else                                   MessageBox(GetActiveWindow(),"Connected Error, Please Check Your Network Status   ","Error",MB_OK|MB_ICONERROR);
    6 ]; n5 f5 n% C9 C1 l+ M
  1084.                                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());
      l5 R" F5 N* b& x
  1085.                                         }
    ' A, \0 Y8 H; O$ ^
  1086.         }
    ; K) t3 e- Z  W2 f% G. q
  1087.       }8 F( U! V( x, [8 E
  1088.     }8 x7 G# z' E' ?! M# Q
  1089.     break;! Z, {  S0 G  A
  1090.   case AP_RECEIVE:
    4 E% n; a' J1 m; P) i
  1091.     {
      v9 \7 e0 w5 N# ]! @
  1092.       int Count;
    & w8 l6 }% t6 q' l/ s1 O* j- x0 a7 e
  1093.       DWORD RecvLen,SendLen;) B* m; X, k( c) ~
  1094.       if(Dn.NetworkLoop(RecvLen,SendLen))8 B: C6 \' J% C6 ^& o
  1095.       {, \8 ]% d4 U5 t, S9 W" v) h5 b
  1096.         LastTickCount=GetTickCount();) d4 e7 D$ K8 q/ H
  1097.         if(RecvLen)
      [: S: m. b# z& R
  1098.         {8 D* e: @% V$ j+ U
  1099.           if(!bReadHeaders)
    6 C) D7 G( a' u- e2 }& O* H9 w, w
  1100.           {
    7 Z8 @, R% l/ _
  1101.             char *token=strtok3(Dn.szRecvBuff,"\r\n");
    # f& h4 ^* M  w, {8 M6 x' w
  1102.             if(token); v( u( k4 Y- q" |0 A- _
  1103.             {9 \: e% Y, y& j- O- ~' o# ]; V/ L
  1104.               dwFileSize=0;
    9 k" Z- f  W2 \# Z7 n/ d
  1105.               for(int i=0;i<(int)strlen(token)-3;i++)
    4 G: c( f% x3 P$ R+ r/ }: |
  1106.               {7 P; q6 |5 L+ y
  1107.                 if(!strnicmp(&token[i],"206",3)), h0 _4 t. g0 T2 k# O* ~
  1108.                 {
    8 S6 c4 i5 S" l1 u, g) S5 e; f
  1109.                   if(!bSilentStep)# F$ P7 `" _- U2 E
  1110.                   {. {: x! m$ `2 H3 H
  1111.                     CString strTempName;
    & Q& |$ c# @0 [# S9 u: h0 a
  1112.                     strTempName.Format("%s.....resuming(%d)",strFileName,dwResumeNums);
    ; O7 ^% Y6 q1 Y. U
  1113.                     if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);! y% p  C9 Z+ K
  1114.                     dlg->m_ListText.AddString(strTempName);) D) i' i( ~$ |1 X- E) Y2 y2 d
  1115.                     dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);/ j9 \7 X6 v$ g: y6 l
  1116.                   }
    ; l  g5 T5 u2 H$ a6 G- O( j
  1117.                   bReadHeaders=TRUE;- l; g) b/ q6 q3 O8 l
  1118.                   while(token=strtok3(NULL,"\r\n"))* C. X5 l# c" l
  1119.                   {
    " Y  z& y1 s# p( m# u  c
  1120.                     if(!strlen(token)&&dwFileSize)3 W, d( c6 h/ ?9 ~  y: ^8 {5 k
  1121.                     {  t, ^+ k0 Y; I% Q$ g
  1122.                       Dn.dwRecvLeft-=token+2-Dn.szRecvBuff;$ _3 u) ]0 x0 P2 W) [
  1123.                       if((int)Dn.dwRecvLeft>0)
    7 e" L. A" h% l: O' Z# \
  1124.                       {
    4 Y% J4 C! L5 b4 G) F. K( a- x) t
  1125.                         if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)8 y7 a/ K) Y4 E* R
  1126.                         {
    1 q# ], c  H7 _9 J) X
  1127.                           dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;' L( t1 L( t; [9 |5 j% Y# j
  1128.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);
    & v& E5 D- A6 ]/ H
  1129.                         }
    4 W8 v7 r( k$ ]$ Q8 U& I
  1130.                         memcpy(Dn.szCompBuff+dwCurrSize,token+2,Dn.dwRecvLeft);
      q( K% F0 I! W% R) Y
  1131.                         dwCurrSize+=Dn.dwRecvLeft;5 V3 h, O9 w5 L5 Y: `
  1132.                         Dn.dwRecvLeft-=Dn.dwRecvLeft;
    & F# B6 j- K9 `* F! j
  1133.                                                                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;
    " t+ u# X( I; ?% ?# y! p7 D
  1134.                       }, D' ?9 D9 L7 {# H
  1135.                       break;
    & B( \7 R0 L6 R/ }  C6 q+ s
  1136.                     }
    1 X4 N8 u! c8 X) E
  1137.                     else
    . A1 a1 e( W7 B8 \9 y
  1138.                     {8 c) G8 F" j) O9 X
  1139.                       if(!strnicmp(token,"Content-Length",14))" y) a0 N! X4 e( a* _
  1140.                       {$ L  c) _  E+ \- d4 v. }: D5 L; S
  1141.                         if(!Dn.szCompBuff)# H0 }3 W' T, k- [' S( ?7 c
  1142.                         {8 j9 ]+ s6 T& I8 f% Q* B
  1143.                           dwLastSize=dwFileSize=atoi(&token[16])+dwCurrSize;3 }9 R* w# y) l
  1144.                           Dn.szCompBuff=(LPSTR)malloc(dwFileSize);
    7 z5 z( K7 j4 U/ b6 c
  1145.                         }
    2 Q! Y, W3 d3 [. w* W* T/ ^, `4 G2 e; W
  1146.                         else if(dwFileSize!=dwLastSize)0 {( q( I! Q! i0 c( L0 d7 C
  1147.                         {" c/ n5 Z7 q1 T4 K1 D, N
  1148.                           dwLastSize=dwFileSize=atoi(&token[16])+dwCurrSize;
    + g0 Z  z, [! M( v8 I
  1149.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);$ Y0 y2 g2 Y7 W# x+ d( a0 E
  1150.                         }
    1 @2 E( S6 r0 g$ _  c
  1151.                       }
    + A3 O* g5 W8 r, \% U/ v: w
  1152.                     }% C4 F# R2 b& e5 i& B- ^
  1153.                   }% }3 i9 O/ y, C2 X6 q2 Y9 W) j
  1154.                   break;& F" h, m; h& k, _: H9 D
  1155.                 }
    % v; X) C+ f7 t; v9 v
  1156.                 if(!strnicmp(&token[i],"200",3))! \  D0 D8 }  @. B% i) s
  1157.                 {
    # e$ m5 {6 u2 ?
  1158.                   if(!bSilentStep)
    7 N/ J' Y$ }! i+ Q9 g# y! y
  1159.                   {
    2 E6 H1 O7 P( A$ u3 o' F
  1160.                     dlg->m_ListText.AddString(strFileName+".....downloading");
    0 T' h+ Q+ A: B1 U5 F
  1161.                     dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);$ `: i7 J- f. M9 A0 H
  1162.                   }! T7 ]% @+ z3 S8 Z# R
  1163.                   dwCurrSize=0;
    & p1 M2 U- E/ e- P$ X& `
  1164.                   bReadHeaders=TRUE;
    . N. C1 [( W+ b
  1165.                   while(token=strtok3(NULL,"\r\n"))
    $ L) W6 E* ~& ^
  1166.                   {; g  ?+ b1 e; S
  1167.                     if(!strlen(token)&&dwFileSize)
    0 v1 ~$ \' t* c/ u! {6 n' U  `
  1168.                     {
    . M# I) X0 O. Q* v1 ?
  1169.                       Dn.dwRecvLeft-=token+2-Dn.szRecvBuff;
      ]( M1 w/ U* I" F* ?- c
  1170.                       if((int)Dn.dwRecvLeft>0), ~) M1 m* m: r+ T
  1171.                       {
    ! \# k" b$ X  t! h: D. L
  1172.                         if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)# ?+ B8 P. L* U/ a0 h
  1173.                         {2 r5 j9 X- I' D5 Z
  1174.                           dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;
    , s* @0 P1 l0 b$ L3 y, S" A* Y
  1175.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);0 y1 P& u2 y4 x" e
  1176.                         }/ }9 S( _' F1 x, @8 ~
  1177.                         memcpy(Dn.szCompBuff+dwCurrSize,token+2,Dn.dwRecvLeft);1 i% R- J* v1 c5 P& J; f
  1178.                         dwCurrSize+=Dn.dwRecvLeft;
    8 i6 _% n: Y' R  f$ k7 X9 P
  1179.                         Dn.dwRecvLeft-=Dn.dwRecvLeft;) L4 y1 y* G3 V4 A
  1180.                                                                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;
    - w# p  K4 X( l+ C
  1181.                       }
    " T* e2 f4 F. Z( R7 x- ?% [) v
  1182.                       break;
    & J$ D% j  f2 \$ ~/ [% \
  1183.                     }; j  b# w. r  K" l8 h* w# |9 F
  1184.                     else! j7 S7 y2 C' g/ B) m1 a8 t7 }
  1185.                     {
    1 R" `3 ?- y3 B
  1186.                       if(!strnicmp(token,"Content-Length",14))% G. z6 [4 o0 I8 F$ F3 v
  1187.                       {8 a/ k* s" @% p% Q0 e' x
  1188.                         if(Dn.szCompBuff) { free(Dn.szCompBuff); Dn.szCompBuff=NULL; }" e; J; v& X* f: N" ~( Y% ]
  1189.                         dwLastSize=dwFileSize=atoi(&token[16]);2 S  Q  O: Q8 T1 O" k
  1190.                         Dn.szCompBuff=(LPSTR)malloc(dwFileSize);; g. j1 ~: L/ w  J" w
  1191.                       }
    % Z' E" p- [4 l5 ~. J% L7 j
  1192.                     }
    ; T; \3 p. t" X3 _, O" @7 R
  1193.                   }- x7 {2 h; ]$ _5 G  b9 u+ N
  1194.                   break;
    1 ~) {* `% t& L) u" G: o) A& B6 w
  1195.                 }
    9 s% ~/ Q4 Q6 q' @1 w
  1196.               }4 a% i0 i# \# f- B
  1197.               if(!bReadHeaders||!dwFileSize)# h- {) F3 b& K
  1198.               {2 P+ F+ m& d, j, Y7 f8 X
  1199.                 // Wrong Header or Reading File Size Error
    ! p6 F6 q9 n! f1 H: O6 T
  1200.                 Dn.QuitNWSSock();* F% v* N& V6 D( R( ^! W$ H" _
  1201.                 dwProgramState=AP_NOTHING;- N* B( e5 c  v" T4 D4 s; i
  1202.                 CString strTempName;
    + p7 e% B. K5 @; {9 r6 _" b
  1203.                 strTempName.Format("Navigate %s File Error !",strFullName);
    ' t- k6 Z6 I" M5 u% A0 F& p) M' J
  1204.                 MessageBox(GetActiveWindow(),strTempName,"Error",MB_OK|MB_ICONERROR);, O+ I" E) n0 ^& ?3 J) N
  1205.                 bRestartUpdater=TRUE;# v* c: P% }% p& ~% u6 \
  1206.               }
    , Z' j9 K5 {0 v" T& V$ [' K* g
  1207.             }; e: H( S5 g0 p. b! J# K3 L
  1208.             else. D) n# T/ ]* i1 z1 Q  L
  1209.             {
    $ [6 p' ?! X- F9 ?; K; w' k' x
  1210.               // Have No Header  `% A6 u/ V( L
  1211.               Dn.QuitNWSSock();
    8 Z: g7 W+ z6 H' ^- X) h! y
  1212.               dwProgramState=AP_CONNECT;
    ; {& q" r' g$ ~. c) }
  1213.             }' d$ o, B3 T/ |1 x6 D
  1214.           }' P/ o4 C* H) V" {
  1215.           else7 I) Y; w  W! w' W9 X
  1216.           {0 D+ D% V  E0 O' H; k! H
  1217.             // Reading File From Web
      ]" U; z& t# `$ q6 R3 w5 ^: Y
  1218.             if((int)Dn.dwRecvLeft>0)
    9 ?  A5 G. D  n* m' `2 z( u9 j
  1219.             {
    1 [- }0 Y" I7 T4 s' x. {
  1220.               if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)8 G# k) L% e( C
  1221.               {
    . D$ l" f$ Q: g, t! i8 ^4 C. K
  1222.                 dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;
    # o6 ]" E: x* E# g: T9 ?
  1223.                 Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);
    % g/ o8 [: y7 w! A
  1224.               }
    . }; q& s+ h! L4 d! Z' M
  1225.               memcpy(Dn.szCompBuff+dwCurrSize,Dn.szRecvBuff,Dn.dwRecvLeft);
    * \0 a$ L/ m/ u% l+ N* G
  1226.               dwCurrSize+=RecvLen;
    $ M$ q4 r& `( S0 J
  1227.               Dn.dwRecvLeft-=RecvLen;
    * \; S7 z2 P( V" ~: [
  1228.             }' W) R: l3 M! v# y6 A) ^
  1229.                                                 dlg->m_Process2.SetPos(100*dwCurrSize/(dwFileSize<=0?1:dwFileSize));  R3 X3 }5 C3 _6 {
  1230. //            int iRate = 100*dwCurrSize/(dwFileSize<=0?1:dwFileSize);; C" C! S: ^4 ]8 ]- W; U  J
  1231. //            dlg->m_Process2.SetPos(iRate);1 q4 m+ R& w- m& L& g5 c6 N
  1232. //            if(iRate < 0)   iRate = 0;  ]1 C6 _3 ~; e4 C0 V' I3 s$ o
  1233. //            if(iRate > 100) iRate = 100;# S# Y/ F5 |3 u: B0 y
  1234. //            char szShow[5];
    + O0 Q5 ?8 L" g6 o5 R6 ~. Z
  1235. //            sprintf(szShow,"%d%%",iRate);! E4 e: Y- u3 B) N% c, u
  1236. //            dlg->m_SingleRate.SetWindowText(szShow);
    ! U" N$ N' K( e' j& ?: G: M
  1237.                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;1 y  C4 y" k$ A
  1238.           }
    2 j9 r, A6 X6 U0 d) \/ K
  1239.         }7 ]6 T: j" A5 l) ]7 A/ f
  1240.         else if(dwCurrSize<dwFileSize)
    8 F: U3 e% ~$ m1 ^; N. B
  1241.         {
    9 x6 M& `; B8 R7 N) x
  1242.           // Disconnection But Size Error
    # t& [" X1 V! n) g
  1243.           Dn.QuitNWSSock();
    ' d8 ?5 {% `* I% o4 k
  1244.           if(dwCurrSize) dwProgramState=AP_RESUMED;
      n' E# j+ ~' D, S" U: `
  1245.           else           dwProgramState=AP_CONNECT;
    5 @  J  o; }, _4 `4 n( Z) B
  1246.         }' h  h; c1 H: ~6 f" l3 {. s
  1247.         else5 i1 y. ~# X3 b! h4 f8 _4 I
  1248.         {/ h+ e) }6 c0 N
  1249. SaveFileJump:3 v9 E; U* d& t
  1250.           // End of File and Disconnect& p; m4 [2 z5 M3 ^. V/ z9 e& B" c
  1251.           FILE *Fp;
    : X) j! R, |% _
  1252.           char szTempName[MAX_PATH];4 Z; G2 C: {, k* T; U$ U
  1253.           strcpy(szTempName,".\\DownLoad\");: ]" `( ]1 C/ W; i( B
  1254.           strcat(szTempName,(char*)(LPCTSTR)strFileName);+ k* O  H$ ]0 Q/ S
  1255.           if(bCompressed) strcat(szTempName,".zip");
    ( s7 o  {# A5 g$ R' w# `
  1256.           if(dwCurrSize)- A$ q* b5 r0 y1 b
  1257.           {
    3 D1 R' m2 H9 k6 w
  1258.                   Fp=fopen(szTempName,"wb");1 P( Y1 B2 Q$ z4 {0 P% S# |( f$ J
  1259.             if(!Fp)
    ) N. X" U# i2 e9 ^* {; Q  }1 Q
  1260.             {" T4 [  ^7 [: C
  1261.               _mkdir("DownLoad");) W6 K( m5 A0 s8 k% N# U5 @! W
  1262.               Fp=fopen(szTempName,"wb");* }% M0 x* a  N  Z! A7 J; U
  1263.             }
    , s2 |0 ?. u; l0 K! N% J$ h
  1264.             if(Fp)
    6 b3 N$ x1 ?: N% l. |
  1265.             {
    + ]3 L9 ?! {. b6 U& j5 V8 }! L: ^, h
  1266.               fwrite(Dn.szCompBuff,1,dwCurrSize,Fp);/ b# k! P) H- G& |) v
  1267.               fclose(Fp);2 H7 i" n$ l& a% ~6 }, Y5 _" t4 y0 ^. c
  1268.             }& @* e" |) x" D0 q( X  h0 `/ m
  1269.           }
    4 O, ^! A2 b: P# F! c1 u
  1270.           if(!bSilentStep)
    4 k1 O# e; o1 W( q& A" P
  1271.           {
      k' D* G" c# i" D
  1272.             if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    ; U5 O! g2 P; m
  1273.             dlg->m_ListText.AddString(strFileName+".....saving");6 @" G$ ]7 a9 v1 v  N1 @
  1274.             dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);! U; v1 G9 A" g0 ?4 z
  1275.           }+ s* w- u' ^' O& C3 l
  1276.           if(bCompressed)* x+ a4 V9 \, `0 Z
  1277.           {
    , X; z1 _) |6 e" i" U5 U! T. r$ @
  1278.                    int opt_overwrite=1;
    4 [0 N; ?! n3 |
  1279.             int opt_do_extract_withoutpath=0;
    # V4 W( J: G. V5 B9 G2 q# u
  1280.                    unzFile uf=NULL;
    1 e5 k$ [, a  z
  1281.                          uf=unzOpen(szTempName);2 j6 I  j& ~7 D. k. ~$ F
  1282.             if(uf), A5 b( A! z& g6 R3 L1 b9 F
  1283.             {$ |' ?6 e. e& n! p
  1284.               if(!bSilentStep)
    3 Z% V/ `( J5 L3 {% o4 o) x
  1285.               {2 K/ p% K' P3 y
  1286.                 if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    ' e: L5 j9 x) }# F# R5 @
  1287.                 dlg->m_ListText.AddString(strFileName+".....extracting");
    : H8 g  K* X. y
  1288.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);) @" m3 M* N% y/ n! a
  1289.               }: l1 R& s- W6 y
  1290.               if(do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,(char*)(LPCTSTR)strFilePath,NULL)==UNZ_OK)) _7 |3 A! T4 i% j8 ?5 w
  1291.               {
    0 e) J0 ~  q3 o4 A
  1292.                 if(!bSilentStep)" f4 P7 |5 _$ Y: p9 r, J
  1293.                 {
    0 e1 w. B  {' G- v9 [( j
  1294.                   if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    2 ?! h! Q8 W5 R5 G$ A: _- {$ J
  1295.                   dlg->m_ListText.AddString(strFileName+".....done");
    3 x/ A+ u5 t. q( y
  1296.                   dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);3 N/ W$ @7 e  G( ^! l
  1297.                 }9 C/ f3 ^! b1 }) o( w; h$ r* m' w
  1298.                 dwDownLoaded++;$ |0 j; Z, P% o% I6 L9 n1 F' O4 b, E7 N
  1299.                 dwProgramState=AP_NOTHING;7 }8 t9 q& K0 k
  1300.               }
    1 X2 q! `$ G/ _0 T  x
  1301.               else; B7 v8 u3 c4 v1 [" r. V3 P" q# k
  1302.               {; d$ O: }- k. c# @; M! b4 P1 s
  1303.                 dwProgramState=AP_CONNECT;( B( g7 {) f+ g% a
  1304.               }' r6 o. a- _8 h  c- f- G1 e# l
  1305.                     unzClose(uf);
    : e9 z6 E9 u& l) z, j$ Y& e
  1306.             }
    6 A, c! q2 R" v$ u- ^. C* A3 d' a
  1307.             else# d" ^( p  b' l3 o# n
  1308.             {* Z% _# j8 R" {4 K0 Z0 C
  1309.               dwProgramState=AP_CONNECT;
    2 u5 f1 h4 m2 n. e! E3 x
  1310.             }# a; O- ~2 h+ _* a0 O. \: h
  1311.             unlink(szTempName);  v, K3 r0 J0 z- j" a; T
  1312.           }
    : i) A3 q8 W* n( p
  1313.           else9 R) t# U+ q8 n
  1314.           {, v" G0 K& |9 i) K: n# Z8 E6 T
  1315.             if(!bSilentStep)
    & e8 p1 |3 Z4 a
  1316.             {: C/ b/ U9 A% b
  1317.               if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    . q( B9 o. u" M/ D4 x
  1318.               dlg->m_ListText.AddString(strFileName+".....done");
    + S# P% |% i: {8 D8 O& f
  1319.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. ?( j1 _% J5 ?7 q& W) P8 L  B
  1320.             }
    1 H; a* N  O3 v; @1 S3 ~/ d
  1321.             dwDownLoaded++;1 t9 Q& Z7 X. C$ J
  1322.             dwProgramState=AP_NOTHING;
    + a) D& N6 k2 N
  1323.           }2 e- Z$ ^5 V, s# C7 Y3 `) Z
  1324.           Dn.QuitNWSSock();7 o& l* y% P4 Z+ r
  1325.         }
    0 L- {. ~9 v0 `
  1326.       }
    : e3 _8 M' L" L
  1327.       else: y- b. l  w3 c- u9 V
  1328.       {3 t3 C3 A5 U$ {$ u) L
  1329.         // Connect Timeout
    7 R7 v% k" P7 V* u
  1330.         if(GetTickCount()-LastTickCount>30000)
    7 E6 E* X( |3 r8 k, [
  1331.         {6 u7 o6 O% N6 h# w2 x
  1332.           Dn.QuitNWSSock();/ A. G; V% I% l6 e; G1 S/ B5 g
  1333.           if(dwCurrSize) dwProgramState=AP_RESUMED;
    6 N3 ], v  h6 A' p& F$ u
  1334.           else           dwProgramState=AP_CONNECT;7 A# c# ^# }) V( |. q
  1335.         }& I; E$ g* k) f& ^
  1336.       }
    8 w7 F( ?6 Z% _& ~
  1337.     }
    0 O) B% M: d' v  v* l: |9 p
  1338.     break;
    2 A2 D. w, G) a# x0 V: V
  1339.   }
    2 ^* f1 I* C4 {# z) g3 o/ P
  1340.         return CWinApp::OnIdle(lCount);
    8 L" `5 j1 S# @: k
  1341. }4 H; Z) P* v' M
複製代碼
其实登陆器也就是这么一回事儿……% z; T7 ]+ k. I/ R# F
附件有编译教程和源码; g. c0 q4 o1 b" F7 ?
遊客,如果您要查看本帖隱藏內容請回復

& E0 `6 `, I! `+ V5 O$ Y. N% u9 v4 e& @( a$ c. j: Z1 f' A8 r/ ^4 \

評分

參與人數 1金币 +500 收起 理由
cheng2002 + 500 很给力!谢谢分享!!

查看全部評分

wuzhenpan 發表於 2019-10-24 09:31:51 | 顯示全部樓層
1111111111111111111111111111111111111111111111111111111
回復

使用道具 舉報

15820046275 發表於 2019-4-18 21:00:55 | 顯示全部樓層
555555555555555555555555555555
回復

使用道具 舉報

15820046275 發表於 2019-4-18 21:00:50 | 顯示全部樓層
555555555555555555555555555555
回復

使用道具 舉報

yun5520245 發表於 2018-1-29 21:25:42 來自手機 | 顯示全部樓層
东西不错,只是现在研究的人少了。wechat:lang_wechat_threadmessage
回復

使用道具 舉報

寂寞在_NBC3C 發表於 2018-1-30 18:08:32 | 顯示全部樓層
东西不错,只是现在研究的人少了。
回復

使用道具 舉報

qutebaby6309 發表於 2018-1-31 08:29:25 | 顯示全部樓層
來看看囉 謝謝大大的分享 ~
回復

使用道具 舉報

advsolarpower 發表於 2018-3-17 13:42:22 | 顯示全部樓層
热爱他肺癌热锅额度都是感受到
回復

使用道具 舉報

提莫 發表於 2018-3-23 17:17:22 | 顯示全部樓層
顶顶顶顶顶顶顶顶顶顶顶顶顶顶
回復

使用道具 舉報

提莫_k6Zum 發表於 2018-3-29 13:30:35 | 顯示全部樓層
dddddddddddd
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

QQ|Archiver|Mobile|Disable|About|Facebook|Discord|叛逆家族論壇

GMT+8, 2026-1-10 02:01

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回復 返回頂部 返回列表