uses
Windows, SysUtils, Classes, ComCtrls, Controls, Forms, IdHTTP,
{HTTPApp,} YofUtils, IdGlobal, IdException, IdComponent, IniFiles, {DateUtils,}
- GikoSystem, BoardGroup, MonaUtils, ExternalBoardManager, ExternalBoardPlugInMain;
+ GikoSystem, BoardGroup, MonaUtils, ExternalBoardManager, ExternalBoardPlugInMain,
+ Sort;
type
TDownloadItem = class;
Idx: Integer;
ATitle: string;
DownloadResult: Boolean;
- foundPos: Integer;
boardPlugIn : TBoardPlugIn;
- listContent : string;
lastContent : string;
logFile : TFileStream;
adjustMargin : Integer;
Board.RoundDate := Now;
//\83T\81[\83o\8fã\83t\83@\83C\83\8b\82Ì\8dX\90V\8e\9e\8d\8f\90Ý\92è
Board.LastModified := LastModified;
+
+ //dat\97\8e\82¿\83X\83\8c\82Ì\83\\81[\83g\8f\87\82ð\8c\88\92è\82·\82é\82½\82ß\82É\83\\81[\83g\82·\82é
+ 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;
}
procedure TDownloadItem.SaveItemFile;
var
- Body: TStringList;
+ Body, oldBody: TStringList;
Cnt: Integer;
OldCnt: Integer;
FileName: string;
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;
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;
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
// \82 \82Ú\81[\82ñ\82ð\8c\9f\8fo\82µ\82½\82Ì\82Å\82±\82±\82Ü\82Å\93Ç\82ñ\82¾\82Æ\90V\92\85\83\8c\83X\94Ô\82Ì\82Â\82¯\82È\82¨\82µ
- 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;
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;