Changeset 37972

Show
Ignore:
Timestamp:
07/19/10 20:56:32 (3 years ago)
Author:
saturday06
Message:

mingw demo ugoku ZE

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/c/AutoUpdater/trunk/Test.cpp

    r37971 r37972  
    1010#include <aclapi.h> 
    1111#include <accctrl.h> 
    12  
    1312#include <stdio.h> 
    1413#include <wchar.h> 
    15  
    1614 
    1715#ifdef __CYGWIN__ 
     
    2725#endif 
    2826 
     27int main(int argc, char** argv) { 
     28    AU_Context context; 
     29 
     30    if (argc > 1) { 
     31        int i = 0; 
     32        for (i = 0; i < argc; ++i) { 
     33            printf("argv[%d]=%s\n", i, argv[i]); 
     34        } 
     35        system("pause"); 
     36        return 0; 
     37    } 
     38 
     39    do { 
     40        AU_Result result; 
     41        AU_Information information; 
     42        AU_Option option; 
     43                option.url = _T("http://www.lunaport.net/test/updates.xml"); 
     44        result = AU_CreateContext(&context, &option); 
     45        if (result.error) { 
     46            printf("error1: %d\n", result.error); 
     47            break; 
     48        } 
     49 
     50        do { 
     51            result = AU_GetInformation(context, &information); 
     52            printf("AU_GetInformation(): " 
     53                "list_downloaded_bytes=%dbytes, description_downloaded_bytes=%dbytes\n", 
     54                information.list_downloaded_bytes, information.description_downloaded_bytes 
     55                ); 
     56            Sleep(100); 
     57        } while (result.pending); 
     58 
     59        if (result.error) { 
     60            printf("error2: %d\n", result.error); 
     61            break; 
     62        } 
     63 
     64        if (!information.found) { 
     65            printf("not found\n"); 
     66            break; 
     67        } 
     68 
     69        do { 
     70            result = AU_StartUpdate(context); 
     71            Sleep(100); 
     72            AU_GetInformation(context, &information); 
     73            printf("AU_GetInformation(): " 
     74                "update_downloaded_bytes=%dbytes\n", 
     75                information.update_downloaded_bytes 
     76                ); 
     77        } while (result.pending); 
     78 
     79        if (result.error) { 
     80            printf("error3: %d\n", result.error); 
     81            break; 
     82        } 
     83 
     84        printf("update ready\n"); 
     85 
     86    } while (false); 
     87 
     88    AU_DestroyContext(context); 
     89 
     90    return 0; 
     91} 
     92 
     93 
    2994//BOOL CreateSecureDirectory(const TCHAR* lpszFileName) { 
    3095//    PSID pSidOwner = NULL; 
     
    205270} 
    206271*/ 
    207  
    208 int main(int argc, char** argv) { 
    209     AU_Context context; 
    210  
    211     if (argc > 1) { 
    212         int i = 0; 
    213         for (i = 0; i < argc; ++i) { 
    214             printf("argv[%d]=%s\n", i, argv[i]); 
    215         } 
    216         system("pause"); 
    217         return 0; 
    218     } 
    219  
    220     do { 
    221         AU_Result result; 
    222         AU_Information information; 
    223         AU_Option option; 
    224                 option.url = _T("http://www.lunaport.net/test/updates.xml"); 
    225         result = AU_CreateContext(&context, &option); 
    226         if (result.error) { 
    227             printf("error1: %d\n", result.error); 
    228             break; 
    229         } 
    230  
    231         do { 
    232             result = AU_GetInformation(context, &information); 
    233             printf("AU_GetInformation(): " 
    234                 "list_downloaded_bytes=%dbytes, description_downloaded_bytes=%dbytes\n", 
    235                 information.list_downloaded_bytes, information.description_downloaded_bytes 
    236                 ); 
    237             Sleep(100); 
    238         } while (result.pending); 
    239  
    240         if (result.error) { 
    241             printf("error2: %d\n", result.error); 
    242             break; 
    243         } 
    244  
    245         if (!information.found) { 
    246             printf("not found\n"); 
    247             break; 
    248         } 
    249  
    250         do { 
    251             result = AU_StartUpdate(context); 
    252             Sleep(100); 
    253             AU_GetInformation(context, &information); 
    254             printf("AU_GetInformation(): " 
    255                 "update_downloaded_bytes=%dbytes\n", 
    256                 information.update_downloaded_bytes 
    257                 ); 
    258         } while (result.pending); 
    259  
    260         if (result.error) { 
    261             printf("error3: %d\n", result.error); 
    262             break; 
    263         } 
    264  
    265         printf("update ready\n"); 
    266  
    267     } while (false); 
    268  
    269     AU_DestroyContext(context); 
    270  
    271     return 0; 
    272 } 
    273272 
    274273int main2() {