procedure NightBuildCheckButtonClick(Sender: TObject);
private
{ Private \90é\8c¾ }
+ FExecPath : string;
+ FExecArgs : string;
+ FAllowshutdown : Boolean;
function GetDesktopDir:string;
function GetDownloadFilePath(FileName: String): String;
function CreateShortCut(FileName, Argment, SavePath :string):boolean;
procedure DonwloadUpdate(url: String);
- procedure CheckUpdate(nightbuild :Boolean);
+ function CheckUpdate(nightbuild :Boolean): Boolean;
public
{ Public \90é\8c¾ }
+ property ExecPath :String read FExecPath;
+ property ExecArgs :String read FExecArgs;
+ property Allowshutdown :Boolean read FAllowshutdown;
end;
var
ActiveX, ComObj, ShlObj, GikoUtil;
{$R *.dfm}
-
+//! \90³\8bK\94Å
procedure TUpdateCheckForm.UpdateButtonClick(Sender: TObject);
begin
- CheckUpdate(false);
+ if CheckUpdate(false) then begin
+ if GikoUtil.MsgBox(Handle, '\8dX\90V\82ª\82 \82é\82½\82ß\83M\83R\83i\83r\82ð\8dÄ\8bN\93®\82µ\82Ü\82·\82©\81H', '\8fI\97¹\8am\94F',
+ MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = ID_YES then begin
+ FAllowshutdown := True;
+ close;
+ end;
+ end;
+end;
+//! \90l\92\8c\94Å
+procedure TUpdateCheckForm.NightBuildCheckButtonClick(Sender: TObject);
+begin
+ if GikoUtil.MsgBox(Handle, '\90³\8e®\83\8a\83\8a\81[\83X\94Å\82Å\82Í\82 \82è\82Ü\82¹\82ñ\82ª\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', '\8dX\90V\8am\94F',
+ MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = ID_YES then begin
+ if CheckUpdate(true) then begin
+ if GikoUtil.MsgBox(Handle, '\8dX\90V\82ª\82 \82é\82½\82ß\83M\83R\83i\83r\82ð\8dÄ\8bN\93®\82µ\82Ü\82·\82©\81H', '\8fI\97¹\8am\94F',
+ MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = ID_YES then begin
+ FAllowshutdown := True;
+ close;
+ end;
+ end;
+ end;
end;
+
//! \83A\83b\83v\83f\81[\83g\91Î\8fÛ\8am\94F
-procedure TUpdateCheckForm.CheckUpdate(nightbuild :Boolean);
+function TUpdateCheckForm.CheckUpdate(nightbuild :Boolean): Boolean;
const
+{$IFDEF DEBUG}
+ CHECK_URL = 'http://gikonavi.sourceforge.jp/updater/debug.txt';
+{$ELSE}
CHECK_URL = 'http://gikonavi.sourceforge.jp/updater/latest.txt';
+{$ENDIF}
var
- value : string;
+ value, url : string;
ResStream: TMemoryStream;
downResult, current, newest: TStringList;
newgiko: Boolean;
begin
+ Result := false;
+ FExecPath := '';
+ FExecArgs := '';
+ FAllowshutdown := False;
ResultMemo.Lines.Clear;
Screen.Cursor := crHourGlass;
UpdateButton.Enabled := False;
newgiko := false;
// night build\82Í\81A\83r\83\8b\83h\94Ô\8d\86\82¾\82¯\82Å\94»\92è\82·\82é
if (nightbuild) then begin
+ url := downResult.Values[ 'n_url' ];
newgiko := StrToInt(current[3]) < StrToInt(newest[3]);
end else begin
+ url := downResult.Values[ 'url' ];
newgiko := ( StrToInt(current[1]) < StrToInt(newest[1]) ) or
( (StrToInt(current[1]) = StrToInt(newest[1]))) and
((StrToInt(current[2]) < StrToInt(newest[2])) );
if (newgiko) then begin
if GikoUtil.MsgBox(Handle, '\90V\82µ\82¢\83M\83R\83i\83r\82ª\82 \82è\82Ü\82·\81B\83_\83E\83\93\83\8d\81[\83h\82µ\82Ü\82·\82©\81H', '\8dX\90V\8am\94F',
MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = ID_YES then begin
-
- ResultMemo.Lines.Add('\90V\82µ\82¢\83M\83R\83i\83r\82ª\82 \82è\82Ü\82·\81B\83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·\81B' + downResult.Values[ 'url' ]);
- DonwloadUpdate(Trim(downResult.Values[ 'url' ]));
+ ResultMemo.Lines.Add('\90V\82µ\82¢\83M\83R\83i\83r\82ª\82 \82è\82Ü\82·\81B\83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·\81B' + url);
+ DonwloadUpdate(Trim(url));
+ Result := True;
end;
end else begin
ResultMemo.Lines.Add('\8d¡\82Ì\83M\83R\83i\83r\82ª\8dÅ\90V\82Å\82·\81B');
IdHTTP.Get(url, fileStrem);
ResultMemo.Lines.Add(
IdHttp.ResponseText + '(' + IntToStr(IdHttp.ResponseCode) + ')');
+ FExecPath := filename;
+ FExecArgs := '/SP- /silent /noicons "/dir=' + GikoSys.GetAppDir + '"';
if CreateShortCut(
- filename,
- '/SP- /silent /noicons "/dir=' + GikoSys.GetAppDir + '"'
- , GetDesktopDir) then begin
+ execPath, execArgs, GetDesktopDir) then begin
ResultMemo.Lines.Add('\83f\83X\83N\83g\83b\83v\82É"\83M\83R\83i\83r\8dX\90V"\83V\83\87\81[\83g\83J\83b\83g\82ð\8dì\90¬\82µ\82Ü\82µ\82½\81B');
- ResultMemo.Lines.Add('\83M\83R\83i\83r\82ð\8fI\97¹\82µ\82Ä\81A"\83M\83R\83i\83r\8dX\90V"\83V\83\87\81[\83g\83J\83b\83g\82ð\83_\83u\83\8b\83N\83\8a\83b\83N\82µ\82Ä\82\82¾\82³\82¢\81B');
+ // ResultMemo.Lines.Add('\83M\83R\83i\83r\82ð\8fI\97¹\82µ\82Ä\81A"\83M\83R\83i\83r\8dX\90V"\83V\83\87\81[\83g\83J\83b\83g\82ð\83_\83u\83\8b\83N\83\8a\83b\83N\82µ\82Ä\82\82¾\82³\82¢\81B');
end else begin
ResultMemo.Lines.Add('\83f\83X\83N\83g\83b\83v\82É\83V\83\87\81[\83g\83J\83b\83g\82ð\8dì\90¬\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
end;
procedure TUpdateCheckForm.FormCreate(Sender: TObject);
begin
ResultMemo.Lines.Clear;
-end;
-
-procedure TUpdateCheckForm.NightBuildCheckButtonClick(Sender: TObject);
-begin
- if GikoUtil.MsgBox(Handle, '\90³\8e®\83\8a\83\8a\81[\83X\94Å\82Å\82Í\82 \82è\82Ü\82¹\82ñ\82ª\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', '\8dX\90V\8am\94F',
- MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) = ID_YES then begin
- CheckUpdate(true);
- end;
+ FExecPath := '';
+ FExecArgs := '';
+ FAllowshutdown := False;
end;
end.