找回密碼
 立即注册

CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閱讀模式
8 @! {' |5 i$ t6 e- D% K
  1. / RevApp.cpp : Defines the class behaviors for the application.
    8 W, ~3 A0 @% T% {0 v; J7 J3 y
  2. //
    6 @" j+ a: @1 F. [9 C7 T+ L4 R

  3. 6 W/ M0 x4 x" R: Y( P- V! y' c
  4. #include "stdafx.h"
    ) Y1 L) U; x4 F) X. {$ P* }7 D
  5.   }& P" p: N& y9 v2 T+ A
  6. //#define UNICODE- G* a# ~; m" t% r4 V% x) X- O
  7. //#include <gdiplus.h>7 G8 i3 ~7 R& W* A
  8. //using namespace Gdiplus;
    : [+ K: r* p: V1 G. K
  9. % l8 q) [$ n" T8 x
  10. #include "RevApp.h"
    7 c/ Y7 }0 ?9 V% x7 G& E
  11. #include "RevAppDlg.h"
    9 l# x! C0 b% D& @- s

  12.   l' }/ X& a6 f) t
  13. #pragma warning(disable:4786)
    * A5 v) I2 {5 ?! f% B# I
  14. #include <map>  Y! h& ]) h# _% W
  15. #include <list>( `" S0 N/ L2 b. y2 \
  16. #include <direct.h>
    . c8 M5 I$ m4 g

  17. : S  q( q. I# k
  18. #ifdef _DEBUG
    - c+ e4 ]4 i/ o1 ?' V
  19. #define new DEBUG_NEW
    & x( P2 M/ ~9 P
  20. #undef THIS_FILE
    & r6 |. e/ q/ W1 f4 M( I
  21. static char THIS_FILE[] = __FILE__;
    4 b9 n$ W6 {! V+ g/ `! D) {/ s
  22. #endif
    + P; C! ^  N! E9 V& i  X
  23. #include "SkinResDef.h"/ l9 t6 U7 |5 [5 M; R, w7 I
  24. #include "ChangeBG.h"
    ; g% X1 P7 Q. b# G1 q; O' r4 |
  25. #include "AFXINET.H"* a9 q$ N3 p1 W, Q
  26. 8 ~! c0 Y5 l# X8 \- s) O
  27. #define TRADITIONAL_CHINESE 0) X/ Z  B0 e2 `+ D
  28. #define SIMPLIFY_CHINESE 1" z3 L1 W& q/ U# a
  29. #define ENGLISH 2  u9 |+ `: s! F" @
  30. int m_iLanguage = ENGLISH;/ O4 Q# f+ j) M# h% m% @
  31. /////////////////////////////////////////////////////////////////////////////# f; u+ [9 E0 ]2 W' i/ M+ ]
  32. // CRevAppApp1 p# U) D: Z! a$ v9 Z6 J6 r
  33. ( O0 ?  s2 S: T# G( _
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    6 L# _& i, G4 Z& F2 S+ q+ x- A
  35.         //{{AFX_MSG_MAP(CRevAppApp)! v  u, W3 C: V
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.6 r$ W" f4 i/ w1 E
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    ! v: s! P6 P, d" E4 A9 ~
  38.         //}}AFX_MSG- `/ F1 a! c6 V- z( R
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)0 C9 Y# x% N8 e
  40. END_MESSAGE_MAP()
    ) `2 r% W6 K6 e( z

  41. 0 @/ }& d( S, B+ x2 c
  42. /////////////////////////////////////////////////////////////////////////////
    3 z2 R  R4 u7 X
  43. // CRevAppApp construction0 f3 J$ p, x6 z8 H* K  R

  44. * V7 {; H0 U. J9 Q
  45. CRevAppApp::CRevAppApp()% A9 Q& l6 z" M- Y1 V
  46. {
    $ ^4 X0 \$ \' X# x: F. o
  47.         // TODO: add construction code here,; Z* K* @( y) Y4 O
  48.         // Place all significant initialization in InitInstance
      U4 `1 L' f0 P
  49.   bDisplayIsBig5=FALSE;+ Z- ^  L8 F2 Q% |
  50.   bRestartUpdater=FALSE;
    2 V- Z  J: w  |  t
  51.   bFinishUpdated=FALSE;
    " s; V$ L) J* D2 J8 ^
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
      t8 u& {( M# @4 N
  53.   InitChangeDataBig52GBKS();6 B% X, a- f! g1 @8 T
  54.   InitChangeDataGBKS2Big5();% k& D0 t; v; y# U0 z
  55.         //
    3 d8 b' P7 n3 j2 Z# {$ k8 |7 d: P
  56.         bClickRunExe = FALSE;, ^" T; h/ [- q' G
  57.         //
    7 \$ w2 I: s2 h- p( @
  58. }
    7 t$ o  v; B! L

  59. 0 b$ w# ]3 ^- x/ N( x
  60. CRevAppApp::~CRevAppApp()9 c" Q$ Q- G3 `6 G2 ^& P! g
  61. {
    / {* K$ L+ i: Y! I7 J: w
  62.         // TODO: add construction code here,
    : t+ J9 W& n1 @* m0 O) D3 Q! ?
  63.         // Place all significant initialization in InitInstance6 Z" r3 j; O- j2 J0 e- L
  64.   EndChangeData();
    * \. A( h6 _# a1 Y4 \
  65. }: p. ^5 z; z. v8 c: e& k& z/ i
  66. ( O6 W1 Q# e4 S4 w' f
  67. /////////////////////////////////////////////////////////////////////////////
    / O! s/ ^% o! x- V8 ~( s& i1 y( w
  68. // The one and only CRevAppApp object* r1 F8 n5 j" F8 C

  69. 2 H7 N0 M# \( v: J- }$ _
  70. CRevAppApp theApp;, S2 \0 w: d' Z' `8 C, Z- }
  71. ) P. r% a4 H! R4 R; A8 l: k7 y
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)6 c+ R& [7 |, p: ^& O
  73. {
    3 b6 r; F8 X) E5 g. K
  74.   int iEOF=0;$ Y8 P, [( E) f. f# k' v7 r# X
  75.   char szTempName[MAX_PATH];, Q( `9 u3 d* R$ H9 v
  76.   *szFileName=0;0 ~' Q" i9 Q& Z- i2 Z. |
  77.   iEOF=fscanf(fp,"%s",szTempName);
    & r% A! L' |9 o! X$ w, N9 @% }
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    6 y5 u) b- H7 R- p9 W% O0 ^, I7 U
  79.   {
      m6 U1 c! [6 Y( A% w7 R: F+ t) i
  80.     strcpy(szFileName,&szTempName[1]);
    # N  S% H8 l* L$ z. j
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)7 n$ A- m! Q) k' i/ Z  M2 I( X7 @
  82.     {% b1 T7 W- f  w. F: b1 h
  83.       iEOF=fscanf(fp,"%s",szTempName);
    + ^& s( X# _0 q) d* u( K8 h
  84.       strcat(szFileName," ");4 Q2 b! X5 o, Q( C9 }' L( s* Y# f
  85.       strcat(szFileName,szTempName);! A& ?4 ^1 u$ ~
  86.     }- I5 m  d8 U! y' V# k# O% Q1 ]5 s7 ]
  87.     if(strlen(szFileName)>=1)# T+ O8 l' i6 I8 S$ E; l
  88.     {
    , _2 }6 i0 P# n$ O3 Z+ A7 U% h' w2 R
  89.       szFileName[strlen(szFileName)-1]=0;" I, h( |0 i, w9 ]! Q) `' z4 b: s8 Y
  90.     }
    ( }  a: j2 M+ q1 A
  91.   }
    2 P& X7 Z7 b0 e. k5 l
  92.   return szFileName;
    - X4 Y4 \' J! J6 v4 J) l: n
  93. }
    ) z8 L0 {1 X- D( S2 Z' M+ n/ _

  94. $ t) j! I* `# k3 V# }$ j
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)9 T5 @; s+ P) s8 z
  96. {
    * }" R: F/ A" k7 ^" L# |
  97.   FILE *fp;
    1 ?2 h9 t) D' o! c. K$ X' K5 g
  98.   char *key=NULL;9 y( U0 `4 d* R
  99.   char version[MAX_PATH];
    $ O  Q- r2 ^6 r7 p6 k# y9 \$ ^
  100.   LPUPDATEFILE file,olds;
    " [: O' [$ r8 ^2 i8 c6 \4 q# A1 Y
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    & ~: k6 \# {+ `9 V0 s: Q, D
  102. + j# \4 y7 J$ K  s4 M
  103.   UpdateList.clear();& J( P9 W; [; q
  104.   UpdateFile.clear();
    : f( F' ~" z( G: k# |. [
  105.   if(GetFileAttributes(filename)==-1) return false;" x; z3 t) T1 Z, N0 l
  106.   if(!(fp=fopen(filename,"r"))) return false;
    9 |, K, }  T( r
  107.   fscanf(fp,"%s",version);( {, r/ f' h' h$ B& {0 f% `& C0 S
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
    ( r  }+ D/ ]; c$ ]# u
  109.   while(fscanf(fp,"%s",version)!=EOF)
    + v% p0 {, v, U) j- d1 [
  110.   {
    & w. s+ g3 Y+ s% N! ^/ D  N0 U
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    5 V5 i) r3 x2 W1 p+ r- I( c
  112.     fscanf(fp,"%s",file->path);
    6 V$ ?2 c$ o3 ]6 ^
  113.     ReadFileNames(fp,file->file);) |* A2 _7 D- @6 ?# Z% ]
  114.     strcpy(file->full,".");
    : `  M. }# K0 L& D# V' N$ h! k+ k
  115.     strcat(file->full,file->path);
    , a; y$ n) [$ M0 e. E
  116.     strcat(file->full,file->file);
    6 S  Z7 l+ z4 a2 e
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())8 v3 N7 N( H$ m  B" m/ |# q
  118.     {; M, c8 z, n/ |
  119.       file->vers=(float)atof(version);
    3 \# E3 o, z* ^+ X/ Y' P9 |7 @& g
  120.       UpdateList.push_back(file->full);1 q8 S1 G2 l. \! V4 J
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    ; B0 j' M% ~! q: W* z' R, r. M+ L- V. R
  122.     }
    ! e$ U5 l  t; f$ S6 \# d
  123.     else
    . c, m; r( Q+ r, R
  124.     {
    7 ?+ M) |1 Z5 z2 P
  125.       olds=(*p).second;- w- p0 P- M$ W  z
  126.       if(olds->vers<(float)atof(version))
    0 B7 w4 @5 J" P; X1 L) |# l* E* x
  127.       {9 K) @( H& I3 ~
  128.         olds->vers=(float)atof(version);) |  Y0 g$ A& D$ x
  129.       }- T9 f- |3 e1 l2 Q+ s
  130.       free(file);" d0 F9 ?" _% C- ]* V5 l
  131.     }
    * M7 o4 R7 r: m& e  b& l; W
  132.   }# h7 x! J( V9 ]0 S- ?3 _
  133.   fclose(fp);! `- I5 }+ p8 M# b8 r
  134.   return true;  c5 _- {$ J9 _% d
  135. }2 x5 P/ p% x5 w1 M$ A2 z% g$ z, l
  136. 4 _5 [4 N& i' X# l: T7 p
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    , `, `3 \% D+ o
  138. {0 a4 P- u" B+ R
  139.   TCHAR  szFull[MAX_PATH];
    # X% p" D9 A6 K7 m0 H
  140.   TCHAR *token,*inter;1 _+ X3 ~& x0 _; ^  |" Q
  141.   *szPath=0;
    3 \4 G7 }' B; ~
  142.   strcpy(szFull,szFullPath);
    + d( f& j, w. W$ ~
  143.   token=strtok(szFull,"\\/");( G$ Z( _; v. \& j8 l* S" j
  144.   inter=token;5 @6 D: t- o5 ^3 G7 I, q- U
  145.   while(token=strtok(NULL,"\\/"))" W! f- ^. `1 @, o8 Z# v( I
  146.   {
    , T* w% X4 V  }' Y' L, M
  147.     strcat(szPath,inter);% O& s2 K; V/ M6 E. ]* W
  148.     strcat(szPath,"\");
    : |1 u1 r6 s: w4 }! P& _8 S
  149.     inter=token;0 M3 `! B( w4 v3 t8 x& r4 \* Q
  150.   }
    3 r  F! F8 i' d$ @+ u7 Y  N' B
  151.   return strlen(szPath);1 |! G! {7 u$ d
  152. }
    % a+ x7 P0 q$ U6 y( ^3 L0 X

  153. + ]) s1 o! G0 I  Y
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)1 B2 d- d% M% f2 F0 {6 v1 e
  155. {$ V1 {, E% v/ R1 w, X: p/ [: Z
  156.   DWORD attrib=GetFileAttributes(Target);
    0 c% V: [; b1 j
  157.   if(attrib!=-1)  x5 P( c+ t1 ^7 M0 b
  158.   {
    & [% a7 E0 u" ?3 ~2 i
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    3 X  R7 m! K# u" ]1 U
  160.     {, J1 x" l: D: {2 _' E2 y
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    + W9 t( \( t  H% g8 u# g
  162.       SetFileAttributes(Target,attrib);! A* ~+ O% ]; B% z9 R
  163.     }
    . h* u9 D; S+ n3 R; o, K* @, ~
  164.   }
    8 w- g9 {8 H& r& b+ ^
  165.   CopyFile(Source,Target,Erase);+ p# Z' r5 M, _$ ^9 O% V6 x
  166. }
    7 u/ d" w$ J! n( ^7 @( y

  167. $ e$ x& ?; B* R* Y3 P9 c
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)0 \+ o8 y8 N, G2 Q
  169. {
    , m0 y0 F/ r6 g! V, X& W
  170.      FILE *fp;
    0 m7 }( p) J, L% [- \
  171.      char  szBuffer[8192];+ a2 ~6 @2 z2 ^8 L% ]$ {1 L# N4 }
  172.   va_list  argptr;
    ! Q. |4 c8 Y- m6 G7 M

  173. 9 v: z! z( e3 w) {
  174.         va_start(argptr,message);
    8 d. a7 H9 F* Q! ?4 H
  175.         vsprintf(szBuffer,message,argptr);+ X& I; V. Y6 T; }3 {4 k
  176.         va_end(argptr);5 I; Y  k9 K0 C0 U+ O
  177.   fp=fopen(FileName,"a");
    $ w& t% V" h$ E! F7 W: R
  178.   if(fp)
    8 H5 [4 |( s1 F% D0 j# K- U
  179.   {
    # f, A1 r; s" }" L" w
  180.     fprintf(fp,szBuffer);
    2 ]6 s0 R2 T$ p# d5 {
  181.     fclose(fp);: d9 d1 m1 ~2 \0 h9 H& ~" T6 Y
  182.           _flushall();
    # V% L! H6 X( e+ i7 F
  183.   }
    - y0 i9 w' C+ ^
  184. }
    # d8 R) Z/ d6 ?3 _+ ^! S) ?

  185. ) y6 c( O+ @  c8 ^, x6 s
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    " }$ D: }" Q% P6 |
  187. {
    : M( O2 }7 N% y( T
  188.      FILE *fp;
    $ n" k9 E8 q0 e1 H. `' b
  189.     DWORD  attrib;
    - O; H3 P5 [" @# A3 ~; O
  190.   attrib=GetFileAttributes(FileName);( `; E  [) J' v( {6 o
  191.   if(attrib!=-1)/ b( v" [/ e  e5 D
  192.   {
    " {$ ~; z: A1 c8 r( n9 n
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
    " b5 m1 i; l" G# i
  194.     if(!SetFileAttributes(FileName,attrib))
    + a# ?; o! n6 K, J2 ^
  195.     {1 c0 [7 ]+ M& R" X$ i; X9 B
  196.       return FALSE;
    ( C$ o4 [+ i7 T- \+ K
  197.     }
    8 a1 I5 Y! J7 ?. i3 W9 X2 F+ G) w* N
  198.   }
    ; u5 o5 G  g# S
  199.   fp=fopen(FileName,"wb");$ b8 k) Y9 P( H+ {( i  R5 L
  200.   if(fp)
      G& w" E# |) S9 b
  201.   {( ?1 o0 K1 C0 g
  202.     fclose(fp);4 I1 x/ U6 _8 x; v7 Z
  203.   }4 Y( x' F1 `$ P6 m) k& I
  204.   return TRUE;; N3 x0 ^5 E% x+ ~! @: C
  205. }
    " E" k9 S' _7 V1 B9 k2 D8 ?3 k
  206. - b; h* U% F. k9 X/ c! `/ \
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    - c$ d/ s0 `- V+ ?
  208. {6 B7 \! e# I& W* S
  209.   char filename[MAX_PATH];/ O- H1 y0 a- u, L% `3 ~: J
  210.   LPUPDATEFILE file,olds;
    : v% h. m& o) n7 l1 @& B* A* k
  211.   std::map<int,CString>::iterator i;6 m6 g5 J  T- U: y3 C$ M2 D' A
  212.   std::map<CString,LPUPDATEFILE>::iterator p;
    9 j! s3 h1 g( j0 \! u6 ?
  213.   std::list<CString>::iterator l;. L, _7 I; M' t3 R& i4 H

  214. 8 X- s- H0 g+ P2 i8 [+ e
  215.   if(bFirstUpdate)
    1 p5 a1 A; x# _% [
  216.   {
    + J/ R: P; \% F4 w3 L
  217.     dwCurrFile=0;) _* S! x8 `' T4 A+ C
  218.     bFirstUpdate=FALSE;
    ( m6 M9 Y& w. U$ D
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    5 a& w5 d: A. P" B6 s6 `
  220.     {
    ( I# }  X/ K2 E! G( _3 w
  221.       dwTotalFiles=UpdateLocal.size();
    3 B0 N9 u: y( F
  222.       dwDownLoaded=0;
    8 r! b. L4 ]# o+ R' q1 [) }9 o
  223.       bSilentStep=FALSE;' P/ d- K7 o* J5 X) O5 L
  224.       bCompressed=TRUE;5 Y  Z$ F. w, V3 K, `4 V7 q0 C
  225.       strExtLocal.Empty();
    ( C- v+ e( D4 p/ |
  226.       strFullName=(*i).second;! a# V& Z: ]3 @4 [
  227.       dwProgramState=AP_CONNECT;
    ( f% B+ h# ^. Y0 M
  228.       return TRUE;) g, s5 k. r5 i" W* o
  229.     }
    3 h4 L/ I8 r7 M  b
  230.   }
    ( g0 z# V; F5 N9 T/ d
  231.   else if(bRestartUpdater==FALSE)
    9 L8 w- s' c. \
  232.   {, B5 t* p" o8 N& x
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())) s# @- U( G0 ]! A9 d' r( |
  234.     {2 z4 O0 F7 K  j0 h& @1 ~4 @
  235.       file=(*p).second;
    2 M3 `: z+ g; O
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    " R9 [# {; B! t1 O6 O" d2 j: U5 D8 R
  237.       {
    $ G6 a: _/ q; m1 ]2 _2 V
  238.         olds=(*p).second;1 r* I% x: }9 B7 Y/ O7 @
  239.         olds->vers=file->vers;7 S% U; B! a9 F3 |; ]- P  [- X2 @
  240.       }
    1 y# @: }: Z$ t! e% G9 |
  241.       else5 {* I* X$ v. q5 N% E
  242.       {5 c" r( K- m& C- ]9 k
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));! o6 p8 {# a) Z. M4 A
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    3 I; l% `  {" ]  Z9 N9 ]  D' ~: X
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));/ q" U3 }7 i8 o+ K2 d2 m
  246.       }
    ' e# `; L; o! v) ]$ n8 w) p
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
    ( ?! J, X' j! _( `+ c
  248.       sprintf(filename,"(%s)",file->file);
    * p, o% z) Z8 l5 D' q
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    / J8 ^% T: }* V$ S9 I' w
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }) A, Q" v- E9 I* n6 B; V; V# T; B8 C
  251.     }6 _* ], v* e; E
  252.     dwCurrFile++;
    7 E. S% \& g* c; j; }+ B# P9 ?
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())% S# k- f. w2 [/ U( R+ `/ ?
  254.     {
    2 o$ v  i: @, v
  255.       bSilentStep=FALSE;
    : h. h  E9 A: {( t& ^! i+ v
  256.       bCompressed=TRUE;- y$ b/ P" j3 i' E( a* e
  257.       strExtLocal.Empty();0 w) b" t  y% {: J
  258.       strFullName=(*i).second;, G: v& L0 S& g! d* H; Q2 I
  259.       dwProgramState=AP_CONNECT;
    4 l  T7 d6 Z- S5 K
  260.       return TRUE;
    - b! m* Q8 B% z* {1 N, H7 W
  261.     }
    5 z% B# V1 {6 @" r
  262.     if(!bRestartUpdater)
    0 P5 O( g2 _- Z' t( B. Z, f
  263.     {) D4 Z5 C* j/ b' n# G0 q+ b# }
  264.       int iCurrSize,iFileSize;
    3 R7 j- d" H2 K$ h7 @) n9 |. o4 ^3 {
  265.       iCurrSize=0;3 _+ z8 L& e/ ?: l" g6 _- v
  266.       iFileSize=UpdateList2.size();
    4 m3 @/ Y8 j& R4 v# [. O
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");1 q6 X3 A' ~+ U
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");7 f: l5 f% j/ p; L% a
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    3 ^' h6 Q1 x5 d" D0 ]/ O: t
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . u" H( a. u2 L+ ?
  271.       Fclearf(".\\update.dat");
    . D/ B- a8 S7 @+ c8 u
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    1 ~8 T6 ]# q% Q; e: r
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)+ ~/ |4 `% V( y1 o! a: {
  274.       {
    * O6 X2 R7 F6 |1 y
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    5 z  ?: ?8 T9 m/ b' A& ^1 U
  276.         {( f- y- u& X0 s2 A& D
  277.           file=(*p).second;
    , A# A$ y& H" z% M, D' Q$ J
  278.           sprintf(filename,"(%s)",file->file);- _4 E0 }: q# X3 r
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    * @5 ]# g# `% r% |" _9 Z( ~" W
  280.           iCurrSize++;
    8 N+ ]2 D! |3 W( s* I# I
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));1 @6 }4 P; b- G1 l) ]2 ?# d
  282.         }
    , K  f- ]$ X% v6 R
  283.       }
    ) y0 Y, i8 C7 R& H8 L7 p8 e1 ?
  284.       unlink(".\\update.txt");, w4 m+ q& p! Z9 `. L: `
  285.       unlink(".\\update.tmp");  o' y3 u# M( S4 p- n1 A4 O& ?
  286.       Fclearf(".\\checkversion.dat");
    . M( p+ q* E' M2 i7 I9 E% g( D
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    ' {, J' M3 S- R; {
  288.       if(UpdateLocal.size())
    3 U0 a& h# }: ^% @$ p
  289.       {
    # X% ~6 ]. z8 I
  290.         UpdateLocal.clear();
    6 _* j5 N+ _1 H9 Q0 E
  291.       }
    0 }$ I6 D& `1 E
  292.       if(UpdateFile3.size())
    3 j' V* I' |- _- g
  293.       {8 n' [+ R/ ^1 d, P
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)) s+ M+ y5 x/ l: \8 Y
  295.         {7 V* h: d% V1 T1 L( u% O
  296.           file=(*p).second;+ {2 Q4 g( j; E( N. i- i! d  M6 k- ^' I
  297.           free(file);7 S% B# S% @  C8 L5 ^& |
  298.         }
    ' V% @& }, e3 T4 K4 V& `
  299.         UpdateFile3.clear();
    4 h8 u3 T9 g* N, i3 U8 s3 P. A
  300.         UpdateList3.clear();
    8 K. p5 M% E, I* T
  301.       }) I5 [7 V$ m7 y
  302.       if(UpdateFile2.size())
    $ Z& ^4 b7 S" w1 x+ X4 I
  303.       {" ]5 L# w% `8 }8 W" X" z
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    ; O8 w3 P. _( @! @- I, i
  305.         {; f% G* f. f% x
  306.           file=(*p).second;
    # G8 C* L' O# I% ^3 a# G
  307.           free(file);
    ' u: V4 ?) z- P+ K
  308.         }
    + R& p$ j! z/ h) x
  309.         UpdateFile2.clear();+ u! I! i) M' ~4 q. m5 r
  310.         UpdateList2.clear();+ r+ C  o& r& l+ m3 v$ z
  311.       }4 H" L& v$ ~. r  M3 I$ R( j& i
  312.       if(UpdateFile1.size())5 K& m0 ~4 i" x5 N: Y( @# z
  313.       {
    , e& I* x2 W  Q' ^7 K* F3 }
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)7 k  g- F  o# K7 p2 g
  315.         {
    ! t' ]# l9 Q9 }! a5 c9 h+ T' y
  316.           file=(*p).second;3 a; Z. x$ _) H( k, S/ t# Y  u
  317.           free(file);
    & w* O6 Z2 a# n$ L
  318.         }
    . _3 u. C1 H6 x$ T# ~( l3 f
  319.         UpdateFile1.clear();
    6 V: E9 s8 {! S% y) d7 I; T) [
  320.         UpdateList1.clear();# p+ ^2 @2 o4 p: h  N  [8 _
  321.       }# B4 V- i. O" Z$ s0 Q3 U
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    # ?4 W# \  Z% {# o% [; ]7 @
  323.     }+ q  t0 {  W) M" W
  324.   }, Z2 A& N) T8 `0 Y" N
  325.   return FALSE;
    6 Y+ |' r5 ]6 a( F8 F
  326. }5 c  I  f2 s. I% y6 Q! d/ i

  327. 7 L9 t7 j0 C. p: }+ Z" N0 w) V  B
  328. void CRevAppApp::ClearAll(void)4 P5 f; m! F- ~- f2 k6 _
  329. {
    & G& {0 s( h: n; [4 K
  330.   LPUPDATEFILE file;# Q% |1 H5 p( t8 L2 A9 S
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    * ~7 U- y  P9 n
  332. $ y$ P+ R4 S) ~/ \, P
  333.   if(UpdateLocal.size())
    2 Z# h" z$ r1 u1 R) }( x. `5 l
  334.   {: e2 t: w- u6 g! s4 A2 ]2 a
  335.     UpdateLocal.clear();+ V, O4 q' f2 |4 `' P& h2 x
  336.   }5 S1 @5 q  @5 x. _
  337.   if(UpdateFile3.size()). ^8 P! I6 Z- S" i' F7 @: v( }. G- r
  338.   {
    " c0 |0 G7 P4 b; {
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++); t/ w5 T6 |% `( D
  340.     {6 U  c: y  U" m+ W8 v9 P; e
  341.       file=(*p).second;5 s/ r1 J( V, A7 T3 A
  342.       free(file);
    ( K; L/ t0 T9 k) f/ F
  343.     }0 @, |2 ?+ q5 N: {, e& j: ^0 [
  344.     UpdateFile3.clear();' ]. g4 m* C; j
  345.     UpdateList3.clear();
    1 t9 A, P4 [+ L- S. ]; T" y0 a
  346.   }
    8 D  k, Z  ?+ A- Z+ ?7 [
  347.   if(UpdateFile2.size())
    ( C" z$ ]1 B# ]$ r' f9 T5 V) y
  348.   {
    ) {: d- o0 r! D* n9 {6 {! o0 }
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++). k$ e% q4 U6 u& M  |
  350.     {' d/ ~4 t& z- `" E+ N6 z  U' `; Z
  351.       file=(*p).second;! U0 x1 B' F& X* k( @; e6 ?) l1 G
  352.       free(file);+ C1 V9 b" ^1 D
  353.     }
    & F! d6 {; A" H4 A; @: \
  354.     UpdateFile2.clear();
    4 c! T: r' e4 C' e
  355.     UpdateList2.clear();
    / O" s" A- Y1 }9 Q: F2 ~
  356.   }
    8 u% t! c* X& C
  357.   if(UpdateFile1.size())9 b( d7 ]! b( G2 Y! w# ?! |3 R$ ^
  358.   {
    / g: \1 Y. h9 z) v# i
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    . K+ e5 b+ z2 \' W- s- H+ Q
  360.     {/ l8 \* r# Y5 y1 G* f, d- s
  361.       file=(*p).second;- V; {2 k- N& C6 G. h
  362.       free(file);
    + V( f7 i$ T- W$ I2 J
  363.     }2 Y  q- u% H% N8 Z/ L
  364.     UpdateFile1.clear();: U7 r% m# d6 t
  365.     UpdateList1.clear();
    ! ~8 G' G( [# [' e% a
  366.   }
    " X  \1 h2 X" G+ F' _
  367. }  # q$ r- c/ M- o
  368.   
    3 R: F5 b2 L+ e) M. q- [. X
  369. BOOL CRevAppApp::CheckLocalVersion(void)/ W9 Y) R! k% {; Z  i8 d
  370. {2 P/ @( M& m  y
  371.   int c;
    " |4 P& R# S7 _5 E" ^2 b
  372.   LPUPDATEFILE file1,file2;
    9 d6 I. Y6 c1 s3 M( [& Q
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;, x% D' h" w& G
  374.   std::list<CString>::iterator l;+ z- {1 i8 U! j* [+ W
  375. ! X7 s5 D) Y3 s, F/ u4 C
  376.   UpdateLocal.clear();
    ! q2 i1 P2 K# Z
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    / a; `8 T1 m) j7 b3 L. _+ Y) a% g
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);2 \4 l1 f% B  G! {* h
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    ( F3 }6 v" z/ k
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    ; Z5 W% \1 G) c2 t9 j
  381.   if(UpdateFile3.size())
    + |/ t, t; `$ t$ Z6 J% G. s
  382.   {
    ! y" {& [% F, Q6 l
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    " B- \3 Y6 e* e4 C. J
  384.     {
    . V5 q7 j+ |0 C" X" n- W( @. S
  385.       file2=(LPUPDATEFILE)(*i).second;" L3 w; g( F  F$ n% U
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    0 O9 g# X! D: p; A! c4 [
  387.       {, q* ~# t9 w' E
  388.         file1=(LPUPDATEFILE)(*p).second;( j+ ~# A  {8 J# e. ]8 u
  389.         file1->vers=file2->vers;
    % ?" w9 r7 {$ H6 D% T1 D% ~
  390.       }5 m$ _  u) U1 C+ v- i6 L
  391.       else/ D! _  S6 u1 t. `+ W
  392.       {  m/ y# q5 s4 ^6 U
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    ' S0 c- z( \/ V4 n6 h$ F4 d! l( |
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    $ A/ F& W( _2 @0 P
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));9 T( C, B  f1 s& H* p' m% D
  396.       }
    8 w& u% C8 |/ k3 I/ [$ s
  397.     }
    8 ?% `/ O7 I' M. k
  398.   }
    1 q3 _9 F2 j2 U$ r
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++): N1 ], R6 K0 H7 f3 z
  400.   {
    # H' A9 g. W$ P& v; i% \2 _
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())* ~, k% @. N4 }7 [$ {. n' V
  402.     {! q5 ^: s2 T: ]$ Y) D* V2 O7 }
  403.       file2=(LPUPDATEFILE)(*i).second;
    ( l% t4 Y  c- f. r/ o) [
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    # O/ W/ y- F7 o, I% W: n5 ~
  405.       {
    2 U, i/ h6 p. U. \
  406.         file1=(LPUPDATEFILE)(*p).second;
    6 R/ I1 K, g2 `5 R" |+ W: E
  407.         if(file1->vers!=file2->vers)9 ^2 R2 q0 ]1 b1 |
  408.         {! U; C- d( G  ^" v
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    6 m* k( ?, e; p0 f2 b: {* D
  410.           c++;7 ~4 R3 d+ o& I6 B% r: \' A& s. E
  411.         }
    " B' M/ v" c2 X9 c) e& i7 w/ ^
  412.       }
    ; p) t: @2 w4 r& g2 t3 G5 r
  413.       else+ U, O/ k6 W, u4 R( U: M. C
  414.       {) g1 j7 m( s% b" ?3 G5 V( Y
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));8 R+ n- k! G3 `* F$ Z. q
  416.         c++;
    9 j9 W! @; x1 M) @# f' `# v
  417.       }' H$ k" N5 S9 j. {+ _0 |- E
  418.     }
    ! S5 ]/ `& I7 ?1 V4 y
  419.   }
    ) s% H$ d4 x1 s  Y, M3 ~- F2 K2 T
  420.   unlink(".\\DownLoad\\update.txt");
    ) A6 Q8 R- c( P
  421.   if(UpdateLocal.size()) return TRUE;9 j) j2 Z+ v) r1 V
  422.   else                   return FALSE;4 s  w& z" _* g- U
  423. }
    3 p1 c5 W! M- a! C0 U! N
  424. 6 k6 U' R( u3 ]# i' m5 }
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"- r1 H( Z! r  h8 R3 A" b+ p0 m& Z
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"& A4 l+ u% j% B: c' l

  427. ' g" M. d& d) O4 X6 P

  428. , W3 H% a" D2 A; W; c. V

  429. " O5 @5 n4 U4 a, W
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    ! W! A/ _  [7 \0 H
  431. {
    * y9 q4 r" v! Z
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;3 b; m8 l" E- ^9 s0 c
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    ; z. j! F# T$ o2 a! D7 @
  434.   {& l7 h& O, _1 h( y- H4 A/ O
  435.     char szLanguage[50];6 G( f3 \+ C2 h( j
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    ( {& d6 b8 n2 X8 r" g' B" K1 `4 J
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;) G) I* a( g; y' s  e/ A$ i7 o' b
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;6 f) h2 C6 D: r9 n! s
  439.     else                                   m_iLanguage=ENGLISH;
    % k' N+ P9 g: x, R8 J+ i
  440.     char szRegister[100];
    $ D% P3 O9 h5 Y; g
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    ; i  @+ Q6 w; q& Y, X% S
  442.     strRegsName=szRegister;
      |6 f0 P: v7 M5 I6 ?
  443.     char szPatchURL[100];6 H  j( [8 s) Y: a, b" b8 o( ?9 O
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    ( G) v: k7 k/ }! T  |. u8 p! Z
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);6 W9 H3 H' R2 a4 J& S
  446.   }9 R0 I1 T% g; d0 x
  447.   else
    ( m) `! J4 O, Q- {/ U* \7 b
  448.   {0 V9 p+ D( ?2 T
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    ! `( [- Q! b2 B; x( S8 E8 v
  450.     strRegsName=DEFAULT_REG_URL;
    " }% S, O- t! D7 T0 S8 ~- R
  451.   }9 j$ B- p$ h- J; S, i: K; p. {; }
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    $ D3 K8 v' u, J
  453.   {
    1 r0 I7 _" L" m+ H
  454.     char szIP[50];. Z7 i) {- b2 y0 F! g# }
  455.     char szDIR[300];/ z: ^+ e6 d+ p. {: W8 f
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    3 U8 b+ v4 W& W" k# K8 _
  457.     {
    - l( c+ P" E2 r# ~/ O' N
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");$ z) n6 J* ^1 S" M( y
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    ( q/ H8 Z& K. U$ i- W  c
  460.       strHostName=szIP;9 K3 p: l5 r* T5 X
  461.       strHostPath.Format("/%s",szDIR);; D4 i$ x" T# M+ L" }
  462.     }) u' D( l* H+ ~& X, p. H$ L
  463.     else
    " R0 M; M2 Y+ n+ |
  464.     {
    , s4 t3 f' d& b( j1 M
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    3 J; S8 e6 a* E7 @6 t
  466.       {
    + v! U' o2 t# v5 \1 V: b9 r( ?
  467.         char szLanguage[50];
    * B5 F* `0 z& E* k4 h7 M9 ?6 e* H
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");( I. x" f. ?* s) F* A
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    ! Q* z2 T7 f: v8 U
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;0 X% }; G! x" h' u. V7 H8 E/ X+ }
  471.         else                                   m_iLanguage=ENGLISH;# \9 V- F8 S+ \- }
  472.         char szRegister[100];9 q& S1 p& z7 V8 v! L) ^9 v! y
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    6 V' _; d! S; d2 I8 c
  474.         strRegsName=szRegister;) c5 g( [3 _: y
  475.         char szPatchURL[100];, |9 a" q3 b4 V8 |' D# h
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");6 L. y) S$ {4 i$ k, y3 D
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    ; o2 G. K( G: r+ ~" ^
  478.       }4 @9 I4 ?8 |% }& O2 g0 o
  479.       else
    - K6 j% }6 u" O  {# t2 i
  480.       {3 B1 [7 k% j& T, z
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    7 o# ?" Y8 [3 {7 T
  482.         strRegsName=DEFAULT_REG_URL;
    : k! r; R& r, [
  483.       }
    2 [0 \: i, s2 a# B) i* _
  484.     }
    ( ?$ n& I, O: c5 @
  485.   }
    6 r: n; W) l0 I) L) @( S. U
  486.   return true;
    - M- d2 j& D2 E6 b) T# |% }$ X
  487. }, ~% O, D, z8 J) g# b8 j
  488. . ]5 y  }8 w( q+ t' [# I# l. c. o
  489. #include ".\ZLib\unzip.h"
    . R) Z! v# x. i9 ?* q
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    ( _+ `4 \4 f" [% z- n
  491. /////////////////////////////////////////////////////////////////////////////
    * E" M' U* Y/ o3 b& r
  492. // CRevAppApp initialization! [) O2 j/ T1 M6 y6 R
  493. & c7 r) k* \! m/ Y
  494. BOOL CRevAppApp::InitInstance()! r& n+ T' K% {- J3 m) G, d
  495. {
    9 M$ u7 H3 h3 \  {8 {; e/ W  v
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];* {2 T0 |( W. V: y3 k1 W

  497. 3 N' r4 y9 a, A4 q5 r
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);( L; B( X4 B2 e9 l* q  ~: ?' F
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    : z* p( s9 X* i9 f) m0 d' r6 q
  500.   {, s# S. q4 s# L% _
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");+ ~- ^0 |: l/ ]! M0 r& v1 r; i
  502.     GetPathFromFullPath(szPathTarget,szPathSource);
    : c* _4 e) d# k
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))5 T1 L# X) M: N; ?
  504.     {- d3 E/ C1 I! }
  505.       strcpy(szPath,szPathTarget);
    ) w' ^& N9 E0 X; S* p% q
  506.       SetCurrentDirectory(szPath);
    6 W) N2 W& B" Z, Y
  507.     }
    # M6 V: C$ z- W0 t9 d( A8 b8 J+ [) H
  508.   }
    6 e9 U6 o4 Q( Q/ Y- b
  509. #ifdef _DEBUG
    5 b9 x" M. Y6 |. i# e
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    * {7 }( q( D, `3 y8 I  d" M
  511. #else
    4 j" t$ c' `2 ~) b
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    1 u! F; u8 o. N- U6 n
  513. #endif7 }& U  `/ \# ]/ Q
  514.   {0 I; k4 o$ ?/ g% X# \
  515.     char tempFileName[MAX_PATH];
    ( I7 p. n& P- o" i9 F( W
  516.     strcpy(tempFileName,szPathSource);! F  q1 R! U4 ]# D$ w) B/ @, O
  517.     tempFileName[strlen(szPathSource)-12]=0;
    3 r1 F! O0 t/ ?3 ]& K3 Y: b6 o
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    ' I6 }  a. R$ }$ @6 n# b
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    - L  Y& e6 x( ?
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);, r& N2 X0 B3 I1 ?
  521.     return TRUE;
    ; C. X  o( D+ ?/ j
  522.   }: U; ?! @* r6 c
  523.   // Nuke 0118: Delete run.exe) `( w3 `7 U2 J+ W3 Y4 P& {. p! U' M
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );+ Y( p) x! C9 K9 i4 K+ F: u
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");4 s  w7 w% e, z, S% L$ z8 A$ K+ {( C
  526.   if(!ReadCfgFile("Config.ini"))! H  K+ }: [. E
  527.   {3 Q3 _6 e  {" j* a2 t
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    / _8 i5 W9 Z& t4 |/ C4 d/ l; j/ \$ h* ^
  529.     return TRUE;+ Z, G* G" w9 U
  530.   }
    $ Y1 r6 @) g$ M4 q# q+ e
  531.   HANDLE mutex;0 r  R) v9 u, S6 _* ^
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))7 s2 A1 V3 ?7 t/ e
  533.   {" O) s( k4 ^% g. H5 h
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)8 F- Y) e% Y; o) H" T
  535.     {
    . l- I: D% X5 F1 D# k  B
  536.       CloseHandle(mutex);
    2 J1 d" G) ~2 k: Z8 J& O6 ^: I
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    . q0 h( S6 Y7 Z; p  j2 e4 {8 q! P
  538.       return TRUE;! K+ G3 j$ ~( f, \
  539.     }
    + ^6 T% G7 i0 Q) n
  540.   }    Z% N* |  Q# n
  541.   CloseHandle(mutex);" r9 _1 h5 s0 O6 ~# ~9 F' S

  542. , ^6 G$ i4 L( @. i& V7 T/ n% B: p
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    : \& }9 F3 V$ Y  e+ j
  544. 5 t: R% y5 I- w9 G8 s  ~) z: H9 p; j
  545.         AfxEnableControlContainer();
    % U- r9 E1 g' }& w1 }- Q
  546. 6 T1 _  G5 n- V: Y9 {; P3 W
  547.   bCanUpdate=FALSE;
    8 ^" F1 Z& C0 u4 I, g4 R3 w7 L# D' |
  548.   dwStartUpSteps=1;
    , E  v% i: L" R# ^% _
  549.   dwProgramState=AP_NOTHING;
    & m4 t2 L* p" |8 H# a

  550. ) T: T9 d" X) ^) Z
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    % x" j% J8 a1 ]) v8 p
  552. & ^# H6 j9 ^& L  o
  553.         // Standard initialization1 y- N* r6 ^- z
  554.         // If you are not using these features and wish to reduce the size
    4 F/ L7 P" `3 D9 Z
  555.         //  of your final executable, you should remove from the following
    , q8 j2 z! G4 j/ i
  556.         //  the specific initialization routines you do not need.. a5 h5 D, a& g( B
  557. & X4 y: o- j5 f4 N
  558. #ifdef _AFXDLL
    * O3 o" ~6 X3 C) a: _. w( W
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL
    . A: _! k# M: E$ a! W/ k
  560. #else
    ( G( I3 O) M* z% w
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    * W) y& u8 f/ X! A& b& D, \
  562. #endif
    ! k9 j, h; L4 L9 X# b6 h$ c
  563.   I4 _" q% z4 N! L- O; T
  564.   dlg=new CRevAppDlg;) f# n+ \0 c2 M. Z$ W8 x$ ~" a
  565.   dlg->Create(IDD_REVAPP_DIALOG);1 Z7 b9 ~5 f- G4 t% o; s
  566.   dlg->ShowWindow(SW_SHOWNORMAL);# q) F6 B, X/ P, j0 Z- H" t
  567.   m_pMainWnd=dlg;
    - O/ G! J8 K1 X8 {/ e: _+ n
  568.   U6 W: s, O9 K* ~% W
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    ( c: y1 [: @2 V& L4 S
  570. " M' T) ~' N! ]- q
  571. //  GdiplusStartupInput gdiplusStartupInput;
    ; @9 ^. x( {. R+ D! W1 I3 m
  572. //  ULONG_PTR gdiplusToken;: S' {4 Q, J( T: a* o/ E% X
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    1 i0 C" E' S& k' M+ v9 U

  574. . }3 C7 `( V" _4 W0 X  i8 d# a
  575. //        CRevAppDlg dlg;) t# M  O6 s0 {
  576. //        int nResponse = dlg.DoModal();. `/ p, L' z! J% D6 f
  577. //        if (nResponse == IDOK). p, a; f! Q) u% k
  578. //        {
    ( Q$ A+ \1 J& ~
  579. //                // TODO: Place code here to handle when the dialog is/ D9 s" _  w2 u8 V: m  p4 a
  580. //                //  dismissed with OK
    ( O! m% J  G; h5 n! p# k
  581. //        }( K6 g6 ^7 x& T- ?3 T0 T8 T8 }- G, {
  582. //        else if (nResponse == IDCANCEL)
    * A. h: |% G) y; W4 v) e; `
  583. //        {( V( R& _' A* D+ O5 U. A
  584. //                // TODO: Place code here to handle when the dialog is
    2 J' e$ f  L# f6 e
  585. //                //  dismissed with Cancel5 t. b8 J1 x/ F8 C0 o
  586. //        }1 }! l/ ?( X% y& w3 A! o; F! Z

  587. 8 b. V5 {7 G8 X
  588.         // Since the dialog has been closed, return FALSE so that we exit the) ?* }( }. Y! d7 ~0 n+ C
  589.         //  application, rather than start the application's message pump.! d* K/ z3 s, I8 |
  590.         return TRUE;" _3 ~. ?: M/ ?; ]9 g% X6 c+ \2 J+ j
  591. }
    " X. _" ~' Y- N& i: p
  592. 8 `3 B& T' w* F( ^$ d# N/ f
  593. char *CRevAppApp::strtok3(char *pSource,char *token)3 c& Z2 ?' W2 ?6 w9 R
  594. {
    1 N9 {# h# G8 ~9 r$ f
  595.   int i;
    & S/ J1 C0 `( V" O
  596.   char *szRet;0 A: g+ `. L1 ^5 Y- _* c: I: A0 I8 s
  597. ' F& W+ ]" U9 _9 w9 |9 g
  598.   if(pSource) { itoken=0; sztoken=pSource; }! \/ T6 n# N' V8 \* S
  599.   if(sztoken)
    3 u( S  p: }( g
  600.   {
    , o( b4 q2 q9 l" Z2 |2 b* I* r
  601.     szRet=&sztoken[itoken];7 ~" q# W" k3 H
  602.     while(sztoken[itoken])5 s/ p& r/ r! `+ u: H( S
  603.     {9 W7 p/ m$ Z  V* J2 }" S8 e
  604.       for(i=0;i<(int)strlen(token);i++)
      ]! ^& z9 c5 A2 T
  605.       {
    2 b8 p4 [  T3 A. ~+ A# k6 s9 n( j
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])/ V+ Q: l: [* p& |2 r' a" ]9 A* W
  607.         {
    & i9 ]6 O9 R6 h2 [
  608.           sztoken[itoken++]=0;
    8 {. s1 q8 d( a% j0 S
  609.           sztoken[itoken++]=0;
    $ i/ ]  H; q/ ~7 |8 m& Y
  610.           return szRet;. {' ^7 A7 g' A
  611.         }
    " G& R& N- F2 Q8 Y/ n% Z) {
  612.       }) P& g/ Z) W5 y0 v, E2 h
  613.       itoken++;: c& E* {' S- x. [8 i1 a0 q
  614.     }
    . H" |! |3 ^2 P2 l2 w) m1 z
  615.   }
    8 S2 o2 R( a1 O$ \% U) Y
  616.   return NULL;# P3 _7 k+ `0 Z% w( x5 p7 \- p
  617. }" l6 f6 [" {, h$ i9 d

  618. + Y( a. z# \0 R2 b
  619. void ProcessProc(long Total,long Current)
    6 ?: X' ?- d# B2 D- s! T
  620. {
    - z. ^- G7 D. D
  621.         MSG msg;2 ~' U: B5 H2 {; x' l
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    9 p8 I4 a% J' H
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    * i# }9 {0 G! D7 M
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    ) S6 Z$ e8 P& N0 ?- K6 C2 M1 w0 H
  625.         {! u, b4 r% {1 Q
  626.                 if(!GetMessage(&msg,NULL,0,0))7 c: j# O) O% l2 z; ^" a
  627.                 {
      Q- L' Y$ ?# @6 J9 l
  628.                         return;
    ) M3 O- R& \1 k/ ?0 H
  629.                 }
    ) q, |( z8 L* l1 |
  630.                 TranslateMessage(&msg);
    / d) p2 B: u7 y8 a8 E+ f* ]* c
  631.                 DispatchMessage(&msg);& r8 |$ a, a5 d. w
  632.         }        * R: Z$ j$ i1 t! c/ s! y
  633. }
    3 l* _$ L9 ?+ h6 ^
  634. 9 R! f  {1 b* z- W( z- n
  635. BOOL bFirstChar=TRUE;
    + l, `8 h( W9 \& x5 L

  636. # z5 |) P! N) g/ a4 Z3 \/ v
  637. BOOL CRevAppApp::OnIdle(LONG lCount); z1 A* T2 M/ f+ ^! I" B
  638. {8 e* h! Z; G% \* y' V# z
  639.         // TODO: Add your specialized code here and/or call the base class4 O+ a& ], Z! ?# J& Z$ f
  640.   switch(dwProgramState)0 S" Y% Q- ?' ]
  641.   {
    * u8 P6 Z, v4 b# F3 {
  642.   case AP_NOTHING:) Y2 p: E3 u3 I: U$ g
  643.     switch(dwStartUpSteps)
    * F  C* o; V: A7 j% }
  644.     {* t) j/ t# }+ t& [8 u" _+ J
  645.     case 1:( x3 |# Y+ C* Y8 x0 S' V! O2 H
  646.       {& \! c7 V1 U) I  H! J3 S/ o( k
  647.         int i;
    + c' x+ H/ O) I1 i; x
  648.         CDC *pCDC=dlg->GetDC();$ N- {7 M' E0 x8 p% Q2 E& f# g1 R
  649.         HDC hdcwnd=pCDC->m_hDC;( i2 O' |7 }& H, Q* E. f
  650. //        Graphics graphics(hdcwnd);) ^/ W) y5 x( g$ Z5 h, [% O
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");# R6 F4 [; g2 W
  652. //        INT iWidth=bitmap.GetWidth();! \% C9 ^4 `: T; {+ `. V/ {4 R
  653. //        INT iHeight=bitmap.GetHeight();
    ( j- b8 X9 d. l' ^& f# y
  654. //        Color color,colorTemp;
    + b1 [/ C4 V6 V& c6 ]
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)6 y/ R) ]9 A0 c# P
  656. //        {
    ( v: I# y  k2 K, q6 i! D8 F
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)9 w: r' R$ Y8 k9 X
  658. //          {+ w; r* @3 }) M( ?8 O1 E3 b  ~
  659. //            bitmap.GetPixel(iColumn,iRow,&color);" o4 L6 |, o! E( G  J
  660. //            colorTemp.SetValue(color.MakeARGB(
    + f. g4 B; F+ ^7 f/ h: w
  661. //              (BYTE)(255*iColumn/iWidth),
    $ K; v' H1 J" }+ B6 w: u
  662. //              color.GetRed(),
    + w# {7 w. b9 L
  663. //              color.GetGreen(),
    6 x  E; w0 ~7 @9 N7 _( c# n: M
  664. //              color.GetBlue()));
    6 n$ L+ [0 b8 P: m2 Q: v
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);  x& |# A+ _9 s" Q* b0 W0 J1 k
  666. //          }
    7 c; z" ^4 [3 V& ?0 K; Y
  667. //        }( ?& x- f& q8 A. [
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
      P# Q, e7 s# a8 |- I( x3 Q1 ^
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    ! z6 C! v: [9 M( h; s" z# w
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    ' Q7 f4 b+ {6 d# Q# f4 T5 p
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");, a$ ]1 |0 m& s& B# p
  672.         for(i=0;i<240;i+=8)# ]0 D2 G+ Q# {0 m* H6 n, @
  673.         {
    ; g' A% r- o+ ^! g8 F2 i  f5 K% k
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    3 `/ R# J( a5 y/ F% o4 M1 X* w
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    , m+ |+ ~  u6 o# M! L; _
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    : m8 G' A+ o/ ]
  677.           Sleep(33);* {% t; z2 f8 F. F
  678.         }( }7 L: a+ B$ x, q7 l+ S
  679.         Sleep(1000);/ y& U) R8 j2 d0 v5 _
  680.         for(i=240;i>0;i-=8)  H! o# q5 m1 @7 @+ s3 g" F
  681.         {* m/ g# ?: u. f& T. |' z' n
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ( _' E1 h& g# w7 `
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
      |+ Y* X( n. X" w5 V7 ^5 Z
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);# O. a, C$ }& I4 X  p
  685.           Sleep(33);3 L% @) P) D; I- J  z3 o- U: \1 J7 D
  686.         }5 G  F5 g% h* Z+ K4 U1 o! L
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    # Y9 }. r* Y6 I
  688.         dlg->ReleaseDC(pCDC);1 S0 f- Z: c1 P8 m5 a# e
  689.         DeleteDC(hdctar);
    % q" M0 U% |$ m6 U. U' K) c
  690.         DeleteDC(hdcsrc);' p6 |, \2 u- v1 S0 P( W9 a1 S
  691.         DeleteDC(hdcorg);+ Q/ Z  @# j, f# f: X
  692.       }
    ( Y) N% G+ Z8 W- j
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);! z5 v7 p/ P! c! [" S
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");: x$ y; G) o) x) O# ^5 J! x
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    * a' d2 ^5 u! P, e8 x
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    0 B7 k3 L8 z( l. \& q5 P) O7 k. p
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 t$ q) K$ X. D1 d3 v2 {
  698.       if(!Dn.Connected())# J7 D- N" c* `1 d) q5 V4 @4 h& ?
  699.       {
    ( n) l& N: U% j5 ?6 f- c
  700.         dwTotalFiles=1;5 {. A$ ^! |4 J
  701.         dwDownLoaded=0;
    2 U3 l: o% h, ~6 t. Y" C: F
  702.         bSilentStep=TRUE;* F6 N9 a$ @- A4 D% u/ q( T3 n' M
  703.         bCompressed=FALSE;
    # [* L+ \3 k# s: |
  704.         strExtLocal.Empty();3 p$ ]: C( L# c2 S
  705.         strFullName="readme.txt";
      c8 o0 r$ _! {! u0 R
  706.         dwProgramState=AP_CONNECT;9 q& Y2 Q( s4 h; E9 h6 s! T# s+ ^: z
  707.       }
    , ]/ L8 `/ q, ~
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    3 g. X1 E! O% e: K+ m% q
  709.       dwStartUpSteps=2;8 X5 v& s% }5 x8 Z" s  q! y+ r, r
  710.       break;
    0 U; b; h2 R5 u3 x7 }0 @
  711.     case 2:4 {8 L- _0 Q. e- [4 ^  |$ b. v
  712.       {
    - n) Q$ x" y, a3 z! d
  713.         int iEOF;
    0 j. F# _3 g+ a% Y+ g% F' }) ^5 @
  714.         FILE *fp;$ t, X$ }: H- [5 ~7 I
  715.         char szString[512];1 x- W; o2 O: r: e' r8 I- R
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    9 v, s- `- v% |9 S* V
  717.         if(fp)
    7 E; x. ?" [' D& s: J5 p; V
  718.         {. v' J2 J& `1 x/ M' S8 M
  719.           do
    . I, o( E: e0 w2 ?, V
  720.           {6 _% E4 q$ u" E; B, p9 N1 L7 H
  721.             iEOF=fscanf(fp,"%s",szString);% D- d: n8 p, C6 \& ^
  722.             if(strlen(szString))
    ' _* p( p. z& I. z
  723.             {
    9 w+ T6 I/ i- Y6 u0 ?* N# {+ W
  724.               if(bFirstChar)
    : Q* K: v5 v' E' I. O0 J( U& @( _7 P7 W+ r
  725.               {" h' G' y0 m4 u" `
  726.                 bFirstChar=FALSE;! Z2 j: j$ f; n. R5 }2 U
  727.                 bConnectIsBig5=FALSE;0 Y( M- b, O! N# g
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    9 N& c" J  J  m6 n; P
  729.               }
    2 o& O1 g+ O4 c8 q
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    # O: H) f: @, P$ L
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    / w; ?8 M( q: C5 z* V) D
  732.               dlg->m_ListText.AddString(szString);- l7 m7 h6 g" a
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    % Y2 o6 h9 g9 f* t
  734.               *szString=0;3 l1 K. O( T7 s2 Q- p
  735.             }
    5 B' }, l+ r( D& ^5 u
  736.           } while(iEOF!=EOF);  s, ~" a$ k0 d5 Y3 P6 n. p  i" K
  737.           fclose(fp);
    1 O( e$ E  s  I! x5 |% y
  738.           unlink(".\\DownLoad\\readme.txt");+ j" A) K! v7 o
  739.           dwStartUpSteps=3;+ }5 u9 X: j; o! f
  740.         }
    ) x* V9 C8 |" G) K7 f- q; J
  741.       }& r9 f& V8 k/ s  t: ^' J0 O
  742.       break;
    3 Y) J3 p9 a( A
  743.     case 3:: x5 g9 W2 a8 N/ F' n: `
  744.       if(!Dn.Connected())
    + Q" d+ O% R6 e8 b' s4 j" h# ?
  745.       {! ~$ A# |; Y! d0 [9 h
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);; K. E8 I7 _, m% N
  747.         dwTotalFiles=1;
    $ W1 N- Q6 ]+ e+ t) B
  748.         dwDownLoaded=0;
    * Y  \( Q3 G5 E' F3 D4 M7 ?
  749.         bSilentStep=TRUE;- {, R% x" x+ C) g$ h7 ]& F( d
  750.         bCompressed=FALSE;
    $ ~& E+ U9 B$ j' e5 o
  751.         strExtLocal.Empty();
    " q1 h% J2 q5 j- \5 U$ `. a
  752.         strFullName="checkversion.txt";: y: K/ a( ]. D
  753.         dwProgramState=AP_CONNECT;
    % ~! y7 T, q' x! ?# _
  754.       }/ }; K! v2 o3 |" x
  755.       dwStartUpSteps=4;
    & K6 e! v. |0 Y- X; h# @' M& p: {. ~
  756.       break;$ K3 X. k. `" `
  757.     case 4:
    5 K) _/ B8 b* |( w. G  V+ ^
  758.       {3 E4 ^/ j1 V1 i" {  }+ i
  759.         FILE *fp;
    3 _: ?0 A9 Y# ~! ^& V; P7 u
  760.         char szString1[128];
    : A  Y* o6 z# F) ^4 k3 U
  761.         char szString2[128];+ R7 `4 _3 U4 y! ^3 V
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    0 C1 b* V' n5 ^0 x3 c
  763.         if(fp)/ A1 l: r% U* S4 N3 a! B# R4 ]9 s7 ]
  764.         {
    2 U$ h2 t% k. G
  765.           fscanf(fp,"%s",szString1);
    - u+ Q. n, H3 T! U" X$ \
  766.           fclose(fp);
    6 `. X7 O+ h  c% Z
  767.           fCheckVersion=atof(szString1);
    6 F) r4 c' G5 p% K; c
  768.           fp=fopen(".\\checkversion.dat","r");
    3 O' l8 \2 l& }5 c5 N" ~3 J) K
  769.           if(fp)# ~6 i' D- \8 D- R1 M/ x
  770.           {
    1 E) l2 C4 D5 g4 S5 J: ]
  771.             fscanf(fp,"%s",szString2);, o# b5 C" i6 \
  772.             fclose(fp);" v( g+ _" W; F1 T! m& m8 D+ d
  773.             if(atof(szString1)!=atof(szString2))( Y% C( ~: A' L( c: K. a5 \7 i
  774.             {" U* N$ h. ~; f9 t
  775.               if(!Dn.Connected())9 s' K+ F6 W- n- }6 i" T6 i
  776.               {* M# L% x8 e2 _0 S. ~( B
  777.                 bFirstUpdate=TRUE;! |* j, z/ j' d) [
  778.                 dwTotalFiles=1;
    . X* r- v3 f: F% r0 P* z. ]9 s
  779.                 dwDownLoaded=0;
    . r$ ^6 F" \6 [9 T
  780.                 bSilentStep=FALSE;/ c7 \' {0 f3 ^# v* }! h
  781.                 bCompressed=TRUE;
    5 E) N. Q% |2 y: s: C) `
  782.                 strExtLocal=".\\DownLoad\";
    ' N" Q" ~! s# g7 K! |" K. }
  783.                 strFullName="update.txt";  i# ^5 ?+ Y+ E1 V4 ^" S- S4 M0 ^
  784.                 dwProgramState=AP_CONNECT;
    ( q% {9 P4 K" F; W8 B1 [
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    9 L7 g5 T9 E1 M- n, W8 C
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    * e6 `3 Y3 K. V& r
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
      P2 h$ w4 T1 Y7 j
  788. / f8 \6 b& V  E5 E
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);3 _! F- G4 `' w( a5 \( ?! _" M- P
  790.                 unlink(".\\DownLoad\\checkversion.txt");- A! n' H8 @$ ?) y" g" E) s
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)' j1 J/ i+ W4 M' l# }: C
  792.                 {5 d" A1 b& T0 V# s  J0 m" N
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");) F4 Q# m, {) P4 J0 E1 n
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");( X8 j' a8 u: C" S5 e1 X4 Y
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    - }; q# F* ?" A; t5 Q6 H
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    & {& y4 J, B( O3 a( q: U

  797. 9 d: X; [, U/ g7 k, \- @
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    / K) F( f7 ?0 B5 w! t5 l& Z
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");3 f- G) R6 C# Z. k( ?& n( `) S
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");4 A8 k% u0 J  l/ Z2 A; E' n
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);9 C1 F" K& T( N& c2 z1 I6 A
  802.                 }
      z: c+ p& f% E
  803.                 dwStartUpSteps=5;( G( w7 b- Q- A# x* F2 N4 A' w# \4 N3 S
  804.               }
    0 V, s) |, K2 X
  805.             }
    8 c9 E$ G7 X5 b- ?! i6 b, U
  806.             else. {' k0 D2 o4 i! x
  807.             {. U: z. x  l  O
  808.               unlink(".\\DownLoad\\checkversion.txt");
    ' g5 Q6 m* ^8 h3 ?' q! c2 h( h
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");( e' Z) C! {3 p1 }& _# |
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    6 b1 `6 _1 S; O6 Z1 {' n: x: b. }
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");% k" b/ |" [& X* A

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

' J8 v9 D: d0 M9 G; r- H. o( c, s. g, `# ^0 h. ^

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2026-1-7 10:41

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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