- Update moved to NSIS Update
- New icon, different from NSIS Menu's git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2198 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2724ff44d3
commit
292f17eb48
6 changed files with 1 additions and 126 deletions
|
@ -27,7 +27,6 @@
|
|||
NSCRIPTDATA g_sdata;
|
||||
NRESIZEDATA g_resize;
|
||||
NFINDREPLACE g_find;
|
||||
static JNL_AsyncDNS *g_dns = NULL;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmdShow) {
|
||||
MSG msg;
|
||||
|
@ -39,7 +38,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
g_sdata.hInstance=GetModuleHandle(0);
|
||||
g_sdata.script_alloced=false;
|
||||
g_sdata.script=GetCommandLine();
|
||||
JNL::open_socketlib();
|
||||
if (*g_sdata.script=='"') { g_sdata.script++; while (*g_sdata.script && *g_sdata.script++!='"' ); }
|
||||
else while (*g_sdata.script!=' ' && *g_sdata.script) g_sdata.script++;
|
||||
while (*g_sdata.script==' ') g_sdata.script++;
|
||||
|
@ -65,7 +63,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char *cmdParam, int cmd
|
|||
}
|
||||
}
|
||||
}
|
||||
JNL::close_socketlib();
|
||||
if (g_sdata.script_alloced) GlobalFree(g_sdata.script);
|
||||
ExitProcess(msg.wParam);
|
||||
return msg.wParam;
|
||||
|
@ -237,13 +234,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
case IDM_UPDATE:
|
||||
{
|
||||
DWORD dwThreadId;
|
||||
EnableMenuItem(g_sdata.menu,IDM_UPDATE,MF_GRAYED);
|
||||
CloseHandle(CreateThread(NULL,0,UpdateThread,(LPVOID)NULL,0,&dwThreadId));
|
||||
break;
|
||||
}
|
||||
case IDM_ABOUT:
|
||||
{
|
||||
DialogBox(g_sdata.hInstance,MAKEINTRESOURCE(DLG_ABOUT),g_sdata.hwnd,(DLGPROC)AboutProc);
|
||||
|
@ -544,89 +534,4 @@ BOOL CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD CALLBACK UpdateThread(LPVOID v) {
|
||||
#define RSZ 30
|
||||
int len;
|
||||
char *response = (char *)GlobalAlloc(GPTR,RSZ);
|
||||
char *r;
|
||||
char url[300];
|
||||
BOOL error = FALSE;
|
||||
static char pbuf[8192];
|
||||
char *p=NULL;
|
||||
*response = 0;
|
||||
if (getProxyInfo(pbuf))
|
||||
{
|
||||
p=my_strstr(pbuf,"http=");
|
||||
if (!p) p=pbuf;
|
||||
else {
|
||||
p+=5;
|
||||
}
|
||||
char *tp=my_strstr(p,";");
|
||||
if (tp) *tp=0;
|
||||
char *p2=my_strstr(p,"=");
|
||||
if (p2) p=0; // we found the wrong proxy
|
||||
}
|
||||
if (!g_dns) {
|
||||
g_dns = new JNL_AsyncDNS();
|
||||
}
|
||||
JNL_HTTPGet *get = new JNL_HTTPGet(g_dns,8192,(p&&p[0])?p:NULL);;
|
||||
lstrcpy(url,NSIS_UPDATE);
|
||||
lstrcat(url,g_sdata.brandingv);
|
||||
p=my_strstr(url," (CVS)");
|
||||
if (p) {
|
||||
*p=0;
|
||||
lstrcat(url,"&cvs=1");
|
||||
}
|
||||
lstrcpy(response,"");
|
||||
get->addheader("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)");
|
||||
get->addheader("Accept:*/*");
|
||||
get->connect(url);
|
||||
while (1) {
|
||||
int st=get->run();
|
||||
if (st<0) { error = TRUE; break; }//error
|
||||
if (get->get_status()==2) {
|
||||
while(len=get->bytes_available()) {
|
||||
char b[RSZ];
|
||||
if (len>RSZ) len=RSZ;
|
||||
if (lstrlen(response)+len>RSZ) break;
|
||||
len=get->get_bytes(b,len);
|
||||
b[len]=0;
|
||||
lstrcat(response,b);
|
||||
}
|
||||
}
|
||||
if (st==1) break; //closed
|
||||
}
|
||||
r = response;
|
||||
while (r&&*r) {
|
||||
if (*r=='\n') { *r = 0; break; }
|
||||
r++;
|
||||
}
|
||||
if (error) {
|
||||
char buf[1000];
|
||||
wsprintf(buf,"There was a problem checking for an update. Please try again later.\n\nError: %s",get->geterrorstr());
|
||||
MessageBox(g_sdata.hwnd,buf,"NSIS Update",MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
else if (*response=='1'&&lstrlen(response)>2) {
|
||||
char buf[200];
|
||||
response+=2;
|
||||
wsprintf(buf,"NSIS %s is now available. Would you like to download it now?",response);
|
||||
if (MessageBox(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
||||
ShellExecute(g_sdata.hwnd,"open",NSIS_URL,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
else if (*response=='2'&&lstrlen(response)>2) {
|
||||
char buf[200];
|
||||
response+=2;
|
||||
wsprintf(buf,"NSIS %s is now available. Would you like to download this preview release now?",response);
|
||||
if (MessageBox(g_sdata.hwnd,buf,"NSIS Update",MB_YESNO|MB_ICONINFORMATION)==IDYES) {
|
||||
ShellExecute(g_sdata.hwnd,"open",NSIS_DDL,NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
else MessageBox(g_sdata.hwnd,"There is no update available for NSIS at this time.","NSIS Update",MB_OK|MB_ICONINFORMATION);
|
||||
GlobalFree(response);
|
||||
delete get;
|
||||
EnableMenuItem(g_sdata.menu,IDM_UPDATE,MF_ENABLED);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue