- 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:
kichik 2003-02-20 19:30:49 +00:00
parent 2724ff44d3
commit 292f17eb48
6 changed files with 1 additions and 126 deletions

View file

@ -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;
}

View file

@ -24,9 +24,6 @@
#include <commctrl.h>
#include "utils.h"
#include "jnetlib/util.h"
#include "jnetlib/netinc.h"
#include "jnetlib/httpget.h"
#define _RICHEDIT_VER 0x0200
#include <richedit.h>
#undef _RICHEDIT_VER
@ -34,8 +31,6 @@
// Defines
#define NSIS_DEV "http://nsis.sourceforge.net/"
#define NSIS_URL "http://www.nullsoft.com/free/nsis/"
#define NSIS_UPDATE "http://nsis.sourceforge.net/update.php?version="
#define NSIS_DDL "http://sourceforge.net/project/showfiles.php?group_id=22049"
#define NSIS_FOR "http://forums.winamp.com/forumdisplay.php?forumid=65"
#define USAGE "Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSI\""
#define COPYRIGHT "Copyright © 2002 Robert Rainwater"
@ -75,7 +70,6 @@ BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);
BOOL CALLBACK AboutNSISProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void CompileNSISScript();
DWORD CALLBACK UpdateThread(LPVOID v);
typedef struct NSISScriptData {
bool script_alloced;

View file

@ -35,7 +35,6 @@
#define IDM_CLEARLOG 40009
#define IDM_BROWSESCR 40013
#define IDM_NSISDEV 40014
#define IDM_UPDATE 40015
#define IDM_FORUM 40016
// Next default values for new objects

View file

@ -54,7 +54,7 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON DISCARDABLE "..\\..\\contrib\\icons\\modern-install.ico"
IDI_ICON ICON DISCARDABLE "..\\..\\contrib\\icons\\adni18-installer-B.ico"
IDI_SHELL ICON DISCARDABLE "shell.ico"
/////////////////////////////////////////////////////////////////////////////
@ -87,8 +87,6 @@ BEGIN
MENUITEM "Edit Script\tCtrl+E", IDM_EDITSCRIPT
MENUITEM "Browse Script\tCtrl+B", IDM_BROWSESCR
MENUITEM "Clear &Log Window\tCtrl+W", IDM_CLEARLOG
MENUITEM SEPARATOR
MENUITEM "Check for &Update", IDM_UPDATE
END
POPUP "&Help"
BEGIN

View file

@ -283,24 +283,4 @@ void ShowDocs() {
lstrcat(pathf,LOCALDOCS);
if ((int)ShellExecute(g_sdata.hwnd,"open",pathf,NULL,NULL,SW_SHOWNORMAL)<=32)
ShellExecute(g_sdata.hwnd,"open",DOCPATH,NULL,NULL,SW_SHOWNORMAL);
}
int getProxyInfo(char *out) {
DWORD v=0;
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",0,KEY_READ,&hKey) == ERROR_SUCCESS) {
DWORD l = 4;
DWORD t;
if (RegQueryValueEx(hKey,"ProxyEnable",NULL,&t,(unsigned char *)&v,&l) == ERROR_SUCCESS && t == REG_DWORD) {
l=8192;
if (RegQueryValueEx(hKey,"ProxyServer",NULL,&t,(unsigned char *)out,&l ) != ERROR_SUCCESS || t != REG_SZ) {
v=0;
*out=0;
}
}
else v=0;
out[8192-1]=0;
RegCloseKey(hKey);
}
return v;
}

View file

@ -38,6 +38,5 @@ void InitTooltips(HWND h);
void DestroyTooltips();
void AddTip(HWND hWnd,LPSTR lpszToolTip);
void ShowDocs();
int getProxyInfo(char *out);
#endif