找回密碼
 立即注册

CSUpdate.exe源代码

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

- @+ p4 V6 h6 `. o" Q, v' {7 ~; i
  1. / RevApp.cpp : Defines the class behaviors for the application.. e# ?5 _; a0 \
  2. //6 K% L) i% I5 E' v; V) q
  3. ; i( a# I  d1 `9 m  R
  4. #include "stdafx.h": C$ A' [1 o0 L- {5 @" Y
  5. 2 b4 s% P! J3 Q% k% h
  6. //#define UNICODE/ D3 R3 l  F9 r2 K$ S4 u% N
  7. //#include <gdiplus.h>
    0 L1 Z" O$ O7 C# |" j4 h1 x
  8. //using namespace Gdiplus;
    4 E+ m+ t/ J) b% p

  9. ! n- W9 ~8 n) W  w4 w  P
  10. #include "RevApp.h", _! T  P3 X: W  ?) d8 c$ x
  11. #include "RevAppDlg.h"! B% A  `! k0 J

  12. $ V$ ~" I9 b: c; Y' b
  13. #pragma warning(disable:4786)6 f8 g6 n0 v) j; @! d& K* z
  14. #include <map>
      Y) C: ^4 n& a$ A+ ?0 z
  15. #include <list>7 b/ N- ^5 q+ M
  16. #include <direct.h>8 i. j9 k' A# ^2 a! s

  17. $ T& l8 {5 u6 g6 T; i
  18. #ifdef _DEBUG
    0 N: t! x+ V7 ~5 Y
  19. #define new DEBUG_NEW  ]2 P: b: U! T( p
  20. #undef THIS_FILE0 b. _# r$ `- f0 @# t
  21. static char THIS_FILE[] = __FILE__;- m% M3 E* s8 _$ v) u9 q
  22. #endif3 x9 g% M0 {- G; d1 e6 s2 A" o
  23. #include "SkinResDef.h"
    " h: y& x6 e* A1 R0 S* V4 a4 {
  24. #include "ChangeBG.h"0 {( g0 V; U6 x5 o/ }
  25. #include "AFXINET.H"
    % f! @- n& r7 C6 R
  26. # `" C0 b# o7 o# }
  27. #define TRADITIONAL_CHINESE 0
    ' y# E8 i) k2 S: {) d7 o
  28. #define SIMPLIFY_CHINESE 1
    $ ]9 I! @* r0 c- \/ T/ x; v: S
  29. #define ENGLISH 2
    0 f$ h2 }% H" o3 d% a
  30. int m_iLanguage = ENGLISH;7 G  p' |$ p+ d/ t
  31. /////////////////////////////////////////////////////////////////////////////( g6 z2 V  F2 }' q' x9 U
  32. // CRevAppApp8 [! u2 @% a; r3 `

  33. ) h( u4 j) v9 f/ R4 v/ I; W
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    / W1 M4 R0 g8 M' Z! a: U
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    & {: |) l# _  O  G& i
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.
    6 c% r! P3 @0 `1 S, g
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    ( A( {# \( B8 [- `% d
  38.         //}}AFX_MSG
    & x/ E; [& k3 y: n
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp); @5 w. X' y" V3 b5 N) k- Q
  40. END_MESSAGE_MAP()1 G$ O3 i1 r( `# Y5 D

  41. 4 o$ V4 a! E" c" x0 u
  42. /////////////////////////////////////////////////////////////////////////////
    ! ~* I/ d- z! H( `
  43. // CRevAppApp construction+ X6 G/ L- Y3 `7 ?
  44. + X8 q8 |+ o! x2 H6 I5 L
  45. CRevAppApp::CRevAppApp()
    4 q( j3 s; |" M
  46. {
    1 @: R4 U% s- B9 T
  47.         // TODO: add construction code here,3 H& `8 U4 Q) P3 P) r& Z) Y. h
  48.         // Place all significant initialization in InitInstance
    . y# ]# q* e5 `4 X# H
  49.   bDisplayIsBig5=FALSE;
    6 X* m& d& q7 g" a7 |7 w' |
  50.   bRestartUpdater=FALSE;
    # z, \7 W; @; {6 |. _8 Z1 S
  51.   bFinishUpdated=FALSE;
    & s8 P' b& n& @7 D
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;9 K% f% U- V+ m8 S( O# Z8 F+ t
  53.   InitChangeDataBig52GBKS();
    3 T3 d1 p( M0 y
  54.   InitChangeDataGBKS2Big5();
      M* D! V. E+ s4 E9 I
  55.         //9 d$ F/ s3 O! N5 m. Q
  56.         bClickRunExe = FALSE;  |/ `; @2 n; Z7 s* g7 g3 C
  57.         //
    ( o: ~/ X. c$ V4 x, q* E
  58. }
    5 ]: u9 x; k7 c0 Q
  59. 9 H/ o3 d& Y) m' Y8 |/ Y8 K
  60. CRevAppApp::~CRevAppApp()/ r- t( Q1 I/ ]& a) {
  61. {5 a5 \" }# l- p8 y1 i  G
  62.         // TODO: add construction code here,3 ?' l) n0 ^9 R2 \  v" v& V
  63.         // Place all significant initialization in InitInstance
    $ @' b/ o1 N- G4 v! ^+ |/ Q5 e
  64.   EndChangeData();: l5 U' t2 y7 }! e3 c) K# T" I
  65. }
    + g. w3 f- `  C) m

  66. ; o+ t# Q2 J$ H! @4 A% P2 {- p
  67. /////////////////////////////////////////////////////////////////////////////
    ' T7 d, ^. j/ N
  68. // The one and only CRevAppApp object
    4 i/ Z/ y1 F/ J2 L

  69. 8 c7 C: h  X# L3 V* D* \) ~/ s# k
  70. CRevAppApp theApp;
    / J; h% h. v$ K+ a! ?  ~- P
  71. 0 M$ v- b2 H: j2 {
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    * N5 u! Z- V9 o! Q$ }4 n
  73. {& n5 Q+ g" S( a# l3 \# y
  74.   int iEOF=0;* e1 T! t! j9 v0 b& ]
  75.   char szTempName[MAX_PATH];6 y8 q, i2 m5 d- S# v5 a
  76.   *szFileName=0;, Z1 h$ ~& P+ N6 U( \% n( u
  77.   iEOF=fscanf(fp,"%s",szTempName);: E4 B) Z. ?! A# B5 x6 I
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    " n% x/ g! m( y. ?
  79.   {
    5 l0 J1 W8 K2 }8 t3 s
  80.     strcpy(szFileName,&szTempName[1]);& k. v. y' X; v0 g) x
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    7 R. f5 \- T3 _
  82.     {2 Z! p( R/ }' F
  83.       iEOF=fscanf(fp,"%s",szTempName);
    ' v; Y+ U. K. K- p
  84.       strcat(szFileName," ");) }  R+ }8 J& h/ A% A+ N- o
  85.       strcat(szFileName,szTempName);2 }9 I: R) n2 I' g
  86.     }" ]0 z9 f6 v+ l/ O' F3 Y/ ^5 n5 K
  87.     if(strlen(szFileName)>=1)1 @. H  X* @  r8 T- b. K3 q
  88.     {( e& I- F2 ^0 u6 ]* x
  89.       szFileName[strlen(szFileName)-1]=0;
    : T8 g  [0 k# l& m; {
  90.     }
    2 E) c" c4 T( k3 l/ K
  91.   }
    ) d& B7 W1 G2 ]- z6 h
  92.   return szFileName;
    ( c( O7 G! H  F1 r- Z
  93. }; l" m, Q. D8 P2 X( s. W6 Y

  94. 8 v/ l" B% P  l; y% `7 e5 P8 b2 `% z3 r3 [
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    5 }& m0 Y  a: C0 _9 Q8 N
  96. {# q) E5 H1 e+ y7 s
  97.   FILE *fp;
    4 D: s* u/ l6 E2 o" @
  98.   char *key=NULL;( D9 J$ p, ~, m- L( N* z
  99.   char version[MAX_PATH];
    - C& f" I7 Y, t/ P1 {" J$ k) s" |( E
  100.   LPUPDATEFILE file,olds;- ^8 O, W) W0 \7 V# D8 v# E+ [" z
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    / m9 l) L* Q+ i# M

  102. / }5 @+ D  d2 i/ s- Z/ d* H% H% Y
  103.   UpdateList.clear();) m3 D1 W3 m8 J% e
  104.   UpdateFile.clear();  m  Z- a1 s: U% F
  105.   if(GetFileAttributes(filename)==-1) return false;1 Q* d, |! K( H) T3 X
  106.   if(!(fp=fopen(filename,"r"))) return false;
    : ]+ }; `3 n2 X/ s6 `% z2 y; A
  107.   fscanf(fp,"%s",version);, j, J1 U$ K. s0 B2 }9 g9 Q
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
    3 m" ?  k& `3 _6 O
  109.   while(fscanf(fp,"%s",version)!=EOF)
    " s# _/ H+ }# k. E( Y2 |7 U7 s/ i
  110.   {
    ( \0 O8 v4 k$ ]$ p4 W
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));  ^# B6 ?5 A$ |
  112.     fscanf(fp,"%s",file->path);6 L& R1 V& X9 _
  113.     ReadFileNames(fp,file->file);% s3 i0 ^' c5 r/ E/ ~0 z
  114.     strcpy(file->full,".");
    % \. C$ L! X+ Z4 Y
  115.     strcat(file->full,file->path);4 h: c, Z7 x0 T6 u
  116.     strcat(file->full,file->file);
    4 e1 r  Q' x* s. Y- W( a6 d- s
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    3 L% h9 S& s8 a6 f/ r
  118.     {
    # T& m& b+ t/ i2 ~4 O" \6 I
  119.       file->vers=(float)atof(version);
    # ?3 ~, u% a0 y8 Z/ L$ p
  120.       UpdateList.push_back(file->full);3 `: E5 O9 Z9 e
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    ) I4 L( @, d3 q* `' k0 X% i
  122.     }
    % {; s' [8 X& G& ?4 c6 t1 J
  123.     else
    / c7 I1 P+ e' d- v2 m5 v: x+ s
  124.     {2 J+ L$ a( F& T' j5 S) \
  125.       olds=(*p).second;& ]) \- Y7 O  C  C4 k4 i. l/ p
  126.       if(olds->vers<(float)atof(version))! [, m! b# G, U$ y5 Z" \9 c0 T
  127.       {
    : Z3 W* O9 Y  f8 K* B  L* w
  128.         olds->vers=(float)atof(version);3 `* B8 y3 Z& _" C& c9 w( G
  129.       }
    , @( C1 }( o9 V4 H
  130.       free(file);
    1 p3 s0 @5 K" S$ J
  131.     }& q8 c0 g+ g$ `" k2 V1 x% S$ Y
  132.   }
    ( O6 [* c3 L; F2 n. C$ m, ?1 k
  133.   fclose(fp);
    " G+ G* O5 X6 D8 ]7 k5 D2 }
  134.   return true;% V2 @& R( V/ U2 e' n
  135. }) H$ S( [( N# [5 H9 W) N1 z( Z
  136. 4 e7 E6 Q3 l5 X/ Y
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)6 X! @! A  p) e. _: j
  138. {/ ?# @; v; ~& l% i% V) H
  139.   TCHAR  szFull[MAX_PATH];
    ; g. q3 M: J+ e' G6 k2 W
  140.   TCHAR *token,*inter;
      z) m' ]9 G1 R6 k( N
  141.   *szPath=0;
    , r4 h& M+ p. I* B
  142.   strcpy(szFull,szFullPath);
    3 R( ~, y8 P5 D' e5 Q& I
  143.   token=strtok(szFull,"\\/");
    1 o2 I5 n% |% e
  144.   inter=token;$ c5 c9 D& h/ {) G" A6 S* d" A1 c
  145.   while(token=strtok(NULL,"\\/"))
    $ Q8 P* W# _0 E2 l
  146.   {
    ! U8 Z8 Q3 T; c: X" i) b+ ~' C4 b* d
  147.     strcat(szPath,inter);$ R" ]7 I! L" U0 I! e
  148.     strcat(szPath,"\");" r" R2 C8 p7 R  Z  E
  149.     inter=token;
    3 T. v: I2 E. ?4 t
  150.   }
    ( z8 d, H5 ]2 \+ A4 F7 A
  151.   return strlen(szPath);! Q; O) R: j& ~0 [* n. [+ Z, E
  152. }9 A& t- {% Y8 e' Q2 M9 @9 ?0 z& L3 m

  153. : m0 q* m( i) [
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)7 v% ^1 I% H6 u; M
  155. {
    : j' L; G7 z, }
  156.   DWORD attrib=GetFileAttributes(Target);) ]- p0 k$ F7 V) R- m/ l8 [
  157.   if(attrib!=-1)9 q* }1 Z& l3 e' N
  158.   {
    ) V4 I5 `* g2 y
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    . H! q$ _) j8 O9 h+ d
  160.     {
    * o/ k7 i& y, V. p: w$ a
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    ) i$ \6 x3 A: V
  162.       SetFileAttributes(Target,attrib);# R, X& A# W& G6 p4 V! _
  163.     }
    5 h1 \  l9 H( J& w" A; z+ A
  164.   }
    $ N' l( Q  q4 F2 c  f/ d+ J$ V
  165.   CopyFile(Source,Target,Erase);
    1 R9 l+ [# ~) _
  166. }
    0 n  R7 v( B) D

  167. + d8 ?% q# C1 C# I1 x
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)+ e8 M! p/ U1 h( ]7 O# [* l
  169. {
    7 P% @9 I. M# l. ^' ~) b: R- t1 Q
  170.      FILE *fp;
    # F* L/ r& R! t, }1 H% ?( S
  171.      char  szBuffer[8192];
      f# J& y  @5 q9 L, S* Q: J
  172.   va_list  argptr;
    5 \& k/ G% \2 v" ]. M, o
  173. : @2 j5 I2 `4 |( {$ Y$ ?8 O1 h
  174.         va_start(argptr,message);: F' x2 N; z+ O3 @
  175.         vsprintf(szBuffer,message,argptr);$ L8 a8 V! }/ h3 N4 G) N! `
  176.         va_end(argptr);# h7 I6 P" m0 D5 ~4 ]
  177.   fp=fopen(FileName,"a");5 J. D0 c: g- g0 i
  178.   if(fp)
    " F% z9 P0 |" S7 ?0 f) z
  179.   {, u3 w& |7 @9 h" s$ Q+ X! z
  180.     fprintf(fp,szBuffer);
    2 o$ C: s/ G) m3 v# A5 e9 f
  181.     fclose(fp);; S! B) C; @% Z. T8 e: h1 ]! s
  182.           _flushall();  h/ y6 M1 n  ^6 y! S
  183.   }1 P3 n4 q3 z- ]1 l6 Z( F; Y2 k: y6 M
  184. }+ G) s' f9 d0 z" g- z$ ]3 P0 z

  185. / _. g4 {0 W$ Y% a# U. p
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    " j9 ^! U; v& x2 c4 b
  187. {
    & }6 P+ A! Q, u9 O' F* |6 }/ X
  188.      FILE *fp;
    6 S( O, U  y( m
  189.     DWORD  attrib;* Z$ `9 w+ O" T+ I
  190.   attrib=GetFileAttributes(FileName);4 J2 ^# O! B5 q' x
  191.   if(attrib!=-1)
    , A1 a6 p0 I* g" g+ b9 b
  192.   {. C+ U1 n0 X* y/ j# }$ @( s
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);/ ]) C$ Y! r6 J, I0 r/ E
  194.     if(!SetFileAttributes(FileName,attrib))
    ! O0 t, z/ V- B7 |( t$ h; A. A
  195.     {1 r5 r. C4 Z& e; u
  196.       return FALSE;. _( k' u4 ^0 l0 L4 _
  197.     }0 D1 ^2 U4 X& m
  198.   }
    - V0 a: m5 h: C+ A& x, S
  199.   fp=fopen(FileName,"wb");: o! f9 ~! _8 `/ B  E$ w$ j
  200.   if(fp)
    * m! P5 ~: V% D3 `: m9 X0 ^
  201.   {
    # o* a) V5 o1 b! {$ y" a7 z5 B( X
  202.     fclose(fp);2 v9 N! w1 h7 k9 C
  203.   }6 _& P3 q' N* W; F' h2 @
  204.   return TRUE;3 p  [# A3 p- A# p& z0 J. S
  205. }; J" g$ f4 g: c) N" V: E5 ]. }

  206. * p8 \; E/ E" y; I+ j! i: j& H# c
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    6 m( e6 ~8 a7 _, R; Z3 k% E
  208. {
    5 ]; M8 U& n& @" ]% \6 o
  209.   char filename[MAX_PATH];) r, ]+ j- ?5 f# O$ @
  210.   LPUPDATEFILE file,olds;
    , Y, Z' h& s. I1 E
  211.   std::map<int,CString>::iterator i;
    ! m  ?3 O5 q. j6 S' J* W4 B
  212.   std::map<CString,LPUPDATEFILE>::iterator p;
    . Q" E! C& l! r6 L" G/ U9 t
  213.   std::list<CString>::iterator l;
    9 C1 n9 h) q6 U3 N
  214. ) N5 l1 {5 Z2 c, i" T
  215.   if(bFirstUpdate)
    2 B3 `) u; h3 z' B9 J  l8 J! d
  216.   {  d$ J- H- u8 G9 E3 T1 s0 u
  217.     dwCurrFile=0;
      {- G% |3 m! X3 l( H) q
  218.     bFirstUpdate=FALSE;
    $ _% G$ G# ?  P
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    2 m" Y- T# H7 K- U
  220.     {/ r4 ]4 t- K9 I' S5 e
  221.       dwTotalFiles=UpdateLocal.size();
    9 f) s" o8 g8 ]7 R( D
  222.       dwDownLoaded=0;9 i8 h7 p2 s/ y2 q( I3 [
  223.       bSilentStep=FALSE;
    & E( d' ?, i7 I, q
  224.       bCompressed=TRUE;2 o7 W+ b8 e4 {0 V9 W
  225.       strExtLocal.Empty();
    ; O! O2 W+ u! ?" n# z& q4 w
  226.       strFullName=(*i).second;3 m: Y# a4 j9 R! _1 ~
  227.       dwProgramState=AP_CONNECT;
    , H2 D9 O/ o( R; ~5 `  q
  228.       return TRUE;
    / X0 P" Y1 L2 T6 e; w) M
  229.     }
    - g: T( w# ^" {8 f6 f# l
  230.   }
    * r1 V9 Y: f3 E( G9 L  \& [" A( |* O
  231.   else if(bRestartUpdater==FALSE)% w8 ]3 F3 F" m3 X, L9 @9 s* U" q
  232.   {9 H- e: J: L9 s  Y- G( Q+ o
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())6 k9 w6 n6 Y1 f7 z" G
  234.     {
    & M( N* V, t6 n$ v
  235.       file=(*p).second;
    + M2 A+ P$ |8 x9 X8 [4 f
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    - o9 k# V$ _+ b  [1 G( M7 Z' J
  237.       {  R+ A0 S4 I# W7 v3 c
  238.         olds=(*p).second;
    3 T( {: H6 e3 _! p# }
  239.         olds->vers=file->vers;: q' l$ c/ c% F' D( y, J4 y1 y
  240.       }
    . F' @" f. |& m, c( g) F: z
  241.       else
    * q4 @$ ~- d$ x& E
  242.       {
    - O- K8 \+ ?9 {  C% d
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    # Z' R- a' g  b7 r+ g6 j
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    * K$ K6 }+ S7 |0 W/ ^; d; J
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    ' W7 C- A+ R9 z+ u3 `, a
  246.       }$ Z5 s* ^8 y, i: F
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");1 W& w& x" s6 Y: D, X
  248.       sprintf(filename,"(%s)",file->file);2 w4 A- I8 o9 W( \0 }
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    ) w7 `* I% W% \5 g; t4 n# s
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    & N1 w. ^- I! H" G
  251.     }
    3 q# V' Z, F4 z
  252.     dwCurrFile++;! V2 }8 s$ F. K2 C
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())* G7 E: F2 y/ l  I
  254.     {
    7 m% ?4 O! y' o8 M8 r, ^2 U
  255.       bSilentStep=FALSE;
    , O) g' g0 S2 F" G0 c1 Q
  256.       bCompressed=TRUE;
    4 B5 N3 ^/ h% ]
  257.       strExtLocal.Empty();. G; q1 O- A% b: w
  258.       strFullName=(*i).second;% M: p  P6 ~! Y) W8 g
  259.       dwProgramState=AP_CONNECT;
    , m. B# h4 y' w0 Y% I
  260.       return TRUE;& u- ^( k1 R) A& E/ b1 b, \
  261.     }
    ( b, _0 R5 v1 ?. z. w3 ?, q# L
  262.     if(!bRestartUpdater)6 G( K/ Z$ O4 R! s
  263.     {
    ) A) M2 L2 S6 V% A) S# j$ @
  264.       int iCurrSize,iFileSize;
    " u9 Z5 t4 n& ~+ P4 b; T" G
  265.       iCurrSize=0;
    8 c; |3 d0 W, f0 h* K+ B
  266.       iFileSize=UpdateList2.size();8 ^& l1 v  O! p  i5 o+ q% `$ J
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");, r) \% C: c, l
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    : d+ U1 x) a8 D9 q. w" y: I$ g' v
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    5 t1 v6 }9 g+ M' k5 v
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 z) w' C  N" X
  271.       Fclearf(".\\update.dat");
    * n( }" `8 V0 d: a, |& ^
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    ) Y5 }8 @& e7 ]* V- B2 u
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++), O/ T* u& ^$ C  O
  274.       {8 R4 i; W' R: K
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())4 c2 ]0 S1 X" G, Q/ ~" |) n; b
  276.         {
    + i" C4 Y! @6 R2 X) J( g
  277.           file=(*p).second;; E: {9 _" C7 M8 `( z0 D- c; D5 i, G
  278.           sprintf(filename,"(%s)",file->file);' l0 S2 ]& F' G' ^6 i' X+ R! K
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);  d0 ]% T; I( ?4 ^
  280.           iCurrSize++;( b# Q! g3 X, M; B" p6 [
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));7 L4 r. ~1 G  Z" k9 ]
  282.         }
    3 Y3 `# ~% q6 ]% w6 C( g: A% _
  283.       }" @2 r7 ^# o9 P2 e
  284.       unlink(".\\update.txt");
    ! o3 E* M- B. f0 `
  285.       unlink(".\\update.tmp");
    ) K+ u# R6 T5 f/ w6 V1 P- w
  286.       Fclearf(".\\checkversion.dat");9 m4 G' Q. U" Q
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    % g6 o0 M& |* U
  288.       if(UpdateLocal.size())! h$ [' g$ c1 M# v; `
  289.       {
    ' I7 |8 m5 o. g' M# P7 g7 r4 g
  290.         UpdateLocal.clear();
    / U+ n- i' i1 A6 m' R! v% t9 {
  291.       }" a( m/ P$ D+ U; ]
  292.       if(UpdateFile3.size()); n" O3 f. {% E% Q
  293.       {; G/ u! g6 u4 T) W! i: z/ ?3 x. s
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    8 h+ _9 u9 q# Z3 H0 \# \; }
  295.         {
    / ~7 n7 l- J8 X( R+ f
  296.           file=(*p).second;1 k) C& j7 L1 A$ X' I
  297.           free(file);
    : X$ n! Z! S1 Q: ?4 m8 r6 r" z5 V
  298.         }
    0 d% x. b) f6 F! ?% x
  299.         UpdateFile3.clear();" s1 P3 N8 z% D6 j7 n  t
  300.         UpdateList3.clear();
    3 M0 w9 T- t- e+ o
  301.       }, V$ L  t, \0 Q& ?$ B( M+ }
  302.       if(UpdateFile2.size())  j( o& W7 w7 L5 o7 v3 Z2 H# p, e
  303.       {
    - k$ H0 t: w' R1 U
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)3 [7 c$ W7 n+ r" W& U) X- p
  305.         {
    6 J+ D3 R6 Q8 J7 Q0 U! E$ N' j
  306.           file=(*p).second;
      f2 N6 n2 K/ Q& C  X! ~8 O6 c
  307.           free(file);
    ( m( S7 e  V1 f  S0 ?. Z" N* [; V7 f
  308.         }
    % |+ m) d3 l0 a. \
  309.         UpdateFile2.clear();
    6 \* j  E, W5 _* a3 W
  310.         UpdateList2.clear();
      ]7 i+ g9 m5 _; o. B
  311.       }
    # J! t' p* F3 w: ^4 X4 v9 }
  312.       if(UpdateFile1.size())
    * s0 R0 ~" B8 E' z
  313.       {
    6 t7 ~6 g& h7 K9 ]1 w
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++). j% o) P5 n$ d4 N' ^; Z& ^
  315.         {, O5 y. c. m: {  h& S# t$ J
  316.           file=(*p).second;% S  C8 q/ U/ P% i8 I8 m
  317.           free(file);% Y* `+ w/ u$ ^7 e2 ]+ G- `& |
  318.         }: e% K2 w4 [2 c$ W( k$ \* j
  319.         UpdateFile1.clear();7 D9 W5 k/ i* e+ \- N+ n/ ^5 ~9 h
  320.         UpdateList1.clear();
    9 O# j2 _, D5 p. k9 @1 `
  321.       }+ ~* n7 F( m# @: @- r  Z
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    ; J, P' V9 V3 t, d3 x4 Y, @- ~
  323.     }1 C0 s' q3 G3 o9 s
  324.   }
      D9 m# q' F8 R' i$ t; z: L
  325.   return FALSE;6 b" k! ]$ H* U  H
  326. }6 p  C) t" Y, Z" ^

  327. $ r: \+ @) N/ M  Z8 T4 }0 O" ~
  328. void CRevAppApp::ClearAll(void)
    & m( k) w9 M' s! ?
  329. {
    % L! d; Y. Y  E
  330.   LPUPDATEFILE file;+ x. I+ q  f% H+ A& q, v
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    * [7 s# G8 v1 j+ c% ~% ~

  332. % H. {' D2 G9 s+ |3 H2 |
  333.   if(UpdateLocal.size())% y- |5 U2 W3 P! x# Q% R
  334.   {$ M* c) Q  N. E4 E3 V8 c
  335.     UpdateLocal.clear();
    * H9 h+ j8 x) z
  336.   }8 C' _, X* v4 b: l% V
  337.   if(UpdateFile3.size())0 O* M- R& P0 `+ a
  338.   {
    + m- C1 c! t+ Z3 F" E
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    6 R6 W; L- _: _  X6 x, K% U3 u
  340.     {+ X* `* B- p7 ?6 u3 g# C
  341.       file=(*p).second;
    + |) x+ b1 o3 D9 F- M( T& ^. Q7 `
  342.       free(file);
    9 k0 N1 v* G( M( L$ t, ~' Z! a
  343.     }
    . E  ]5 m3 f; H! R, T9 I2 y! x8 D( B
  344.     UpdateFile3.clear();8 G* Q$ c' h% K! q& q) h
  345.     UpdateList3.clear();
    + o$ g+ P" D9 f
  346.   }
    . R- V$ \/ F/ |5 X5 I; x) h
  347.   if(UpdateFile2.size())
    9 |, {6 k' g% {  ^
  348.   {
    7 k: K, n) v& l/ I& Q: H% H' J2 O( F
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
      i, W0 H' U2 A6 x5 B6 k+ k
  350.     {
    5 t* O; H. j  \6 k8 K
  351.       file=(*p).second;8 R2 R& \& [2 m# F. M' T
  352.       free(file);
    * y8 O' c0 y5 ^% D/ y
  353.     }+ H4 u6 }5 J8 h$ G% i. Q- \* G
  354.     UpdateFile2.clear();0 Y' b. d* ?: G3 @, Z0 E' ~
  355.     UpdateList2.clear();
    , c9 [  W* d: a( w
  356.   }
    : i5 @" E6 W9 _$ F) _% M
  357.   if(UpdateFile1.size())5 g4 n+ @( \! B1 H4 P* D6 c
  358.   {, T+ P" n  z0 c# h% o+ e8 v. d
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    ; a) O8 \* x' B# M! S4 A0 q
  360.     {( M5 J/ F3 L; {
  361.       file=(*p).second;  n( n, l7 ~! Y* |, A0 ?
  362.       free(file);
      r+ P4 g9 `* N2 H- J
  363.     }2 w) b+ W9 x3 |1 X; ]1 a
  364.     UpdateFile1.clear();& ~5 `, X7 }: M5 r5 d+ {1 C
  365.     UpdateList1.clear();
    6 D9 c) J" p4 X% @( z
  366.   }9 K/ U* P/ U9 }2 @4 d) Q# t6 _
  367. }  2 N: W! b+ s$ j* o
  368.   2 `( d% u. m* l+ z4 E0 a
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    # W7 N  C3 I0 V( X, j9 e
  370. {9 q0 O7 x1 x' `5 B7 M8 p
  371.   int c;' e% o4 n5 j0 q5 t( Q5 z5 W
  372.   LPUPDATEFILE file1,file2;
    ( v3 W4 P( J/ o5 [& R
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;& H# Y8 g# I6 O/ t7 a, D1 B1 p
  374.   std::list<CString>::iterator l;. m# t" ]6 u& ]  r
  375. 2 U+ g0 _  [. N) ?  ]1 P
  376.   UpdateLocal.clear();  {2 K$ y' d7 h4 V% u; ]
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    / i' g: n+ ?. z) K  d8 a8 M
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);6 E+ w. x6 G: _/ R
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);& q* |& @3 W* E
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    3 T0 ?/ ?0 ?  E; I7 r
  381.   if(UpdateFile3.size())
    # V+ N, u2 e& y# X" X$ g
  382.   {
    ( M: |! h5 p% H+ Q: m
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++); j6 p! @( l! B' }: M6 s. N. y
  384.     {
    . E& f4 x. E, B: o6 N4 k" V& O
  385.       file2=(LPUPDATEFILE)(*i).second;
    ' f- W! d1 L8 {0 Z+ U
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()). I! f; M" s1 G# w4 r6 S  j
  387.       {9 _: n7 D; P$ z9 i& A9 O
  388.         file1=(LPUPDATEFILE)(*p).second;  b: h0 t' J# T* J+ ^. R: H$ C
  389.         file1->vers=file2->vers;
    0 l0 [- Q) ]! D  y# c7 o, P* i
  390.       }$ a2 r& T, Z" M# U7 I1 E8 z# k: ^7 ]- o
  391.       else
    ( A- x( n% N7 R" U+ o  Z) z
  392.       {; ?2 d$ P6 i6 j- T5 V" `3 A) A
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    9 u2 I- F. G9 t5 |6 {$ v- K$ p
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));3 Q. z/ t% }2 t+ w$ A2 Q/ g
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    9 B0 m/ H7 w7 x( [
  396.       }7 @3 L7 y+ j8 X& N' `
  397.     }
    9 u: h4 a4 u! y4 ~( _) @: \6 O# }
  398.   }% _! p& h' b: C# q" c: o" @
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)8 J3 O9 E( ]0 ~1 q! s
  400.   {
    3 h' \2 }. `/ G. ~+ L8 {& L+ L9 p
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    ; U0 J* D2 Z1 h& b/ V
  402.     {
    9 i: Y- z4 {! n
  403.       file2=(LPUPDATEFILE)(*i).second;
    ; @7 o+ o# w  @+ w$ ?
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    8 \. A! [: L9 h* O1 }' [
  405.       {, i6 t( X; e% n) E% g6 Z4 i% l  Z
  406.         file1=(LPUPDATEFILE)(*p).second;  g# k: L; @) w
  407.         if(file1->vers!=file2->vers)1 g: O4 c" w5 A5 @
  408.         {2 z% a, E/ ~3 l9 M1 Z
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));# h3 X8 x8 o1 O
  410.           c++;
    2 R. u2 ^2 G0 p7 v# M" s) D, [
  411.         }
    % P' K* x5 g7 S: B1 `% H' N
  412.       }! S( c2 S0 C2 J" X8 J- [7 M8 X
  413.       else/ Z9 N2 [* y. w3 B* m
  414.       {
    * n! r: B# z. v6 X9 \) z$ o5 `7 S
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));6 c+ d: a: ]7 s* Y; {- Y: c% F
  416.         c++;: m/ n8 j, J% M2 `# j
  417.       }& D( N8 f: r4 n( [, \+ R
  418.     }3 e3 s  H$ m) O
  419.   }
    ; m7 G& u' r3 L2 ]  T
  420.   unlink(".\\DownLoad\\update.txt");: `6 x' |# j8 T% P  ]  X9 j  r
  421.   if(UpdateLocal.size()) return TRUE;3 }8 F( [" W  w/ U/ _. E
  422.   else                   return FALSE;/ P. N/ Q- _- w  l: @# P0 z
  423. }
    : J) u% t, N# k5 R/ {* H

  424. 0 A5 E; X( m( i. I; m. i4 l
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"# c6 T3 a" X( b' G; E
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"8 p: U/ X7 g5 O7 V6 o# U/ X
  427. 6 o2 U# }: D6 V* S4 p. y: }& k- @

  428. $ `1 p  F+ @& u! w  U# l6 N9 z; N
  429. & x7 [7 s( ~* K! F/ j8 T: B
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)9 r+ C  v  S# D$ R$ z; t
  431. {
    $ E& m7 e" x& o- J% d$ o' Z
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
      V6 ^. H" ~; c2 u! L
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    - S6 H$ J; l! t0 I/ @  C  m' t
  434.   {
    ; f2 N9 n: b" F7 H( m+ i# x
  435.     char szLanguage[50];- ?4 D2 q0 S( m: A( X! U" w
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");* |9 o2 |4 D; W" ]8 @
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    . }- V: S1 Y8 i, Q9 N/ O5 \
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    9 d) J8 t# m& G6 l: T& b
  439.     else                                   m_iLanguage=ENGLISH;
    9 O5 b, A' N2 s$ |
  440.     char szRegister[100];8 ]. S1 J6 d8 W, c! v7 i4 X$ {
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");" c4 t+ r- Y* S8 H: e! m
  442.     strRegsName=szRegister;
    * H# R( }  W9 J3 A# J
  443.     char szPatchURL[100];% I) e8 w! V6 ^: Y- z5 ^0 D
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    % ?! Y6 B& Z8 R9 P4 O  ~( b
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);4 {) N: p2 _- R: r: e- m
  446.   }
    : K- D+ g7 G: D8 [' _; w
  447.   else
    2 L( e3 i7 M' d9 ~4 C7 v
  448.   {
    2 K( P0 W6 Q7 K! S8 a8 w5 R. o7 H
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    . Y1 I. b. I& d2 A, a$ v3 U
  450.     strRegsName=DEFAULT_REG_URL;
    . M; R$ y# J! S+ B* u  V
  451.   }. O- N7 Q% c( M/ O& l3 @# ^
  452.   if(GetFileAttributes("hosts.ini")!=-1)$ w$ o4 B9 E8 y( P
  453.   {
    6 o7 Q$ s0 u( ~, N. y9 i+ k1 M
  454.     char szIP[50];
    / W9 T1 B. y# e6 A/ ~' |4 V# \
  455.     char szDIR[300];
    8 v# u$ c! ]+ d) f( o, z" r, k
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    ; @2 @5 K( O) c( P
  457.     {# Y: P8 G4 y7 P, [# J) s2 Y, j
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    . P, m  z9 ]2 ?8 f
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");& X) P* h7 o& P
  460.       strHostName=szIP;
    . i; M; N' d+ v9 a6 j
  461.       strHostPath.Format("/%s",szDIR);
    9 W& i% z$ P! i2 i+ Q$ ~
  462.     }
    6 V1 W0 M* ]4 j/ ]; j3 B5 ]% D" {8 V" ?
  463.     else
    . J7 T1 s2 _1 s" q( u
  464.     {
    6 j; }/ N, {$ W* T$ z
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)" G2 `: t4 V. |
  466.       {
    / D1 a# F# s! _7 d" m$ b
  467.         char szLanguage[50];
    $ C6 w( q6 u2 t4 D
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");/ G2 o9 L1 d/ M
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;6 G5 O  h2 J; x2 b9 K/ s; G- K
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;! {% |( ]" C& O0 z2 }
  471.         else                                   m_iLanguage=ENGLISH;
    % {8 i- J* P  h' E' h/ ]
  472.         char szRegister[100];
    ( W! S  v7 V1 P( ^7 i, {- c
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");% G' s" m& ~% `. f6 V+ p* ?8 f1 R$ M
  474.         strRegsName=szRegister;
    # I; F, J1 ]0 s/ O5 h$ N" }. x
  475.         char szPatchURL[100];
    ; B. v' I# j% ^) r' z7 J5 t
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");: x( n" y4 D* O# J4 O0 X
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);, ?% g3 g0 @! Q8 q, d
  478.       }% b# I  Z1 ^' r5 S
  479.       else7 M2 k/ R) C  s* h3 ]
  480.       {
    : |# E4 c: Z" z& a
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    " c! b4 U; q- W9 Q' n" r
  482.         strRegsName=DEFAULT_REG_URL;8 l9 _$ Z- O; e, S3 K* [
  483.       }
    7 C; f$ o) t7 r/ ~. l: D, d0 s
  484.     }: H- n& D, I! V/ S
  485.   }7 x  c) d$ O4 O6 s7 J
  486.   return true;
    0 h* u/ ~9 J' i2 r  O
  487. }
    / h0 ~2 p/ V9 B0 W

  488. ; A8 u/ z; W! a- N/ R% R6 G
  489. #include ".\ZLib\unzip.h"
    5 p5 h- V" O7 G% i
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);0 V; ~0 o+ `2 q, s
  491. /////////////////////////////////////////////////////////////////////////////
    1 t( S# I  L; ?* N& a1 I6 ?( `  P
  492. // CRevAppApp initialization
    1 `% K' P7 D. M9 p' J

  493. 4 ]. a0 X, V2 O! l  t% P3 n
  494. BOOL CRevAppApp::InitInstance()9 Y2 s- z! S5 ~, C9 P- K; c
  495. {
    % B( l7 R; J. q. t5 J
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    ; G# S8 b7 K# L
  497. 7 M2 V* i' i- J( e
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);
    ' [8 T1 k9 [2 T% o
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    1 z( }" T6 J; G' m5 Q, \
  500.   {8 q) `5 B' K" S' M
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");$ \) B8 t4 D5 o0 b  b; s- ^- c* N
  502.     GetPathFromFullPath(szPathTarget,szPathSource);, g5 w) Q5 z9 l$ l1 M  F7 P
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    ( h0 n; b: C7 K" O
  504.     {
    0 s# B2 J$ x# H6 d0 @5 i
  505.       strcpy(szPath,szPathTarget);
    ! v& @8 }# j) {& @
  506.       SetCurrentDirectory(szPath);
    & Z2 m5 L9 {" w: `
  507.     }9 e, J3 E6 w% t3 t
  508.   }3 V% `3 j" c, X3 ~7 d$ G
  509. #ifdef _DEBUG
    6 e: r) f; H6 s* v7 W/ Y8 J
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    ! S+ }8 I8 _% ]) y" {0 a% P
  511. #else
    / s8 [/ ?2 Y, P3 v
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))/ [8 A7 p% E( ]1 b" Q1 }- I
  513. #endif
    3 Y$ Y8 K/ z! }0 P2 K' n. F% T. c
  514.   {
    2 B9 ?& M3 \0 s6 N$ ~/ J- {+ |% S
  515.     char tempFileName[MAX_PATH];- [% u: T& S( u2 h! {9 s
  516.     strcpy(tempFileName,szPathSource);. F/ ]2 E% q- ?, n# r
  517.     tempFileName[strlen(szPathSource)-12]=0;, y2 ^( ~/ Q8 |* ]1 {
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    , L( M  s- s% I1 l
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);' F) j% E. U6 N% t  I0 l
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);; E3 M- x9 W% z/ @
  521.     return TRUE;
    9 J$ z" M  S4 r& p( p% K9 Y
  522.   }
    ! R. F! g5 h1 L0 M0 x2 H) d
  523.   // Nuke 0118: Delete run.exe
    5 R+ U* N! Y0 [" A
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );: A2 C' J3 h  @) i5 ^0 \4 S
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");; x0 f; A7 i1 g( T8 B7 P6 J: t: ]3 C
  526.   if(!ReadCfgFile("Config.ini"))
    4 r9 g- r4 I# Z* ~: ?$ h+ y
  527.   {
    & c% `; T7 A9 f. J# s' u$ K
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);& }% O. a9 `  R* t' `5 U
  529.     return TRUE;6 f' e! r  g, |9 H8 }* m# K
  530.   }
    9 M: x/ c% [/ {' l" J, L
  531.   HANDLE mutex;0 p% v. U6 H" T3 v. e, k% x$ \, w
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))" b( Y2 d' z% @8 l+ ^) V+ }
  533.   {
    ! u/ j; ^- k. Z# T. a4 y8 |
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    * T: e8 F: _6 ~0 [: V- u
  535.     {. N" l: D. ]- w+ X3 `
  536.       CloseHandle(mutex);! L0 v2 N8 Q/ Z3 D
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);2 t  S- b3 H* `
  538.       return TRUE;
    5 u9 p- b" t0 D, K- D- s5 G
  539.     }
    / l* x. S+ l' N- O7 F
  540.   }  " D2 a0 S  Z' n4 U  W# U6 o
  541.   CloseHandle(mutex);9 X& ]" t; K% v% u/ e& t( ^

  542. , e2 U/ l' B& h. M9 o8 V* l  W0 Q
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    1 T) H/ x' l1 X) ^$ _

  544. 6 H* w0 B' Y) X% J* S" G9 t
  545.         AfxEnableControlContainer();6 E" C; @# g+ j+ v+ b* s7 H

  546. 7 S! }- z+ i0 H3 M7 H
  547.   bCanUpdate=FALSE;
    $ i1 l! s' A9 q! D9 n% l- ^
  548.   dwStartUpSteps=1;- t" U, ]$ F. T/ T4 H6 i$ C6 f
  549.   dwProgramState=AP_NOTHING;7 ~/ B& e- k5 A( [7 I! a

  550. 8 q# ]# E' S4 R9 R& y
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);0 a% E% z, F- k- j. `5 A+ A9 o; Q

  552. 4 N4 {# {$ g5 H* S* X4 K* H& q
  553.         // Standard initialization5 @1 {$ B9 [) Y
  554.         // If you are not using these features and wish to reduce the size
    9 b3 A$ w0 l& k+ o5 S4 _
  555.         //  of your final executable, you should remove from the following& v1 q9 d2 R. i
  556.         //  the specific initialization routines you do not need.$ w: k$ k3 k* M! [  J) X
  557. : _3 f- Q7 V% I+ ~4 B+ s
  558. #ifdef _AFXDLL
    ' R: S  }; S/ t' H1 t  R! ?  X1 Z
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL3 e3 y: @$ _) X' u  z8 I7 x% R
  560. #else
    ) d3 d7 ~9 j. U- y1 P! C
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically# m8 C6 W3 b  K8 E9 L
  562. #endif, f0 x$ V3 R6 h( _! g3 q) _( v( d, Y" U

  563.   i' s  s! H* e- h9 J& A) r
  564.   dlg=new CRevAppDlg;# F0 `1 C- [' ~+ R; z4 K# Z9 o
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    6 Q3 a1 y% X5 A: `
  566.   dlg->ShowWindow(SW_SHOWNORMAL);4 \2 r2 V1 P9 q  e, _* R
  567.   m_pMainWnd=dlg;
    0 Y( P. Y. A4 D& D- L% v

  568. # m$ t0 N7 O' C. q# x
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    & I/ n2 L) S: e, j$ {9 [

  570. ( \6 w3 t2 _* L
  571. //  GdiplusStartupInput gdiplusStartupInput;
    4 m4 ^) h! u# n  E/ m) l' G
  572. //  ULONG_PTR gdiplusToken;
    ! t2 N% Z; }" d+ |
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    1 D, g4 N0 _! `$ A! |! D5 N; @% O7 Q
  574. ' {1 e. W( E2 {& s2 a1 v5 Z
  575. //        CRevAppDlg dlg;
    4 ^2 B) d# f. g
  576. //        int nResponse = dlg.DoModal();
    9 i' i; R, }9 ^4 n8 O2 \
  577. //        if (nResponse == IDOK)
    * n1 ~' N3 x' r8 T( g( f
  578. //        {9 D0 _+ J0 E8 Y0 @
  579. //                // TODO: Place code here to handle when the dialog is
    0 M: o9 D2 \5 A' P
  580. //                //  dismissed with OK
    ! b6 g! q, z. }, U  f; X& d
  581. //        }- x! r: A) Q' @5 I- G: k- h
  582. //        else if (nResponse == IDCANCEL)2 [$ \% E5 x: U; B. }
  583. //        {) ~& A! B6 D& W1 ]: Z
  584. //                // TODO: Place code here to handle when the dialog is) w* |4 R% i) B5 ~
  585. //                //  dismissed with Cancel
    9 N- P0 g- x$ G7 b
  586. //        }
    , d3 a6 i1 ]  }1 ~3 A8 V3 ]
  587.   A1 a8 |" ^+ X" q; F
  588.         // Since the dialog has been closed, return FALSE so that we exit the" C1 u' h) _4 Z5 ~5 I/ W0 {) W5 ?" ?
  589.         //  application, rather than start the application's message pump.
    2 q6 O* d3 ]. J2 ^; x
  590.         return TRUE;
    # o6 q6 Q6 H" Q) ^% }! }3 U
  591. }# f6 d& U) b7 J0 |0 e: X

  592. & s6 |, g) _0 z
  593. char *CRevAppApp::strtok3(char *pSource,char *token): b1 Q3 }7 t# _) }! N
  594. {
    $ P  N3 n; v5 n" T! l/ q1 W
  595.   int i;! l5 ^8 x0 R' k4 Y! D9 `( s; N) ~" A$ ?
  596.   char *szRet;
    & }+ W, r7 @& g$ W
  597. - \5 v3 Q& ]& _# z. C
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    8 J/ T* y9 w" |8 t$ Q, J3 e: Q
  599.   if(sztoken)6 U& F% [) f6 O5 Y1 p- s
  600.   {+ B; B1 ^  s  Y8 x
  601.     szRet=&sztoken[itoken];/ L2 O" u  {; M/ Z! [$ q  {
  602.     while(sztoken[itoken]); g5 Q' w! E/ `
  603.     {
    $ Y. e* f+ ^' a) z( e
  604.       for(i=0;i<(int)strlen(token);i++)/ g) @' T- T9 h
  605.       {, Q! \# o+ G# e  Q
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])* f# W5 G2 e# D  T& B' u) ?9 j$ m
  607.         {
    ! R, w5 [- r  G3 z% @! J  h" I
  608.           sztoken[itoken++]=0;
    2 |, w1 f2 a. Q5 J) }2 I
  609.           sztoken[itoken++]=0;( L$ g5 n2 i* z1 K1 l! _
  610.           return szRet;
    9 s2 t* ?8 r8 z% b) H
  611.         }* y  B( L) X0 U; y0 }  M: R+ a
  612.       }
    " _7 S7 ^9 E6 e" f1 ~% Y  \
  613.       itoken++;* T  x$ w/ d- h  D
  614.     }
    & x5 \4 F8 v& ]' q' _
  615.   }" P1 {" D% w) L  a7 s% d
  616.   return NULL;
    0 H; f$ Y- _" l
  617. }+ d/ t# \7 }4 ?! ^0 m

  618. ( m" c4 C" Y, N5 r
  619. void ProcessProc(long Total,long Current)3 p$ i0 ?" a; @
  620. {. U1 e. U4 K% M! A& R0 y
  621.         MSG msg;8 g, U/ d) W$ N, C, C) X5 g, U
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    & K: S! H* }! K9 [0 U9 V9 z
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));, o- w8 j' |/ h" j6 Z& R1 c
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))3 x0 d9 R9 L$ F/ q5 j! d
  625.         {" R) i" n. [2 ^4 Y, b* I) G$ }$ `& m
  626.                 if(!GetMessage(&msg,NULL,0,0))
    1 j& k9 R& w: ^( l6 ?
  627.                 {, U% {9 }+ @8 s; c) E1 f9 h. l
  628.                         return;
    9 N7 W- H6 G; O
  629.                 }
    ' W& a7 W: _  F$ ]! Z; s% _
  630.                 TranslateMessage(&msg);1 C: j& u9 o9 P3 s2 e. p4 h9 v# z
  631.                 DispatchMessage(&msg);1 R' R% Q. b2 W
  632.         }       
    5 ~* C& f& ]+ B
  633. }9 F! ~/ H: p1 Q0 [

  634. : ?2 P6 }. Z3 A
  635. BOOL bFirstChar=TRUE;" O' X; P9 a. ^  Y1 w$ G' c
  636. " R) A/ x  k; t$ j. u8 h2 s
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    ! u/ v; R( w( d# S6 x- H
  638. {
    " m( g3 }; r, y' C- P
  639.         // TODO: Add your specialized code here and/or call the base class
      y- V! A  E: `
  640.   switch(dwProgramState)
    8 @: Y. @( Y3 O* j& d$ M0 X
  641.   {
    $ y5 y9 J3 h0 u0 p% b
  642.   case AP_NOTHING:
    & D' Q- g& M4 d2 v
  643.     switch(dwStartUpSteps)
    7 g& `4 T0 L+ r2 D
  644.     {
    4 `2 ]  W* K" C  m3 N
  645.     case 1:
    , H' {4 [. _6 {' Q; o: G( K/ F3 @& D
  646.       {9 P- f8 |( e' z1 a
  647.         int i;
    3 N0 g* b  ]7 \0 t
  648.         CDC *pCDC=dlg->GetDC();
    3 `2 [, f% \! U: l' j( h
  649.         HDC hdcwnd=pCDC->m_hDC;
    , _1 S4 k: h% P; _+ d6 E" R" [
  650. //        Graphics graphics(hdcwnd);$ ^. f" j5 Y; T7 Q1 ]% a
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    1 {& j; ^+ t9 u. ]1 }8 X2 J) X
  652. //        INT iWidth=bitmap.GetWidth();
    & w, x3 u0 g& ]( S5 h
  653. //        INT iHeight=bitmap.GetHeight();
    ! m) ?3 Q, P" W" }* P% z
  654. //        Color color,colorTemp;
    3 Z) [6 T; F* M  t) ?
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)* K0 m5 m+ Y- r* W, h6 P9 [# I: {
  656. //        {; o" q+ S2 k/ Q  h- W9 Q
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)
    4 X! p5 Z) @1 |7 ?% ~8 M$ @# ^
  658. //          {# L0 V8 V7 q/ E7 ?1 s, N+ ]
  659. //            bitmap.GetPixel(iColumn,iRow,&color);- ]. Q7 C3 q9 u+ B" P
  660. //            colorTemp.SetValue(color.MakeARGB(# o2 Y/ W+ f& F! h0 L0 l
  661. //              (BYTE)(255*iColumn/iWidth),4 w& _' x/ [, u/ U- i  }! k
  662. //              color.GetRed(),
    ' c) N0 D5 p$ B% W( l: o, n4 }4 O2 c
  663. //              color.GetGreen(),  e$ j( V  O8 [) H& e% l
  664. //              color.GetBlue()));0 _) H2 X+ ?, N1 \* ^
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);
    ' _5 p& |; j! o2 r! M2 v( f
  666. //          }
    0 r# D$ c6 o4 F% t# j
  667. //        }7 G9 g& J+ ~3 P& s
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    3 I+ m# S+ U/ c6 W8 U, }* O
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    * S1 ^  k4 G- k. R/ h
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    7 j- z" `/ @) Y
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");/ r$ X/ ]8 s1 P1 M2 y9 Q6 t( [; s
  672.         for(i=0;i<240;i+=8)5 t. |5 H$ O( n" Z6 e7 S: d& Q: z- I
  673.         {. m- s& U. a! U5 R2 L
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ) T- L1 D1 v. c0 J, R7 [6 s; i' _
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    ) Y8 T% D1 i- f0 @
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    % W9 ?( ]6 |% b% _# w3 J( I/ F; S: I
  677.           Sleep(33);
    ( A# }2 A! p% X+ `9 O
  678.         }1 t$ `/ U1 s6 l6 b8 n
  679.         Sleep(1000);
    ; y+ x. q3 }* B" }* w
  680.         for(i=240;i>0;i-=8)1 C" O. w( T) T5 N; p5 B
  681.         {
    9 M0 R: |! h5 {- b/ w
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    7 U: A0 Y% B! B5 k0 j
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);$ _7 l; p! b, d$ k5 X
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    ! g$ g% Q/ E6 f0 e
  685.           Sleep(33);
    ; Z% m2 ]: ~% F) D6 K0 }
  686.         }
    9 O; ^) j  P. G! p4 Y
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);9 o/ Q# C7 i6 A
  688.         dlg->ReleaseDC(pCDC);
    $ ~8 v) |7 @) B! |2 c
  689.         DeleteDC(hdctar);
    6 D3 U, w8 |& U' X
  690.         DeleteDC(hdcsrc);* {( q8 l) M1 V( o2 I) d! L
  691.         DeleteDC(hdcorg);7 E* L+ I- a+ f9 ?
  692.       }6 Q" L/ M/ a8 b% w/ |4 ^
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);# P, K' G# ?9 Z: G9 {& k
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");
    2 y" E' W2 ]- n) H
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    1 O) u/ W1 e9 ?) E2 o
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");$ j$ L2 k( T4 x# j3 G6 M
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. a, d: C* W4 I& h' g( w$ A, H( K
  698.       if(!Dn.Connected())
    4 j% B) U$ a+ |
  699.       {
    0 I6 R- }, J6 P5 r6 i
  700.         dwTotalFiles=1;  J  J% g0 H8 u
  701.         dwDownLoaded=0;/ M4 u# m/ b, a1 U  C: B6 M% B
  702.         bSilentStep=TRUE;6 ~8 j% V, ]4 ^- Q' K% x
  703.         bCompressed=FALSE;
    & }2 L3 k# H7 U" J- `$ q
  704.         strExtLocal.Empty();$ Y$ ^! L4 M4 y7 ?- {: i6 V7 X. J  X
  705.         strFullName="readme.txt";8 W! x* z( J0 R- f* @, y
  706.         dwProgramState=AP_CONNECT;
    , y1 A' w+ ^. }+ T1 g( K
  707.       }
    , o6 V8 W( B7 }
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    # J) ~: W' Q+ r% l: x% M% N7 }
  709.       dwStartUpSteps=2;
    % b% [9 ^9 F+ m% P
  710.       break;
    5 ?/ b: l9 k8 C; d
  711.     case 2:
    . d7 N- u) V8 h2 R! x
  712.       {' E1 e, G; b' [2 `: s7 X3 Z+ {* R
  713.         int iEOF;
    ( D8 q1 W% {4 q
  714.         FILE *fp;
    : V' n! Y) X$ [  d9 h, [+ \
  715.         char szString[512];- l) `6 p* ]9 l3 X5 O
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    2 h; Z& J1 B8 j) Y
  717.         if(fp)
    + W6 [1 r1 Z: ?1 G
  718.         {  `  z" s  Q5 |1 @. i7 u5 U! w: E1 F
  719.           do) I0 |/ X: D# [- A
  720.           {/ ?1 z8 l4 V# z) z; w
  721.             iEOF=fscanf(fp,"%s",szString);7 y* Z. [' L' k
  722.             if(strlen(szString))
    5 n, g7 p6 R; h6 T6 `  v- L
  723.             {
    & @4 k- A2 |$ C5 A, V
  724.               if(bFirstChar); I% T; i0 `& c! W# [
  725.               {) H  [* [0 S8 I3 c. Z3 Q
  726.                 bFirstChar=FALSE;: o8 z; O) S7 i( C* ]1 q( z
  727.                 bConnectIsBig5=FALSE;! r& P/ u; \5 u9 w, i/ i0 @
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;% O: y- Q/ f( P2 L8 c
  729.               }* g: C$ L. h* `+ K& q4 g5 v3 {0 X
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));) n! t- c" ~% J' p1 z) t
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));3 A  s5 r( Z& ?
  732.               dlg->m_ListText.AddString(szString);
    , K  W7 F% M& V3 h" ?
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);! I$ ]8 u$ Y% O
  734.               *szString=0;# T( C  ^) v0 x/ ^2 j' I; [- G
  735.             }+ \" C) l* [$ A
  736.           } while(iEOF!=EOF);
    * v. C% d, J! R" {
  737.           fclose(fp);
    5 C4 p5 N# Z1 I8 I9 P9 |% s
  738.           unlink(".\\DownLoad\\readme.txt");, a' l  ]. }; v2 z" L4 q6 ?% Y# C
  739.           dwStartUpSteps=3;" v5 b# F, m! V! y' K
  740.         }, F- X# h( K( v5 X4 j/ b1 z" L, X
  741.       }
    ( R# z) C; D* y- Q* n
  742.       break;
    & C8 M& [9 M( T0 U
  743.     case 3:
    + O: d0 r- Y7 K  P5 z8 l3 C9 Z
  744.       if(!Dn.Connected())& ^  l; A/ P: H3 s6 l, V& I
  745.       {& V' D1 U+ f' G" v' Y
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    4 @: D* l5 C8 G( j$ t$ b  C
  747.         dwTotalFiles=1;
    4 S9 ~/ C$ h$ C, T0 f" D: o4 @
  748.         dwDownLoaded=0;
    ! b6 i) H6 ?  q" O! f7 R0 g
  749.         bSilentStep=TRUE;
    5 p7 ^7 [( `& n; P! B1 n7 K
  750.         bCompressed=FALSE;4 d0 h/ A1 z  T) |( O
  751.         strExtLocal.Empty();: y0 B3 B$ p9 h+ ^& L% {& ^
  752.         strFullName="checkversion.txt";$ E) V8 S) t% p1 A' F
  753.         dwProgramState=AP_CONNECT;( K& Q0 h6 [! J# O4 `
  754.       }
    9 {% @+ @1 I; K; z+ v" O
  755.       dwStartUpSteps=4;
    ( T) D2 G3 V" s$ n5 r( e* @& D3 t3 w
  756.       break;6 t( j. `* g* ]7 W- w
  757.     case 4:
    0 u* C  v7 y, [8 R; B
  758.       {" w9 |7 V4 {; v
  759.         FILE *fp;% G( h6 j$ \% U8 M5 Y7 V+ T
  760.         char szString1[128];# v. n( M, s8 B9 E. f. I7 R
  761.         char szString2[128];; r& y' F. A$ N1 L7 S8 c/ ~0 K# d# X
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");0 Q: p- F+ I% N# m! B/ ^8 |6 z5 [
  763.         if(fp)
    # F) S8 y: P8 m- L. W" n
  764.         {
    4 p5 j' h: Z! `9 @$ [/ d
  765.           fscanf(fp,"%s",szString1);& E& l' O4 [* X1 g- M/ E, p4 D" K7 k
  766.           fclose(fp);# D6 k2 j7 K/ P& A
  767.           fCheckVersion=atof(szString1);* ^, ?; Z4 i4 R9 b: @: W
  768.           fp=fopen(".\\checkversion.dat","r");
    ! W  k7 e4 V# I( e: s
  769.           if(fp)/ k: I) X& X* J
  770.           {! F0 @1 o3 }3 M: u8 W
  771.             fscanf(fp,"%s",szString2);$ m" F4 Q: w+ M) V- a
  772.             fclose(fp);8 \) j& ~) I2 F$ Q& a
  773.             if(atof(szString1)!=atof(szString2))
    8 L! D! p( {  K1 U& X8 r: v
  774.             {
    5 W7 W3 \$ a! r8 g+ {( L  k
  775.               if(!Dn.Connected())
    4 K+ d1 Z7 O2 H4 u; }* T: V
  776.               {: U3 n! j' L' _  K. x! i
  777.                 bFirstUpdate=TRUE;$ Y1 R3 p+ W3 U3 O) N
  778.                 dwTotalFiles=1;( D5 F6 J* M' f" w: W  {  D
  779.                 dwDownLoaded=0;
      \  |: |, ^0 e( c5 ?
  780.                 bSilentStep=FALSE;4 X2 a; @& `* z' u
  781.                 bCompressed=TRUE;
    + l( b* n7 M  N% A/ Y. @
  782.                 strExtLocal=".\\DownLoad\";3 V# F% t" `4 g1 U4 I2 U; Z3 O5 ^
  783.                 strFullName="update.txt";
    ) s$ w. t. b( u9 X8 ]. k
  784.                 dwProgramState=AP_CONNECT;
    ' A* d* Z' }0 l" ^: f3 U+ l0 l- l
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    9 B4 a$ l; v0 c; }+ j7 s( r$ `
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    " u; b0 W& e! d7 o, y" Y3 H
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");1 y' [5 t" h) z+ f7 {1 l; l

  788. 6 R. P9 I3 z7 p! G
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 v" ~) V4 Y6 o1 X2 G7 k- S3 p
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    ) G6 K+ V; ~. v8 E5 i; b; {
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1), p' @& k! R* i2 H. D
  792.                 {
    ) p4 ~! r9 X: b# J( G& l. H
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");' m  g7 R5 L, P( [
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");! D: |& y0 k7 l- u
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");6 ^. _  U5 M8 e1 p
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 k9 ^1 e3 w; n( N% k6 U: b
  797. 2 g, X% x3 p! ]7 a6 c' H
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    7 y' R( q5 i5 y9 v' T
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    6 S8 \) M2 Y! l' N0 U) f% q
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");% @. j" H5 ~1 \" b; T
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);) |5 j& R; ~0 j. i$ J* K
  802.                 }' R5 {2 d% f1 f3 n( ?6 P
  803.                 dwStartUpSteps=5;1 b. S! z5 u4 m* a
  804.               }
    ; c: W9 K7 {& t2 Y7 [' a
  805.             }* e$ \& N2 j% w7 Z) w
  806.             else
    7 s/ S8 x" r4 j3 F4 X9 P' H
  807.             {# G1 U# W; g' x! H
  808.               unlink(".\\DownLoad\\checkversion.txt");
    ; J- z  }$ N) N: h2 C* C0 I7 L5 b& u
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");9 |8 N8 ~% o/ P, X% J  m
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");2 o. L2 O0 D' N1 Q* ]
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");- B  N: D$ z8 Q, z
  812. + g0 x$ I. ]( L8 G; R9 j
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . A. [7 G5 X. O; |6 o
  814.               dwStartUpSteps=99;+ l  _# j- ]' I$ R
  815.               bFinishUpdated=TRUE;
    ! g4 T$ M$ t5 a6 x# L
  816.               bCanUpdate=TRUE;
    $ \* V0 f) S* D! k
  817.             }" n  B) J1 |1 d6 T" Y* D
  818.           }
    - t5 _) P8 b* J; I, `
  819.           else
    1 j. p9 \$ ?# d" T6 l+ t8 Y6 v
  820.           {
    9 w4 \# r. t, C6 s$ v
  821.             if(!Dn.Connected())! n+ A0 {  U# Z' l1 Q0 o
  822.             {0 c( `3 O4 T( D5 J
  823.               bFirstUpdate=TRUE;! s$ V1 T0 K, R9 o% A( j, M
  824.               dwTotalFiles=1;
    " {  O# c+ ^( H  x6 c( {( g
  825.               dwDownLoaded=0;
      w& V( u/ t9 ^/ Y& L
  826.               bSilentStep=FALSE;, y" o& m4 A" ]) Z# `% o' @
  827.               bCompressed=TRUE;3 j2 U3 I6 M: ^; `2 Z
  828.               strExtLocal=".\\DownLoad\";
    & L" `8 v2 U9 S' O# |& u
  829.               strFullName="update.txt";
    # h$ [' Z: i7 N2 w
  830.               dwProgramState=AP_CONNECT;& e  ^0 O, m% L# g4 D
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");  ^1 Y7 `. _1 z3 ?$ o+ u
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");5 H* {5 w/ P% u& u, Q( Q
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    + K, ~+ D4 x( [4 Y0 _
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    - ?3 q7 U7 t! n0 J1 F2 |2 b
  835.               unlink(".\\DownLoad\\checkversion.txt");; w- ?7 [' q' r. F
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)8 h5 W: k, k9 o- G/ ?
  837.               {+ T' q0 O  Z3 h+ J" H
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    & P2 l7 o3 ?+ k" I- \- R
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    * r6 r! d  Z6 J* G. O
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");) O/ f/ {  D/ ~5 o
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);/ I, z" P! G' O
  842.                 ! b. h% D0 n5 d1 B7 J
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");6 q4 N: b0 L7 x. ]8 E6 A/ p7 e
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");) W% c: K3 L7 Q
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");3 e* H2 w+ i' g! N; K8 m/ c
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    7 S. V1 K3 x6 v7 O; N  B5 N: i
  847.               }
    $ }9 S5 k# i' p" H& |7 e: K7 P1 |
  848.               dwStartUpSteps=5;
    2 A! x, Y; i  ]$ n: @9 O0 p$ b
  849.             }+ l+ x' ~1 T! E8 F
  850.           }, o  }( j- v# N# p, ?2 p6 I2 z
  851.         }2 y4 q& R; o5 V
  852.         else" k0 L5 y$ [$ u5 s- A) f* g$ I
  853.         {
    0 Q4 K7 P9 e/ J) @; z  c6 N
  854.           dwStartUpSteps=3;
    * {& }- T5 D6 G+ T5 B' v( w) ^* t
  855.         }/ T$ Z, c  t1 ]+ ]' S
  856.       }
    # T9 x7 ]* w# F9 x* Y5 u
  857.       break;
    7 M; T- q$ ?: B( ]  Z
  858.     case 5:  A% M( |/ e. {+ k. q- v
  859.       {
    $ s7 q) J9 Z7 n8 @3 K0 S+ `2 R3 B1 G
  860.         if(GetFileAttributes("Wsa.zip" )!=-1): \, }/ F! i  Q  Q! I+ g: j, [, G
  861.         {
    ; g0 I: b1 K4 S, v0 P2 f8 X8 m. V
  862.           int opt_overwrite=1;/ ^$ J* a, |- I4 G) Z* }9 t
  863.           int opt_do_extract_withoutpath=0;& I& h2 ^. W5 P$ Y" j8 K* Q
  864.           unzFile uf=NULL;3 O2 X7 L$ c% j% F  U8 R& T9 ?
  865. ; O$ m, r4 t7 U( {! ?; Z8 @
  866.           uf=unzOpen("Wsa.zip");6 {! d+ l! H, X/ i, Y
  867.           if(uf)
    * K" j. i, E- r- E" Y2 j  G
  868.           {6 K: P% A3 y, u6 M$ K
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);( r% k; A# Z, Y2 H+ E6 P
  870.             unzClose(uf);
    : B, D9 `5 t7 K0 Z7 d  |
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    ' k  D2 n# ^( @
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");
    8 x5 c: V& n4 v+ O5 _# O1 {
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");. r" G6 l3 c, y8 u8 S$ s: B8 w
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ! m% r- n% [" N/ u1 n
  875.           }( W* r5 l- {' y/ g5 t' d
  876.           DeleteFile("Wsa.zip" );
    9 b* h; L! A/ }0 w4 K* ~
  877.         }
    . C# d! D7 F  |& a* ^

  878. 3 `: }  n4 B3 b) N" |1 Q2 h1 D
  879.         if(CheckLocalVersion())
    " K" o5 C. ^+ R# p3 a! K6 @$ ~* z1 r
  880.         {( h# D8 [& s( }! K9 g4 }
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");% s7 x8 _+ u7 E6 Q  t4 B, M9 B1 A, r
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");0 E$ [4 }7 c  L% g2 f8 l0 R
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");! @/ w" ~: S8 h# u
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    8 E" n5 Q' T3 G8 ~
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);. Y! \. _1 l) P- B* J
  886.           dwStartUpSteps=99;
    0 g" C% p7 G" p# C- m" H- u+ ^
  887.         }% }. z8 v& \. l, D3 I: \7 B3 b
  888.         else
    0 ~% d/ }: I6 B$ s2 F
  889.         {) p$ c, T& Q0 W0 Z0 A
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    # _0 o3 t8 S- F8 H
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    $ u+ x: B0 y8 U% j
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");
    % a; Y1 y5 X: y$ q" P1 j/ J

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

7 J4 D& f# \! E$ }  A
/ A0 {9 N8 K+ Q5 w9 p

評分

參與人數 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-3-10 02:58

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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