OSDN Git Service

更新チェックで、ギコナビ終了→インストーラ実行まで行うように修正
authorh677 <h677>
Sat, 13 Dec 2008 03:58:29 +0000 (03:58 +0000)
committerh677 <h677>
Sat, 13 Dec 2008 03:58:29 +0000 (03:58 +0000)
Giko.pas
GikoDataModule.pas
UpdateCheck.pas
gikoNavi.res

index 901e585..374fdf2 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -609,6 +609,8 @@ type
                FPreviewBrowserRect: TRect;                     ///< \83v\83\8c\83r\83\85\81[\82Ì\95\\8e¦\88Ê\92u\82ð\8bL\89¯\82·\82é
                FActionListGroupIndexes: array of Integer;      ///<GikoDM\8fã\82Ì\83A\83N\83V\83\87\83\93\83\8a\83X\83g\82Ì\8ae\83A\83N\83V\83\87\83\93\82É\90Ý\92è\82³\82ê\82½GroupIndex\82ð\95Û\91\82·\82é\94z\97ñ
         FResPopupBrowser: TResPopupBrowser;
+        FUpdateExePath: string;    ///\83M\83R\83i\83r\8dX\90V\83C\83\93\83X\83g\81[\83\89\83p\83X
+        FUpdateExeArgs: string;    ///\83M\83R\83i\83r\8dX\90V\83C\83\93\83X\83g\81[\83\89\88ø\90\94
                procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
                procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
                procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
@@ -736,6 +738,9 @@ type
                property ScreenCursor : TCursor read GetScreenCursor write SetScreenCursor;
                property ActiveBBS : TBBS read FActiveBBS write FActiveBBS;
                property WorkCount: Integer read FWorkCount write FWorkCount;
+        property UpdateExePath: string read FUpdateExePath write FUpdateExePath;
+        property UpdateExeArgs: string read FUpdateExeArgs write FUpdateExeArgs;
+        
                procedure SetContent(inThread: TBrowserRecord);
                function GetActiveContent(popup :Boolean = false): TThreadItem;
                function GetActiveList: TObject;
@@ -929,6 +934,8 @@ begin
     FResPopupBrowser := nil;
        CreateBrowsers(BROWSER_COUNT);
     FIconData.uID := 0;
+    FUpdateExePath := '';
+    FUpdateExeArgs := '';
 
        //\83\81\83j\83\85\81[\83t\83H\83\93\83g
        SetMenuFont;
@@ -1798,6 +1805,12 @@ begin
                end;
        except
        end;
+
+    // Update\82ª\82¢\82ê\82Î\8eÀ\8ds\82·\82é
+    if FileExists(FUpdateExePath) then begin
+        // \83A\83b\83v\83f\81[\83g\8eÀ\8ds
+        GikoSys.CreateProcess(FUpdateExePath, FUpdateExeArgs);
+    end;
 end;
 
 // \8ae\8f\8a\82É\82 \82é\83L\83\83\83r\83l\83b\83g\81E BBS \83\81\83j\83\85\81[\82ð\83Z\83b\83g\81^\8dX\90V
index eb3c64e..66c5223 100644 (file)
@@ -4569,18 +4569,29 @@ procedure TGikoDM.UpdateGikonaviActionExecute(Sender: TObject);
 var
     form : TUpdateCheckForm;
        Msg: string;
+    shutdown: boolean;
 begin
        if (EditorFormExists) then begin
                Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
                MsgBox(GikoForm.Handle, Msg, MSG_ERROR, MB_OK or MB_ICONSTOP);
                Exit;
        end;
+    GikoForm.UpdateExePath := '';
+    GikoForm.UpdateExeArgs := '';
     form := TUpdateCheckForm.Create(Self);
     try
         form.ShowModal;
+        shutdown := form.Allowshutdown;
+        GikoForm.UpdateExePath := form.ExecPath;
+        GikoForm.UpdateExeArgs := form.ExecArgs;
     finally
         form.Release;
     end;
+    if shutdown then begin
+        // \83M\83R\83i\83r\8fI\97¹
+        GikoForm.Close;
+    end;
+
 end;
 
 end.
index fe0fa4d..6385a01 100644 (file)
@@ -21,13 +21,19 @@ type
     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
@@ -39,21 +45,50 @@ uses
     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;
        ResStream: TMemoryStream;
     downResult, current, newest: TStringList;
     newgiko: Boolean;
 begin
+    Result := false;
+    FExecPath := '';
+    FExecArgs := '';
+    FAllowshutdown := False;
     ResultMemo.Lines.Clear;
     Screen.Cursor := crHourGlass;
     UpdateButton.Enabled := False;
@@ -106,6 +141,7 @@ 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' ]));
+                                Result := True;
                             end;
                         end else begin
                             ResultMemo.Lines.Add('\8d¡\82Ì\83M\83R\83i\83r\82ª\8dÅ\90V\82Å\82·\81B');
@@ -150,12 +186,12 @@ begin
         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;
@@ -227,14 +263,9 @@ 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.
index 4f53f43..184ebd8 100644 (file)
Binary files a/gikoNavi.res and b/gikoNavi.res differ