找回密碼
 立即注册

CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閱讀模式
! O( y% N. y- x
  1. / RevApp.cpp : Defines the class behaviors for the application.) ~3 I0 }; `5 O+ }
  2. //
    ) E: j: I9 Y+ m

  3. 0 [/ ?$ V8 k0 |. S
  4. #include "stdafx.h"
    ; i+ h4 l$ t7 f0 L
  5. : p! l- ^0 Z/ l4 o/ F
  6. //#define UNICODE! J, N* C' H, q; q
  7. //#include <gdiplus.h>* q! v" \+ T9 E6 V+ h1 u0 }9 K4 q
  8. //using namespace Gdiplus;
    ( [  ^1 [5 [( `4 W& r

  9. 1 j; c/ P4 G1 G
  10. #include "RevApp.h"
    + S6 E+ g) L/ `; b
  11. #include "RevAppDlg.h") V% M( k% t! G( z$ p8 q0 T

  12. & H* j9 D0 z5 J3 S) h6 o" S
  13. #pragma warning(disable:4786); ]) m3 o% c' E. q" U- f; u
  14. #include <map>+ A( B" y; j  A) H* ~) K5 s5 n
  15. #include <list>
    : y, @3 }5 h( j& z& V/ j! x
  16. #include <direct.h>
    ) G6 U% w" s" A! ?' B8 N
  17. 8 N! c8 ]( D1 r. `( W
  18. #ifdef _DEBUG( ]5 L! F9 Y% j
  19. #define new DEBUG_NEW
    : O/ t( b- v" Q: d8 [# b' [
  20. #undef THIS_FILE+ @% D' v" f) J" |
  21. static char THIS_FILE[] = __FILE__;/ D5 V4 T( C: G( T5 @; d5 G
  22. #endif
    $ e! D2 F2 n" g* w, C
  23. #include "SkinResDef.h"1 y6 T. X/ U* K% c! ^! R
  24. #include "ChangeBG.h"3 T& e- C1 b7 c
  25. #include "AFXINET.H"5 z) z) a+ \" h$ B  K! w

  26. % k$ G$ t( r. X& V: y+ h5 o1 v
  27. #define TRADITIONAL_CHINESE 0
    9 {7 B9 \7 x; D& B) y
  28. #define SIMPLIFY_CHINESE 1: P9 N3 s6 ]4 a; J2 O$ L
  29. #define ENGLISH 2: ?( f! }; e  e1 Z& _  X: G
  30. int m_iLanguage = ENGLISH;  U9 j! m' d. k& F, _/ T* i
  31. /////////////////////////////////////////////////////////////////////////////5 D+ U- a3 V! h! [) S& B
  32. // CRevAppApp
    2 J9 p! L6 ?9 T4 M' a
  33. , h2 ?7 |7 l2 P; Z+ ~2 p2 n
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    1 `* m' Y- V; J! n/ f. w
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    + {  K* F2 s4 R$ H! X+ Y% D) V. Q
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.( Q3 \( _% G' Y2 F
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    ' g7 z# f$ a" S2 D; O
  38.         //}}AFX_MSG; f) a, H! E" f
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)# V1 E# A; A6 A% T( A
  40. END_MESSAGE_MAP(), W$ a5 o( s: Q% ?% g
  41. : @+ r! d. Z4 T
  42. /////////////////////////////////////////////////////////////////////////////# _- y, r1 b. p9 T5 q' z9 `6 h' [
  43. // CRevAppApp construction
    & {3 h6 u' f6 e9 T3 W5 k

  44. 2 F5 x! o$ T+ p# j
  45. CRevAppApp::CRevAppApp()
    ( J7 L  z$ ]% U! p" D9 B3 q$ d
  46. {
    - n, [  Y, e! J6 u# N( q
  47.         // TODO: add construction code here,9 r9 ]7 v& N& x$ s
  48.         // Place all significant initialization in InitInstance7 X$ q6 G+ M7 R3 v. b& e0 R, n
  49.   bDisplayIsBig5=FALSE;
    " T' n4 g+ `- [+ x5 e3 ^
  50.   bRestartUpdater=FALSE;$ K) u9 l) s7 }8 I
  51.   bFinishUpdated=FALSE;2 X  g- G2 E5 {" ^
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    ( w+ b! Q, I& ~6 X' Y, S
  53.   InitChangeDataBig52GBKS();5 H6 B& w. Y8 d# x
  54.   InitChangeDataGBKS2Big5();
    " s5 Z# U+ I+ K1 Z' g
  55.         //' h+ S0 x1 F8 z
  56.         bClickRunExe = FALSE;
      W1 w& t1 w- q0 l2 K5 f  ^
  57.         //! l5 a/ }' l- }
  58. }
    $ X6 ^" W( }' c* V. N
  59. . u4 D" D3 M0 u! l- F3 Q9 A3 s
  60. CRevAppApp::~CRevAppApp()6 H9 Y& z5 B2 Z9 P7 N) I
  61. {
    0 z: k" P( o3 r( Z
  62.         // TODO: add construction code here,
    " z* p+ c" G5 K0 B9 {! }
  63.         // Place all significant initialization in InitInstance. s6 R0 N, s, N
  64.   EndChangeData();
    / u) q# M  i4 @8 V. ?0 Y
  65. }
    ( v9 h: o) M/ m0 K) o

  66. 0 q. k9 C' `7 n0 l# y
  67. ////////////////////////////////////////////////////////////////////////////// H* j) b  f) n2 g, J9 E. B
  68. // The one and only CRevAppApp object
    2 M+ o; Z8 a0 g1 D& O+ h
  69. # D8 _' ?6 X  d  G+ `3 t8 l3 R
  70. CRevAppApp theApp;& n. d& m( y9 I2 b  \
  71. % h8 i! k8 {4 Z1 W) T2 @3 F* G
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    $ j% ]9 }$ D$ V, k
  73. {
    1 |9 m9 b7 I/ g6 x
  74.   int iEOF=0;
    0 n3 c" x0 P. {7 h/ g+ U: b- Q/ q6 R
  75.   char szTempName[MAX_PATH];
    % Y$ ?" K. H& E0 k9 V
  76.   *szFileName=0;2 b) O+ D/ r) `+ f' F
  77.   iEOF=fscanf(fp,"%s",szTempName);
    4 m( A8 D+ U5 F
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='('), N. V/ u' p) O" B
  79.   {$ b! ]* R: ]2 s: v; ~* X
  80.     strcpy(szFileName,&szTempName[1]);5 a0 X8 w1 t) P4 R2 b5 B4 ^
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)3 p2 z' S1 r  R6 ^" s4 D0 k
  82.     {* h4 u, P* u- [, t% s  g
  83.       iEOF=fscanf(fp,"%s",szTempName);
    3 m# \6 S5 y5 A1 f2 [) Y: s6 L
  84.       strcat(szFileName," ");
    5 [' T: J, f0 R/ H7 g- i, i( g9 H
  85.       strcat(szFileName,szTempName);( J. _' F' Y$ t; V% j' }
  86.     }" q) a; ^" w/ D2 G
  87.     if(strlen(szFileName)>=1), T  R0 t2 E5 ~* e4 n$ t: }
  88.     {: }5 y$ X, d" p* |+ ~/ C
  89.       szFileName[strlen(szFileName)-1]=0;- ?0 O' R, ~" E( N3 }  R9 y) s: _3 m
  90.     }; ^3 p! k& ?+ A
  91.   }
    1 }4 _4 p1 P0 v7 z" Z5 T
  92.   return szFileName;, ]$ k5 y) d6 [( S: H  M" r! S- u
  93. }
    6 J  M7 w7 R* O

  94. + G( Y6 d8 z' S. o) ?
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    ( }# n$ A9 p3 V5 I1 _6 Y; ^
  96. {4 G. D7 N* L1 ~/ N( a1 C
  97.   FILE *fp;7 H* F: E) X: G/ b( }
  98.   char *key=NULL;2 y  H7 \0 l! [- b" f0 ]
  99.   char version[MAX_PATH];" n0 W5 e9 I# g& e& U( T
  100.   LPUPDATEFILE file,olds;; r% }7 J$ A" D/ ?. R" J6 c! f' D
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    2 i5 ]! j: ]( i+ ]( B" D
  102. : Y8 L9 b" C$ x8 }( J# e) f$ t
  103.   UpdateList.clear();0 G2 A/ ?1 e! S; G2 u+ z: A: G
  104.   UpdateFile.clear();
    : ~8 r/ j6 `  C1 ~8 U
  105.   if(GetFileAttributes(filename)==-1) return false;3 J; L% Y3 H( J6 k
  106.   if(!(fp=fopen(filename,"r"))) return false;
    5 Y7 P1 [  r) ]. g7 b, u" ^6 ?$ g
  107.   fscanf(fp,"%s",version);3 e5 l/ u' Y3 s3 b  @  F  ^4 D
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }5 r  j/ l! Q; L) M
  109.   while(fscanf(fp,"%s",version)!=EOF)' J3 D6 v5 D! s6 S8 o+ D  V
  110.   {' R$ j, o( k! s0 I5 d
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    ; O9 z$ b3 I6 K/ l) V# u
  112.     fscanf(fp,"%s",file->path);) ?8 x, M6 R+ R. ~; _. v( K
  113.     ReadFileNames(fp,file->file);5 m9 |  O) D4 I- W! G+ H
  114.     strcpy(file->full,".");/ o8 k) L6 a' @5 x1 K& a# }$ W! L
  115.     strcat(file->full,file->path);2 u4 ^7 p8 e) T' z5 g3 U
  116.     strcat(file->full,file->file);
    0 o  k8 n! R" H, J, F& h) ~
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    ; ?# c: f- [, E4 L8 f9 K
  118.     {+ N  Q, `" F0 m9 }' A' ~7 P
  119.       file->vers=(float)atof(version);
    5 L, r0 W5 s: Z7 Q/ |/ L
  120.       UpdateList.push_back(file->full);
    : `5 Q! P1 N; L$ R0 I& R. q! W
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));( _8 i" o' K0 U0 R9 H1 V- p
  122.     }$ {8 x8 z# u2 K  p6 _
  123.     else9 A9 v5 ?6 U7 r2 Z( W6 {2 j+ R. b
  124.     {
    5 e" \6 B1 p" _- ~) u. M
  125.       olds=(*p).second;
    & A6 d$ s9 ~  ~
  126.       if(olds->vers<(float)atof(version))
      z* T1 ~. L6 _! t( r
  127.       {
    . K- r2 R' ~# e4 A
  128.         olds->vers=(float)atof(version);
    - V. F. O1 W- F: ~2 `/ Y$ ]
  129.       }
    + i/ H$ U3 t" v* I9 `$ D
  130.       free(file);% y% H- D& d' B  u( C. o( L
  131.     }9 p5 u) W- e$ e
  132.   }+ }* p+ L: J' |3 X! B8 A
  133.   fclose(fp);
    3 q  f9 L, u- R- k- {  r! g5 W
  134.   return true;/ A! u! X2 U  o- W9 s- {; T
  135. }, I9 C/ T& R# E0 C# F& _
  136. $ X+ x: C; E6 w5 r/ `9 _% a4 ^
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    - g8 c: e5 ]4 W6 ?' ]' Y, e
  138. {
    - s+ k" G3 p: T& O
  139.   TCHAR  szFull[MAX_PATH];
    + m% w. Z6 f8 v% |" s& U1 K( E
  140.   TCHAR *token,*inter;6 H$ `; J9 I& j, m$ h4 _. O# H
  141.   *szPath=0;
    1 t: Y2 C5 ^3 U8 k
  142.   strcpy(szFull,szFullPath);
    5 o! \  g6 y4 a+ Z7 \9 ^: ]7 h
  143.   token=strtok(szFull,"\\/");! y8 C$ g% T; W; J8 M6 F& T
  144.   inter=token;
    3 C7 S5 L7 H9 Y+ V; F
  145.   while(token=strtok(NULL,"\\/"))
    " t- F+ B$ d; A( v7 Q+ a
  146.   {
    ; R% D% A- f* h# h
  147.     strcat(szPath,inter);0 k/ \4 f$ K3 g/ g) z9 [/ H4 `
  148.     strcat(szPath,"\");) i: k$ s) b# Y6 p
  149.     inter=token;" r$ P+ p$ b, v$ j( r
  150.   }
      v$ n2 E9 n( D( O: ?- T
  151.   return strlen(szPath);
    * h% q) L  T; t6 g
  152. }- M$ p% }! @% W

  153.   x: W! `. J. j
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)& n* g# g2 ?- l
  155. {! R, t) n7 S/ L# T7 F
  156.   DWORD attrib=GetFileAttributes(Target);
    & ~" ?6 ~+ p) m5 P. A1 u* G! ^
  157.   if(attrib!=-1)
    2 h6 q, K2 O& D
  158.   {
    . `5 z, O( s3 E. z* T; L
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))5 {6 i  ^4 A/ Y: _" _
  160.     {
    6 f! F) I  b: }- n( K9 g# P
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    # Q8 ^, }& W' J/ `  F
  162.       SetFileAttributes(Target,attrib);
      {' A8 D$ _, j. S" Y8 }. I) b
  163.     }! d2 B5 b$ T+ n$ F: H
  164.   }. O" k- I" c2 R$ k, F1 w
  165.   CopyFile(Source,Target,Erase);! i& h+ i9 I2 _$ r1 x
  166. }5 c+ t# q+ S; }* p- [( f
  167. 1 O4 m7 E' V3 O  Q+ Q: p) y' S
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
      t1 Y- x$ A% ?% Y+ A4 i
  169. {) @8 S% ^. Q" j, R; t. ^. z
  170.      FILE *fp;
    0 ^* ]0 X4 o% ~. A( j
  171.      char  szBuffer[8192];
    8 D8 f& e2 J" S7 Q
  172.   va_list  argptr;+ x& E3 ^2 {0 V8 ?9 v4 ]
  173. 1 {' K; Y5 u6 {2 f$ x, j
  174.         va_start(argptr,message);
    7 J  v2 ]) ]6 H' ^8 q
  175.         vsprintf(szBuffer,message,argptr);
    : u& e1 L  \5 I6 d
  176.         va_end(argptr);6 v9 T; D' i5 ]" l6 Y$ T
  177.   fp=fopen(FileName,"a");
    0 u, ~2 g# `& z1 @* U
  178.   if(fp)
    & U8 b$ n! K7 ?: R
  179.   {
    * n, K( q$ J) G' ], t# y
  180.     fprintf(fp,szBuffer);. M/ S1 N( ?& ^( R% q" D
  181.     fclose(fp);
    # Z, H! L' w4 Y. }& `: `: G
  182.           _flushall();- B+ b6 q! Z; x; J& @3 P
  183.   }
    * M' K% p: E# ~
  184. }  I5 A- ]; D. j. S6 k2 u
  185. 8 I0 d- E9 a$ W3 r! g# I
  186. BOOL CRevAppApp::Fclearf(char *FileName)4 p) ~1 f9 A1 R4 j0 v4 M! T5 z  n
  187. {
    / F1 p* V" P$ \. M" F
  188.      FILE *fp;3 V0 u+ V- g( O
  189.     DWORD  attrib;6 C" q9 I1 Y* {) g$ p
  190.   attrib=GetFileAttributes(FileName);
    - Y9 z6 ]& n% l
  191.   if(attrib!=-1). l2 p: D, R6 ]! b: t& h
  192.   {
    ( ?( c/ w% `0 w" v5 M
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);& Y' ]3 \  T# D
  194.     if(!SetFileAttributes(FileName,attrib))0 B4 O  p: B% b" e& b* K6 l
  195.     {
    4 C5 w$ n* j) I8 O
  196.       return FALSE;4 W' `+ ?9 f) C" f8 w2 K
  197.     }" g- R9 S' i+ O, I% W" v+ w
  198.   }
    7 r! k9 `, i. l' Z! ~2 C+ \
  199.   fp=fopen(FileName,"wb");1 k2 L9 C) O: ]9 A. M
  200.   if(fp)
    # m9 ?. {' ^4 b& z' t4 Y4 Z
  201.   {
    " I/ e2 c/ R3 o8 O% A( ]6 m
  202.     fclose(fp);$ A3 w/ r) l. B0 F
  203.   }5 Q, o6 {: [1 ^
  204.   return TRUE;4 A; e6 s& @: L+ W7 t" S
  205. }
    ; |, T& A1 G, c* O
  206. $ k% f/ B4 B1 \& `) i7 l6 R7 D
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    ( i; t4 B- D! x/ _
  208. {/ j. X, C: p/ [9 @  @/ p
  209.   char filename[MAX_PATH];
    . t9 [1 J4 v* g; N, u) Q3 T
  210.   LPUPDATEFILE file,olds;$ f# ~, C4 o! O7 u* E  K
  211.   std::map<int,CString>::iterator i;
    ( P# c; m, R  E) x9 ]- \4 p
  212.   std::map<CString,LPUPDATEFILE>::iterator p;8 B. G4 d* ]- r& [
  213.   std::list<CString>::iterator l;
    " D8 U3 p9 [% t7 _- o6 D

  214. $ V$ k7 h. |7 V& L1 J; s$ ~, g7 O
  215.   if(bFirstUpdate)
    3 Y6 ?: L2 Y6 ?" W
  216.   {
    ! D- h9 W* `1 h
  217.     dwCurrFile=0;2 }/ ]& K9 \- ^
  218.     bFirstUpdate=FALSE;
    . F+ L9 n" p, U) z, N: L
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    & T( A! L  u3 _4 {, v5 C9 M0 P. ~' }
  220.     {1 i. F' q" ~9 k8 Y( o  B. p0 L
  221.       dwTotalFiles=UpdateLocal.size();8 S% t: A, D5 N9 I8 h
  222.       dwDownLoaded=0;& i# {  `: e: d; P" G
  223.       bSilentStep=FALSE;
    / Z8 C' |- {2 R3 H; L8 U  k
  224.       bCompressed=TRUE;. ]: c' L6 V: y% b5 }% k1 U- q
  225.       strExtLocal.Empty();
    / t2 w+ R4 H: G3 s" r# i+ U
  226.       strFullName=(*i).second;
    ; y* }' k. D/ z0 H. {8 Y% W
  227.       dwProgramState=AP_CONNECT;
    ( W2 h9 a3 b6 J, s2 g
  228.       return TRUE;
    / D% v0 s1 G1 M( H" J) ?
  229.     }7 G2 S5 h5 X2 C
  230.   }
    $ y9 w* U9 R3 j' y+ Y% o
  231.   else if(bRestartUpdater==FALSE)1 f) ^, b. G, T% T' A7 c4 X$ r2 C
  232.   {
      U% D; N* Z$ f4 O* Y* W9 s
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())' ?0 d7 Z! K- C" E7 ]5 b
  234.     {& {! C$ N0 f7 h8 C2 K) @5 T2 X
  235.       file=(*p).second;
    5 C: I7 w/ Q* H, Q" M: G0 J
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())  B4 @! r' T2 t8 p: S! `5 G5 l
  237.       {( D* F' P# w- \  V" ~
  238.         olds=(*p).second;1 v4 o, t- g+ g
  239.         olds->vers=file->vers;
    % X9 U7 ]3 z5 g( \: R& E- X% l
  240.       }
    ' `* T" \8 N- N; x% M5 ~
  241.       else
    - Q# a9 y7 X' D6 S; B5 A; E$ k% k
  242.       {* ?5 z$ ?) t) _% z4 ?, z- I6 M" T
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    8 S7 g9 s. t" D0 s/ j
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    9 `1 o' W: `7 a8 P0 p" W
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));% P8 Y; m& G, N* V
  246.       }( }/ U+ t- n$ J7 w9 U& m
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");- L, o3 L, w! p- U" b
  248.       sprintf(filename,"(%s)",file->file);2 H5 M" d( r( R- F6 Z
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);# \2 H/ S6 j  E
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    " L4 b& P$ _2 i' E2 R' h
  251.     }" [" @: l) [7 r5 r" G
  252.     dwCurrFile++;% {7 S$ o4 ?$ N
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ) Z% [# [, E6 P
  254.     {( E: y$ v# Z0 E6 X
  255.       bSilentStep=FALSE;
    ' f1 F5 Q3 ?3 M0 ^3 H2 M
  256.       bCompressed=TRUE;
    4 O9 ?7 u/ b& P: t& y
  257.       strExtLocal.Empty();+ z  ]$ w; T% y+ ?/ N) p! K3 ]
  258.       strFullName=(*i).second;
    7 I4 E2 F, y, C  z' D  G
  259.       dwProgramState=AP_CONNECT;4 O% z6 i8 ?& l
  260.       return TRUE;
    + A6 Q5 V6 R( K3 D
  261.     }
    / u! T. p: B8 Y( I0 ~2 Z
  262.     if(!bRestartUpdater)
    6 H4 y3 q1 j$ i5 v4 r  t
  263.     {
    , J6 k( @& L* s0 K! R* D
  264.       int iCurrSize,iFileSize;
      n2 B4 d8 r9 m: j2 Q6 ?
  265.       iCurrSize=0;& K5 _& ]  J! b8 S7 E4 Q9 y8 ^
  266.       iFileSize=UpdateList2.size();- }! Y0 J' \% A$ J( ~+ p5 T- U
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");
    - H/ O. P! ^. [6 ^( i0 X
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");- n2 A: h. }# w" `' U' C
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");% c: d  m$ G1 L( R
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ! O9 B% J4 e# ~1 P7 Z
  271.       Fclearf(".\\update.dat");
    - {. b, q5 |3 l9 x$ d: a
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    7 x: K0 \) v+ U  {
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    7 R+ Z+ H" T8 k) F" r8 V
  274.       {
    2 F5 g8 O* A" I6 [7 q# y: i, A
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    " K5 Y. N& |4 |- U" T
  276.         {+ _7 e! b( J2 W) ~  P9 J
  277.           file=(*p).second;
    + Q, L3 ?' `5 b
  278.           sprintf(filename,"(%s)",file->file);
      ?6 m4 N, C; q! s3 {$ E9 L
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);2 R% k# U8 [) m0 Y1 |' J
  280.           iCurrSize++;8 x2 d7 q! j# z& X9 _1 \: R
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));+ E8 O% T8 {. ]6 H: I0 l# N+ Q' H4 D/ A
  282.         }. x9 P. K0 Z; B6 q
  283.       }0 ~9 ?: t: t/ U/ ?0 h6 E
  284.       unlink(".\\update.txt");
    # w7 D! l9 w1 D" @/ e
  285.       unlink(".\\update.tmp");8 m+ N! d) O- Q  K
  286.       Fclearf(".\\checkversion.dat");
    2 x( {- l& b, l1 C( V
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    & W% n4 Z  Y! v6 Y
  288.       if(UpdateLocal.size())9 O9 ?5 r8 v. ?$ h
  289.       {. ]# d1 N  i) ]& y) Q
  290.         UpdateLocal.clear();" i& V& ?$ b6 k, _$ A4 {
  291.       }! \' a/ ~' o# D" z  ^5 k) E( L
  292.       if(UpdateFile3.size())8 b0 P9 I) P3 i  T6 E: G
  293.       {" r" ]: q, h' F. H. V& G; `
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)* @& L" N9 Z0 F& v7 D
  295.         {6 t' l  r7 w# c- d7 v9 s/ y
  296.           file=(*p).second;8 [# V- K  N+ a# t( g
  297.           free(file);) y5 F; t/ _# ]8 d
  298.         }
    ! G2 _. b# g4 \3 \( i
  299.         UpdateFile3.clear();1 F9 b8 ]0 [- ?
  300.         UpdateList3.clear();, o1 B4 _, W$ ^% l# W. I" F
  301.       }
    , R" y7 q3 W8 |2 v7 b9 G3 z
  302.       if(UpdateFile2.size())
    + p/ Y* A/ O* R. j
  303.       {5 H8 f- ?$ S6 a) r! t0 F/ b& q
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)8 s- T4 ]7 A' y6 l' o$ Z
  305.         {' t8 b  v) x. t
  306.           file=(*p).second;
    7 h1 j. L+ a0 B
  307.           free(file);2 u# Z$ |5 `/ x( F
  308.         }
    ( D% P/ r1 N% k9 N; X( w/ k
  309.         UpdateFile2.clear();% d- x4 \. ?0 H1 l' Z7 W
  310.         UpdateList2.clear();- w4 P" k, V' o3 l; J3 k+ Z
  311.       }: N% P! ^4 R9 c5 G( `: ~; y7 @
  312.       if(UpdateFile1.size())
    * J2 T2 }& r6 \+ b$ N+ z. F& i
  313.       {, F0 {; X% O, h1 s
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)/ [" g3 C* N# I* E" v1 ~
  315.         {: l: m0 A+ u. W$ j
  316.           file=(*p).second;8 n6 U" k/ d7 a2 Z! H4 t7 o" H
  317.           free(file);5 I9 C& s+ t' a
  318.         }; e; P# E! `6 |
  319.         UpdateFile1.clear();5 W* g# m! U2 X/ R
  320.         UpdateList1.clear();* ]( q; M/ x0 l
  321.       }" [8 G- B5 k' u( i, N" N4 k
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    ! l/ E- S6 }0 O
  323.     }( n# @3 m# _$ H1 V
  324.   }1 e, D- `) N/ J! T
  325.   return FALSE;& T$ n& u4 [" F5 y
  326. }+ S' p* v. j/ \' \( B4 e
  327. % f+ x3 s/ |, f% ?7 s( J
  328. void CRevAppApp::ClearAll(void)* A# P9 s( P5 }: V+ B% b' N
  329. {% t4 w. }( Q# k- A/ t9 b  a0 Z# O1 `
  330.   LPUPDATEFILE file;2 W2 v7 E  f4 Z. z7 q1 S
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    " ]# g# N, @0 s+ y( U; r5 \
  332. % l+ C3 u) E- @0 N# X. ]! l# G
  333.   if(UpdateLocal.size())
    . s' s; q0 V- i# ~4 U
  334.   {
    3 l* ^7 m3 ^) c* y
  335.     UpdateLocal.clear();
    4 s% K, t. R3 a# v! f6 Z% d$ {
  336.   }2 H. u/ p5 L$ @- t# Y
  337.   if(UpdateFile3.size())
    6 k( f- ~/ @0 a9 h$ n8 {% p
  338.   {3 R& K  W. n- j2 b/ x
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    & e( ^( p4 w. b# I
  340.     {9 V# _; \6 s8 A0 r
  341.       file=(*p).second;$ y+ M1 A% h- ~# G$ \2 c. Q% k
  342.       free(file);
    $ k8 D7 A( i- N0 \- g) H- C' x+ K
  343.     }% E" |+ ]6 R# s+ Y+ y& w. _. y
  344.     UpdateFile3.clear();
    7 W" q. C) m& i2 l
  345.     UpdateList3.clear();$ V; f' O. f0 M0 F3 y9 m6 q2 C3 h
  346.   }
    ) ~' T$ W4 w: ^7 k2 U
  347.   if(UpdateFile2.size())+ U4 r% ^; y) E, g7 K, I+ `2 G
  348.   {
    + E& o2 a$ }' A4 P3 J- \" l
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    $ `- _/ V* z; j+ ^* W- M9 g
  350.     {
    % I: |* g) P4 @/ q, L* ?
  351.       file=(*p).second;
    + u( _1 N4 z7 ]4 V% V% U
  352.       free(file);
    8 F; l# b0 }( ^5 d# X
  353.     }
    ; O4 M2 l# E  E* h# `" T
  354.     UpdateFile2.clear();" i) [# q; _  A- W% o
  355.     UpdateList2.clear();2 N5 C" J8 m! w; T* |
  356.   }7 Z* Q; d- b+ G; `! V* x
  357.   if(UpdateFile1.size()), ^+ D% T2 ~0 A" U* v! t4 \. j
  358.   {
    3 |' g& z! h0 p. }
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)3 V8 F' ~" g% h, E1 o: \8 M1 [
  360.     {' E% c  ~- O4 J1 k
  361.       file=(*p).second;4 [8 m3 S; O# [9 }) |
  362.       free(file);6 B. s  C0 s8 J  @) a
  363.     }
    ! S, j" d" m8 S$ _- w0 ^
  364.     UpdateFile1.clear();
    8 s: h! j5 Y) Z- \2 D9 T
  365.     UpdateList1.clear();" r$ f8 E6 D! g3 a1 N
  366.   }1 p! }( j" Q( y
  367. }  
    & @/ s8 g9 f; K' w/ b
  368.   9 \+ J6 r3 K9 n! T
  369. BOOL CRevAppApp::CheckLocalVersion(void)6 A; V# h" _7 E
  370. {2 |! E0 A, _8 d$ E" r/ `
  371.   int c;
    # @' r. D0 w0 X3 ], o2 f
  372.   LPUPDATEFILE file1,file2;" Z. c6 l9 t/ n' a# X/ _+ F/ Z3 B
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    + _" }9 u$ H1 g' ~3 q5 n
  374.   std::list<CString>::iterator l;
    & R5 |' v3 B2 u: X5 }

  375. 3 m( q. M# T. {, u: U
  376.   UpdateLocal.clear();8 I8 t& `6 V. F& Q- O
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    ) f1 D; ]1 z' {  _' I  O
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    4 Y2 x1 @& l8 M. t0 ~* L+ z
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    7 E  L: P5 k+ ^4 G1 D+ w
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);2 y0 G6 a: a$ f/ Q+ C6 T
  381.   if(UpdateFile3.size()), B. u4 n8 i7 }
  382.   {
    : N! i* J6 o% r; i8 w* }
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)/ T( e2 R" e# ~! S: f. D
  384.     {5 @( s/ \. m3 r4 n
  385.       file2=(LPUPDATEFILE)(*i).second;
    9 t: j% u4 Z- W5 a5 s
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()); [" j2 Z* x6 |0 [# s7 }$ V
  387.       {" R1 U1 O1 L. I) D: u
  388.         file1=(LPUPDATEFILE)(*p).second;2 W( V# x( Z3 n
  389.         file1->vers=file2->vers;+ l& P) w6 ~- ~4 A8 ^/ I
  390.       }
    0 e$ Y5 S* a7 `
  391.       else2 Y* n* {- D: L/ H, I* w9 I& @
  392.       {
    $ u8 o' ^# k$ o
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));0 Z. y$ {" m/ f" `- s
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));: ]2 R$ f' U  p6 @: l$ o, ~4 |
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));$ i4 B, i$ @- Q
  396.       }& Y; A' a# v7 v  K5 _. q* X
  397.     }' H2 |" C2 ?1 H/ ]/ R+ _. L
  398.   }7 H& P% x" w( H) R! D
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    & G- A, n+ [6 q" a# X9 K7 z% H/ t, f) i
  400.   {
    * N& M; B: U7 e7 g% g' x, Q, n3 ]
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    - w% C. v3 }  j' R# w- X3 Y
  402.     {
    / `: n/ [% H& R. i/ @# c
  403.       file2=(LPUPDATEFILE)(*i).second;
      ]% Q+ R* O& @$ U* l4 h% i& y
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())" w- B7 @4 j0 R8 z  _
  405.       {
    5 `7 z! G4 r, a
  406.         file1=(LPUPDATEFILE)(*p).second;! [8 Z; z0 t7 K7 _5 N
  407.         if(file1->vers!=file2->vers)
    . l7 T9 F: Z6 h5 |
  408.         {
    / W# ?4 c0 W& R
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));% ]# R! w4 V3 Y  a6 k+ }
  410.           c++;
    5 i' K0 A. e9 n. L+ Q* V8 I
  411.         }
    + m" S( U" |* v, d, m9 V
  412.       }# O$ e) j( m" S4 E, f
  413.       else$ e2 i1 @! b4 n
  414.       {( n" ?. K& H. @( J
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    5 _* h. o# m4 I/ s. O
  416.         c++;0 t/ _/ f! g/ m# M" o2 s
  417.       }
    % w2 k0 K* B  c. {/ Q0 v
  418.     }
      H5 `3 _) [$ F9 a4 X5 ?
  419.   }
    " a) x, {- v4 M# H, T' ?
  420.   unlink(".\\DownLoad\\update.txt");. k. z$ x$ ?' o. W8 P
  421.   if(UpdateLocal.size()) return TRUE;; \$ |5 J& r; Q9 u, ?% s. d
  422.   else                   return FALSE;+ E% B; ?- A7 D/ L7 j4 ^
  423. }
    6 r( Y" u+ O! k# C

  424. + `0 E/ t" c: X$ ?; c
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    5 N( |$ ~7 y7 \: `2 j* G
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"  L, ~: U2 x9 H8 {% H- ]

  427. ( z0 S& \1 |6 j4 S( j) H! B" s" @
  428. $ L5 f7 B# R  B: l3 K$ ?' Y

  429. ; o. A2 N* D" ~: R) A; S( @
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)+ [, x; Q0 A# A/ F8 i  @( a7 F
  431. {2 g! ~+ g& a7 H" Y
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    5 h" r- a, x8 G3 G
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)' s2 Y8 x" ^, Z2 b
  434.   {7 F3 [/ m7 A8 U9 |; u
  435.     char szLanguage[50];
    ; F$ b8 J& A+ Y3 A
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    3 A0 h  B, n, n+ N9 u4 Q) d
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;! E: w" C# E0 W- b
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    . B9 W: a7 }9 z
  439.     else                                   m_iLanguage=ENGLISH;6 p' |; i! C' N# V  o' A
  440.     char szRegister[100];2 W" k3 T* a2 V
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");2 ?% @  p2 J+ E. J. v
  442.     strRegsName=szRegister;7 n, U: q, J- c$ h
  443.     char szPatchURL[100];
    # B- M: V5 I8 [- K
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    9 S0 R  {4 R( E( N: z3 M. @
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    9 o0 C( G; }- I& ]2 |' r+ @3 X+ b* {
  446.   }
    % I; X! `  L, ~% _& o
  447.   else0 p5 w1 h9 K' J  w. D6 b
  448.   {
    , {) }" a/ Q9 F; ~
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);$ `7 a7 x( v; y  ^0 u# j! M
  450.     strRegsName=DEFAULT_REG_URL;( M# e- ?( ?& C4 |' f
  451.   }
    4 e1 R- Z' F) l
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    % D& F' ~0 O) H" j  y
  453.   {
    . {/ f" M8 j9 r7 Y$ D0 \2 m
  454.     char szIP[50];
    8 z5 F. \# N3 `, I% [2 y+ |4 ]
  455.     char szDIR[300];" X" p  `( A8 F0 O& [
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))$ A8 j% ~! N% E- L1 D
  457.     {
    5 Z/ E6 G$ w; Q& k# s6 @" P& J
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    0 X) G% M# Z) v# }. }8 f
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    : G: q* ]9 `4 e* F1 e4 r9 {
  460.       strHostName=szIP;
    . {( Z% ^3 V$ O. {0 t5 P. A+ ], T0 U
  461.       strHostPath.Format("/%s",szDIR);
    . J6 ^) t# ~  z
  462.     }
    ' Z/ r6 u; j- v! u( ^/ T: \
  463.     else
    4 ~3 m  }/ J6 R$ ~" x- U, K
  464.     {
    # Q- [5 M- e; _1 I: o$ z$ q
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)5 w. I" U/ B  H6 j
  466.       {
    ! z- b) Y: T  {3 {
  467.         char szLanguage[50];
    2 F5 ?8 u% ]$ p9 g) Q
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");) _$ V+ _* N! S6 I; [# b! v
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;5 [" h% n! @9 ~+ p6 k
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    , r+ c, J/ b6 w3 s+ u  ~! o- O
  471.         else                                   m_iLanguage=ENGLISH;
    & z6 J% n5 D5 w- s
  472.         char szRegister[100];
    ) r4 {2 {. l/ S- [
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");, E5 ?2 w- ?6 R. {9 @/ d2 v. V
  474.         strRegsName=szRegister;
    2 y. S$ P4 d; R! @
  475.         char szPatchURL[100];
    ; m% i3 g8 E/ e5 N2 q5 N* b: i, `
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");8 S1 J) e4 B" ?) X5 y3 k+ f& b
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);: P1 o. b7 |" @  |% d
  478.       }+ v1 M8 B( t) y+ v, l8 d. C' P' r" @2 V5 L
  479.       else
    , k4 [  _9 J7 x3 k+ t+ b; v
  480.       {
    3 X( O' l' v! V- l9 B. |
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    ! D' l; q& G; q" }9 }% A
  482.         strRegsName=DEFAULT_REG_URL;
    ' S0 w8 f; Y  j  v
  483.       }
    - I; _6 p2 S. g3 D
  484.     }
    5 K+ o/ E7 N8 r
  485.   }. x2 Y& k+ t) p& Z# p
  486.   return true;
    / L# `% _! z7 i& Z4 q* [
  487. }4 h  E) f* O; ]% `" a) j: G* G
  488. 0 l) s1 v* e4 e
  489. #include ".\ZLib\unzip.h"
    / r0 D/ p% d0 ~; n  x
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    * P0 f/ X. H! U4 H
  491. /////////////////////////////////////////////////////////////////////////////; {: K. B0 M1 e& K$ s/ S& O; m, b- Z
  492. // CRevAppApp initialization$ k8 }0 ^! M. ~# v

  493. 2 z8 u3 j+ F% l2 U) p/ _
  494. BOOL CRevAppApp::InitInstance()
    / L, _5 u1 C1 m; g3 X) H
  495. {
      p0 ]4 v9 q- M/ f/ i
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
      O7 ?( `$ a/ m) w& G7 q  C- @
  497. 2 O+ }3 Z, N8 b
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);
    ( D$ H6 h$ u+ x+ z& l( `" t: g
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    % m: d( \; L  S$ g1 p+ e5 a
  500.   {
    # |* f  H1 ], R7 N3 m) Y4 Y/ t
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");! @; `/ }9 Y; z; E
  502.     GetPathFromFullPath(szPathTarget,szPathSource);3 |; F+ u! |8 r8 v  t, t( t% K: E
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    2 W5 S% q1 y, |- C( A* @
  504.     {
    & M* }6 f( @' x2 |/ g, {; B
  505.       strcpy(szPath,szPathTarget);% \$ y6 ]3 Q/ l: X
  506.       SetCurrentDirectory(szPath);, f, z& c# p: q' a
  507.     }
    8 b3 }8 `6 J2 B4 {* \8 j7 Z
  508.   }3 ~+ d& n7 ^) U  B
  509. #ifdef _DEBUG% l/ f$ G( u2 [! ]( @/ K" H
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    4 t& W1 K. G! L0 L
  511. #else
    & B  E0 P( Z& Z3 q
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))0 W6 {, {, o0 B0 Y# _- n+ J- |
  513. #endif8 }( i7 w; `6 r4 \
  514.   {" X# M5 \& w9 V$ f4 e8 ?
  515.     char tempFileName[MAX_PATH];
    : _* o7 p: |' H1 B' T5 g: ~% f! B
  516.     strcpy(tempFileName,szPathSource);
    ! b6 ?9 P# L9 g1 q
  517.     tempFileName[strlen(szPathSource)-12]=0;
    4 Z' r0 `2 z* v* a# v: i3 W  m1 I
  518.     strcat(tempFileName,"\\$CSUpdate.exe");$ `$ O$ B7 i/ m+ |& t& y! Z# _
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    5 T$ ?; k( p, q, `' `
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);% V3 Z" |" o3 |1 l0 x/ I; }# J
  521.     return TRUE;
    8 P9 u, y0 |1 H7 n
  522.   }
    4 Y( U& O3 X/ i) X) }
  523.   // Nuke 0118: Delete run.exe
    ( N2 g% P  \, _1 Q9 A/ L+ D# ^( S
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    & ~8 u6 X7 U' [, m6 d
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");
    ! }4 g7 V, Y5 x1 h" v
  526.   if(!ReadCfgFile("Config.ini"))
    ! o" M, \/ z8 v6 e' g) ?
  527.   {9 X# u+ g4 t8 ]" }; z
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
      V1 ?& Q" f4 C0 O" h' I+ z" G7 w" S
  529.     return TRUE;' f# ^1 Z* ]! `. H+ i  p
  530.   }: a( M! o" Z5 |1 X/ A6 {
  531.   HANDLE mutex;& \: W) c( n& i7 s; q
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))4 b1 h" }: Q' b& C' R& q0 W1 P
  533.   {4 D( d) i9 g* d, L
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS): F$ `0 `2 j. M- y3 `# q" x* P
  535.     {+ s- }4 q7 z. V4 x! V
  536.       CloseHandle(mutex);2 x$ C' E, @$ t; H2 z4 s
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    6 d& N7 e, ^1 E' [, O& ^9 r7 h
  538.       return TRUE;
    4 S1 J6 A  M' t6 M
  539.     }) I, J5 N) b* S3 W
  540.   }  : h7 V! [1 C! u* Q0 O6 Q9 ]1 B
  541.   CloseHandle(mutex);
    : ^; O  E9 v; v4 m% ?

  542. 3 l- ]" f4 j/ R2 z4 J/ Q8 u+ ^/ w6 n
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);& Y4 `1 Y9 ?, n; \# X
  544. / r' L! ^) l1 r$ [
  545.         AfxEnableControlContainer();
    ( ?1 `- [5 @% g8 s& c$ `
  546. - |/ `, a: q  F" d6 V
  547.   bCanUpdate=FALSE;( s" Y% H* F0 y
  548.   dwStartUpSteps=1;0 \9 M0 y2 f  ?+ l& s
  549.   dwProgramState=AP_NOTHING;
    8 _3 Q6 Z4 g; K- I4 a; O( b

  550. * S$ N; V" A  B  T5 S8 W2 w* g" J
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    % }% p6 u+ C/ Y+ b% b6 C6 F( n
  552. 8 Z) H' E3 e* u9 Q; X
  553.         // Standard initialization
    2 u5 B) G; O- `5 p$ k3 H
  554.         // If you are not using these features and wish to reduce the size, k  f1 X" r- J$ P7 U8 s+ E
  555.         //  of your final executable, you should remove from the following  w  ^% I6 l7 b5 x0 C3 \8 A
  556.         //  the specific initialization routines you do not need.7 m) p! T* |& z: {

  557. 3 C% K: a( a7 q  X  u8 `$ B5 m4 j4 S
  558. #ifdef _AFXDLL
    . ^) a0 ~- H/ i( @, g
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL5 F7 G3 _6 S" Y5 r: z
  560. #else9 j7 z1 [* t+ r1 {, c7 g: W( g3 h; W
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically% ?" d/ d. r; o
  562. #endif
    ! |$ d6 V! b, [/ _' z- a

  563. 9 u  K0 I" E$ I) H, j
  564.   dlg=new CRevAppDlg;! E2 q( W( D  [: c
  565.   dlg->Create(IDD_REVAPP_DIALOG);! }0 d+ r7 C+ i7 q6 {
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    1 i( Q8 p# r, b7 O5 B. U% Y
  567.   m_pMainWnd=dlg;
    ' ]  i$ f# d# z" a$ g( C
  568. 6 Y* a" r1 x9 Q# T. W
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    + Q7 ~# f8 ?, Y( m4 B

  570. $ X1 v2 ^& I  [% A# t
  571. //  GdiplusStartupInput gdiplusStartupInput;6 @: h! l/ t# f: ?7 `
  572. //  ULONG_PTR gdiplusToken;
    4 m0 _& }6 Z! A0 A# z: K
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    7 L3 b. V( N0 _
  574. " g# s0 h) ^- @& y8 ]: K
  575. //        CRevAppDlg dlg;
    + r5 W9 c" O/ i" m. p
  576. //        int nResponse = dlg.DoModal();
    , S; V  d2 k2 M" r! j/ _
  577. //        if (nResponse == IDOK)
    $ T5 m2 V7 V! a) p( E2 R' q
  578. //        {4 I7 B( f; y$ w. Q) G5 g
  579. //                // TODO: Place code here to handle when the dialog is; p8 R. }: v4 m  Y. s% R4 z
  580. //                //  dismissed with OK7 i6 _. Y, E7 a" u3 n
  581. //        }
    ! Y) R. X2 G1 ]3 q
  582. //        else if (nResponse == IDCANCEL)
    * {! V/ R1 D; V3 S" i7 h
  583. //        {
    0 u& C; ?  t/ L" i
  584. //                // TODO: Place code here to handle when the dialog is
    3 f+ b9 u4 k3 M
  585. //                //  dismissed with Cancel; l0 b, W0 R/ C$ b' c' y. C
  586. //        }5 ^, Z! r* M' Z. f. f9 h
  587. 5 D' S( ~; t% e. q: a9 o+ A- Y: i
  588.         // Since the dialog has been closed, return FALSE so that we exit the* j- m) k# K, r
  589.         //  application, rather than start the application's message pump.
    8 F! h3 X4 b4 v7 [/ C$ k3 {2 |
  590.         return TRUE;' P; h5 a2 T# `' G  `9 e2 e# Y5 E7 m
  591. }
    3 t) e; l6 y! t5 [3 B
  592. : E% x( G( b7 _% Q: G* ~, g% [
  593. char *CRevAppApp::strtok3(char *pSource,char *token)" D0 H$ x) ^- R7 P( F8 v5 U
  594. {, d) i2 e8 s; }+ a2 P" y
  595.   int i;6 E: r2 o5 w# `# M: g8 ^; S7 |0 L0 _
  596.   char *szRet;2 h! `. y9 F# b  ^
  597. - o5 I& d. y8 Z& f& H# v
  598.   if(pSource) { itoken=0; sztoken=pSource; }* V6 S+ Q2 m* k  g) k
  599.   if(sztoken)
    8 L* R8 [- x: J3 ~% j$ \
  600.   {
    , z8 A! P  M' G2 s! E& Q4 C8 f
  601.     szRet=&sztoken[itoken];& ^% M6 F- ~3 M/ q
  602.     while(sztoken[itoken])5 J% {8 p9 g" J
  603.     {& }" m/ o, p9 E; a$ O) B
  604.       for(i=0;i<(int)strlen(token);i++)
    / q6 u7 f' e- @9 s* J
  605.       {  A6 Z0 X9 t3 B6 j3 \
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])4 A2 j' K) v5 N& {
  607.         {2 E% q8 b. _9 @' b
  608.           sztoken[itoken++]=0;
    / b+ |0 t. I7 @7 q& O8 S
  609.           sztoken[itoken++]=0;+ t" V( D1 Q5 ^' h! O: a7 l/ X- |
  610.           return szRet;/ h' U; C% n: Z1 A9 A" D
  611.         }
    2 n* f" q+ v. N
  612.       }
    3 z" D% [9 a6 X; K' X
  613.       itoken++;5 o+ x' Z. ?" [1 P% B- d
  614.     }; U/ ^/ R& O, X6 R. s
  615.   }+ ~' l# H0 w5 {: l
  616.   return NULL;+ ^8 K* y* M+ D; o/ H6 U/ K
  617. }' m# V: ^" w# l

  618. ! F% R! z3 U3 Y/ _3 m0 V
  619. void ProcessProc(long Total,long Current)7 y/ R: Q' S9 ]) ?# I( l0 e
  620. {
    : A" `  U9 T6 b- ^3 L
  621.         MSG msg;
    5 F" m0 Q4 H2 m1 u) D
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);7 n* `& n9 @9 e! C" i
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    ) V. N) q* N$ v
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))% R& }+ o8 N4 @% T
  625.         {. X7 Y+ J! J, Y  F4 D& Y
  626.                 if(!GetMessage(&msg,NULL,0,0))! x, F1 [% A% {, [0 ^4 @3 A
  627.                 {3 ]# D0 w: u: \* K
  628.                         return;* G4 |/ b( f& Z: p4 d
  629.                 }6 I" f3 I* R8 `7 S7 F, N: d
  630.                 TranslateMessage(&msg);
    " Q1 ]5 K# m4 v+ H$ c
  631.                 DispatchMessage(&msg);, k1 q' q# F, t  E
  632.         }       
    6 ~3 U( N" U0 S* D7 ?. y" ^& f
  633. }
    % |# _& s9 v" R' ^, R& D' K
  634. 2 u' D4 E- b- z- |& ~& G
  635. BOOL bFirstChar=TRUE;. t4 ?6 y* W( H7 z+ w! Y
  636.   }( U9 q& l( `6 e' @
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    # K5 G$ a4 S* M% {" w- [% g8 H
  638. {5 G2 I8 R3 g# m- P- ^
  639.         // TODO: Add your specialized code here and/or call the base class
    & v' q" i6 L6 c) O' Y9 {" M
  640.   switch(dwProgramState)
    ! H9 f" T" f) T
  641.   {
    3 F) C8 x+ c$ z# S* G
  642.   case AP_NOTHING:5 B  p& C0 v) c" q
  643.     switch(dwStartUpSteps)
    8 P" y  F$ C# |4 G' S5 y
  644.     {
    0 p. B6 ^, h% M  D0 U
  645.     case 1:& t3 N5 w9 M3 I4 b
  646.       {7 L2 ?0 \/ w% s5 B4 e
  647.         int i;
    + d0 A4 a  p2 U
  648.         CDC *pCDC=dlg->GetDC();: D0 E8 r( M9 D& Q, b9 M
  649.         HDC hdcwnd=pCDC->m_hDC;
    1 c$ p5 r& N6 ^+ s% `+ H! f" ?
  650. //        Graphics graphics(hdcwnd);% A1 T( P. S0 N5 B8 @3 Y) s$ Z
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");" s7 m* P6 L: x8 ]+ y5 {
  652. //        INT iWidth=bitmap.GetWidth();
      c# w* ]9 O2 h8 V1 |! a3 e5 u% A
  653. //        INT iHeight=bitmap.GetHeight();
    " X9 z3 l3 @9 x+ N
  654. //        Color color,colorTemp;4 D* X/ x: i/ f7 N% P0 j5 |; v
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)
    0 y6 p( k/ m3 D6 z7 `! z( s
  656. //        {/ u: n! O7 O6 T( j3 a
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)+ D! u& j0 Z3 |+ |6 k% w8 B9 r
  658. //          {& j$ g/ H8 H6 B9 }
  659. //            bitmap.GetPixel(iColumn,iRow,&color);0 k7 g+ ?4 X8 \+ t  m
  660. //            colorTemp.SetValue(color.MakeARGB(
    - m1 k, q; W! c  u7 E- W7 M
  661. //              (BYTE)(255*iColumn/iWidth),, F& @, ^0 l! h' p, T3 M+ ^
  662. //              color.GetRed(),
    ! F  F3 O1 w6 V/ I/ |8 K7 C
  663. //              color.GetGreen(),4 q- ]2 u  i1 ?# t* b* g4 N
  664. //              color.GetBlue()));0 n& F+ I1 t4 k/ {
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);2 v. Q8 t+ k6 l1 c* `1 d8 o2 D1 z
  666. //          }
    - F0 ?+ Y& c" Z
  667. //        }
    & J5 ~+ E3 i( @& t
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);5 D4 B9 L6 R9 N1 q0 g4 G( s
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    7 y) I9 {3 z  g3 _! l2 ~
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");9 c3 p# W. L5 l% y' g) i% h
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    0 Y  l; N% P- n! c8 ?* S+ d' D
  672.         for(i=0;i<240;i+=8)  q. ], u  G* ]6 V
  673.         {
    % p/ i7 m" m+ z1 x+ d2 P7 Z
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    4 E" w' u6 ?8 U8 `) r6 k
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
      ^6 B. N% L/ k+ f8 e" m
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    3 {* @, D2 Y; f1 }! S
  677.           Sleep(33);3 L2 X7 n! j" F; y9 K
  678.         }4 m" R8 ~& u) O% v( B
  679.         Sleep(1000);
    2 [1 c* o" X0 Y$ M# U" e) G
  680.         for(i=240;i>0;i-=8), F) z4 f6 J6 n8 R
  681.         {
    % n) u. i! t! p9 ?0 q
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    5 t1 t: F( _" k1 W( ?- Z* v
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);7 M: i/ d3 z# o1 y& w6 ]5 Q
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    / H/ @/ r( V5 ]5 _
  685.           Sleep(33);
    & W% }3 p. l8 \2 _: k* p: C: B
  686.         }
    4 M3 N) ?, }3 n* o) Z& x
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);3 A9 O: v4 @) Y. Z8 n8 c+ n
  688.         dlg->ReleaseDC(pCDC);
    * x2 i8 _8 x) H% \0 g  J
  689.         DeleteDC(hdctar);
    % ?& V7 ~8 a1 B
  690.         DeleteDC(hdcsrc);
    ) }1 R& Y* H" E! R! t
  691.         DeleteDC(hdcorg);5 v6 U+ d$ |& z8 H# l6 Q: S( s  X' A
  692.       }: ]  h5 m: w6 e5 p8 F# X* N
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    # e3 e5 k$ d0 @# l2 ~  Y) ]
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");9 V2 c* L* d8 X& X0 Q& ?4 f& e5 G
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    7 n% f, k* G2 e5 Q' Q
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");  d$ e" A$ b- r& K+ t
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. j% l4 F$ s. t. O3 c% G, r! }; q" D) P
  698.       if(!Dn.Connected())
    % F/ p, q  R$ C( R
  699.       {
    ; f7 o. p2 m! l- L7 P
  700.         dwTotalFiles=1;5 z( [& Y4 X# J3 o, q! ]
  701.         dwDownLoaded=0;
    : _  {+ B) i$ C* u5 m1 R
  702.         bSilentStep=TRUE;9 U+ u' g* a9 ]
  703.         bCompressed=FALSE;! X' _/ r9 ~( E
  704.         strExtLocal.Empty();( |7 \2 ]  {0 h  I
  705.         strFullName="readme.txt";
    & @: c& e6 p( X1 s2 ]0 f, B
  706.         dwProgramState=AP_CONNECT;
    , v( c5 S9 w: p+ O
  707.       }
    + y; M& `8 n6 U
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    2 n  j# O0 \' ~
  709.       dwStartUpSteps=2;+ F8 F+ _+ i. p7 V% ~
  710.       break;) Z6 _8 \! ]+ K
  711.     case 2:
    ) c% r" N0 ^6 L, d& x+ h/ }
  712.       {
    0 C; t4 [3 y6 a3 o' F: U
  713.         int iEOF;% J: B. Q6 g8 m6 t
  714.         FILE *fp;4 T# {2 Z7 c7 u; W* o
  715.         char szString[512];5 k: Z& t: K1 n9 @- v5 E
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    * F# X5 j( L, i9 M; N$ [1 O& O8 t
  717.         if(fp)
      k8 o; a# P% X1 N: p
  718.         {, L' O2 q9 d+ {8 K3 u
  719.           do  d# l, }3 D  r. y$ q
  720.           {
    # `3 a" @2 i  K
  721.             iEOF=fscanf(fp,"%s",szString);
    . y) Q' q, G( B; v# Y( t
  722.             if(strlen(szString))
    - J8 T' o3 O* G1 c
  723.             {
    7 U) p5 E& ?3 ~9 Y$ U8 H# K& ~3 r
  724.               if(bFirstChar)
    # d% f& j) b( k# u  b$ L
  725.               {" [; P9 V5 W( [( [2 i( H
  726.                 bFirstChar=FALSE;( t! z, z: c7 n' ]" z
  727.                 bConnectIsBig5=FALSE;
    ( x9 v1 B  j! x
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    " B' @  F9 t0 i+ `
  729.               }
    9 E8 A" \/ X" E5 {
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));- q. K, ^( q! ^* M( w9 y, e- E8 A4 J
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));$ H3 I4 t) {6 ]7 l" ]% z' N
  732.               dlg->m_ListText.AddString(szString);' d1 F" d3 N2 A& ~
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    8 s3 a" \1 X# _2 U
  734.               *szString=0;7 g+ S% Y* X9 d0 p0 ^3 D
  735.             }
      L+ _4 s5 m! l; y
  736.           } while(iEOF!=EOF);
    ' |% Z, f% K5 v0 c& A* o  a
  737.           fclose(fp);4 |! w5 X3 f! |  w1 ~1 H( v  ^1 M7 n
  738.           unlink(".\\DownLoad\\readme.txt");
    9 o+ h7 t  s+ K' z. f4 S* j
  739.           dwStartUpSteps=3;# ]$ q& C  O, x# l  Q% p8 A
  740.         }/ c+ U" Q  _5 M/ m
  741.       }
    8 h+ ?% K* M& O; u: B7 ^1 [
  742.       break;
    + I: x+ j* N0 v2 I  A
  743.     case 3:  T' o! N, A, l8 v+ ~
  744.       if(!Dn.Connected())
    9 S! P( y& c. u5 h$ u
  745.       {: @) H$ x) N  `5 x3 g7 ~
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    9 P' i/ R0 _' C. Z8 d! t$ s
  747.         dwTotalFiles=1;
    4 Y9 X7 @: W" h
  748.         dwDownLoaded=0;+ k- _1 b6 x8 r% j
  749.         bSilentStep=TRUE;
    ; G& S$ r4 ]2 b  O
  750.         bCompressed=FALSE;. R# B* q5 v. j  _+ F9 i/ }3 Q# {; Z
  751.         strExtLocal.Empty();! D. C7 y% A9 B' L: H% b. V
  752.         strFullName="checkversion.txt";
    ! B, ~9 C* ?' C0 L/ f4 Y  ^% R
  753.         dwProgramState=AP_CONNECT;1 ^! j% `! @- h( G
  754.       }+ G7 T/ S/ o0 T  x! f, o" O# \+ O* M
  755.       dwStartUpSteps=4;/ K( O/ C: C" l6 [3 M. Q
  756.       break;
    ' f; C( a! e& }1 {2 ]
  757.     case 4:
    ' V' h/ S8 y% b+ E
  758.       {$ a6 m# l& q, k0 N  a1 e
  759.         FILE *fp;
    ' h+ ]( ~9 H1 r
  760.         char szString1[128];
    1 r2 V: N0 Y( }& C# ]6 C
  761.         char szString2[128];- L. u: e" C4 j3 R
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    * A2 H- g: A1 a2 |6 L; {$ M
  763.         if(fp)
    ' f% b3 ^( _8 i! F0 N) e* q4 _
  764.         {
    1 m# _+ t# Y2 p# Y" i8 T" k
  765.           fscanf(fp,"%s",szString1);/ G2 B" _9 z3 F9 B* q/ X& y6 ^
  766.           fclose(fp);( m- Y" d3 R5 b
  767.           fCheckVersion=atof(szString1);
    5 ^7 I' l9 ~. W1 u
  768.           fp=fopen(".\\checkversion.dat","r");
    , N' V. R7 x8 s' b9 [* F
  769.           if(fp)  |5 ]% n) |1 `
  770.           {8 B$ P8 e/ I0 j
  771.             fscanf(fp,"%s",szString2);
    4 I% i' n# g) ~' D$ P6 i
  772.             fclose(fp);
    0 x! `7 n* W0 A
  773.             if(atof(szString1)!=atof(szString2))
    6 k7 x: c; i/ p; u) E# Q8 ?6 U, i
  774.             {
    + g; Q7 ^; f/ H. C
  775.               if(!Dn.Connected()): y5 n" {& U) Q# @8 r$ q. Y
  776.               {
    7 [- h5 Z; z; ?. b. t
  777.                 bFirstUpdate=TRUE;
    ! s# w' L& {8 [/ C
  778.                 dwTotalFiles=1;' `, N: t/ \$ M3 [2 @$ ^
  779.                 dwDownLoaded=0;
    2 d" R1 k) }6 v5 N
  780.                 bSilentStep=FALSE;
    1 H1 {+ |$ w! W+ ~3 D
  781.                 bCompressed=TRUE;& @' n; S! `, t5 r
  782.                 strExtLocal=".\\DownLoad\";
    + H' w3 ]# z. e/ e; ~2 j; j
  783.                 strFullName="update.txt";" ^. n9 U3 ?% h0 h3 @
  784.                 dwProgramState=AP_CONNECT;
    % E( r3 S$ m" V5 V: U
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    5 u6 ?& Y; W$ U) O# Q/ d9 `. F* Y: i# C
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");. |' i6 @5 \$ S9 q5 U
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    / ]% e1 l4 \+ o: n
  788. $ X$ }3 a  a% \5 C+ l- l
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    # B9 [/ ~% W  \" Z- n7 y% ^
  790.                 unlink(".\\DownLoad\\checkversion.txt");- F& o$ e7 }3 t7 C) @1 s
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)! W! D) M4 v# \- s8 r- @
  792.                 {
    4 W; O# a( r9 `0 ]( \: V
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");0 n/ M: j- I; J
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");" y4 ]+ q0 h$ x5 f4 F4 i% l+ w2 `
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");7 P, O. Z; {0 u: }5 j7 P' ?: x
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);- r" E( M( z6 {/ ~8 Z# e
  797. $ I/ \3 t5 V1 X. N$ r) e
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    ( \5 l1 n, o  D6 N! ]
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");7 `+ B0 p# }2 W. K
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");2 S" ]3 d5 Q: Z/ d" K
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);/ s9 H( J7 B2 k! J" p' o
  802.                 }/ I( Q& B% E5 @( F
  803.                 dwStartUpSteps=5;& n* W2 k$ f2 o. b, Y# N7 C' n
  804.               }2 s& y+ g9 ?* g* ~
  805.             }
    : L4 Y: ?5 h4 }+ s$ ]
  806.             else5 L6 p5 s' B; ^& [1 {/ g
  807.             {
    % F# u8 k& z, \1 f! V3 ~
  808.               unlink(".\\DownLoad\\checkversion.txt");  q% K  r& Q. ?+ p* ~+ {, O& E
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    8 Y6 t) d, R2 o. e& m- A0 s
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");1 y! p7 u+ |" H& M/ u
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");- U" ^2 i0 A) W1 q; U/ ~- M
  812. 7 }1 _2 P: P: n% o. k) U  U# H; ?# A
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);( \# T0 M# U1 x
  814.               dwStartUpSteps=99;
    - K3 I4 l  }0 c+ ]+ M/ Q; M
  815.               bFinishUpdated=TRUE;6 B4 t! I, x, f% u9 m! Q
  816.               bCanUpdate=TRUE;9 Q& U5 P5 c1 x5 P6 K2 G5 H
  817.             }; |3 B3 J3 Z: f' @. p& q  P! x
  818.           }7 Q3 N3 d6 {: a' s  Z& l6 T8 l& n
  819.           else
    2 D) s: c* @- q& d! j1 ]0 e# m5 C) |
  820.           {
    & j/ l2 B0 c& |; @3 |
  821.             if(!Dn.Connected())2 @4 I9 l( U8 L. z
  822.             {
    ; S1 v' H2 h8 `# ?
  823.               bFirstUpdate=TRUE;
    6 _6 c; S4 {0 ]* U0 e# K
  824.               dwTotalFiles=1;4 I) D) x5 F# |! v
  825.               dwDownLoaded=0;$ M! a$ W) C% s1 K4 ?
  826.               bSilentStep=FALSE;) r/ r  B" l0 S
  827.               bCompressed=TRUE;
    & p; {) e2 ^9 j) f5 Z
  828.               strExtLocal=".\\DownLoad\";
    1 U% }7 F: k, I2 B& Q' n9 `8 H4 Z6 e
  829.               strFullName="update.txt";6 [/ ?( K+ f3 E5 w$ h% I- C" C
  830.               dwProgramState=AP_CONNECT;
    ; R2 t. r- C( R
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");$ y/ |& s( C. \/ Q) T* |. S; d4 m
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");5 ~% R& g' J5 l. Y+ m+ e6 O8 R
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    & O) X! O: M8 |4 x+ b, R
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    * P& |$ b( m8 V" W/ r& k
  835.               unlink(".\\DownLoad\\checkversion.txt");" Y2 w  S% g( W" ]
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)' T. G, i' |  ?  w( i8 {$ B
  837.               {; V$ c' D& s/ C+ `5 K$ C  W
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    $ h4 U$ c! n4 U" u+ Q  J; n- l
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    0 \8 L9 Z  p, r: i" [+ Y6 p. B" B
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    ' _& I' S# |8 E" h
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. V: w7 H3 `; x, Q6 W" F7 j! _3 p  U
  842.                 ! k4 n% W4 J/ ~6 E6 y1 C
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");4 O: M7 ]7 @; X: c! X
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");6 F6 g0 t* O9 L( t
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");" y3 m, S* S. d% e
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);2 F% ~" ?$ V; J  f# |; s
  847.               }, {. L) U- M* }: ^4 }( P! h: t, v
  848.               dwStartUpSteps=5;  H3 W- S6 ~$ i+ s* w9 ?
  849.             }/ c& m0 x" t+ s' ?
  850.           }
    * x" ~$ U" v1 K9 |* u6 `' f7 E7 F# p2 D
  851.         }8 r7 ]5 p  t6 |# X8 m( g
  852.         else, q- A5 ~* ^1 V- K( U$ Y" x
  853.         {0 O5 z; e, h7 m% \, N. N' Q
  854.           dwStartUpSteps=3;7 w/ P: `; v% E0 ?: \7 }3 Z
  855.         }
    6 \+ x" C/ r$ f* k8 X0 M
  856.       }% z; i( T, G$ ]! g: q; F
  857.       break;
    " j( z, [. O# @# |' L9 U; K
  858.     case 5:
    " ~* J# b- b1 |$ B3 r9 e* X+ ]
  859.       {
    - L+ y5 Z! f- E" [5 g
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    $ _8 x. j+ m. D: j
  861.         {1 o( D5 V/ M& z$ h6 u$ f' i! G
  862.           int opt_overwrite=1;; a- w. O: t0 w- P5 s, v/ c
  863.           int opt_do_extract_withoutpath=0;; @% s4 B) l' ^0 m; k
  864.           unzFile uf=NULL;- P3 D! f3 Y8 }1 S* U; }$ J0 I9 t
  865. 0 u/ N1 V( r6 \: m
  866.           uf=unzOpen("Wsa.zip");6 e* Q, J+ ]8 I0 s5 A
  867.           if(uf)
    ' I7 V( _& @7 c2 t& p. }
  868.           {: x* i$ W5 P  |; y: h! L
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);+ [4 O( d$ W: V  j/ Q' F4 R
  870.             unzClose(uf);
    - }2 k' O/ Y8 e! M( G. }
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");3 W4 B) m3 n; \5 I
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");1 [; j7 G/ u' p* ]5 r% w3 k
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");! n) y+ g# d, O- C6 o: ], g  V- ~! q
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    5 A& V& w: [- F1 G' S
  875.           }
    * U9 y1 X, V( t* l6 x
  876.           DeleteFile("Wsa.zip" );8 B+ M# [' {) G6 O: E2 [
  877.         }
    3 s9 [! v0 g" C! r% I" j

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

/ }" ^) Y$ [1 b3 `6 h5 d  L# p& `, s5 }* {- {, ^0 C" R0 D

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2025-9-5 14:18

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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