CSUpdate.exe源代码

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

& f& {4 J: K$ o4 m6 _) D
  1. / RevApp.cpp : Defines the class behaviors for the application.* V7 z7 s) e- W1 V( B% k
  2. //, m  F, e2 c& Q; [, X' |

  3. ' G+ S0 `+ I  p) [1 z  G" n
  4. #include "stdafx.h"
    4 v0 u) \- n  K3 S2 q
  5. 0 T8 B1 p: ^  j$ T( O* J8 G7 e
  6. //#define UNICODE
    ; ]. Y# C( ^4 Z2 s6 f! z
  7. //#include <gdiplus.h>+ C. x- M4 K4 P+ d- ?3 g
  8. //using namespace Gdiplus;1 ^/ {9 N7 ?3 m6 p0 N* Q% d# f8 E5 G
  9. 6 A7 L. f& k) j7 Q; G, L8 U
  10. #include "RevApp.h"
    ( c3 k& i7 ?- o4 q) E! @# G
  11. #include "RevAppDlg.h"
    % Z" S# d3 c" x/ c# L2 ~
  12. + ^) f& u! C- L0 {! M
  13. #pragma warning(disable:4786); B$ |) e5 e$ ^9 V% P
  14. #include <map>
    4 `' r6 e* y6 l" X% J2 L. ?
  15. #include <list>- W' t6 K. ^. [9 }3 c/ A
  16. #include <direct.h>
    , f- h8 U) ^8 b) a: N2 P, ~9 z
  17. 2 n7 @# y: P: W. L; ]. {
  18. #ifdef _DEBUG0 z  a8 y* v: h
  19. #define new DEBUG_NEW
    ; H/ ]; a0 @: @* O, \2 G" n  U+ V; J
  20. #undef THIS_FILE- ]1 T3 c& h/ [' c- C+ i
  21. static char THIS_FILE[] = __FILE__;0 ^, ?" I% n6 j/ [
  22. #endif9 \: S1 V. e! V$ C
  23. #include "SkinResDef.h", a5 H3 a. f- l( N' |8 x: p- |
  24. #include "ChangeBG.h"
    ; O5 x* e% e- y% W+ G0 l, Z. J
  25. #include "AFXINET.H"
    , P! p* Z3 Q* K
  26. * E3 N1 L, f4 Y
  27. #define TRADITIONAL_CHINESE 0, H, l6 P6 @& o3 a5 g
  28. #define SIMPLIFY_CHINESE 1/ W- P. s) A9 w7 d. k/ y
  29. #define ENGLISH 2
    : h5 c) }, R3 g4 ^
  30. int m_iLanguage = ENGLISH;3 z% A$ G* f/ D/ ]0 B$ R0 O
  31. /////////////////////////////////////////////////////////////////////////////% S* @1 r! f. U5 i& r/ |& Y" F
  32. // CRevAppApp$ l0 g% z- s% b  w* b0 r
  33. ' I( O1 k( Q& i% c, n
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)9 J/ z/ ?3 C( E- u- F
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    : X# i8 ^" h2 n' e* B/ y. F. m- i) U
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.# W& I- ^. g% R5 B5 ?; K* J2 ?4 h
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!! B! i3 h! b1 _- J# n. |
  38.         //}}AFX_MSG6 B7 h. A2 `5 Q9 A7 A
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)1 r% E; Z- [% x* v
  40. END_MESSAGE_MAP()
    ( m; }: w# A4 c4 I" n4 i" f
  41. ( N# @. \: P: m2 z: q
  42. /////////////////////////////////////////////////////////////////////////////& Y# @, K" y, B5 ?4 q5 ~3 K+ H1 ]
  43. // CRevAppApp construction3 ^& q. J5 g% r# m0 _

  44. # {/ Q$ s0 A7 u2 E0 |5 |* g
  45. CRevAppApp::CRevAppApp()
    0 J1 q- {7 s- f# F, T+ Z
  46. {
    3 G5 D& x0 {; o$ [  O+ v
  47.         // TODO: add construction code here,
    7 s3 o( h. P7 v) K3 x! `6 q
  48.         // Place all significant initialization in InitInstance
    * r" G' }9 O9 K/ J9 Y! d
  49.   bDisplayIsBig5=FALSE;
    * a* `0 H8 R9 {" C% o9 ^8 B
  50.   bRestartUpdater=FALSE;
    2 n: G8 B0 t7 O
  51.   bFinishUpdated=FALSE;7 p) |1 i4 E) H" b  F1 u3 R
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;6 x* I% J$ Q9 b/ j2 s
  53.   InitChangeDataBig52GBKS();  p, J6 d1 W, A# K9 f
  54.   InitChangeDataGBKS2Big5();( f6 u. g/ f9 e1 m' L( x
  55.         //+ t& }1 x% l! w  A! F% e
  56.         bClickRunExe = FALSE;0 L2 p/ U8 j: g
  57.         //
    5 v' t7 J  [2 H6 @8 ]9 [
  58. }5 U' T! Y  c0 x0 N6 O/ Y) B
  59. $ N& l7 P) t2 ?3 C# ^/ {
  60. CRevAppApp::~CRevAppApp()1 L5 B3 a/ y5 X4 J& G# ~
  61. {
    " r6 J% U  Y& {! `
  62.         // TODO: add construction code here,2 O0 R% E. ]" A  U; U3 j
  63.         // Place all significant initialization in InitInstance/ X: W! f8 N$ {4 V
  64.   EndChangeData();
    8 z* I( U* N# S; q. x7 N
  65. }
    0 G5 ^9 H/ u( Y0 U
  66. 4 r/ K9 ], Q& ?* y
  67. /////////////////////////////////////////////////////////////////////////////6 C' G7 |9 l/ G% D$ H- h
  68. // The one and only CRevAppApp object. c; @/ H; m  i! v* \
  69. " S# L2 c5 a/ c
  70. CRevAppApp theApp;
    4 J0 k$ w$ B' x. S" ]' s3 a

  71. / C! i' I* z( p! z5 _
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    3 o3 m# x- E& \5 G
  73. {# J9 B, S6 z2 ^
  74.   int iEOF=0;
    3 v% I, |. k! z8 \$ S+ G( V) r$ ?
  75.   char szTempName[MAX_PATH];% l( Q: t3 x1 c/ i
  76.   *szFileName=0;- l6 h, L3 u3 x/ R' _
  77.   iEOF=fscanf(fp,"%s",szTempName);, O! y$ `% |  t6 C. E( e
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')( C9 U7 V6 R3 X
  79.   {1 c- ^8 z# ^$ C( B0 V( A; k
  80.     strcpy(szFileName,&szTempName[1]);/ H& n/ u% [1 }0 S) n6 \
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    ( h" v* z  j8 J3 C  B5 v
  82.     {4 F# f5 x2 I4 d5 I
  83.       iEOF=fscanf(fp,"%s",szTempName);; Y0 ?" |* J& E: m  B
  84.       strcat(szFileName," ");9 ~0 i! j  R1 H
  85.       strcat(szFileName,szTempName);
    ) }/ Z' I0 c, `! A
  86.     }
    # r; E1 u1 s% @
  87.     if(strlen(szFileName)>=1)
    ' S3 p" T7 H# T$ o9 v4 ^
  88.     {
    ! |0 x. C1 E9 _: O$ o
  89.       szFileName[strlen(szFileName)-1]=0;6 c* m) ~* M6 w/ i! W
  90.     }
    " j7 K7 G1 ~, g6 W& |7 Q
  91.   }
    $ q/ i6 Q* A. x# _1 R' Z
  92.   return szFileName;2 z0 j- O+ I0 Z! A1 U8 N
  93. }7 S0 S$ k* e' ?; w  d

  94. 7 U6 x" ]5 {, b, u# \1 [+ t
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    3 r5 B8 ?9 D5 X' g/ n3 N
  96. {
    / b( ^$ ]4 I) i# C6 ^4 g  Y
  97.   FILE *fp;; D! w( |/ a$ i0 {
  98.   char *key=NULL;
    5 P* b$ b( r0 e1 h
  99.   char version[MAX_PATH];( ^& Q; [' I2 W$ B3 y
  100.   LPUPDATEFILE file,olds;
    4 R6 J8 e( y( v- B/ T8 Q8 s
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    1 I1 l9 X' ~. I5 U# }

  102. , E5 A% J+ @- k, h  ~4 q
  103.   UpdateList.clear();  v7 C; m/ M9 _5 |% |6 n1 H
  104.   UpdateFile.clear();4 r& T  A% z: J1 M; _/ ^; Y% I
  105.   if(GetFileAttributes(filename)==-1) return false;+ D: V& M, a# U
  106.   if(!(fp=fopen(filename,"r"))) return false;$ F. X/ M2 r+ W8 {/ C+ C! y, Q4 S) ?
  107.   fscanf(fp,"%s",version);, f( t/ G, y5 t4 J
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }: |. x9 d/ V: z/ p9 h7 Y
  109.   while(fscanf(fp,"%s",version)!=EOF)
    7 B# D  Z( x; K) ]! q) Y* h+ N
  110.   {
    % Y2 k* f5 P% i. p
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));1 h- R; S' W; U9 C
  112.     fscanf(fp,"%s",file->path);" P% b4 f' v( h7 V2 F/ T# q
  113.     ReadFileNames(fp,file->file);
    5 r$ f: d$ u6 }6 K6 v
  114.     strcpy(file->full,".");
    & n6 [, t8 i. M4 J+ ?2 R; w
  115.     strcat(file->full,file->path);- y/ Y4 N: y2 W; ]6 i
  116.     strcat(file->full,file->file);
    : u4 s) N! h7 H/ G. s# {$ M4 K
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())" z. T$ Q, L* W: O
  118.     {
    ( q1 r$ g$ f  @# A
  119.       file->vers=(float)atof(version);
    : s, S. e7 q; o- m9 D. G0 V) k
  120.       UpdateList.push_back(file->full);
    " g/ J# m2 i  p
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    ' [8 X& w' \6 N, P) Q
  122.     }4 L0 z. w0 R: p$ O) g
  123.     else# {, R: Y2 l7 }# y1 r5 z
  124.     {
    & Q+ K6 g# a- d+ `' w$ }
  125.       olds=(*p).second;
    ( K, O. {/ ]/ L/ h
  126.       if(olds->vers<(float)atof(version))
    $ ^$ P5 Z/ m3 t2 D
  127.       {) c5 b6 W, u' Y9 A* D
  128.         olds->vers=(float)atof(version);# ~3 T& u7 I- |: S+ p4 o+ H1 a; s& \
  129.       }5 k$ o( y+ ^/ B- C
  130.       free(file);# x1 U- ^) _3 \" S- Z
  131.     }+ }/ P# }  E+ J" x
  132.   }! i$ v2 o' I2 }0 t' i7 y! ]
  133.   fclose(fp);
    * e: n. Y6 e. V' S$ D4 i* ]
  134.   return true;
    9 `" J$ Z' ]+ @3 r1 H- I7 F
  135. }
    - ~( R9 b$ R7 d5 t0 C

  136. ) `3 r# ]2 G% o" Q
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)+ ^. Y3 v8 @3 I& k( \/ y
  138. {% e, n9 y' Z7 M; h0 D7 C& V8 g
  139.   TCHAR  szFull[MAX_PATH];
    - Z+ P  H/ M- h* |$ z8 x3 r  l7 t
  140.   TCHAR *token,*inter;
    " v  R5 ^) w6 a9 ^6 Q* n
  141.   *szPath=0;
    ( T7 }, G% |$ ~: ?
  142.   strcpy(szFull,szFullPath);% \7 M& V  ~; r
  143.   token=strtok(szFull,"\\/");" O! k" s( \/ x2 V
  144.   inter=token;0 o6 q2 [0 I9 d
  145.   while(token=strtok(NULL,"\\/"))! E3 h4 f3 I9 I3 w9 N, m2 \6 y2 u
  146.   {
    ) |3 Q4 I6 a6 @2 D: m1 P
  147.     strcat(szPath,inter);
    $ N" C. p+ A' B9 U+ Q# o" f5 t
  148.     strcat(szPath,"\");
    " b# d8 ?; }9 j3 b9 ]
  149.     inter=token;3 T* B$ U! T5 Q6 b' T; S# Y% r
  150.   }
    : }: k# g1 }/ }! S
  151.   return strlen(szPath);( A2 L" v. C! q) ?7 M
  152. }
    ! j3 S" i$ O  p" Q# r+ x7 `6 T! K

  153. 9 [( C1 g  N0 O) m6 _' W
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)
    + ?6 r+ o% C1 R# y0 U
  155. {2 A) I5 q6 i) ?+ L
  156.   DWORD attrib=GetFileAttributes(Target);2 E% n  z1 K, ^$ g% T& C' m
  157.   if(attrib!=-1)& W( a# q, u  Q! b* g# T; X
  158.   {
      X9 u# H) F  |( U6 M& o; I
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    " X* l# j% O5 j& T$ }$ [/ o
  160.     {6 S& z( |' Q4 B
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    9 v8 F. q; y" p5 M
  162.       SetFileAttributes(Target,attrib);( G& [* u( u6 y( [! v% m+ j
  163.     }
    % i6 S5 |1 Z5 S4 D5 ^" h
  164.   }# F" A7 L! y; h; Z
  165.   CopyFile(Source,Target,Erase);
    6 I% W' T3 {/ G# }7 m
  166. }
    ' z; f8 f$ n! X! k* g5 z
  167.   ]: A6 Y8 N3 C+ K8 S4 L  m
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)6 w+ ?) m; t' d! a! V
  169. {
    4 Z+ Q; w% I4 ?5 F. P
  170.      FILE *fp;: n/ m* g  R8 u6 h% |
  171.      char  szBuffer[8192];
    % [0 l; J% S# s2 y; S
  172.   va_list  argptr;
    1 B4 t* v, ]5 |0 p. o) u0 t4 S+ P
  173.   z' j$ i4 K; w6 v
  174.         va_start(argptr,message);
      T& J  r: Z( {/ l' E% c1 b
  175.         vsprintf(szBuffer,message,argptr);4 O, x; n3 J1 D1 K8 g4 Q4 {( \
  176.         va_end(argptr);) ^! D* ~# Q+ _' u0 R% P9 S7 r
  177.   fp=fopen(FileName,"a");
    0 v' M, Q5 @/ t1 K8 o0 [, ^# S
  178.   if(fp)
    5 t$ j; A0 U6 m+ t1 y* f
  179.   {
    * i# y& f$ ~/ y/ o
  180.     fprintf(fp,szBuffer);4 p+ n# ~8 u' Z* R: l
  181.     fclose(fp);! r0 h9 |: o2 [) M' s( n7 y( \
  182.           _flushall();; Y5 C( t3 E1 X" o/ y
  183.   }2 O$ L% C8 A& D0 E6 W1 D
  184. }' h* |: \1 M* G/ N+ c  D) Y

  185. 1 e" R$ j! [1 ?, v+ V
  186. BOOL CRevAppApp::Fclearf(char *FileName)' }+ U) d, z6 S6 p- p, \
  187. {0 E0 T# L% D2 k  r
  188.      FILE *fp;
    % G2 l7 g8 g5 X9 z: u5 |4 b
  189.     DWORD  attrib;& ^; i4 k6 F3 e2 S( {1 |
  190.   attrib=GetFileAttributes(FileName);! j8 y7 i* X) Y5 @; W; T& Y. w8 s
  191.   if(attrib!=-1)
      W* y4 c3 p3 m# @% K" ]% B
  192.   {2 b1 M7 v  E. S: |8 Z
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);! D1 F, x2 O2 V
  194.     if(!SetFileAttributes(FileName,attrib))
    : X6 N8 |4 q0 ?, G
  195.     {
    $ v  g8 D& k/ i$ J0 k
  196.       return FALSE;
    6 u0 t. n' ?1 S* p7 [6 W
  197.     }
    ' m7 k9 n$ V5 T
  198.   }
    & e8 J9 X+ A/ x; ]( {, f/ R' z' }, N
  199.   fp=fopen(FileName,"wb");
    ! R) C& F  |7 N$ G8 W. ]
  200.   if(fp)
    7 w) b) I) s( ~2 b, D+ T. K4 h) ]
  201.   {) T; h2 y" N$ I
  202.     fclose(fp);
    . N/ F0 S; B4 Y
  203.   }6 x( h* s% ]- J/ H0 T* _
  204.   return TRUE;
    & Q6 A2 C8 q1 _* h8 l9 S  y& j: X
  205. }
    6 S4 ]7 P1 Q1 P6 r( O% ~

  206. 8 g: r* x) U) i. L
  207. BOOL CRevAppApp::UpdateLocalVersion(void)9 U2 |( @- F9 \4 e* c
  208. {; H6 U' A7 ^3 W' X! F; ]! {8 p
  209.   char filename[MAX_PATH];+ k( }. H* S: c- g9 W4 C1 D; {
  210.   LPUPDATEFILE file,olds;( f! Y9 N$ B" }$ K1 T  B
  211.   std::map<int,CString>::iterator i;
    + c" X5 I" Y: S9 {
  212.   std::map<CString,LPUPDATEFILE>::iterator p;- v# S# ]( s, l
  213.   std::list<CString>::iterator l;
    , {5 Q3 Y0 A% |- l0 Z
  214. : m6 S7 l8 ~5 y; r% i* w  T
  215.   if(bFirstUpdate)
    % Y6 U) |1 _, K, P
  216.   {* }+ r/ O& ]  A+ p  W5 b9 u# I" J1 V9 J
  217.     dwCurrFile=0;
    ) U$ I* P# \. ^) t, h
  218.     bFirstUpdate=FALSE;
    . I& o& {; @3 j2 W* M: a8 m
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ( B9 J9 P2 [6 k# h) ?7 Y2 Y" h2 a
  220.     {
    5 ~/ p+ w- M" D3 k  W1 I& m
  221.       dwTotalFiles=UpdateLocal.size();! V7 e/ y- [3 M" i8 t( K  s
  222.       dwDownLoaded=0;2 j9 c) L* C, g" L
  223.       bSilentStep=FALSE;
    - w+ o6 W. k( b- v$ ]' u
  224.       bCompressed=TRUE;
    4 s6 n2 o% o) f3 E# E
  225.       strExtLocal.Empty();: K* g/ |2 J% D  S: u
  226.       strFullName=(*i).second;
    ; T; R  Y3 b. F% Q1 i5 Z' k3 s$ Q
  227.       dwProgramState=AP_CONNECT;
    1 \* ^% W* s2 k' r7 o5 x) Z
  228.       return TRUE;
    $ H; n* s+ p6 M# H
  229.     }, n1 Q/ J: d; |! `- `
  230.   }, y! ~+ O  W, d' l! g& D
  231.   else if(bRestartUpdater==FALSE)
    / v: |3 T  l8 u% a
  232.   {4 f+ F& L; e1 f3 K$ w9 C
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    3 O9 W9 g2 H- N6 \. y: `+ S% O
  234.     {
    5 X$ h7 A6 e& J# G
  235.       file=(*p).second;, N  q& o* l4 E7 k7 b- d4 Y
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())! n  l% s# {% a5 I- j0 h: E3 e
  237.       {
    0 P3 I1 I8 |$ a; E
  238.         olds=(*p).second;
    / \  V: T& |  n8 F' b$ C( R7 n% R/ G
  239.         olds->vers=file->vers;
    4 J1 O' X2 d3 u. a0 v
  240.       }$ P/ O% e4 X4 b, t6 |$ X: ^3 f
  241.       else' f; d3 L8 r, `5 p( T5 p
  242.       {* C. L9 ?1 C8 a  J
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    ) c6 w2 y$ U. I/ K. j0 U$ E
  244.         memcpy(olds,file,sizeof(UPDATEFILE));4 A: Q2 j( `( z$ _& L
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));6 r' \$ g' u$ x' J
  246.       }& u" j5 i  t( V9 x! P- ~
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
    9 v) J& F1 p& {- j& u2 P0 g6 v. p
  248.       sprintf(filename,"(%s)",file->file);1 B/ A, t! b* ]' j2 \2 }, U
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    * d+ y3 O2 [' f$ Z1 N% X
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    3 F4 M) }' R7 Z( B! X9 [- m
  251.     }- d- {1 ?* G- V  q0 [
  252.     dwCurrFile++;
    ) S, P+ M1 p0 F
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    9 L% C& j2 H' W3 F3 p1 j: R
  254.     {; e/ ?9 w  m7 l, J$ n6 d- e
  255.       bSilentStep=FALSE;
    ' s* k, |2 R9 f. u$ l8 _) @; ]
  256.       bCompressed=TRUE;
    ' r  y! A# J5 }+ O5 \" l0 P
  257.       strExtLocal.Empty();3 `( X, Z, T4 g* ]) Q/ z! p! c
  258.       strFullName=(*i).second;; S. y: S% ^, @
  259.       dwProgramState=AP_CONNECT;
    7 Z( ~. k3 i/ c7 ?" q+ u
  260.       return TRUE;9 ~6 W0 i0 p9 i9 ~, d8 {8 W7 i4 h
  261.     }
    6 }1 h" ]3 r1 ^" Z7 I8 I% V* G( K8 J
  262.     if(!bRestartUpdater)" f8 E1 u0 }: L* n/ g7 z
  263.     {
    6 S3 b) Q; O9 P! R8 L) D5 N
  264.       int iCurrSize,iFileSize;
    , I" R1 C8 n$ e; X1 j# e! B
  265.       iCurrSize=0;' M9 `3 J7 x, S5 C$ [2 N) D
  266.       iFileSize=UpdateList2.size();
    " \* Z; ?5 C' e
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");. Q  ]' G4 W" ~, }2 V' J+ U  G9 O
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");3 f  n+ E8 M+ V6 J5 F8 R2 }* G; ^
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    ' Q* n& c, H8 B- m' w
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    4 t0 v% {& Q8 f! ?" s9 P9 n" q. a8 O  K
  271.       Fclearf(".\\update.dat");
    4 T9 p- ]' u+ o' J! Q# X# @
  272.       Fprintf(".\\update.dat","Bloodyf\n");: f. ^7 ~/ ], a% M9 }4 U$ V' `: p
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)& n: L# j' R# A
  274.       {
    / ^7 M; n4 y8 T+ z& d* ?
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
      p+ Y" e" N1 t0 `+ p" T+ Q
  276.         {
    + c4 I9 s+ ~1 T2 M
  277.           file=(*p).second;$ N5 L  m$ s+ Y" D3 l7 \+ s
  278.           sprintf(filename,"(%s)",file->file);" c9 ^& }$ b3 Q' [# h7 m
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);/ k4 x- w( B; r( v: ~
  280.           iCurrSize++;; y* u" V/ X0 B" c! w, r
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    + C& V' x' ]+ l# ^
  282.         }) }5 r0 Z; Z; w; ~0 w' z' J
  283.       }$ B) A( g  e& _( T" x& Z
  284.       unlink(".\\update.txt");! d3 E, Z( Q8 G/ o& L& L% @
  285.       unlink(".\\update.tmp");
    ( l7 z8 b8 o7 ^4 f7 i
  286.       Fclearf(".\\checkversion.dat");
    3 L9 \3 R$ E1 y! W5 T+ R
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    " u4 ~9 S) c- Y( T
  288.       if(UpdateLocal.size())( Q$ w  V+ J9 r4 @" t( |
  289.       {
    3 C( ]4 t) ?" y/ C. b& `
  290.         UpdateLocal.clear();  X2 L3 w, z4 o/ r* r9 U
  291.       }9 O, `7 ?+ T8 L6 W8 j9 B0 e1 B
  292.       if(UpdateFile3.size())
    0 l' e7 K+ E. h( K
  293.       {- J2 t4 \1 u. y8 k; `5 z% ~! v/ _
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)3 V( `. k1 O9 k) M
  295.         {2 ?( p/ _. K  e3 W* _, L6 h
  296.           file=(*p).second;
    ( ~( `& ^( E- G5 H8 D
  297.           free(file);
    $ r( C5 R) X( ]
  298.         }9 C: X, j9 V3 g% L, i- b9 G
  299.         UpdateFile3.clear();
    6 M; g! {% w  z  ?' z/ E* Q: g1 m
  300.         UpdateList3.clear();$ N4 V1 t, f  L$ M, e3 k# d- n+ q
  301.       }
    0 L9 C' e6 l, n$ I1 ^
  302.       if(UpdateFile2.size())
    0 ]5 X. E+ M; x7 h
  303.       {
    & P% ], F/ Y+ i1 s, e+ X
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
      s2 Q( j* R  ~3 o
  305.         {5 R4 P) x# S) @1 t4 \
  306.           file=(*p).second;! Y4 V! G& e$ P0 k% B
  307.           free(file);5 W$ G3 E- h+ o* U0 I
  308.         }
    8 o. v1 O* S5 e& U0 y. d* C
  309.         UpdateFile2.clear();6 N; k7 k. ]  ~$ H
  310.         UpdateList2.clear();
    + z4 m2 y/ R2 Y4 D9 H" y! V3 D
  311.       }5 @) W, Q( Q6 y7 U" R: E
  312.       if(UpdateFile1.size())
    1 f- Z, @5 t) r) \1 h" S$ r! {
  313.       {+ H  P5 E' H; \5 ~4 v4 t
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    ' r8 Z( A  K7 E9 n# F
  315.         {/ N' L  X; ~) c2 }) {* T
  316.           file=(*p).second;8 a* p2 |$ B; h1 D" J
  317.           free(file);
    5 n* y' S4 G. z7 v
  318.         }
    8 G4 j1 w( p2 E1 X2 ^( z2 c( W
  319.         UpdateFile1.clear();4 C2 ]/ ?# k- r- Q
  320.         UpdateList1.clear();
    & S( w5 J. M" E! l  j( w5 M
  321.       }: Y. z* w# F% U# L: r: p! y
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    & V, s* N9 o5 @* d$ ~  m
  323.     }
    0 Z% n7 Q* `: H* \. J* o
  324.   }
    * ~" b, _; U2 @: z7 W
  325.   return FALSE;% r" l# a: _( ?# |
  326. }& n( W$ j: L. O* A# s
  327. * w4 i, d' z* ^' o$ |/ T& |
  328. void CRevAppApp::ClearAll(void)
    8 y3 L) {" W! N# G! F& g
  329. {
    . h" [! z, I$ |7 P; C6 g, ~# @3 x
  330.   LPUPDATEFILE file;* M0 O% r# q" ~! L: |
  331.   std::map<CString,LPUPDATEFILE>::iterator p;. S5 @: a5 G2 K% @2 m0 g
  332. - k1 K+ Z7 S0 i  m) }
  333.   if(UpdateLocal.size())
    / m0 o$ t8 P+ [4 L9 `% |# y% K0 F
  334.   {+ O: c$ R! z* j; @* r, @
  335.     UpdateLocal.clear();
    % f/ ^  W! S& W/ _& X  U
  336.   }
    + ^. ~/ D+ u  K2 r* u0 M
  337.   if(UpdateFile3.size())1 z. u3 F) k9 S6 q. j1 O6 O
  338.   {
    5 {; C6 S2 C$ ?5 M) B5 D+ s
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
      G0 q4 Z. i% }
  340.     {% c! Z- d& ?) u# c/ L
  341.       file=(*p).second;; _$ C- \( e) ?' t
  342.       free(file);) V/ J& t+ y' E7 Z# y
  343.     }4 B7 q% O$ X6 i1 d
  344.     UpdateFile3.clear();4 s& N+ Y1 H& t( H- L- Z
  345.     UpdateList3.clear();
    2 Y5 b6 y5 V( R
  346.   }5 s5 h6 k$ G" i- W3 V' I
  347.   if(UpdateFile2.size())
      R0 ^0 g* t) K
  348.   {
    # k: }  T; J  d
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)" U8 M* ^; O; i
  350.     {
    0 K: X) Y" e! X$ q7 x* j7 n0 v
  351.       file=(*p).second;7 d# L/ b; p1 O. M2 H0 ]& r
  352.       free(file);
      F3 t* M% _) x; G
  353.     }
    ; ~% i/ D- u0 ?
  354.     UpdateFile2.clear();
    ; e4 b4 x. h. w5 Y' C
  355.     UpdateList2.clear();8 ?. G7 A1 ?7 ~( i' d+ U
  356.   }% o- F: D# h' l5 k+ x* f5 z' T
  357.   if(UpdateFile1.size())0 f! z- f* R: h, b( B0 t6 W
  358.   {
    ( }2 Y# R. K! v# t
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)9 d! s8 Q6 {* e8 v
  360.     {
    3 x0 x1 q$ c! X* N% v  j
  361.       file=(*p).second;
    ; U1 E$ N8 n5 z% A9 K
  362.       free(file);
    ( T) a1 e5 B% s( j& W* N7 Z6 \7 n6 e
  363.     }  x1 P2 I$ ?- u5 E! w
  364.     UpdateFile1.clear();- j( x9 Q5 i1 _$ Z
  365.     UpdateList1.clear();+ q8 ~6 X, h0 R, g; l
  366.   }
    8 y: M! i- \' M. e  M4 p+ ]
  367. }  1 `5 y5 d: j7 L: L- J2 c
  368.   / ~) J8 p" H- m( C( w$ l
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    ; b: F9 u: f' f" V
  370. {
    : z6 R0 R/ Q; k. h; |; o. T; s
  371.   int c;' M9 s' j7 g$ T6 u
  372.   LPUPDATEFILE file1,file2;
    6 R8 e8 s) [* E; ]
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    2 @/ n9 @* C5 o) r
  374.   std::list<CString>::iterator l;2 z' g9 v) @+ V' O" T& I% {

  375. 2 l2 n$ K6 S, b* q
  376.   UpdateLocal.clear();
    $ A) K, n3 N) ^( v& x6 y" d+ M
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);7 r4 }2 c% N) w) g
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    $ H. A: u$ ]+ j0 H3 c
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    ' `9 R$ E* S# K5 c) h1 v
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    & f2 a3 m* ?+ [5 g" [0 q
  381.   if(UpdateFile3.size())5 F3 X* w! T& P% t' s3 ~2 p. J
  382.   {' `9 m9 _7 F! ?7 H- Z
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)% @, n/ O! o  ]0 Z! q& j2 b
  384.     {
    2 f. x! `. q* S& g* e
  385.       file2=(LPUPDATEFILE)(*i).second;
    3 I: s% V+ q# l9 A; J' s3 f
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    : ~, T, s* ?7 Q! Y4 G, h3 ^* X
  387.       {
    # f- o* a  I1 z6 X) C
  388.         file1=(LPUPDATEFILE)(*p).second;6 @) r& G6 V6 F" f* x5 e* n
  389.         file1->vers=file2->vers;3 C3 `$ w5 r+ L2 C( G3 @$ [, i
  390.       }
    " M  c3 d/ n5 O6 p( x& T" J
  391.       else3 R- t  Z. V4 _4 V$ u
  392.       {
    3 h; b8 m/ W: b0 J
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    6 J4 ?8 V" i" R0 f; a! ~
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    & D  q7 X# F. ~1 V1 v
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    3 O  J+ M' `4 @$ N
  396.       }) ^. P  \/ y. b6 h
  397.     }
    1 |- c. f2 F3 ]" P2 ?
  398.   }
    . @/ ]* J& \0 U- u( K
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)9 D) q- a- D1 U4 O( M% B( `
  400.   {& k# J1 A, Z, h. l: n) G
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())* H5 i0 A8 y- B1 n) g' o* Y) l
  402.     {
    ! O# E; H/ ]9 l
  403.       file2=(LPUPDATEFILE)(*i).second;
    # A' E. l7 V, h" f
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    , O! E' C, q. }/ y) N6 p0 x' v, q
  405.       {2 ]! n7 W% t0 w7 w5 {+ H/ p# I
  406.         file1=(LPUPDATEFILE)(*p).second;
    1 _/ b* k9 J' [6 B, N( Q! ]
  407.         if(file1->vers!=file2->vers)% v/ M/ k6 {3 v' A4 |% Q3 J
  408.         {
    ( i2 ^: K. W  H4 n
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    4 w# ^+ U9 Z" z
  410.           c++;3 _# Z( g4 t1 \# T/ ]1 ~4 E: k  L6 g
  411.         }& F* g) h& B) H: W# R" g# `" S, r
  412.       }
    + h/ W6 O* O4 N; j' _5 u1 ?
  413.       else' D# F, j- ^9 V9 _$ d
  414.       {
    0 H% d: C, n- ?) O2 W3 Z
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));! Y& _; b2 W. Z
  416.         c++;; z1 B2 F' n/ O: a
  417.       }# |5 v( }" L5 R+ r& {: v, S9 K
  418.     }3 |: N4 ?8 k+ `& s0 k
  419.   }% T4 `: x( A6 @3 K0 \. {3 e0 D# c
  420.   unlink(".\\DownLoad\\update.txt");
    ' H# D  M9 M; z; Q5 M
  421.   if(UpdateLocal.size()) return TRUE;
    # E% n- m" f3 z% z( c
  422.   else                   return FALSE;
    " s" r8 V6 P' W& S
  423. }4 @. ~8 W# s, L: V4 Z, [
  424. ; O' e, E. t& k9 E  B+ _
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    ' ~# t. |5 X. K0 Z* {
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    8 Y& H! L9 w4 D, z

  427. - t2 q1 L% O6 T4 \" k8 d0 U, ^+ K

  428. 1 M8 v. c& f$ T& n, H+ j, Q- S6 e

  429. 8 _8 _' E% t3 y
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    7 V" L# [( }# V0 ?/ U9 [
  431. {
    8 i% ?- e# O# J- K5 U
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;: m4 t. ?! ^& ~) U; R4 n
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)  \' _) z3 r( W* a8 r3 H
  434.   {3 X" \! `; Q6 V) ]3 n1 Z* @
  435.     char szLanguage[50];
    7 R( e0 [$ _7 A: e* U' O
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    9 ^; a7 E8 A2 }
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;4 M# C4 ], d# i" V
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;$ y4 Q1 g6 g5 L9 t& m, n' b$ V
  439.     else                                   m_iLanguage=ENGLISH;  C7 M* ~- p* g: E6 l6 B: H
  440.     char szRegister[100];
    6 r) j, ^& \" i6 [
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");# m; M7 E! ~$ L+ m" Y
  442.     strRegsName=szRegister;
      b, o- u8 _5 ~/ [  i, P6 B/ r7 e
  443.     char szPatchURL[100];
    , f; P  H( D& B  P9 U
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");* ?' E2 t6 f: ]* G' |4 ]
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);9 G: q5 R0 s( S. i. W+ F" y
  446.   }
    * f) T% d* E: l, d3 ?" _
  447.   else5 g. U* k8 n3 L# t& Q
  448.   {* _; S* ~' K9 E* e! b
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    * S- U3 ]0 p' D( S4 h
  450.     strRegsName=DEFAULT_REG_URL;
    ) I/ P8 m9 L: z- X
  451.   }
    $ D9 e/ A  i" b: K* }
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    # @# }/ m/ n; ?* Z' V8 Y+ m& W
  453.   {% ~) A2 P! U  r# k
  454.     char szIP[50];
    8 K0 G$ z0 _* y" s% j8 k5 T
  455.     char szDIR[300];
    - y0 [5 `% ^! T7 ?5 B
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))- c! }. m  d, z
  457.     {
    * y" R/ G8 P! R0 d9 J/ M/ h
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    ; l& d8 h* N3 C7 m
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    4 R/ T: ]/ f5 P. J
  460.       strHostName=szIP;
      c+ Q. Q8 D0 Y2 S8 u4 m  X! ?
  461.       strHostPath.Format("/%s",szDIR);/ |8 }+ @8 L& ^( j+ O8 \. O
  462.     }
    2 U/ u, A# ]6 X" o. Y" t0 m& O5 Q
  463.     else
    ( |/ }" s( m7 V" j. `
  464.     {( O: P  m3 ?( a4 L0 ?
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)# m/ ?& n7 z) l% V: Q
  466.       {
    0 ~/ M/ O, n3 I/ C, j9 r
  467.         char szLanguage[50];4 x# M7 k; X  b5 Q/ f) r. x' p+ V
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    " d% ]+ B/ `4 u4 N
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;" Q3 d9 Y6 K9 C
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    4 u* @3 h, I. |& Q# N# b- {7 K
  471.         else                                   m_iLanguage=ENGLISH;
    + F# |) y  Q9 G, O  x! M
  472.         char szRegister[100];( q+ e. n9 h- B" c/ X* O2 \7 z- U) e
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    - e9 V& ^% ~& ^" P& s
  474.         strRegsName=szRegister;
    " L! R6 F4 ]& y1 A$ s3 \
  475.         char szPatchURL[100];5 R0 T0 L& L8 @6 V( g
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");# J% V0 g. r: i3 ^6 Y
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);! W+ |9 ~) M+ [1 f  a% g) z
  478.       }
    / w4 W  w$ @& {7 @& R1 N  Q
  479.       else
    # p; R" f9 g) P6 j( u$ ]+ }& Q
  480.       {+ d" h+ R) ]- u
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    2 K5 t  Z* }+ E2 h: C5 U/ D8 ]4 J
  482.         strRegsName=DEFAULT_REG_URL;
    - N8 p: k9 j3 O5 x2 |" g( W  Y
  483.       }6 C$ [( a' @, }* _& c, j
  484.     }2 \+ B1 e) d/ R8 M$ ^( q
  485.   }: }7 m) }0 X4 a9 c7 s' U
  486.   return true;. R& D9 @  k7 `! s/ ?$ K& T
  487. }! X+ g$ g( O* |. Q$ `/ Z

  488. 6 y# J, @8 k; h2 s. j
  489. #include ".\ZLib\unzip.h"
      i# G& {! C) Z* s' t
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);% m% ~& N% ?8 F# W/ \
  491. /////////////////////////////////////////////////////////////////////////////
    + O* c2 |+ K  E* ~/ o- A+ z: L
  492. // CRevAppApp initialization. b6 s0 e& s; i. T+ x# z

  493. " d  D9 B3 a4 Z& W
  494. BOOL CRevAppApp::InitInstance()
    $ G4 v0 m# q/ K3 }7 ^2 ~
  495. {
    , `7 M4 u3 \' d$ Q
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    : q/ c; V# ~6 L: N" x% ]/ Z8 U

  497. 3 i8 D5 D+ I' @1 n; G
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);, }4 ]( S2 q2 }2 n7 @9 j
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    ! O& S' u+ \' o* J- _) I6 x
  500.   {
    , ?* G8 {8 k. y, y" X$ n
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    ( `# B; e* q5 Q- r$ N' E5 _+ Z
  502.     GetPathFromFullPath(szPathTarget,szPathSource);
    ( n& }2 @* A9 r  `3 F  B0 y5 ~( S
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    ; k7 \: v% F1 Y
  504.     {* G+ H/ q0 c) K
  505.       strcpy(szPath,szPathTarget);9 B" V, q( s7 J& l& Y* E( Z. i
  506.       SetCurrentDirectory(szPath);
    ; t9 Y6 {/ |! H6 `
  507.     }% `0 i  t' z9 g+ `' \
  508.   }
    % X$ B3 w3 r* t# \
  509. #ifdef _DEBUG3 R, ?5 `. Q0 t2 G* |
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))! P- G9 A7 f- U$ t. Q. l& m9 C% G
  511. #else4 O- D2 p2 |1 u% {
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))# v6 _: H  O& ]( O
  513. #endif  z0 p, R# W4 d' l
  514.   {
    , B3 f0 G) L' `6 f2 @/ ?
  515.     char tempFileName[MAX_PATH];7 w! W5 U3 g* M! p& O; l
  516.     strcpy(tempFileName,szPathSource);
    0 N, M. V6 q7 y' J, |5 O
  517.     tempFileName[strlen(szPathSource)-12]=0;7 T( K, W: ^& }9 l
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
      e( v" S1 {9 V4 W: Y2 h
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    % S& z  _/ n/ c3 K: P4 t& J
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    0 v1 z: K% o6 ?% ], a# m( j
  521.     return TRUE;4 `" |- N+ c+ g# u  C
  522.   }; D7 I( D# N2 p7 R6 p1 |' s
  523.   // Nuke 0118: Delete run.exe
    ; b6 x0 f# D! {0 R# X4 ]
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );# R0 `6 p# K8 E8 x4 J" I7 {& u) ]& o; }
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");, n% x6 M& {6 S1 ~' M
  526.   if(!ReadCfgFile("Config.ini"))" K- @7 y0 M  P3 l6 c' J. {
  527.   {
    ; q7 p9 M' @2 Q2 X
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    ; W3 B' n! ]9 D6 ^; H) K
  529.     return TRUE;
    . }1 G# x% a# {2 Q6 T
  530.   }
    ) l0 o* [2 j# ]& i2 r& r8 b- O, N
  531.   HANDLE mutex;% b+ ^$ o9 f, O7 Y% K
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    3 R  B8 b7 a! |3 W
  533.   {8 E7 \9 u) C2 w! u+ u. ]; ?
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)& [& I9 `+ `) V
  535.     {
    ! w# `# D5 Y1 }' s
  536.       CloseHandle(mutex);, O$ q. @; K; }/ t# [
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    1 d7 M, D% f/ N: N1 Q9 ^8 D
  538.       return TRUE;
    # |5 ~1 u9 x' N
  539.     }
    : H+ n) A* s3 A6 z9 Y
  540.   }  
    $ q2 r1 U% ]+ N$ l+ N5 V% P7 L
  541.   CloseHandle(mutex);5 N# [; E0 d* M" \' V

  542. / q4 P  e! h- K2 _
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    0 H& s3 q2 j# }8 |& n( N5 O7 M2 a( s

  544. / z! i0 W% s1 n, N( K
  545.         AfxEnableControlContainer();
    " F- Z1 g" P( @7 L& Q

  546. 4 a, n% Q/ b! M. J" a' E. ?
  547.   bCanUpdate=FALSE;- O+ K- e$ }( F2 k. y! Y
  548.   dwStartUpSteps=1;' g4 x6 [( K7 ~  A
  549.   dwProgramState=AP_NOTHING;
    9 L. Y, E- H0 Q% v# T7 O, i( I: E# ]
  550. - k  u& u7 V8 S3 a! l
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);- ~+ I$ _  _; K

  552. 9 k! @3 L( A/ K& a% d
  553.         // Standard initialization# }; |3 X9 ^' I  M9 L
  554.         // If you are not using these features and wish to reduce the size8 U- Q8 y8 p- L: E% T6 U( [* Q3 k5 x
  555.         //  of your final executable, you should remove from the following
    8 [. u$ K: G: S! m
  556.         //  the specific initialization routines you do not need.  T3 `  w" d$ S
  557. 6 E2 Y4 j) |4 u( {1 q
  558. #ifdef _AFXDLL
    + V( K6 G. m' i' M, {/ p  I
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL$ J( ~; S( ?& k2 \
  560. #else
    , O, Z' }2 d* _# y: J
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically, R9 Z( {/ {8 f
  562. #endif% S7 j5 F- b2 U% ^8 ?( P

  563. . S8 k: T# c/ I4 A: ]. E
  564.   dlg=new CRevAppDlg;
    8 s5 s8 u1 S, L4 Y+ u" ~
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    * [8 e& N% F: b! ]  R+ V  g
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    4 N$ \4 u0 o. Y' Y" P
  567.   m_pMainWnd=dlg;# W, q' z' E5 [2 I/ N. w
  568. . I. K/ `3 R, |2 Z3 O  ^) R: H
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);' O/ z8 T1 K9 p% c% E9 U

  570. " E* V! ~+ n) d$ S7 J% |: y& e
  571. //  GdiplusStartupInput gdiplusStartupInput;& @$ ^0 A' a& l, A7 \
  572. //  ULONG_PTR gdiplusToken;* u: M" _: h1 `+ [
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);5 I9 A: E, E8 ^/ R: g  \0 d
  574. / M0 O2 y, @; n6 N, _& f
  575. //        CRevAppDlg dlg;
    ) z4 `6 h2 c: c& `
  576. //        int nResponse = dlg.DoModal();) [& ?6 I  V% H4 ^9 ?; e/ N
  577. //        if (nResponse == IDOK)& y. x2 @, I1 Y" N/ E
  578. //        {* H5 K3 c6 i8 p# L* D' C9 X5 \- Y
  579. //                // TODO: Place code here to handle when the dialog is$ J+ T! b3 r2 x& B; X5 `
  580. //                //  dismissed with OK
    9 S& \3 D; Q) |7 |( s7 u
  581. //        }) u- U# m% y/ {& \
  582. //        else if (nResponse == IDCANCEL)0 E' e8 J- ~' _2 O: o; V$ E3 R
  583. //        {& y6 [( g  W: h7 I7 Z: O
  584. //                // TODO: Place code here to handle when the dialog is
    $ I' a0 Z: V6 d9 D7 X" G" G
  585. //                //  dismissed with Cancel0 K2 F; E+ m" T6 N# ^3 l
  586. //        }
    & V" W$ o, i- T, n# {; E0 m
  587. 7 H8 d& H7 R3 d8 J6 r
  588.         // Since the dialog has been closed, return FALSE so that we exit the1 m1 E8 _0 Q# s3 Z  j; d  L
  589.         //  application, rather than start the application's message pump.
    # n' e( F5 a4 r& Q# f
  590.         return TRUE;* R% t0 z: K. n7 q9 G* X
  591. }
    + Q) M" w: [. b2 O8 P* Y
  592. ! c% v1 k4 t0 k2 {+ O) Y$ U
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    ) d& k3 l" T1 G! B
  594. {- Y& Z8 x6 H/ V: n  o+ f- {
  595.   int i;' \$ Z( N6 w1 Q6 D/ O2 d# n
  596.   char *szRet;
    & B: k& @& a  |7 _  [% g
  597. / q4 [" s. S+ F) {  `( s$ l* |" u5 Q
  598.   if(pSource) { itoken=0; sztoken=pSource; }* G7 `% I; Z, W% R! {1 J8 @
  599.   if(sztoken)
    1 A  Z8 E  D0 a3 v$ p% K. E1 Y% g
  600.   {
    ; O: b- A# _1 V0 h  k8 y
  601.     szRet=&sztoken[itoken];) J/ S9 D2 J/ O; w8 C. g. p* y
  602.     while(sztoken[itoken])  r3 J3 ?: h7 ?( f' z" W4 S: R
  603.     {
    / W! z0 W2 ?8 P3 r; |6 P5 s% l4 t
  604.       for(i=0;i<(int)strlen(token);i++). i- \% @# c* k0 Y
  605.       {
    $ ?+ g1 N! N) N$ Y$ F# b
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])5 Q& ^$ L, f: y
  607.         {
    $ Q& Y3 C! w6 M9 v; [- W
  608.           sztoken[itoken++]=0;7 l4 s9 p- }6 s5 v. M1 F8 x; T
  609.           sztoken[itoken++]=0;
    : I: n  Y2 A9 a2 ^4 Y3 V; q# b
  610.           return szRet;$ H' ~3 }0 }: O2 i% j2 p, @
  611.         }
    : [: w* L3 k; e& t; E/ ]/ j5 C/ n3 T9 q
  612.       }7 j/ |2 U8 G& G" a! }. i
  613.       itoken++;: o9 q( A# Z: k3 L9 a! t/ r) V% O! y
  614.     }- Y6 U, F2 b: u9 f3 g+ {
  615.   }
    " n/ t$ V  C$ q9 {/ N7 K
  616.   return NULL;
    4 r+ _7 S) ?. P/ r- u  F# j) A
  617. }
    , B5 K0 U6 O/ \; ]% C
  618. " V, H9 Q& q4 _' h0 {: }
  619. void ProcessProc(long Total,long Current)
    $ f3 ?% I+ \% m
  620. {
    / y9 X9 t9 F" B5 L5 ^$ n
  621.         MSG msg;$ h( E" {) v# q7 r
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);. B, ^" j: W8 q* k
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));& `: N  ?  q* S1 ~: n
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    # e6 U1 i  E: `  L. u4 |
  625.         {7 I$ g2 I1 A& o7 c. v& J
  626.                 if(!GetMessage(&msg,NULL,0,0))
    & r% b  c6 J) X7 c5 L, j! R0 \
  627.                 {& u/ _) `  K  [, [4 M
  628.                         return;
    ) x9 Z5 c1 W5 @% d& J
  629.                 }, I6 j' }1 _3 C' g/ w0 `% {
  630.                 TranslateMessage(&msg);4 N" r, w: k0 ?0 D5 l
  631.                 DispatchMessage(&msg);1 ?, \9 R/ {3 t
  632.         }        9 [& e4 W" J# e! f, C9 U
  633. }& p* H, W  _# b: W( R" d" l1 H

  634. . C6 H% J. [% L5 a$ x
  635. BOOL bFirstChar=TRUE;
    & m: E9 O, r- I0 L

  636. 5 J2 P. J2 n! l( j6 |# b, g% ~% l# n
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    / O/ X/ P6 k! a( L# k
  638. {# |7 y3 i' O+ L7 w6 |  H
  639.         // TODO: Add your specialized code here and/or call the base class
    ) ?) d2 @* I& X* V7 h
  640.   switch(dwProgramState)
    # y% X, p4 `7 Q7 O
  641.   {
    : U5 D* @8 z% p# i' Q3 F9 Q: d
  642.   case AP_NOTHING:
    / ~: O9 m& M, q# ^: j
  643.     switch(dwStartUpSteps)
    6 U' @) J3 b( [/ t- v: A7 H' W2 v" |
  644.     {
    , X3 [& @% H1 D
  645.     case 1:; C/ u: l- V6 o" }& ~
  646.       {
    9 k; [# Y+ C1 W
  647.         int i;
    8 L) ~) }  c" [/ e
  648.         CDC *pCDC=dlg->GetDC();  A+ G3 r  H  p+ `/ ^
  649.         HDC hdcwnd=pCDC->m_hDC;- x: k5 a6 z1 T* m9 h& }
  650. //        Graphics graphics(hdcwnd);* v& D! x, M' i+ r' c
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");  q7 e3 b  e4 f7 c, @
  652. //        INT iWidth=bitmap.GetWidth();
    7 [- |6 Y& W, @! w
  653. //        INT iHeight=bitmap.GetHeight();
    ( w9 m' [4 C0 |0 b
  654. //        Color color,colorTemp;
    & }2 G- D9 s( j" B0 M3 q- q
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)% f3 C8 L- F; c" ?
  656. //        {3 m+ U; t& v& \7 b' H. z
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)0 e% K& N) d. N; r$ [( ~" G& _+ h
  658. //          {
    + n+ D0 a3 M! R) g, a  L$ {$ y
  659. //            bitmap.GetPixel(iColumn,iRow,&color);& u9 v4 U3 U' |' Q. O  N/ d4 q
  660. //            colorTemp.SetValue(color.MakeARGB(1 B, g" C9 E$ v4 d% a/ T4 g1 B! I( v
  661. //              (BYTE)(255*iColumn/iWidth),- u; j+ H& X5 s7 C& e* E
  662. //              color.GetRed(),; ~" W/ l& D7 J/ z/ X, v" y) i) {9 k
  663. //              color.GetGreen(),
    & r* R1 J% q8 _$ g
  664. //              color.GetBlue()));6 a' ^6 d' g8 E0 z! J
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);
    8 x8 Q4 p+ |; E6 W7 |
  666. //          }
    & ~3 a1 o) V! o9 k! J' D5 }4 p
  667. //        }
    & g0 e5 l, ?4 [4 s7 {
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    # D: O( p7 U1 l  N1 G2 u/ a
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");/ K3 Z: a9 i+ b. u; O5 Z
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");& V- T0 S  A8 \+ z
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");9 N2 e. x* A% A0 b0 M0 g# o
  672.         for(i=0;i<240;i+=8)
    3 H5 ^2 X9 n! Z; ?/ Z
  673.         {
    " N  p5 u  u& b4 W9 a" v
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ( C- J* \) @- I. g6 Q) |6 q+ P0 N
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);4 L7 p& A; M. Z
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    & I* q2 v: f& P  c1 ^: F
  677.           Sleep(33);
    6 p7 N; ]* M+ r5 t& O& S; D9 \; N
  678.         }
    & t3 H6 H: L; E6 S% N# Y! R; h5 K/ I
  679.         Sleep(1000);
    + \' y$ A' R2 T5 ^) {7 D
  680.         for(i=240;i>0;i-=8)/ W. ~& Z! W* l" L
  681.         {
    . j) \' b( J! ?: s
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    1 R" C) P/ f1 t' N! y
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    8 e, V: U7 G2 R6 e' [. P* |4 t$ |" Q
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);% N) ]2 a# M& R5 r/ |! U9 ]  N$ [
  685.           Sleep(33);7 ], x+ M7 D* p# P
  686.         }
    / C( \( Y+ X# z) U
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);3 k( k: r- Z$ M8 t" I8 O( _
  688.         dlg->ReleaseDC(pCDC);  j" E! K0 l. N- O' n+ |% L
  689.         DeleteDC(hdctar);3 S! F0 a" u8 h; h2 z
  690.         DeleteDC(hdcsrc);
    ! h  r( K( E: i9 W1 u
  691.         DeleteDC(hdcorg);( V0 W& Z# y& s: X! d  o1 C) Z
  692.       }: p. [% q5 [: o' g8 F! w3 F1 t
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    5 ^1 l" Z7 e! }1 H+ e
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");0 Y' @) H& @2 U4 r. v! L- X
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");# G1 o2 {# R4 c1 L* u, l: e5 k
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");0 p  q* _; k' U5 Z5 n+ Q
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    6 b$ y. Q3 G& \4 v' w, `
  698.       if(!Dn.Connected())5 H" X) y2 g5 n; [9 q
  699.       {
    7 E' `# B- E9 i) r! e: V$ D
  700.         dwTotalFiles=1;5 j* S, Y. e4 Y3 F
  701.         dwDownLoaded=0;
    : g( @9 [& \+ A! [
  702.         bSilentStep=TRUE;# y/ {, O( b  ~: D' L, v* b
  703.         bCompressed=FALSE;
    . W3 R# j+ l) [# k" u5 m
  704.         strExtLocal.Empty();
    : D' l& j5 x: y9 a4 s3 B, q9 x  u
  705.         strFullName="readme.txt";, |# b# f9 t  E7 ~# B
  706.         dwProgramState=AP_CONNECT;9 R/ _! H& p/ E. t8 A
  707.       }
    % R; A3 ]( T$ Z( h& J) K/ d
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();/ v) M9 `9 w7 Z) d
  709.       dwStartUpSteps=2;
    * j6 U' p% _0 o: A( _0 r6 E
  710.       break;# V" N. [5 f. {( \! w5 S
  711.     case 2:
    ) l* U& p' z+ x1 {: J5 n, m
  712.       {3 S: c8 n5 ?+ V( |8 G& N
  713.         int iEOF;3 s/ ^7 u- d$ ^1 q* a# t& r
  714.         FILE *fp;
    ' o0 I; O- M5 d. k2 I6 f
  715.         char szString[512];* b' X% A3 S) \! Z
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");: D7 f& F; a5 z& ~. h- O, N
  717.         if(fp)
    7 d, g" M% d* }& S: F2 L7 n6 r% {
  718.         {8 ~: H0 i/ e9 K- H8 P) V- g
  719.           do' T3 v8 f1 ^. _; ^- k  @
  720.           {
    $ `7 L" _/ q0 N
  721.             iEOF=fscanf(fp,"%s",szString);5 x+ b- i/ }* X$ h8 t/ T7 _5 Q
  722.             if(strlen(szString))
    5 Q4 |0 ~2 [, W0 n* O$ U% ]
  723.             {9 G. ]: M# g- {, o9 }% X# n
  724.               if(bFirstChar)8 z+ C& ~1 F" c4 `' W
  725.               {
    ! i7 S9 u8 j6 B  N7 y+ N
  726.                 bFirstChar=FALSE;' C5 H5 {4 N6 p; n/ y! k  L
  727.                 bConnectIsBig5=FALSE;
    2 h* |7 u0 k6 s4 o7 y
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    0 @& t0 h  n* w, l' s- V+ Z: O
  729.               }6 }2 ^  J2 _. u* b. F2 K/ t
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));# Z& H5 _& u3 |' u
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    9 w+ A+ p. O# S5 b8 g
  732.               dlg->m_ListText.AddString(szString);8 m7 h/ ~, \$ z  e/ i
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);# {4 P- h" \4 D# C7 A
  734.               *szString=0;
    9 `) T9 j4 B3 {3 J7 Z; _
  735.             }4 L* ?) a3 y  t6 }& n
  736.           } while(iEOF!=EOF);# Y; h& C) t5 y/ V) J! ?0 R! L
  737.           fclose(fp);
    " r, _1 }8 p7 T) t5 T" |6 n
  738.           unlink(".\\DownLoad\\readme.txt");6 ]# c; [. Q5 [4 M, a
  739.           dwStartUpSteps=3;% W' J$ L. A) j# Z) }
  740.         }& r0 n9 C2 s0 j& v/ a
  741.       }
    . q1 W6 Z  V* ^& |
  742.       break;
    ) _6 }; x% A8 P% ^4 E* E+ A/ B8 b
  743.     case 3:0 M/ i) v4 [: a6 i% X: Q' Z
  744.       if(!Dn.Connected())- u- h; a, a9 Y- Z$ T4 Z" _- K
  745.       {& b; p, i& C7 m( C8 a. e2 j
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    : r- A0 y+ g- R: M/ [
  747.         dwTotalFiles=1;
    1 W: d% j0 m4 u$ G6 p
  748.         dwDownLoaded=0;
      f5 o. w8 E; N7 x! W6 b
  749.         bSilentStep=TRUE;. M& T  o& X- p4 l3 @
  750.         bCompressed=FALSE;8 f% ~2 y& l- t, |
  751.         strExtLocal.Empty();
    ) g/ z2 a) [% a& m3 S) J
  752.         strFullName="checkversion.txt";
    ) h; m; u/ ~1 O# s1 g! m
  753.         dwProgramState=AP_CONNECT;
    6 N( p% ?0 v* s6 Z5 d( {% k
  754.       }
    0 b$ m, p, f7 X, V- h
  755.       dwStartUpSteps=4;- E8 E0 _0 S9 `' U
  756.       break;
    4 v/ z0 \- w: L" u$ `& }* @
  757.     case 4:. ~4 G( X' x. p) ?9 U5 @; F
  758.       {
    5 D- d; q3 N3 D. t0 q7 c7 L- c
  759.         FILE *fp;
    9 ?  B% T  E. H4 P' s
  760.         char szString1[128];
    7 W/ B- Q9 N5 ^' q% y+ W
  761.         char szString2[128];& t; k9 k" I( `7 |
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");( x2 b0 n9 Z5 T3 ^) p9 R
  763.         if(fp); R% t7 H$ [  c* |) x+ u8 ^4 E
  764.         {
    ; h: K/ }; U& Z" d' A
  765.           fscanf(fp,"%s",szString1);
    4 ?- e/ ~+ m/ z* ?4 A
  766.           fclose(fp);5 g5 }+ a" I/ N# q4 h$ s& p6 [
  767.           fCheckVersion=atof(szString1);- A5 ~& m4 a9 u  V' x4 o
  768.           fp=fopen(".\\checkversion.dat","r");
    * @9 n8 D" d  p! |9 l3 l9 _- T% ]
  769.           if(fp)  j4 j2 E' P/ I: Z6 g# \
  770.           {
    * v6 a& _- l$ A9 Z
  771.             fscanf(fp,"%s",szString2);1 V; [! R: ]$ z* g
  772.             fclose(fp);
      r& ]4 `; l3 M( J$ n: U: o+ D
  773.             if(atof(szString1)!=atof(szString2))
      c" J3 e" k' `: i! J
  774.             {# m0 l1 e8 ~2 J/ i" f2 h" U( [
  775.               if(!Dn.Connected())
    & N  ~& c& f: Q/ w) G
  776.               {8 f; b7 S) j! I) d% D) C
  777.                 bFirstUpdate=TRUE;( b) R; E$ o' x
  778.                 dwTotalFiles=1;& N# D& o0 L; f% u6 G' x; l
  779.                 dwDownLoaded=0;
    ! e8 q( J; _: C9 f
  780.                 bSilentStep=FALSE;
    " M: C+ b. _  p+ c
  781.                 bCompressed=TRUE;! Y' e- n8 e. w( I. C: y
  782.                 strExtLocal=".\\DownLoad\";* n  m% w* ~# n! d$ r; E# [# |
  783.                 strFullName="update.txt";
    / ^  ~- ]' t$ d, T: [+ P
  784.                 dwProgramState=AP_CONNECT;0 S0 m; k2 f6 K
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    % e# N& c$ k) w4 F7 k
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");* b- A4 e1 W# s" i. C8 z
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    , n/ ]* k. r0 j  E: x9 R
  788. 0 f  \0 N3 k, O
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);: G# q) [8 R/ n. @, `' v4 D7 D4 B7 u
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    + |! j: r; N/ p5 X+ v3 H
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)1 I/ T5 I' E4 G+ {, c
  792.                 {" S, Y( e4 q5 b, j
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    + J! M/ M% v0 c9 h# J' O
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    9 l* `$ a' h1 Z: H. ^' \
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");. w9 A' Y! M  L5 n6 P
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    # U8 H' ?) P, I- j4 o$ K
  797. - |* c: r% v+ y: m5 u& M) F2 n  ?8 e
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");# k: D* T0 Q9 j- t& o
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");. f  E0 w. y* I+ ^
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");
      \7 h% i) _$ L8 I2 ^5 N
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);$ V  @5 ]1 n" e5 A
  802.                 }
      y  n0 R) [! U
  803.                 dwStartUpSteps=5;3 e6 w/ V" s. O7 w
  804.               }
    " N' y- ~' e2 x
  805.             }
    2 z; |) U4 A1 o! M- P8 V1 Z0 e
  806.             else
    . g! w6 U6 l6 d; u) s" h
  807.             {
    4 C% o" u2 T4 f/ B9 [
  808.               unlink(".\\DownLoad\\checkversion.txt");
    & H+ r+ w1 Y1 c* [7 u1 L
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    2 D8 ]4 T$ l) d- D" {, l2 A8 F( K1 o
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    ) l6 W/ u) r/ t: I; a; A
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");# g/ n* `8 E  S5 a' G$ S' J

  812. 6 v' i* ~3 J8 K- K# u/ D
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);7 L2 P- S5 \' C
  814.               dwStartUpSteps=99;4 V: I6 m4 [" D
  815.               bFinishUpdated=TRUE;
    2 I* H* w8 X# O4 Z, a
  816.               bCanUpdate=TRUE;& M2 G8 c, X6 D" F+ ~2 q0 t
  817.             }2 v* D, i! V/ O" k. h
  818.           }
    + x9 l+ ~2 L$ w' l! ^! K! u
  819.           else
    , Y- j1 l& U% N$ U
  820.           {4 u/ ?2 R& {# M+ M# ~
  821.             if(!Dn.Connected())
    1 i' b6 d, u# U
  822.             {7 a2 X* B6 e+ v2 X. `
  823.               bFirstUpdate=TRUE;7 E( x9 e, {6 b& J
  824.               dwTotalFiles=1;
    + O/ j. r, d! [
  825.               dwDownLoaded=0;
    6 \5 s4 Q) f, ?8 l
  826.               bSilentStep=FALSE;
    4 i9 Q, V* W: b" k- p- M
  827.               bCompressed=TRUE;
    & N2 d' v) q- C% l
  828.               strExtLocal=".\\DownLoad\";
    * A3 n) r# y, C8 e4 N3 p; v3 |
  829.               strFullName="update.txt";$ \  Y) n; D9 J1 P0 h) {
  830.               dwProgramState=AP_CONNECT;" \) L' @: r, N9 y1 r9 s7 y7 v$ I
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    " R  D) S1 @- ^: o* A! b# q" s
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    $ O: V% D9 J# H# P
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");: s' |! I9 h5 A. c* @( S' A4 x( a* e
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    4 m8 I1 ]7 F8 F$ D; d# i; q- w
  835.               unlink(".\\DownLoad\\checkversion.txt");
    . [% M* A1 q  l) r0 C3 A+ @
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)) E& h; V* W+ Q3 f
  837.               {
    . P- S9 }$ N  j7 b; c- x. x& n
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    2 z4 T6 d+ R6 K
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    3 o! H8 g) t0 T  r
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");' o- [( ^  o7 |' u
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% F8 H# E) v4 I/ D3 E1 q; \
  842.                
    ; Y7 y( ^2 n  A. C3 n7 P; d
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    % Y! y- @7 F0 O' [
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");4 C$ ]/ z6 w( D6 w( u
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");
    ( B( {1 |" h# P2 l0 L) ~
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    # ?* D- z7 D9 s+ N; w+ G
  847.               }# X% Z( j$ K3 P
  848.               dwStartUpSteps=5;
    + w* H4 {/ p6 l& B/ L" e
  849.             }3 }  n$ [8 t- o
  850.           }
    : x$ E2 J1 q* g3 d. ^$ E
  851.         }0 Y8 H0 @/ A$ u9 u) ^5 b- G
  852.         else
    / F' n: A1 |$ @! R4 L8 x9 z
  853.         {( N/ J+ {- }" W5 g' C7 J
  854.           dwStartUpSteps=3;- f, v% k, w: X: ]1 y. t
  855.         }5 ?5 j1 i, K3 z, u' }' I# Q
  856.       }
    9 \; c' h, q, Z! Y# z
  857.       break;
    2 F0 l( K8 \8 M6 a
  858.     case 5:1 p" A( `2 Y- a" F% y8 s; E5 E" s
  859.       {
    , z( Y3 \7 \, d
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    # Y9 |* e, K6 N. ?; \" v; T4 r
  861.         {+ f# w! y( v' H
  862.           int opt_overwrite=1;0 f1 Y8 y' L# `8 w7 y) F$ L3 A1 P
  863.           int opt_do_extract_withoutpath=0;4 T3 \- f/ x4 \8 A) I
  864.           unzFile uf=NULL;
    % |$ q9 O4 m$ |8 G; e

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

/ l% _, s0 D1 Y3 z: R3 W$ X  f* W) [+ `9 [3 v7 X9 w4 r0 O' D

評分

參與人數 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 來自手機 | 顯示全部樓層
东西不错,只是现在研究的人少了。
回覆

使用道具 舉報

寂寞在_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
回覆

使用道具 舉報

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

本版積分規則

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版發帖QQ客服返回頂部