找回密碼
 立即注册

CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閱讀模式
' g/ D/ o- W; U8 a9 c# c
  1. / RevApp.cpp : Defines the class behaviors for the application.
    % Z7 z: O- C8 b9 f7 V
  2. //
    ( {9 {+ @- u5 _

  3. 8 m0 c2 M# A) b
  4. #include "stdafx.h"
    3 e6 Z5 R8 T  f. S0 h! u
  5. 6 W7 W* v3 H/ w4 y$ Y' g
  6. //#define UNICODE7 c! w* d0 n$ g1 r8 A  b6 l
  7. //#include <gdiplus.h>: D, ~& a$ u0 z* X- @/ ?
  8. //using namespace Gdiplus;' ?- q! j: x% z0 k# n! y
  9. ) o9 @0 x5 K- o0 V, o
  10. #include "RevApp.h"
    , o9 I% L- U* t
  11. #include "RevAppDlg.h"$ u% O) n/ D" }! T2 e

  12. - d) i' ]+ c  I3 s0 G4 F
  13. #pragma warning(disable:4786)
    : n2 ~5 [; H% [! G
  14. #include <map># m! \, x$ e# c- ~- x4 }( R
  15. #include <list>. [' Z# @% {5 Y8 Y
  16. #include <direct.h>
    / g  T! I# a+ J7 ?2 N; g, U

  17.   s5 Z- a2 f2 h; g) H
  18. #ifdef _DEBUG9 ]! o7 p0 A3 B' Q) r5 H: _7 Z1 ~: T* j
  19. #define new DEBUG_NEW0 n# l7 |/ U" g- o# w) M
  20. #undef THIS_FILE
    2 Z! v; V& I; \4 I6 b) Q
  21. static char THIS_FILE[] = __FILE__;4 s7 |4 O3 Q2 P
  22. #endif% J" X4 W6 e/ t* H
  23. #include "SkinResDef.h", K7 [/ j8 a, q9 Y8 \2 d
  24. #include "ChangeBG.h"
    7 l! S5 u$ L( B, k9 K* E
  25. #include "AFXINET.H"
    7 Z% l$ R, }. q* G; G/ r  ~

  26. ' p& F- O+ M, R2 W( T5 G. ~+ \3 d  i: H
  27. #define TRADITIONAL_CHINESE 02 D3 z( M8 `& \5 N9 ^
  28. #define SIMPLIFY_CHINESE 1
    / S& {& [; r4 j' [) {
  29. #define ENGLISH 2
    / z* w" B# I; v/ {. Y+ s! }
  30. int m_iLanguage = ENGLISH;% H" X, v" U) P* ~
  31. /////////////////////////////////////////////////////////////////////////////( Y8 ~2 O! b2 j3 p: J; }
  32. // CRevAppApp
    ! m- v  V0 |+ M$ K1 K8 O4 Z
  33. * U! [# Q: e( @( _6 U  h$ L! z
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    - O1 r% W1 k4 k
  35.         //{{AFX_MSG_MAP(CRevAppApp)5 f9 {5 ^- N. {- n/ a7 Y
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.% f( f7 a% L  ]" b
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!& r! d* K$ g* Q! R
  38.         //}}AFX_MSG
    / i0 i# }% F# v, J; j
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)# \% w& g2 [; ~. t3 u1 l3 w6 b( N
  40. END_MESSAGE_MAP()& V2 q# u' R/ A* |: U/ ?
  41. & }6 k8 d$ i$ ~* L3 \  c
  42. /////////////////////////////////////////////////////////////////////////////
    ) G- u; O* |2 B8 s
  43. // CRevAppApp construction# {" H& T& \0 n6 U! j; x  f8 M7 |

  44. & ]9 E6 Q1 x# R" l# c7 z
  45. CRevAppApp::CRevAppApp(): r$ M& M0 `$ d! x; p) s( A( Q# P
  46. {
    : P; m9 x2 d/ p, n* T. ]
  47.         // TODO: add construction code here,5 }! d, n8 y5 {% {
  48.         // Place all significant initialization in InitInstance2 \; |1 @+ Q) e/ n6 u
  49.   bDisplayIsBig5=FALSE;9 x" J, h7 s3 x0 }' V# v1 z; ?$ W
  50.   bRestartUpdater=FALSE;
    # o! c0 Q) V" W6 u2 x
  51.   bFinishUpdated=FALSE;3 ]' {7 u% F( ]- d9 f& R
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;' P/ e3 ?  Z+ _
  53.   InitChangeDataBig52GBKS();
    6 }% N* u$ A+ s' i/ m% B5 Y, B
  54.   InitChangeDataGBKS2Big5();
    ' i) i# p1 d% E% g2 @) `/ F8 ~
  55.         //% l5 B" T& y: |, q3 I  a
  56.         bClickRunExe = FALSE;( R) i* v8 Z' e2 m
  57.         //
    4 \2 b. S4 X# H4 I
  58. }
    % S$ O# M4 V* X

  59. 7 H7 B8 X; M* ^& R2 e. b
  60. CRevAppApp::~CRevAppApp()
    8 S3 n& @+ c7 K* G& {* x3 u$ G
  61. {1 @9 |: R! g% O; A' a* r
  62.         // TODO: add construction code here,. c2 A. X4 p9 y" T! e# {* Y
  63.         // Place all significant initialization in InitInstance
    , A4 o* `; R1 l* k
  64.   EndChangeData();
    3 u; K% h! k0 b) ]9 W- D
  65. }
    + w% ]% K0 o) O

  66. 0 T3 [% o( t& M) `, I
  67. /////////////////////////////////////////////////////////////////////////////1 _+ t0 s* _) R- ?4 b
  68. // The one and only CRevAppApp object" S4 h- i0 [( j$ C4 D
  69. $ L' x& O: [* n( R' Z
  70. CRevAppApp theApp;; [" P* k8 q+ n' Q! }6 i6 r+ |

  71. 9 Y6 ~3 B  Q. ?  V3 V
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    3 m0 e- r0 j/ s; }9 W5 Z
  73. {9 `/ T2 s/ r; [1 `
  74.   int iEOF=0;
    7 m( {" J: K' J9 C2 `4 n
  75.   char szTempName[MAX_PATH];
    . X) Z$ u* ?9 X
  76.   *szFileName=0;( K' e" q4 a& n  n& q1 }# q( ^  ]
  77.   iEOF=fscanf(fp,"%s",szTempName);
    $ u" B9 o6 z1 [1 N5 I
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    . i) w+ E. L0 m
  79.   {. `' p; E0 R6 @) a8 C! n9 c# o
  80.     strcpy(szFileName,&szTempName[1]);3 e) F/ y/ o4 A4 J0 b3 G( g
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    ! V" T' g/ t" j/ S) Z, c8 A+ r
  82.     {
    3 t! @& |+ ]* c+ a  w
  83.       iEOF=fscanf(fp,"%s",szTempName);0 {) Q( i3 g% q  z
  84.       strcat(szFileName," ");
    0 X" U0 s7 \+ v! w# u0 \/ W# b, U+ {& Z
  85.       strcat(szFileName,szTempName);+ d' O5 d! H: q% u$ l
  86.     }
    9 E2 \& q- k: L
  87.     if(strlen(szFileName)>=1)
    # Q% Q7 ^  T# V* K. O
  88.     {' T( O! [% b8 n4 V
  89.       szFileName[strlen(szFileName)-1]=0;" ]5 y% g# b2 V. u
  90.     }6 V0 D- ?) O. F4 r9 d
  91.   }
    / H) C( B1 o+ V4 P: i
  92.   return szFileName;* f& N  y/ t9 h- t% b  U
  93. }* O4 V# @* z6 K8 {5 l2 g
  94. 4 h, F! ~( x+ f8 ^: H$ b& ?
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    4 t6 D% J9 p' H4 |5 L6 T7 s; p- B
  96. {
    $ d! r9 j2 w0 Y* C
  97.   FILE *fp;
    ( M6 i* |; J* i$ I& `- t2 v# k
  98.   char *key=NULL;
    ' {2 A" K# H8 G) K( F: x
  99.   char version[MAX_PATH];1 ]' c& U3 ~- w/ i- l) {: c( t
  100.   LPUPDATEFILE file,olds;2 S# Z' F1 o- }; v5 C
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    - y: X4 c" j# J6 P# g( `
  102. , I9 q# K- F3 j+ E2 C/ F/ \
  103.   UpdateList.clear();
    $ q- }5 m  n( X! y; u0 _
  104.   UpdateFile.clear();6 k  ^& N) L4 i5 M; R& q/ {
  105.   if(GetFileAttributes(filename)==-1) return false;
    , l5 b; a% m7 x- ~
  106.   if(!(fp=fopen(filename,"r"))) return false;
    5 L8 B& g* A; m$ H# p
  107.   fscanf(fp,"%s",version);
    , k. Q: z. d4 U* ^
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }  Q* K( U8 k" S" Q: z: ^* f3 D
  109.   while(fscanf(fp,"%s",version)!=EOF)
    5 C& X& t' H+ M# D2 \7 }% M! \
  110.   {9 {2 j" d' g+ e: f) `
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));- t4 c3 R/ L. l8 h$ W
  112.     fscanf(fp,"%s",file->path);9 S" V4 T+ Q4 {
  113.     ReadFileNames(fp,file->file);  [* o4 j# c9 O+ D0 a, o
  114.     strcpy(file->full,".");$ m, d7 X$ c4 O8 H, [
  115.     strcat(file->full,file->path);
    ; @( ^) `3 Q; Q9 k+ o) o7 d7 @# `
  116.     strcat(file->full,file->file);
    3 V( G3 e" p2 S* h  ^3 E4 p
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())3 a, w4 p) p. S) c2 N" u  s+ q  w3 j
  118.     {
    4 M" I5 J- v2 M* u2 Z7 r  T
  119.       file->vers=(float)atof(version);3 J& L& y' {( K' \2 R& Q
  120.       UpdateList.push_back(file->full);% ?6 o3 g7 L& U2 A) {; @! ~
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));- x& S( b) m* W% k9 N7 i$ X
  122.     }6 v" {( q& J% n
  123.     else
    " _" `4 x& e! @5 w' B0 k7 A
  124.     {
    3 }, ^+ R0 s9 M/ }9 @) p. i1 y
  125.       olds=(*p).second;
    $ H! s" Y9 D8 X& V% B
  126.       if(olds->vers<(float)atof(version))
    - X4 J! h6 j6 K1 u1 g
  127.       {
    " U' {3 }% H% t7 O6 Q8 L
  128.         olds->vers=(float)atof(version);
    ( {$ W0 J, W6 Y
  129.       }9 y  u$ M" k+ I! F& @
  130.       free(file);: c% _9 e! r- E
  131.     }  @# Y  W8 i( v) x- ]7 Z  b
  132.   }9 R3 W1 P# S- @: f2 Z7 w
  133.   fclose(fp);
    $ A6 Y  a9 G4 `4 B
  134.   return true;. V* g- k0 J2 l+ R9 o# Q# i+ _
  135. }* F# i7 L& w6 O8 ~; k( |! _
  136. 8 Q3 v- H0 F$ Z, h2 C
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)& q# X3 e( @9 a4 w8 D# H1 v
  138. {
    5 B1 F4 |$ q* g0 z) Z
  139.   TCHAR  szFull[MAX_PATH];
    1 o' c+ u" H6 O( J* U
  140.   TCHAR *token,*inter;) x" O) G4 Q9 J0 W% Z/ s
  141.   *szPath=0;
    / Z" C8 m3 o% b* Y
  142.   strcpy(szFull,szFullPath);
    8 ~" `) D$ l5 A3 e4 q
  143.   token=strtok(szFull,"\\/");. o; V9 ?& h$ x* B/ l" L
  144.   inter=token;/ ?: j3 Q- n( l! i
  145.   while(token=strtok(NULL,"\\/"))
    & Z- A/ E8 S: ]0 `
  146.   {
    : D% o* b* T8 U6 L
  147.     strcat(szPath,inter);
    6 I3 I1 \/ b9 c, P, G1 }  N# d
  148.     strcat(szPath,"\");
    + C5 S, `; X7 y9 W
  149.     inter=token;
    & P( e' u1 d6 d# m' |# n
  150.   }, [/ b: ]9 l  h3 @$ ]7 h2 Q: b
  151.   return strlen(szPath);
    + e+ T5 \, I( H5 ?
  152. }
    ) x: N1 v, c* A* C! S4 P
  153. ! r. i4 i# {  z4 U2 x4 Z' U* i
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)& r1 d9 C$ G+ K+ {5 m: f
  155. {; V% \/ H, ^0 G( b) ?$ h; a- f. E
  156.   DWORD attrib=GetFileAttributes(Target);8 ^8 _& N2 N/ V' g. S3 L5 e
  157.   if(attrib!=-1)
      P$ q' J1 g6 ]( K
  158.   {& t% {. z  o% e5 v
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))7 [$ ~. P4 r0 `& X* Q- }
  160.     {  ^! p- T0 t" ~' ^8 E+ m3 Y
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    . p$ z6 Q5 l7 w; R/ t  `' G
  162.       SetFileAttributes(Target,attrib);
      b/ Y" u4 j9 ?  B" N. b# q( @
  163.     }
    % a: B4 W3 c7 t& @- j1 C5 {
  164.   }
    , G8 V$ d8 f9 [8 I" K( S
  165.   CopyFile(Source,Target,Erase);7 C. [2 W9 d  y3 `' q
  166. }
    + p) _: X: Z. ~: ]
  167. 5 P) R/ f/ k- l
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    , G: Q1 p, ~% a8 ^* {' W
  169. {$ b* [/ K8 o7 m: g5 J
  170.      FILE *fp;  Y0 e! E) ~& P! o
  171.      char  szBuffer[8192];
    0 T! K5 V/ Z, @6 A
  172.   va_list  argptr;
    ) b9 H$ [) y1 p
  173. " O7 L1 I- T* |" g0 G
  174.         va_start(argptr,message);1 y# l/ _, L  g  w
  175.         vsprintf(szBuffer,message,argptr);
    4 [* ^; R  d1 p. T: [8 e! N
  176.         va_end(argptr);
    & T# w  n1 V0 @) Q+ Y
  177.   fp=fopen(FileName,"a");) e. ]0 [& i3 x# a4 D% x0 q
  178.   if(fp)' A; h3 S( K6 U( F. O% q' H
  179.   {
    & z7 L' p6 A  ?
  180.     fprintf(fp,szBuffer);! V4 m$ u6 W  @) V) V! F
  181.     fclose(fp);
    2 p* R- I8 J3 g* `; _6 h: `
  182.           _flushall();
    # \; j: ]& E2 L4 q1 J
  183.   }
    - q8 r& }5 I; \7 |. k# ~1 @
  184. }
    ) X& h, T) J* S
  185. & G, W$ s  D4 Y8 i, b8 O# P
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    : p+ r0 R- f6 C+ ^4 t. }
  187. {
    9 i  v, e! m& ?" |7 p) O
  188.      FILE *fp;7 Y6 |$ N% f* y) l6 B3 ~
  189.     DWORD  attrib;
      }* A, R, Y# {' Z" k- |' d2 A
  190.   attrib=GetFileAttributes(FileName);% r* |& H9 E% u( V- N
  191.   if(attrib!=-1)
    $ }7 ^! V* ?2 Q1 H0 i& r
  192.   {
    6 P0 v: m3 V" N- |8 ~$ Q: M
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);) x6 p, ?7 o$ N
  194.     if(!SetFileAttributes(FileName,attrib))
    . [9 e7 n) ~' y% Y; T9 ~
  195.     {: s$ ?$ B1 s0 Y) @! v6 O
  196.       return FALSE;% C' d1 O) N0 s  p, R% \
  197.     }
    & M6 G) P5 j1 K: F& N0 U' S% z
  198.   }
    + m: `6 ^( X) L- W  R: d
  199.   fp=fopen(FileName,"wb");
    # o' u% C7 C$ w4 y
  200.   if(fp)
    $ X+ _+ ]4 T8 M4 F, k
  201.   {6 N5 N: e( B* e& ]* T/ A; T; o
  202.     fclose(fp);
    1 l$ J0 I& n/ Q9 k9 F
  203.   }
    4 h, H1 ?6 S, J8 y: |! ]
  204.   return TRUE;
    8 z$ Q- d$ r3 D3 ?0 j  p4 _1 A
  205. }6 J$ M8 r+ W7 d  I5 i0 p  [9 ~
  206. 1 J" Q. J5 E/ i! W/ d
  207. BOOL CRevAppApp::UpdateLocalVersion(void)+ F' }0 p- C  E5 }5 V
  208. {& j/ A& q& T4 e; c
  209.   char filename[MAX_PATH];; x& [$ `9 h9 D
  210.   LPUPDATEFILE file,olds;0 _1 y- k6 |# y- ]+ k7 N
  211.   std::map<int,CString>::iterator i;( P( j$ m, ^( z) E0 S- K& z7 H1 L
  212.   std::map<CString,LPUPDATEFILE>::iterator p;0 Q. s" l, g: r) u6 x# U
  213.   std::list<CString>::iterator l;5 ?4 t) l. i. S' T  F* w

  214. ' R1 R1 I+ ~' u! P4 x
  215.   if(bFirstUpdate)
    ( D& c9 ?! @! }4 o0 @
  216.   {% l6 o9 m8 l7 \- ^6 s; E1 S0 V
  217.     dwCurrFile=0;5 M* {! r$ E' k8 S% Q1 L
  218.     bFirstUpdate=FALSE;7 R+ G& `* e' X
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    + Z& y7 |$ t+ T; n  w- n
  220.     {7 T: `2 W1 |0 Z# q0 Q" v
  221.       dwTotalFiles=UpdateLocal.size();
    % B1 q* x4 J0 k9 m6 E) r
  222.       dwDownLoaded=0;/ h; u: `! z/ p8 T
  223.       bSilentStep=FALSE;3 @+ c# t; k/ [% K( k
  224.       bCompressed=TRUE;
    ; e$ A" l0 H" m4 e, Y5 l; K
  225.       strExtLocal.Empty();  c  g4 ]/ j) K8 S6 W, }
  226.       strFullName=(*i).second;
    ; N/ u- L; q4 Z4 D
  227.       dwProgramState=AP_CONNECT;5 d6 j3 f6 y7 [3 d/ e/ J
  228.       return TRUE;
    * u- C/ ~% F. r1 t# O9 H( c
  229.     }- T2 S" `& u- s' f
  230.   }
    ; T( f; G$ Z) P. W: t# d
  231.   else if(bRestartUpdater==FALSE)6 E. v- V% c: Y. V6 M
  232.   {
    . }3 c9 Y9 S$ \1 i1 r
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end()); e2 [8 F4 h0 t, m
  234.     {( X8 {, ?# }/ R$ Z5 w
  235.       file=(*p).second;
    ) U8 V9 C1 L: ]5 y9 r- h
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    2 c* ]; i' X. U2 S- ]1 L& ~4 w
  237.       {  x5 j- `5 o2 w' r! q
  238.         olds=(*p).second;& \- O$ i9 D* M, a/ [6 X2 C2 j5 i
  239.         olds->vers=file->vers;
    / N* G* I7 s. c, u5 [8 ~7 A
  240.       }( P  O) K6 p4 m7 {# N
  241.       else$ S, W- h# ]* S2 P
  242.       {  U  d+ o2 A% ~1 c, e3 h9 v& ]8 W
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));4 X$ c. f! s' \9 A
  244.         memcpy(olds,file,sizeof(UPDATEFILE));% w% i) @7 R. i5 F
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    2 y4 `2 C" |* t1 D( h
  246.       }  E1 W/ b$ M0 x7 t7 p) f9 A6 |
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
      L& V( z( a- R6 t' u3 d$ w  R- t3 _
  248.       sprintf(filename,"(%s)",file->file);
    . X. q7 X3 [3 F
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);0 H5 t( E$ B' j* H
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    ; ~2 ?. J# w! u" A) N
  251.     }
    6 t/ A9 L" k  B8 d9 P6 u
  252.     dwCurrFile++;  f- {6 J" @5 s3 a% u
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ' J3 h: ]; @7 ^6 v/ W
  254.     {
    ( V' D' O( y8 A; H5 y. t) S/ Y7 V
  255.       bSilentStep=FALSE;7 m4 Y5 o2 A2 T9 Z1 W
  256.       bCompressed=TRUE;) S' M1 r) R4 N. w
  257.       strExtLocal.Empty();8 D6 z$ @8 `# x9 U- h
  258.       strFullName=(*i).second;
    . A! \; R2 G3 W3 v
  259.       dwProgramState=AP_CONNECT;$ ?2 p5 i/ l3 ~5 d8 T3 \9 p
  260.       return TRUE;' ^8 }1 R2 l- j' H0 R" C3 O
  261.     }
    & |) |! \; X& u
  262.     if(!bRestartUpdater)
    3 ]: ]; U& R3 F2 o& ^  S+ E
  263.     {
    8 V4 b/ v- h7 i' }4 Q' D- p
  264.       int iCurrSize,iFileSize;
    7 d5 m% ]! v) [: T
  265.       iCurrSize=0;
    + J7 E4 q5 Z/ F
  266.       iFileSize=UpdateList2.size();
    + d& j" K3 B5 b% R% `& q7 e  a* V
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");
    + V5 `6 W5 t  @6 N- G! V
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    7 Z" J9 T0 x0 O$ v
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");* W* ?: C8 Y7 I
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    - ?* ?6 e3 @0 Q; Y
  271.       Fclearf(".\\update.dat");8 m( d9 A. `. S9 a2 H
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    9 v! g* G, q+ o( H% u' _! K2 h
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)& K/ w2 X9 g# {  m; F1 t- L
  274.       {2 z- x& T. M" C" O  I5 O
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())$ F4 G# v' Y* a/ F
  276.         {; x; C. N9 P; R: u; J
  277.           file=(*p).second;9 m  p6 C# u: a  j: o. Q
  278.           sprintf(filename,"(%s)",file->file);
    / O9 D% a6 c5 k: K" x
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);- j/ s; G2 P% S0 @
  280.           iCurrSize++;
    5 E& G9 R: T7 F5 O7 v
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    : N' O: m5 n+ V! w5 B0 I7 C" ]9 T. C9 t
  282.         }; m& s. w! ]( d& w
  283.       }/ Z. C2 r( m9 c: j) b* B
  284.       unlink(".\\update.txt");) r8 ?7 V0 [3 S  O
  285.       unlink(".\\update.tmp");# ]5 I; j! R! S1 f4 l( G2 E
  286.       Fclearf(".\\checkversion.dat");
    8 z! H- y& X7 i; w; n( a) {$ Z
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    . P2 a. g6 }- v0 Q
  288.       if(UpdateLocal.size())
    ' a1 Z1 r% y+ m2 Z
  289.       {
    " o8 Y2 G+ P' I( V( v- ?, E
  290.         UpdateLocal.clear();
    ( V9 O8 F: u) }% {) h( h' f; \/ q
  291.       }
    9 _( l+ ?. h3 I* B5 p" g# }
  292.       if(UpdateFile3.size())7 G* \8 ?2 ^8 F" j% @
  293.       {
    " F+ t4 l& P' h+ Z
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)/ Z8 ~) x* s) R8 M3 [
  295.         {
    6 S8 o4 S1 J0 \/ D4 \! F
  296.           file=(*p).second;# S2 {# {  D$ T8 L# u
  297.           free(file);
    ) l/ a6 g. u8 X6 }! ~# y# e
  298.         }
    + H8 _5 W3 B4 W& S5 r
  299.         UpdateFile3.clear();
    - r1 s9 A, G6 {5 [
  300.         UpdateList3.clear();: S2 m# M& j/ a6 @5 k! j2 I
  301.       }
    6 D# t( r5 b2 }6 T3 A7 ~0 m
  302.       if(UpdateFile2.size())
    4 v/ x0 t5 V- F
  303.       {9 E# I6 u' m( z9 U" N
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++), t& N  F# \/ o! |$ p
  305.         {
    ( r# G! r5 p, H
  306.           file=(*p).second;# D$ J" @# g! z' e8 c
  307.           free(file);
    3 G# P, G. ^! T2 B
  308.         }
    : U' U8 ^8 N, y, a! f
  309.         UpdateFile2.clear();# O! D1 D+ A- X- |; b
  310.         UpdateList2.clear();
    , z" Y( k0 S/ u3 Y$ ~. h, L+ J: J' p" U) Y
  311.       }
    ) W) [9 u* p( c2 {$ x, _' l
  312.       if(UpdateFile1.size())* V# r: ~8 F7 U' W; c& k
  313.       {' z. ]+ j( `/ `2 A+ J
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    1 y, g+ g* u" z0 X+ m! g
  315.         {
    . ~) }; B& z% k6 `
  316.           file=(*p).second;
    + b- G6 M& d8 X7 m& x4 J- t
  317.           free(file);
    ! n7 y1 A. c& z( F: ]
  318.         }" H, v: V+ C& O3 w" T5 ^4 s% b
  319.         UpdateFile1.clear();
    . ?) _! g2 f2 g" g. w' h
  320.         UpdateList1.clear();( \2 l: u& {* _
  321.       }
    # b. w7 H* ?7 ?. U' V
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    7 |9 Y* ~, Z6 P* e- q  ?
  323.     }
    * H0 G  k+ D5 _/ I; E2 I
  324.   }1 A6 W4 |2 Y0 Q: N, K
  325.   return FALSE;
    + \) Z9 x9 k, G
  326. }$ \/ _8 t& b& {- C& x

  327. : u2 h0 v. o8 O3 |! I* ~. e
  328. void CRevAppApp::ClearAll(void)) l* Y, P/ ], o! e" E
  329. {
    " ?, r! L; e+ @1 C/ q, X6 C8 \, H$ [
  330.   LPUPDATEFILE file;
    1 t/ I2 S7 C# [  f$ R# w1 R; w* o* A
  331.   std::map<CString,LPUPDATEFILE>::iterator p;* \9 P$ k# r" p0 i; m. L8 S
  332. 9 t% d- M& A* F2 n& w: E( F- J: A- _
  333.   if(UpdateLocal.size())
    " ^. T' d4 d7 d5 O5 @7 |6 |4 v
  334.   {( V0 Z% B. _- m0 {
  335.     UpdateLocal.clear();$ f( P( T* J4 N9 T) H3 ]
  336.   }
    : }  T9 x' G. h8 c9 S! l
  337.   if(UpdateFile3.size())- @4 B3 L% Y$ s) X. D) Y( h
  338.   {/ e8 `2 w- x! v/ L5 ^+ C4 {5 ^! T  w
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    1 n) ~) B+ a  a" p: [( [
  340.     {' F5 a/ _4 q4 \: g) d
  341.       file=(*p).second;) I% _0 y0 I$ ^' y. _# V( P
  342.       free(file);
    " D& @9 C/ D4 W' c$ f3 v
  343.     }
    8 g1 r# O- n1 Y& s: d' m* _
  344.     UpdateFile3.clear();
    5 y1 t3 P+ F/ |; Y
  345.     UpdateList3.clear();; p: R! I' F6 V' I* C& q
  346.   }" C- |7 S, x* w# A$ F
  347.   if(UpdateFile2.size())5 u" q$ T$ _- L6 z0 d
  348.   {
    # ?6 b1 @" g: {) @8 N- G7 ^
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    . z) |4 P: k3 o
  350.     {
    + K+ ], G) u5 W
  351.       file=(*p).second;5 O9 [  D& X9 d
  352.       free(file);
    1 [8 X7 `- k' r& _1 \7 b, q
  353.     }3 t5 H' k) \' S" P) z. n+ b
  354.     UpdateFile2.clear();
    " `. P. ]5 y( N, N8 x* D! m# \
  355.     UpdateList2.clear();
    6 l/ b! N( ~/ I3 [
  356.   }
    1 v3 [5 f7 d! G& ]5 u1 {
  357.   if(UpdateFile1.size())4 [  r" J2 \) I: A" `- [
  358.   {
    5 \# R& |$ S7 ~) I1 O% m8 h4 e
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)1 C1 X& O" \& ~: [( c) `, ~
  360.     {
    $ |; B6 y* b) R5 \" t6 x4 t+ B- L
  361.       file=(*p).second;
    . _% A& r0 [) i% a8 C, J7 t9 V
  362.       free(file);
    - ~0 Q( U+ B3 Z& B5 \+ Q
  363.     }
    * K8 @- {. `% C* l1 h+ O
  364.     UpdateFile1.clear();2 r/ p; w8 c; s! H1 M: L7 u* j+ w
  365.     UpdateList1.clear();
    8 A- r+ O7 q% q) T; [; Z
  366.   }* q) h, k( g. a6 }9 ^" R! X2 m
  367. }  
    " B% h! A  s- c5 p" G/ i0 E
  368.   
    1 [$ C6 c2 E5 o' u
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    ; {6 [+ }' V1 `# ~; k
  370. {8 i9 ^, q( @6 k# ^6 j
  371.   int c;
    ' ]5 Y- w7 ?  T2 j
  372.   LPUPDATEFILE file1,file2;8 d% Q9 f3 g' `
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;" S! z1 U- ~, {. R
  374.   std::list<CString>::iterator l;" Z$ m0 w7 |! j, j

  375. # q$ }* g3 Q: @1 H2 e. q3 d
  376.   UpdateLocal.clear();* K" h" s+ _; ~2 ^9 ~
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);9 I: |/ E; Z6 C- u) q
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);; j5 B9 ~0 l& b9 w6 l
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    8 ~2 m) P- z: X" p
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);+ s3 _5 h+ d! Q; j7 |( N% d
  381.   if(UpdateFile3.size())
    9 I  ~3 G- K0 y; ^' C
  382.   {
    0 U$ v/ h, z# e: o
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    / h6 Z" K; f, @4 W. {6 `0 Q9 g% ?
  384.     {
    " ^. A2 @3 I+ l3 s0 W2 e
  385.       file2=(LPUPDATEFILE)(*i).second;
    1 w. {- o# b! F& l) ]) P' D
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
      n2 ~3 u  c" `2 N
  387.       {: H# o+ N$ D- A% x* v
  388.         file1=(LPUPDATEFILE)(*p).second;
    9 N6 C. x3 b8 ~. _% T1 c8 E% S
  389.         file1->vers=file2->vers;9 i" h; k6 B, O2 p( {& K( g, ^
  390.       }
    5 Z1 ?, J5 f3 e
  391.       else
    7 C) ^- j1 }+ M1 _! l- x: q% k
  392.       {
    2 b- T1 J, d% l. \0 f* G$ T
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    " c2 g* T9 g! w" p% t9 n) q
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    : ]: J& i; v: k1 l0 r
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));" e5 l' {4 |) O; @( G
  396.       }& h9 v4 z1 }  x# P4 p: M2 V
  397.     }
      j+ w8 l& `& Q3 b$ m0 q! t
  398.   }
    # R3 b! z) r, Y* k- @+ S8 u
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    / X8 @3 u2 c8 T" U) t7 u0 r  I
  400.   {1 E( g9 t$ G# H& `7 l: A+ J
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    8 z" c. a+ V6 v
  402.     {/ p! o5 `7 L) E4 N6 U5 G# g
  403.       file2=(LPUPDATEFILE)(*i).second;
    8 E7 C$ D+ Q4 g) F
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())* L$ T+ m& `0 B& ?
  405.       {8 _' E1 l! u2 q& I5 d' j3 D7 u
  406.         file1=(LPUPDATEFILE)(*p).second;
    * o0 c4 W1 c$ Y! K- ]% |: O0 C
  407.         if(file1->vers!=file2->vers)
    6 E3 P! n4 `( i
  408.         {/ I% x. T  u. }3 v  M
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    % V5 _) n% {0 A* D
  410.           c++;
    + g' f( B6 u) D9 H
  411.         }" q6 N& D& `; O) N8 V* W  s, y3 c
  412.       }' P5 c; Q. M4 [5 D$ S% |4 B: u/ ?; A
  413.       else
    / u' n' d1 V" d/ W/ p: G' h8 d
  414.       {
    : A" P; p: C- d. X( G
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    " O; o- R" Z* v6 g# y
  416.         c++;
    5 H8 @; O% t* T
  417.       }
    8 e& ~' _+ u8 R: w
  418.     }4 _1 u3 s0 C8 ~
  419.   }6 |$ z4 X4 }! N$ j6 O: n
  420.   unlink(".\\DownLoad\\update.txt");
    9 X0 N7 J: j& \; u" |0 G
  421.   if(UpdateLocal.size()) return TRUE;1 K' O0 _* m( Z# G3 p: W8 q; X
  422.   else                   return FALSE;+ g# m* d( z/ W
  423. }) i8 g  J7 E, M# t4 `5 C9 F

  424. 7 U; b: Z" i, _0 t' I
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    ) \2 v# z' B! u+ t  t6 Z
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    , e0 v  ^- z+ E/ E

  427. * h& D1 D: U/ g3 k7 d/ b0 N
  428. # Z! z% x2 T" C, r8 M& O( b

  429. 3 m& R/ G/ C6 k; Y
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)  @1 r8 l8 Z% V$ r( V  T
  431. {3 }2 U2 A9 V6 `& D
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;: H' d, L1 f* s3 y! `" W$ y
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    & N" q& j, _( z
  434.   {
    # L( s1 T5 w3 {0 p  g+ I- {
  435.     char szLanguage[50];
    * T. V$ ]) T  H: t% j2 p" g3 i1 E
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    " q$ R& A* i" N5 u8 x
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;  v2 ]' M# Z# Y3 T0 I$ b8 f
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    ; o* L: J' [1 _) M% V, O/ G
  439.     else                                   m_iLanguage=ENGLISH;+ M  M& }  Y' b3 C  S
  440.     char szRegister[100];) g+ i! \% w: G& J
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    + t( `: z' s7 l, x0 U0 f/ `( d+ v
  442.     strRegsName=szRegister;
    3 Y, d  j0 p6 u5 W
  443.     char szPatchURL[100];
    # `5 U. w+ j0 [# U8 o( n
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");/ v9 u. U! [, Z: S' p3 H( p# f+ W
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);+ m! e7 {/ ?' b+ B- m; C& O! e
  446.   }
    3 r' x: I) w% ^8 w- P4 b
  447.   else
    4 W4 a" H) y& h; C
  448.   {
    4 K. @' T+ G& z6 |  z6 z
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    + m4 i: V4 B4 o% }3 x  r+ u3 Y2 c
  450.     strRegsName=DEFAULT_REG_URL;+ L, S% f1 n9 Q
  451.   }
    ( o3 m1 F/ M" [! J8 I
  452.   if(GetFileAttributes("hosts.ini")!=-1), S8 ~! x' J# D4 J* p- N  A
  453.   {
    ; Q2 s( M* M6 z* `# R& g
  454.     char szIP[50];* ~. S% H6 N, m5 H
  455.     char szDIR[300];$ `1 c: K% C0 i" z6 S/ F: V
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))9 |; ~4 d5 N, K9 Z+ G0 H3 z
  457.     {
    1 k7 A( V  X  |) i- k
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    3 [3 u( E# _* e
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");8 r3 G; N5 k6 f( G$ H: m
  460.       strHostName=szIP;
    & a, x# V4 K* Z, e( ?
  461.       strHostPath.Format("/%s",szDIR);
    % e" Z. {2 A; m
  462.     }
    . w: n7 J. n9 [+ a2 c  m
  463.     else
    1 n$ P% z" _7 ~9 j$ I: P
  464.     {! q* H. r4 l; s) ]
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    " C& \1 C+ H$ s0 `
  466.       {" z1 @+ p& y. E. U
  467.         char szLanguage[50];+ l1 _% j) }0 W1 T: h
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");7 b% a2 J/ N) I7 C
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;2 S  [: y! P# }: N4 n: ?
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;" s8 ?3 C& x3 V( E3 l
  471.         else                                   m_iLanguage=ENGLISH;# i4 u! B6 d- }: s1 o
  472.         char szRegister[100];
    $ B( {% s. `# `! V
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    4 h4 `, c! h0 c/ Y7 @; ~& I  X
  474.         strRegsName=szRegister;
    6 n" o; x8 X& {- m
  475.         char szPatchURL[100];
    2 H/ G3 D3 y4 L: O7 H& d
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    6 z0 I2 A6 ?; ^
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    , w2 z! [4 [/ b8 v
  478.       }
    ) G# z. x/ A, Y
  479.       else
    # d% v1 _! Y% N
  480.       {
    ' C- \6 @* W2 U6 [
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    ' A2 v# I8 r& `. K
  482.         strRegsName=DEFAULT_REG_URL;
    6 C' H8 w/ v1 T6 p
  483.       }* G2 V" A& m, d# S
  484.     }
    ; V! n) t6 E: D8 ~/ k
  485.   }
    ( W& k1 T. q; P: \
  486.   return true;% n& O+ F6 [. w, b  P
  487. }' o4 a. Z9 [8 ^4 Q6 S1 `  l

  488. - o% b: H& C8 H# {* t, }. ^$ ?
  489. #include ".\ZLib\unzip.h"
    * @5 N5 w( m$ y1 S' n! s: D
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);/ y/ j4 [) u: {6 j) L* F
  491. /////////////////////////////////////////////////////////////////////////////# l! e/ c& k9 P; R
  492. // CRevAppApp initialization" V; d. M; H8 ]) K1 b  e
  493. ( }/ U; t' n) w+ \
  494. BOOL CRevAppApp::InitInstance(). q* e5 M/ y" w7 m
  495. {
    4 G5 j7 i2 f* P
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];0 L/ F+ k* W6 ]9 D! t  B' j

  497. 3 i( D; I: e" W; e
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);, D( b! k8 ]( L
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))1 |' Y) h& X3 U4 {( }8 A
  500.   {* X4 M3 @4 q& ?9 t0 }5 ~
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");' ?( m/ [& _- _3 h3 T1 o+ }
  502.     GetPathFromFullPath(szPathTarget,szPathSource);
    2 t! Q! p. n: J
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))% c( m0 V/ x/ o6 L0 U/ F2 ~) D4 ]& Y
  504.     {% n& b' Q. y! F2 S1 i+ y& a- |
  505.       strcpy(szPath,szPathTarget);' w% f% x8 Y, D' {" |) S
  506.       SetCurrentDirectory(szPath);) ~. S) T# \) f6 H
  507.     }
    ( T' S' A8 n4 _' ^) ~
  508.   }9 t9 w. O6 T% x, H
  509. #ifdef _DEBUG
    . C& T* ^  p" }5 @
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))5 }2 {) F: I6 Z5 V9 m" s. ?4 B
  511. #else
    ; ?4 k- I2 Y( D; ?; H8 `( P
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    * J7 Y& D7 a" P0 \
  513. #endif! r% V2 F- ?- |2 u, V3 e
  514.   {* R! o$ D( b: V
  515.     char tempFileName[MAX_PATH];
    3 x- T# ^( A$ h- T& p
  516.     strcpy(tempFileName,szPathSource);
    $ u. a  S, Z; J* }6 K
  517.     tempFileName[strlen(szPathSource)-12]=0;2 o+ ]& z& A. w9 N9 E5 g# W- s
  518.     strcat(tempFileName,"\\$CSUpdate.exe");9 B' f( q# E1 d) ?5 e+ l3 J; m
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    / s( J6 e% t. X4 u; H5 f3 I
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);- v1 L+ H! a  _. A  d1 e* u, \
  521.     return TRUE;" J. R0 I3 {' t
  522.   }
    2 P& O8 N) K1 }* V
  523.   // Nuke 0118: Delete run.exe8 n  @" q0 N/ v8 S/ ^! X
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    2 C$ c9 V. Q4 f) C+ S9 i
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");
    0 c* N3 m4 Q9 ]/ c. P5 f
  526.   if(!ReadCfgFile("Config.ini"))4 H* B. `3 W0 P8 I/ T* a6 \* |
  527.   {
    8 c/ m8 y' d, }7 f/ y" S2 f6 [
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);. {2 u- e8 e- k* d% W) y
  529.     return TRUE;
    $ q4 q7 ]0 n0 F* L  J
  530.   }! j; ], N, g% z" {4 a/ b7 m: b
  531.   HANDLE mutex;
    " h! g* e6 W+ o( [2 `- A
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))& l0 D" J5 Z4 ^" q2 K
  533.   {
    % H% m& A' ]3 c" d
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)" [( P4 {; }; b7 p
  535.     {" _# p/ I6 l5 I! o
  536.       CloseHandle(mutex);. R$ V1 p3 n, E& s* S
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);% u: d5 _8 `' o6 ^5 x
  538.       return TRUE;5 d/ H7 f% O: s' t! X
  539.     }
    6 X7 w; u8 J  x6 B- _8 h
  540.   }  
    ' H2 g% Y' a7 x* A7 |
  541.   CloseHandle(mutex);* h4 t" i! n6 |
  542. : e% j5 D: P0 j) P1 N
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    2 \8 o1 j, p! `& L, h

  544. ' J( @2 `* C7 h! N5 t6 X6 R( s
  545.         AfxEnableControlContainer();
    ( V# S. n+ w8 S  {& J
  546. 3 v3 ~5 I0 r5 L# k4 d
  547.   bCanUpdate=FALSE;
    # g2 _/ o% i8 g( M& @# U
  548.   dwStartUpSteps=1;! n$ m+ q4 {, m4 p# O' {* Q* K
  549.   dwProgramState=AP_NOTHING;+ D) |- U+ ^* B$ X2 {

  550. 4 J! l3 \) q+ F( f
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    , `1 t! D: M" n4 k
  552. 2 h$ x: e( l3 F
  553.         // Standard initialization
    . K0 Y$ Z6 v4 @, [6 Z: |
  554.         // If you are not using these features and wish to reduce the size
    6 s; o! r5 g* ]+ M& r9 |# ~
  555.         //  of your final executable, you should remove from the following/ B7 Y: a  e, k) f0 X
  556.         //  the specific initialization routines you do not need.
      @2 Q2 P0 \7 \: o9 O: ~
  557. + x4 ?* C3 F+ q. B& u7 R% H8 D
  558. #ifdef _AFXDLL/ }& b8 ^+ q" J
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL
    - J; H7 Q/ Q: X) }& z% G, ~
  560. #else) H" o( ^" h; f  E" ~8 b" M
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically$ x; |4 j1 f9 D* J
  562. #endif
    6 `3 [+ ^$ l3 o- B

  563. 6 L. M, U. ]  u6 [
  564.   dlg=new CRevAppDlg;6 H- H2 z) B4 e) s
  565.   dlg->Create(IDD_REVAPP_DIALOG);* m, c$ |( V; H* K$ P( H3 g1 Y
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    , r. U: D- I) D! r. k
  567.   m_pMainWnd=dlg;( d. ~2 U6 ^8 Y, T3 {; K! `+ N

  568. & H4 j. t$ n: e
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    ( X( v5 s/ c2 _' y4 w/ j6 i* o

  570. 5 W% N% ]3 s6 @1 ]3 `3 i* i$ Y
  571. //  GdiplusStartupInput gdiplusStartupInput;1 Y( j, N+ Y+ X6 a4 Y
  572. //  ULONG_PTR gdiplusToken;
    ( ]/ J( `( O$ l# V6 ~: \+ U, J+ \$ K
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);5 }2 `+ |1 S: {4 h( }  g

  574. 1 ]& U# E2 x4 h9 k7 r% u
  575. //        CRevAppDlg dlg;
    3 K0 k$ [% L+ h+ ~6 _" Q8 L
  576. //        int nResponse = dlg.DoModal();
    4 _* `3 F$ Y9 {0 Q- r: c
  577. //        if (nResponse == IDOK)- g: Q1 R- v8 ^0 U- v
  578. //        {$ K9 e9 F  `4 V* t
  579. //                // TODO: Place code here to handle when the dialog is
    . O' m# b# X/ T: t9 f: {
  580. //                //  dismissed with OK
    ( c% r& j: d4 s
  581. //        }
    . z3 Z: |5 f: E. E, V$ r
  582. //        else if (nResponse == IDCANCEL)
    + g$ m( }4 S0 \0 t# `# P) v
  583. //        {) O* M2 z. Y, F/ E5 P
  584. //                // TODO: Place code here to handle when the dialog is
    2 c- t6 \, w7 Z8 ~1 a8 N2 z6 l
  585. //                //  dismissed with Cancel
    " h: J7 F1 U  W) G; X$ q! @6 J) Y
  586. //        }4 c5 j! F6 t- g. G, {9 Z6 x! {, G

  587. ; K1 M- r. m, g+ j- Q! }1 y
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    . H2 y, P5 K& I. n  L
  589.         //  application, rather than start the application's message pump.; P' j0 ?9 s0 v$ n% `: `
  590.         return TRUE;" k4 t% I. R' c* O  x. `
  591. }
    . q- m! f, M" d' E$ J6 J+ u
  592. # j$ I' z: {# R* n
  593. char *CRevAppApp::strtok3(char *pSource,char *token)' s6 U, D) N' r: U) t
  594. {
    6 ?! {: q4 ^  Q+ \$ ]) l/ D" x
  595.   int i;. l: P1 C* S2 Q+ e) W
  596.   char *szRet;# ?9 Y% h! H; @' C$ C
  597. * j. p8 _' \* W7 E
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    1 x3 O' Q+ `+ a0 N" n* W' V: i
  599.   if(sztoken)8 I0 u; W, w1 o5 [
  600.   {
    7 B6 }) l4 E9 ^7 o2 T; _5 a1 x
  601.     szRet=&sztoken[itoken];% k) _+ w$ E; O- _$ k
  602.     while(sztoken[itoken])" Y+ g2 C* m1 ~' c
  603.     {) p! i7 ?2 R5 {! T1 a
  604.       for(i=0;i<(int)strlen(token);i++)- R  }/ r6 @8 \) m6 _* P
  605.       {4 ^, H. b/ G0 \7 S2 Y4 e9 V
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    6 H: {: c+ B: G% H+ r, t/ f
  607.         {
    / K! I6 i: F. M+ ^+ ?$ a1 e) g
  608.           sztoken[itoken++]=0;
    9 m8 i; c9 a' N9 p; ~( t
  609.           sztoken[itoken++]=0;
    & x/ I" ^. j% @0 u" |6 c( m
  610.           return szRet;! b# S9 N" B1 s4 P
  611.         }
      G! }$ N4 F4 k
  612.       }
    : E5 v9 }' \4 k6 e4 e5 ?& \
  613.       itoken++;
    ( O; E  X6 \. v6 R# }5 H$ C
  614.     }# @' T1 c# U7 k( g' k
  615.   }
    % x2 @( l% Q* f  w4 {
  616.   return NULL;. q' g! [- I1 P) f# d
  617. }/ Y( k% a* b  Y% J9 W

  618. $ Y, D$ K. u" z# k/ P
  619. void ProcessProc(long Total,long Current)
    & g3 v! J! @, i& V/ ?
  620. {
    7 B7 B% `# j) c+ z  d: n  {" E7 Z
  621.         MSG msg;0 w+ t9 N; W8 e  M4 S' u
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);+ P+ \$ e" B" ?* X) f6 d! P5 D
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    7 s3 F7 ^! w" @7 G  D: O) @
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    0 F  a. f$ }0 }5 T2 i
  625.         {! P: T9 ^# t$ Q$ \1 m9 H
  626.                 if(!GetMessage(&msg,NULL,0,0))1 X7 B  @+ O3 [
  627.                 {
    9 ?2 w% [- O( s
  628.                         return;- @8 \6 m5 y, T2 z
  629.                 }
    0 ?- n6 A; V! c' X( X* z0 G! o
  630.                 TranslateMessage(&msg);
    # o8 [5 N0 x: F- y" E3 e
  631.                 DispatchMessage(&msg);' q/ h! s8 ?. s7 H5 {0 c
  632.         }        ; P9 q# P+ X7 u. w0 w
  633. }) y9 |" J0 y7 P2 o8 j& Y% g( h+ Y
  634. ! s* }7 {7 w3 c& [) G( v* E
  635. BOOL bFirstChar=TRUE;% l; P" q$ D5 q3 L7 o" G* g
  636. ! k& E$ Z4 C/ E* `/ X1 O7 k" N
  637. BOOL CRevAppApp::OnIdle(LONG lCount)9 O0 w9 `' T+ \
  638. {
      H5 J( R- u5 S7 i4 o2 ~& @2 b* a( A5 G
  639.         // TODO: Add your specialized code here and/or call the base class
    1 B! V6 ~. Y7 l0 a, @
  640.   switch(dwProgramState)7 A3 O8 s* K. l. ^
  641.   {& k& ~5 ?# g3 Z9 R2 I+ a' h- j- G
  642.   case AP_NOTHING:. N6 I& Z" s2 O7 N/ T
  643.     switch(dwStartUpSteps)
    # N0 |& m. X% ^9 s
  644.     {, d: X/ P! z% I3 k2 s
  645.     case 1:
    ( \3 [$ k# L3 ?5 B3 d  `6 I
  646.       {
    $ P7 Y3 h, \% v1 t' k
  647.         int i;
      d; M7 [+ ^1 x3 n, u( I; q$ ]
  648.         CDC *pCDC=dlg->GetDC();! {1 S! ~6 v2 f  f) e0 v- @1 Y% \3 ]
  649.         HDC hdcwnd=pCDC->m_hDC;
    4 M- P5 W8 K4 l2 X: U5 i
  650. //        Graphics graphics(hdcwnd);9 @& `; E4 d, c0 v
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    5 \. C, @8 {$ ~" l4 J) d+ K
  652. //        INT iWidth=bitmap.GetWidth();( ?' A7 f5 d* i# C7 u
  653. //        INT iHeight=bitmap.GetHeight();
    % V2 a; [  j+ v/ C0 Z! a9 W
  654. //        Color color,colorTemp;8 w+ \! X: v5 [4 n: k1 y. O
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)2 m2 ?8 t8 H3 h
  656. //        {
    & E3 A) @% `  n* V; F9 ]: h
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)3 Y& [7 G; ?2 X+ Y8 l; H
  658. //          {, X. i8 z8 i2 c
  659. //            bitmap.GetPixel(iColumn,iRow,&color);" \8 G. x# ^7 R' _7 |
  660. //            colorTemp.SetValue(color.MakeARGB(; `/ f. W: K* {4 V+ E
  661. //              (BYTE)(255*iColumn/iWidth),
    % F$ @2 j+ g8 L5 H0 ?8 ^4 v. o3 L
  662. //              color.GetRed(),# A+ I" F. D$ n( M( A
  663. //              color.GetGreen(),
    9 i; \- |5 k/ g( Y
  664. //              color.GetBlue()));4 ~$ i+ s; v: \
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);0 j, d8 t: ~  m# a
  666. //          }- E% B& K6 G& g2 o* M- Y6 k3 }
  667. //        }: n% a  k# I& m% ]# P
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    5 _. U% p( g9 R# y5 B1 F6 k
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");- k8 f# m! ?1 P; o! g
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");0 U7 ?+ ?6 n4 y
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    8 P0 L2 G1 Q: T
  672.         for(i=0;i<240;i+=8)
    ( V2 w; P, [. g0 H. n
  673.         {
    + [; _: P" ?/ a8 [) b+ U
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    3 I0 a* a( @& `: U9 }" l& ^" K9 J
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    : m2 |" B" O; Y, J0 E* B
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);, @, |$ e) u( M4 Z
  677.           Sleep(33);" X! T* c& D2 {4 l5 Q% p
  678.         }, O: l0 D! K$ \- j8 e
  679.         Sleep(1000);
    ' S1 R' g) }2 ?9 m& e: M) X
  680.         for(i=240;i>0;i-=8)
    / ~" S8 }3 G* @2 |7 e5 m$ F
  681.         {' w- I1 P) Z3 L/ C6 A* h+ J
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);: i( B  @3 [* Z6 A+ p) y
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);3 i* H; K1 @2 y: `) Z7 e5 F
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);1 H" X8 p: R2 F- d, L
  685.           Sleep(33);, ^! `/ T, d/ h' |, C7 }
  686.         }
      A+ h* o! _0 Y
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);) h3 }+ l, j# Z; ?7 Y7 K$ O
  688.         dlg->ReleaseDC(pCDC);
    5 L/ N! ^$ I. x
  689.         DeleteDC(hdctar);7 G* \8 y4 f5 g5 Y# G5 v' V% p
  690.         DeleteDC(hdcsrc);9 o! k% ]! |( `! n. w
  691.         DeleteDC(hdcorg);6 ]7 U, i9 [" r1 a( g
  692.       }
    " W' o3 ~, t8 W$ f1 Q; Y* |
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    + R" w, w3 ?! L# y
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");1 p' ?/ n, R8 T1 j  S* U7 j
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");) P4 Y% n8 z3 @% C
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    # c% N; S' ~4 E/ M' D
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);9 ^+ G+ n( V0 q0 P% }# s
  698.       if(!Dn.Connected())
    # B9 J) f: {5 f, a: k% ^, K
  699.       {
    / L1 U7 q& e) v) Y
  700.         dwTotalFiles=1;
    2 W7 _: @" L% x0 E( F
  701.         dwDownLoaded=0;  C; A" p% s  S' R/ n- N3 j5 Y8 q6 b
  702.         bSilentStep=TRUE;
    8 c  W$ b# D" ?# E, l
  703.         bCompressed=FALSE;
    4 L. K. J- {- |. e
  704.         strExtLocal.Empty();
    * r9 F, q+ h( X4 m& `
  705.         strFullName="readme.txt";# ?, D  Z  o) L+ P' f
  706.         dwProgramState=AP_CONNECT;
    ( E% ?# x; b5 t4 o
  707.       }
    ; A6 R# Z: C" e. |/ k" M  b
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();( H& W( ?' W% O+ C! Q
  709.       dwStartUpSteps=2;+ s" ^* v  G) C( Y
  710.       break;8 R) o9 Q% v! d: r+ J9 m
  711.     case 2:
    8 E) |1 ]5 [. b  i: N
  712.       {
    - x4 a( l: o1 W7 q: X! t4 U! ]
  713.         int iEOF;: i/ F6 e1 M1 y. K* c& c
  714.         FILE *fp;
    - E- P, J# ^  P4 r1 `- ]  p, z
  715.         char szString[512];' q& _$ T# X: e7 ^% ?* a
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    % t% b# o1 Q. k4 C; b
  717.         if(fp)) O9 ^$ p  Q- q. e
  718.         {
    0 e/ m5 b3 I1 s- i4 [" W
  719.           do+ K% K$ e8 Y0 q2 M. s+ b) }8 a" e
  720.           {+ z/ n$ p: Q7 A3 D6 d
  721.             iEOF=fscanf(fp,"%s",szString);' ~7 n" W' y* w( y- y
  722.             if(strlen(szString))& N8 ~: J+ Q% a5 o
  723.             {
      m; s6 o0 |, _8 x( W5 R
  724.               if(bFirstChar)5 n/ g) @+ p; v
  725.               {* \% F9 i+ z) y
  726.                 bFirstChar=FALSE;5 h) Y4 c& R, ]$ P1 `
  727.                 bConnectIsBig5=FALSE;
    - T# \) V+ q" h' P' \8 q" G
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    * b  M$ Q! X9 Z9 C# r
  729.               }  [) V' L+ B, Z! K9 x  j; B' k
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    ' T! t7 p1 Z: E' w; d
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    % u! ^: H. \6 K* C- z/ \
  732.               dlg->m_ListText.AddString(szString);
    # j) T& r/ k& o0 U+ w5 q
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);9 Q! C2 W4 F' ]& E9 p& @: O' e
  734.               *szString=0;
    % H' R% Z4 X% V' T9 M6 X" ]2 ~
  735.             }2 W# ], c5 e% F$ T( B
  736.           } while(iEOF!=EOF);
    , F5 o- M% h8 G  a; [
  737.           fclose(fp);3 }; T/ X% v2 Y9 B: l
  738.           unlink(".\\DownLoad\\readme.txt");
    * X' s/ Z2 Y9 W. c
  739.           dwStartUpSteps=3;
    8 A8 H. H" Q7 F' |0 I# V' K
  740.         }
    ! |  Q( s0 _9 e/ o5 R+ ?
  741.       }
    $ V% L4 \' O& d/ O: b
  742.       break;* m3 t% t$ g7 b) R
  743.     case 3:7 }2 s7 ~9 U8 X" H
  744.       if(!Dn.Connected())  S3 X2 j3 T+ ~% S* J
  745.       {
    % b  l( [0 g; E& b$ y. c7 p7 F
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);6 d) h$ u- G7 D5 e7 Z' d$ f
  747.         dwTotalFiles=1;
    ; q( n) B( G0 O; q  R
  748.         dwDownLoaded=0;( r8 w/ a/ D$ ]- U7 W7 Y& Y
  749.         bSilentStep=TRUE;
    8 _) R  x7 X* q: V$ }9 e
  750.         bCompressed=FALSE;; q6 O5 G5 _1 u% R
  751.         strExtLocal.Empty();4 a% p3 ^- O1 Y! Q$ ]$ Z  @+ F
  752.         strFullName="checkversion.txt";; ~7 J* z" i9 T4 i$ k6 F. S
  753.         dwProgramState=AP_CONNECT;
    ! ]6 d; j' s9 c4 r; M/ _+ t& g- M
  754.       }( n& J6 h" c! M6 _- m& L$ z+ F
  755.       dwStartUpSteps=4;
    5 G. S, P/ L5 D8 q
  756.       break;: `) C/ f6 G7 d$ h' S1 c
  757.     case 4:& \: i7 @9 v% }9 M3 ?
  758.       {! V! N3 H, B4 K0 D3 K8 b
  759.         FILE *fp;- o& H! n2 {6 `! m/ ]$ D( p& K$ w
  760.         char szString1[128];
    ; R% O, s* R2 u# c' Y7 ?
  761.         char szString2[128];/ v( }- `& z- y6 A* i1 }
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    ) B6 O: ?, |. }# n" u, D6 D
  763.         if(fp)2 Y- A8 W; n5 S5 o) ^+ w- q8 s
  764.         {" Z  \; h. d0 Q$ U2 A, m3 t
  765.           fscanf(fp,"%s",szString1);
    ) d7 Q. J& G$ ?5 \- @% \
  766.           fclose(fp);7 u, s9 ~6 Y0 n$ |% o6 I' j
  767.           fCheckVersion=atof(szString1);- A7 C) F2 a; q' S! ], m/ e
  768.           fp=fopen(".\\checkversion.dat","r");& S8 e) \9 v2 R: T8 R/ W5 S
  769.           if(fp)3 i* \! _4 B$ U6 G  P
  770.           {
    . L2 b8 {7 O* _' E4 u" g+ v
  771.             fscanf(fp,"%s",szString2);) G+ I2 b; \$ s; j) n
  772.             fclose(fp);6 \+ |+ G5 o  {7 Q. b& Q9 d
  773.             if(atof(szString1)!=atof(szString2))6 d7 i5 p& H+ Z- H
  774.             {0 u7 b, o0 U, c2 k
  775.               if(!Dn.Connected())8 F  D) D- `* R
  776.               {
    % e2 [9 z0 E/ u" E6 a/ Q# v
  777.                 bFirstUpdate=TRUE;$ }' @5 W3 m2 c$ h7 T' W
  778.                 dwTotalFiles=1;( Z# K; I5 j4 r5 T; t
  779.                 dwDownLoaded=0;
    7 {8 n+ l1 H& A! d& s
  780.                 bSilentStep=FALSE;
    4 D2 e, C  ~, k/ j# u) b5 k
  781.                 bCompressed=TRUE;
      r! }* l/ \& J5 k, f- s8 r8 ?
  782.                 strExtLocal=".\\DownLoad\";( ?# d) q9 j& D7 F( h+ M- `& ]
  783.                 strFullName="update.txt";; E; T4 M1 J; S7 q+ l
  784.                 dwProgramState=AP_CONNECT;. q2 K. ^! H6 G7 o( ~1 y# P
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    / V% x" b  U; t4 \
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");+ r- D4 [2 P+ d$ d& M- G
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    , T9 O6 h4 Q, _
  788. 7 a: q# w/ L% @1 O* {) q) ~" A  A3 x
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);# k4 h& l  a4 k3 i& p' L
  790.                 unlink(".\\DownLoad\\checkversion.txt");% I6 o7 D! B5 V1 k- m8 p1 G
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    + o  O0 A0 b" {; H) ?
  792.                 {% M. \! O4 ^3 i9 [
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    : V; H1 H" g0 A, H) s3 O- p4 d
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    & h8 b; u0 L, l6 a- a' N
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    * |0 F: W! p3 z0 B' i% J
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);& m7 P- |- l: z7 a: @9 R
  797. 4 d) y( [% }: D: g1 j' @; ^4 c8 H
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    * R$ ]/ h7 d2 S1 n: j
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    8 L7 v3 `; \- X9 ?, T. j+ d
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");5 o* `2 j  K8 m: Y+ Y$ \( N
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);7 ~0 S1 i- v* J1 B2 G4 f
  802.                 }
    ' w! p6 g! q+ g9 O7 S  a! N9 K" Y
  803.                 dwStartUpSteps=5;, I8 @  x: u+ F2 o* A' N
  804.               }1 z0 F2 u8 M: X
  805.             }; P% S( M8 I) N
  806.             else
    9 z6 R6 b2 X- R! S
  807.             {1 q6 K* l/ Z7 Q
  808.               unlink(".\\DownLoad\\checkversion.txt");
    + _# u7 e( B8 [5 e! l0 \$ l
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");( X9 J6 _# d' f9 V
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    ) |( i- D1 ]. S8 m5 P8 h; z
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    8 I3 b0 C9 k/ X" i# V' X

  812. 2 C% \( {8 r$ y+ O
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);$ P1 i0 }" a. \5 g2 h/ U9 y$ ?
  814.               dwStartUpSteps=99;
    0 P5 V" M$ _5 x" t
  815.               bFinishUpdated=TRUE;# _& k' d3 n$ O7 Q- R
  816.               bCanUpdate=TRUE;/ b, {/ I: l3 ?1 R! H& X; K
  817.             }
    . Z5 N; p" O) C, v( U% ~1 }0 f
  818.           }
    4 p$ p: Z% G7 r8 c
  819.           else6 H2 y: I4 ~; s& y
  820.           {
    3 [5 M9 L" t  A7 I# \. v" o, X  d/ F
  821.             if(!Dn.Connected())8 y, K! u. }+ e+ j# g
  822.             {( \  Q# t+ b2 o% r
  823.               bFirstUpdate=TRUE;
    ( n) F8 x% G/ S6 g' u
  824.               dwTotalFiles=1;) ^8 m' W  }+ C7 x* e9 X
  825.               dwDownLoaded=0;
    1 h9 j1 P* w2 y2 ~
  826.               bSilentStep=FALSE;
    ( W' U: I1 @+ V5 M
  827.               bCompressed=TRUE;
    3 D* u& M9 ?" \9 ]# g- F
  828.               strExtLocal=".\\DownLoad\";
    - o7 G# W) ]# T' P+ O  i
  829.               strFullName="update.txt";' ~' W5 I  Y. d  W$ V4 R
  830.               dwProgramState=AP_CONNECT;$ N2 [. n* O6 q4 e! k  a) N2 D. a
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");" Y0 B) t1 X5 ]6 y
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    ' N- ?1 @4 s/ T) R. |8 |
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    . h; O- |$ w1 q8 T, n
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    3 w9 a# R  [& o- e, R
  835.               unlink(".\\DownLoad\\checkversion.txt");
    ' }2 |) I. M8 |- n/ Y' z
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    9 v! w+ r* G3 k1 A$ G+ q7 m
  837.               {
    ' p& N* V, Q0 y6 M' p3 s9 V
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    + j- d* \7 Z1 R. A1 W
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    6 G$ y* T. G  _( |
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    , h! A3 e$ i' l4 S
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);+ C2 v8 h* Q: Q& j' D6 E' O
  842.                 $ F/ ^0 T2 Z9 o6 ]6 }; E1 u
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");' l. C! y& k+ b" @$ B. _) J$ h% [
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    ; x& m: p; P9 B" h, j
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");. r' Z. s1 m% H; u
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);" A% F2 S- @6 D$ o4 O
  847.               }% ~  e, j2 U7 V* ]& R6 w( Q* H
  848.               dwStartUpSteps=5;
    8 }& v/ b5 b; c$ q4 B
  849.             }
    7 R- f1 M( i9 j/ K# {4 g
  850.           }# L, J) b0 O7 y3 z
  851.         }- n' Z& }% m5 _3 b: O: G" H
  852.         else
    6 d4 V4 j6 }- K5 T' c& Q3 O* g; b
  853.         {
    : i: w6 s. K4 h8 N  u
  854.           dwStartUpSteps=3;5 k4 l& T0 s) q9 i! S, F
  855.         }7 e+ g; d/ s, ?: O& W/ V. z5 y6 j
  856.       }
    3 M# k% Y: M; `% \3 r! ^
  857.       break;$ `, Q+ S; Q' R  @4 w
  858.     case 5:
      w% t7 O- G! ~
  859.       {
    / k8 W7 U& I1 \8 Q$ x
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)9 z6 b; V9 x7 C) [5 M+ U" D! x
  861.         {% b% n3 W- b3 T5 x- C6 d
  862.           int opt_overwrite=1;+ ?* v: z( i2 f* F
  863.           int opt_do_extract_withoutpath=0;! M9 I4 u" }5 w
  864.           unzFile uf=NULL;
    " ~; R4 n: ?/ Z" s' p  b
  865. 4 y: A+ J8 r7 W
  866.           uf=unzOpen("Wsa.zip");
    9 ^1 v6 ^" _8 h6 _0 j. H/ Q
  867.           if(uf)  ]& g8 R* g( x6 Y" ]8 B$ e
  868.           {: l3 U! F4 ~* V7 V# Q8 Z" r
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);. {+ V" L% X: G3 B" L& W
  870.             unzClose(uf);+ _. f0 O$ r& O0 f* K) g
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");' j# [2 f, z* u2 o
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");/ n7 B3 [1 _! m4 h  B1 g9 a
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");
    7 e, @* M$ O4 j
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. L' D% a' W8 H4 x7 e% J1 m9 F! A
  875.           }
      ~, q  ~! F& a9 g/ Y3 U
  876.           DeleteFile("Wsa.zip" );
    7 U0 J- r5 {, D4 ?- a5 n( O' F" C
  877.         }* q) T6 `# J( T
  878. # w3 M  L/ W7 L  j
  879.         if(CheckLocalVersion())
      J! N' ~6 f6 m5 |5 J# c
  880.         {
    & E% ]" h# c9 X$ e1 A
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");
    8 B2 d; F1 i% x; o7 E
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");. M- H+ _! s7 \
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    $ o4 C0 a0 q; x2 d. R) H
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    7 P& S7 V" D# v3 y. W. ~& N
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);3 @* U( W) x1 S5 A% W
  886.           dwStartUpSteps=99;
    3 ?: x8 P' ?1 A. i' r
  887.         }; t  ^" J- d* C# M
  888.         else& c' y: ]. `; _- f& R' K
  889.         {
    . s2 d3 e9 [$ Q' _1 {
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    , i; |) E; [5 U% k, S5 }
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");  ~# D( R2 R; v3 R) I
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");- v4 a; X8 l- Z/ I0 P$ o3 o! j

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

1 O$ ^. k0 [+ C" o& D* ~* D: F. s" I! T- g# l( U

評分

參與人數 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, 2025-12-21 11:03

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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