X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=ItemDownload.pas;h=fe0fb18e75e307325ffd472990615748de2c573f;hb=21fef4e58359ae52b77a404272173b7b9bb012b5;hp=6fc21809a8c750145835a9bf3f1d0361ace4473b;hpb=3ea74337d5d0d9aec75292ab1dcf89b496f47cc6;p=gikonavigoeson%2Fgikonavi.git diff --git a/ItemDownload.pas b/ItemDownload.pas index 6fc2180..fe0fb18 100644 --- a/ItemDownload.pas +++ b/ItemDownload.pas @@ -156,9 +156,7 @@ var Idx: Integer; ATitle: string; DownloadResult: Boolean; - foundPos: Integer; boardPlugIn : TBoardPlugIn; - listContent : string; lastContent : string; logFile : TFileStream; adjustMargin : Integer; @@ -993,10 +991,13 @@ begin Board.LastModified := LastModified; //dat—Ž‚¿ƒXƒŒ‚̃\[ƒg‡‚ðŒˆ’è‚·‚邽‚߂Ƀ\[ƒg‚·‚é - Sort.SortOrder := False; //~‡ - Sort.SortIndex := 7; //ƒXƒŒì¬“úŽž - Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount; - Board.CustomSort(ThreadItemSortProc); + if GikoSys.Setting.DatOchiSortIndex >= 0 then begin + Sort.SortNoFlag := true; + Sort.SortOrder := GikoSys.Setting.DatOchiSortOrder; + Sort.SortIndex := GikoSys.Setting.DatOchiSortIndex; + //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount; + Board.CustomSort(ThreadItemSortProc); + end; for i := Board.Count - 1 downto 0 do Board.Items[i].AgeSage := gasNull; @@ -1174,7 +1175,7 @@ end; } procedure TDownloadItem.SaveItemFile; var - Body: TStringList; + Body, oldBody: TStringList; Cnt: Integer; OldCnt: Integer; FileName: string; @@ -1183,11 +1184,11 @@ var NewRes: Integer; finish : Boolean; loopCnt : Integer; - KokoTxt : string; - KokoIdx : Integer; - NewTxt : string; - NewIdx : Integer; - LastTxt : string; +// KokoTxt : string; +// KokoIdx : Integer; +// NewTxt : string; +// NewIdx : Integer; +// LastTxt : string; LastIdx : Integer; begin FileName := ThreadItem.GetThreadFileName; @@ -1205,10 +1206,6 @@ begin try // if FileExists(FileName) and (ResponseCode = 206) then begin if FileExists(FileName) and (State = gdsDiffComplete) then begin - // Body.Text := Content; - // if Body.Count > 0 then - // Body.Delete(0); - // Content := Body.Text; loopCnt := 10; repeat finish := true; @@ -1221,61 +1218,58 @@ begin except on E:EFOpenError do begin sleep(10); - finish := false; Dec(loopCnt); + if loopCnt > 0 then + finish := false; end; end; - until finish and ( loopCnt > 0 ); + until finish; //Cnt := Body.Count; end else begin if IsAbone then begin // ‚ ‚ځ[‚ñ‚ðŒŸo‚µ‚½‚Ì‚Å‚±‚±‚Ü‚Å“Ç‚ñ‚¾‚ƐV’…ƒŒƒX”Ԃ̂‚¯‚È‚¨‚µ - loopCnt := 10; - repeat - finish := true; - try - Body.LoadFromFile(FileName); - except - on E:EFOpenError do begin - sleep(10); - finish := false; - Dec(loopCnt); + oldBody := TStringList.Create; + try + loopCnt := 10; + repeat + finish := true; + try + oldBody.LoadFromFile(FileName); + except + on E:EFOpenError do begin + sleep(10); + Dec(loopCnt); + if loopCnt > 0 then + finish := false + else + finish := true; + end; end; + until finish; + + Body.Text := Content; + if (ThreadItem.Kokomade > 0) and (ThreadItem.Kokomade <= oldBody.Count) then begin + ThreadItem.Kokomade := Body.IndexOf(oldBody.Strings[ ThreadItem.Kokomade - 1 ]); + if ThreadItem.Kokomade <> -1 then ThreadItem.Kokomade := ThreadItem.Kokomade + 1; end; - until finish and ( loopCnt > 0 ); - LastTxt := Body.Strings[ ThreadItem.Count - 1 ]; - if ThreadItem.Kokomade > 0 then begin - KokoTxt := Body.Strings[ ThreadItem.Kokomade - 1 ]; - end; - if ThreadItem.NewReceive > 0 then begin - NewTxt := Body.Strings[ ThreadItem.NewReceive - 1 ]; - end; - Body.Text := Content; - ThreadItem.AllResCount := 0; - ThreadItem.NewResCount := 0; - NewRes := Body.Count; + LastIdx := oldBody.Count; + repeat + Dec(LastIdx); + OldCnt := Body.IndexOf(oldBody.Strings[ LastIdx ]) + 1; + until ( OldCnt <> 0 ) or (LastIdx = 0); - Body.Find( LastTxt, LastIdx ); - OldCnt := LastIdx + 1; - if ThreadItem.Kokomade > 0 then begin - Body.Find( KokoTxt, KokoIdx ); - ThreadItem.Kokomade := KokoIdx + 1; - end; - if ThreadItem.NewReceive > 0 then begin - Body.Find( NewTxt, NewIdx ); - Inc( NewIdx ); - ThreadItem.AllResCount := NewIdx; - if OldCnt >= NewIdx then - NewRes := Body.Count - OldCnt - else - NewRes := Body.Count - NewIdx; + if OldCnt >= Body.Count then OldCnt := Body.Count - 1; + NewRes := Body.Count - OldCnt; + + + finally + oldBody.Free; end; + end else begin Body.Text := Content; //ThreadItem.Count := 0; - ThreadItem.AllResCount := 0; - ThreadItem.NewResCount := 0; OldCnt := 0; NewRes := Body.Count; //Cnt := Body.Count; @@ -1305,8 +1299,10 @@ begin ThreadItem.AllResCount := ThreadItem.Count; ThreadItem.IsLogFile := True; ThreadItem.RoundDate := Now; - ThreadItem.UnRead := True; - ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1; + if not ThreadItem.UnRead then begin + ThreadItem.UnRead := True; + ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1; + end; // if ThreadItem.RoundNo = 6 then // ThreadItem.RoundNo := 0;