uses
Windows, SysUtils, Classes, ComCtrls, Controls, Forms, IdHTTP,
{HTTPApp,} YofUtils, IdGlobal, IdException, IdComponent, IniFiles, {DateUtils,}
- GikoSystem, BoardGroup, MonaUtils, ExternalBoardManager;
+ GikoSystem, BoardGroup, MonaUtils, ExternalBoardManager, ExternalBoardPlugInMain,
+ Sort;
type
TDownloadItem = class;
TGikoDLProgress = (gdpStd, gdpAll, gdpDatOchi, gdpOfflaw);
TGikoWorkEvent = procedure(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; ID: Integer) of object;
- TGikoWorkBeginEvent = procedure(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; ID: Integer) of object;
+ TGikoWorkBeginEvent = procedure(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; ID: Integer; const AWorkTitle: string) of object;
TGikoWorkEndEvent = procedure(Sender: TObject; AWorkMode: TWorkMode; ID: Integer) of object;
TDownloadEndEvent = procedure(Sender: TObject; Item: TDownloadItem) of object;
TDownloadMsgEvent = procedure(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon) of object;
FOnWorkEnd: TGikoWorkEndEvent;
FOnDownloadEnd: TDownloadEndEvent;
FOnDownloadMsg: TDownloadMsgEvent;
+ FDownloadTitle: string;
procedure FireDownloadEnd;
procedure FireDownloadMsg;
property Item: TDownloadItem read FItem write FItem;
property Number: Integer read FNumber write FNumber;
constructor Create(CreateSuspended: Boolean);
- destructor Destroy; override;
+ destructor Destroy; override;
procedure Abort;
property OnWork: TGikoWorkEvent read FOnWork write FOnWork;
property OnWorkBegin: TGikoWorkBeginEvent read FOnWorkBegin write FOnWorkBegin;
FResponseCode: Smallint;
FState: TGikoDownloadState;
FErrText: string;
+ FForceDownload: Boolean;
+ FIsAbone : Boolean;
public
procedure SaveListFile;
procedure SaveItemFile;
property ResponseCode: Smallint read FResponseCode write FResponseCode;
property State: TGikoDownloadState read FState write FState;
property ErrText: string read FErrText write FErrText;
+ property ForceDownload: Boolean read FForceDownload write FForceDownload;
+ property IsAbone : Boolean read FIsAbone write FIsAbone;
end;
implementation
destructor TDownloadThread.Destroy;
begin
+ FIndy.Request.CustomHeaders.Clear;
+ FIndy.Request.RawHeaders.Clear;
+ FIndy.Request.Clear;
+ FIndy.Response.CustomHeaders.Clear;
+ FIndy.Response.RawHeaders.Clear;
+ FIndy.Response.Clear;
+ FIndy.ProxyParams.Clear;
FIndy.Free;
inherited;
end;
Idx: Integer;
ATitle: string;
DownloadResult: Boolean;
- Abone: Boolean;
- foundPos: Integer;
- boardPlugIn : TBoardPlugIn;
- listContent : string;
+ boardPlugIn : TBoardPlugIn;
+ lastContent : string;
+ logFile : TFileStream;
+ adjustMargin : Integer;
+const
+ ADJUST_MARGIN = 16;
begin
while not Terminated do begin
//===== \83v\83\89\83O\83C\83\93
+ FAbort := False;
boardPlugIn := nil;
ExternalBoardManager.OnWork := Work;
ExternalBoardManager.OnWorkBegin := WorkBegin;
ExternalBoardManager.OnWorkEnd := WorkEnd;
+ FDownloadTitle := '';
case FItem.FDownType of
gdtBoard:
begin
+ FDownloadTitle := FItem.FBoard.Title;
if FItem.FBoard <> nil then begin
if FItem.FBoard.IsBoardPlugInAvailable then begin
boardPlugIn := FItem.FBoard.BoardPlugIn;
end;
gdtThread:
begin
+ FDownloadTitle := FItem.FThreadItem.Title;
if FItem.FThreadItem <> nil then begin
if FItem.FThreadItem.IsBoardPlugInAvailable then begin
boardPlugIn := FItem.FThreadItem.BoardPlugIn;
end;
end;
end;
+ if Length(FDownloadTitle) = 0 then
+ FDownloadTitle := '\81i\96¼\8fÌ\95s\96¾\81j';
if boardPlugIn <> nil then begin
- if FAbort then
+ if FAbort then begin
Item.State := gdsAbort;
+ end;
if Assigned( OnDownloadEnd ) then
Synchronize( FireDownloadEnd );
if Terminated then
{$ENDIF}
end;
+ adjustMargin := 0;
+ if Item.DownType = gdtThread then begin
+ if FileExists( Item.ThreadItem.GetThreadFileName ) then begin
+ // dat \83t\83@\83C\83\8b\82Ì\8dÅ\8cã\82ð\93Ç\82Ý\8fo\82·
+ SetLength( lastContent, ADJUST_MARGIN + 1 );
+ logFile := TFileStream.Create( Item.ThreadItem.GetThreadFileName, fmOpenRead or fmShareDenyWrite );
+ try
+ logFile.Seek( -(ADJUST_MARGIN + 1), soFromEnd );
+ logFile.Read( lastContent[ 1 ], ADJUST_MARGIN + 1 );
+ lastContent := StringReplace( lastContent, #13, '', [] ); // CR \82Ì\8dí\8f\9c
+ finally
+ logFile.Free;
+ end;
+ end else begin
+ lastContent := '';
+ end;
+ adjustMargin := Length( lastContent );
+ end;
+
FIndy.Request.ContentRangeStart := 0;
FIndy.Request.LastModified := ZERO_DATE;
ResStream := TMemoryStream.Create;
Writeln('Modified: ' + FloatToStr(Item.Board.LastModified));
{$ENDIF}
URL := Item.Board.GetReadCgiURL;
- Modified := Item.Board.LastModified;
+ if Item.ForceDownload then begin
+ // \8b\90§\8eæ\93¾
+ ATitle := Item.Board.Title;
+ if ATitle = '' then
+ ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
+ FMsg := '\81\9a\8b\90§\8eæ\93¾\82ð\8ds\82¢\82Ü\82· - [' + ATitle + ']';
+ FIcon := gmiWhat;
+ if Assigned(OnDownloadMsg) then
+ Synchronize(FireDownloadMsg);
+ Modified := ZERO_DATE
+ end else begin
+ Modified := Item.Board.LastModified;
+ end;
end else if Item.DownType = gdtThread then begin
{$IFDEF DEBUG}
Writeln('DAT\8eæ\93¾');
Writeln('Modified: ' + FloatToStr(Item.ThreadItem.LastModified));
{$ENDIF}
URL := Item.ThreadItem.GetDatURL;
- Modified := Item.ThreadItem.LastModified;
- if Item.ThreadItem.Size > 0 then begin
- {$IFDEF DEBUG}
- Writeln('RangeStart: ' + IntToStr(Item.ThreadItem.Size));
- {$ENDIF}
- //\82 \82Ú\81[\82ñ\83`\83F\83b\83N\82Ì\82½\82ß\82P\83o\83C\83g\91O\82©\82ç\8eæ\93¾
- RangeStart := Item.ThreadItem.Size;
- AdjustLen := -1;
+ if Item.ForceDownload then begin
+ // \8b\90§\8eæ\93¾
+ ATitle := Item.ThreadItem.Title;
+ if ATitle = '' then
+ ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
+ FMsg := '\81\9a\8b\90§\8eæ\93¾\82ð\8ds\82¢\82Ü\82· - [' + ATitle + ']';
+ FIcon := gmiWhat;
+ if FileExists(ChangeFileExt(Item.FThreadItem.GetThreadFileName,'.NG')) = true then
+ DeleteFile(ChangeFileExt(Item.FThreadItem.GetThreadFileName,'.NG'));
+ if Assigned(OnDownloadMsg) then
+ Synchronize(FireDownloadMsg);
+ Modified := ZERO_DATE;
+ RangeStart := 0;
+ AdjustLen := 0;
+ end else begin
+ Modified := Item.ThreadItem.LastModified;
+ if Item.ThreadItem.Size > 0 then begin
+ {$IFDEF DEBUG}
+ Writeln('RangeStart: ' + IntToStr(Item.ThreadItem.Size));
+ {$ENDIF}
+ // \82 \82Ú\81[\82ñ\83`\83F\83b\83N\82Ì\82½\82ß adjustMargin \83o\83C\83g\91O\82©\82ç\8eæ\93¾
+ RangeStart := Item.ThreadItem.Size;
+ AdjustLen := -adjustMargin;
+ end;
end;
end;
- Abone := False;
+ Item.IsAbone := False;
DownloadResult := DatDownload(Item.DownType, URL, Modified, RangeStart, AdjustLen);
{$IFDEF DEBUG}
Writeln('ResponseCode: ' + IntToStr(FIndy.ResponseCode));
{$ENDIF}
if Item.DownType = gdtThread then begin
if Item.ResponseCode = 416 then begin
- Abone := True;
+ Item.IsAbone := True;
DownloadResult := True;
- end else if DownloadResult and (AdjustLen = -1) and (Item.Content[1] <> #10) then
- Abone := True;
+ end else if DownloadResult and (AdjustLen < 0) then begin
+ if Copy( Item.Content, 1, adjustMargin ) <> lastContent then
+ Item.IsAbone := True;
+ end;
end;
if Trim(FIndy.Response.RawHeaders.Values['Date']) <> '' then begin
{$IFDEF DEBUG}
Writeln('Date:' + FIndy.Response.RawHeaders.Values['Date']);
{$ENDIF}
- if Abone then begin
+ if Item.IsAbone then begin
{$IFDEF DEBUG}
Writeln('\82 \82Ú\81[\82ñ\8c\9f\8fo');
{$ENDIF}
Writeln('\82 \82Ú\81[\82ñ\8dÄ\8eæ\93¾\8cã');
Writeln('ResponseCode: ' + IntToStr(Item.ResponseCode));
{$ENDIF}
- end else if (Item.DownType = gdtThread) and (AdjustLen = -1) and (Item.Content[1] = #10) then begin
- //\8d·\95ª\8eæ\93¾\82©\82Â\82P\83o\83C\83g\96Ú\82ªLF\82Ì\8fê\8d\87\81i\90³\8fí\8eæ\93¾\81j\82Í\93ª\82ÌLF\82ð\8dí\8f\9c
- Item.Content := Copy(Item.Content, 2, Length(Item.Content));
+ end else if (Item.DownType = gdtThread) and (AdjustLen < 0) then begin
+ // \8d·\95ª\8eæ\93¾\82ª\8fo\97\88\82½\8fê\8d\87\82Í\82 \82Ú\81[\82ñ\83`\83F\83b\83N\97p\82É\8eæ\93¾\82µ\82½\97]\95ª\82È\83T\83C\83Y\82ð\8dí\8f\9c
+ Item.Content := Copy(Item.Content, adjustMargin + 1, MaxInt);
end;
end else begin
Item.State := gdsError;
end;
end;
- {$IFDEF DEBUG}
- if (Item.DownType = gdtThread) and (Item.ResponseCode = 302) then begin
- ATitle := Item.ThreadItem.Title;
- if ATitle = '' then
- ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
- FMsg := '\81\9a\89ß\8b\8e\83\8d\83O(1)\82ª\91¶\8dÝ\82µ\82È\82¢\82½\82ßgoogle\83L\83\83\83b\83V\83\85\82©\82ç\92T\82µ\82Ü\82· - [' + ATitle + ']';
- FIcon := gmiWhat;
- if Assigned(OnDownloadMsg) then
- Synchronize(FireDownloadMsg);
- URL := 'http://www.google.co.jp/search?q=cache:' + Item.ThreadItem.URL;
- URL := StringReplace( URL, 'l50', '', [rfReplaceAll] );
- Modified := Item.ThreadItem.LastModified;
- Repeat
- if not CgiDownload(Item.DownType, URL, Modified) then
- Item.State := gdsError;
- URL := FIndy.Response.Location;
- Until Item.ResponseCode <> 301;
- if Item.ResponseCode = 200 then begin
- foundPos := Pos( '<dt>', Item.Content ) + Length( '<dt>' );
- Item.Content := Copy( Item.Content, foundPos, Length( Item.Content ) );
- foundPos := Pos( '</dl>', Item.Content );
- If foundPos > 0 Then
- Item.Content := Copy( Item.Content, 1, foundPos - 1 );
- Item.Content := StringReplace( Item.Content, '<dt>', '<>' + #13#10, [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '<a href="mailto:', '', [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '"><b>', '<>', [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '<b>', '<>', [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '</b></a>', '<>', [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '</b>', '<>', [rfReplaceAll] );
- Item.Content := StringReplace( Item.Content, '<dd>', '<>', [rfReplaceAll] );
- end;
- end;
- {$ENDIF}
-
case Item.ResponseCode of
200: Item.State := gdsComplete;
206: Item.State := gdsDiffComplete;
Synchronize(FireDownloadEnd);
ResStream.Free;
end;
+
+ FIndy.Request.CustomHeaders.Clear;
+ FIndy.Request.RawHeaders.Clear;
+ FIndy.Request.Clear;
+ FIndy.Response.CustomHeaders.Clear;
+ FIndy.Response.RawHeaders.Clear;
+ FIndy.Response.Clear;
+ FIndy.ProxyParams.Clear;
+
if Terminated then Break;
Suspend;
end;
begin
FAbort := True;
FIndy.DisconnectSocket;
+ if socket <> nil then begin
+ socket.DisconnectSocket;
+ end;
end;
procedure TDownloadThread.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer);
begin
if Assigned(OnWorkBegin) then
- OnWorkBegin(Sender, AWorkMode, AWorkCountMax, FNumber);
+ OnWorkBegin(Sender, AWorkMode, AWorkCountMax, FNumber, FDownloadTitle);
end;
procedure TDownloadThread.WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
i: Integer;
index: Integer;
NewItem: TThreadItem;
-// SaveCount: Integer;
NumCount: Integer;
Body: TStringList;
Rec: TSubjectRec;
_ThreadItem.RoundDate := ZERO_DATE;
_ThreadItem.LastModified := ZERO_DATE;
_ThreadItem.AgeSage := gasNew;
- boardItem.ListData.Add( _ThreadItem );
+ boardItem.Add(_ThreadItem);
end else begin
if boardItem.Items[index].No > boardItem.IntData then
boardItem.Items[index].AgeSage := gasAge
boardItem.Items[index].No := boardItem.IntData;
boardItem.Items[index].AllResCount := inCount;
- boardItem.ListData.Add( boardItem.Items[index] );
- boardItem.DeleteList( index );
end;
end;
begin
- Board.ListData := TList.Create;
+ //Board.ListData := TList.Create;
Body := TStringList.Create;
try
//\83_\83E\83\93\83\8d\81[\83h\93ú\8e\9e\90Ý\92è\81i\83\8d\81[\83J\83\8b\93ú\8e\9e\81j
//\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;
+
if Board.IsBoardPlugInAvailable then begin
// \90V\82µ\82¢\83\8a\83X\83g\82ð\8dì\90¬\82·\82é
// \90V\82µ\82¢\83\8a\83X\83g\82É\8cÃ\82¢\83\8a\83X\83g\82Ì\83\8d\83O\82ª\82 \82é\82È\82ç\82»\82ê\82ð\90V\82µ\82¢\83\8a\83X\83g\82É\92Ç\89Á
Board.IntData := 0;
Board.BoardPlugIn.EnumThread( DWORD( Board ), @MakeThreadCallBack );
+ //\8cÃ\82¢\83\8a\83X\83g\82É\82µ\82©\82È\82¢\82â\82Â\82ç\82ð\8dí\8f\9c
+ for i := Board.Count - 1 downto 0 do begin
+ if( Board.Items[i].AgeSage = gasNull )and not (Board.Items[i].IsLogFile) then
+ Board.Delete(i);
+ end;
+
// \90V\82µ\82¢\83\8a\83X\83g\82É\96³\82©\82Á\82½\83A\83C\83e\83\80\82ð\90V\82µ\82¢\83\8a\83X\83g\82É\92Ç\89Á
for i := 0 to Board.Count - 1 do begin
- if Board.Items[i].IsLogFile then begin
+ if(Board.Items[i].AgeSage = gasNull) and (Board.Items[i].IsLogFile) then begin
Board.IntData := Board.IntData + 1;
Board.Items[i].No := Board.IntData;
Board.Items[i].AllResCount := Board.Items[i].Count;
Board.Items[i].NewResCount := 0;
Board.Items[i].AgeSage := gasNone;
- Board.ListData.Add( Board.Items[i] );
end;
end;
-
- // \8cÃ\82¢\83\8a\83X\83g\82ð\8fÁ\82·\81i\83\8a\83X\83g\82Ì\82Ý\81B\83X\83\8c\83I\83u\83W\83F\83N\83g\8e©\91Ì\82Í\8fÁ\82³\82È\82¢\81j
- for i := Board.Count - 1 downto 0 do
- Board.DeleteList( i );
-
- // \90V\82µ\82¢\83\8a\83X\83g\82ð\83{\81[\83h\83I\83u\83W\83F\83N\83g\82É\92Ç\89Á
- for i := 0 to Board.ListData.Count - 1 do
- Board.Add( TThreadItem(Board.ListData[i]) );
end else begin
//\90V\82µ\82¢\83\8a\83X\83g\82ð\8dì\90¬\82·\82é
//\90V\82µ\82¢\83\8a\83X\83g\82É\8cÃ\82¢\83\8a\83X\83g\82Ì\83\8d\83O\82ª\82 \82é\82È\82ç\82»\82ê\82ð\90V\82µ\82¢\83\8a\83X\83g\82É\92Ç\89Á
Body.Text := Content;
NumCount := 0;
for i := 0 to Body.Count - 1 do begin
- //if i = 0 then Continue; //\82P\8ds\96Ú\82Í\83X\83e\81[\83^\83X\8ds\82Ì\82½\82ß\8f\88\97\9d\82È\82µ
-
Rec := GikoSys.DivideSubject(Body[i]);
Rec.FFileName := Trim(Rec.FFileName);
if (Rec.FTitle = '') and (Rec.FCount = 0) then Continue;
Inc(NumCount);
- index := Board.GetIndex(Rec.FFileName);
+ index := Board.GetIndexFromFileName(Rec.FFileName);
if index = -1 then begin
//\90V\82µ\82¢\83X\83\8c\83b\83h
NewItem := TThreadItem.Create(
- nil, GikoSys.Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
+ nil, GikoSys.Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
NewItem.Title := Rec.FTitle;
NewItem.AllResCount := Rec.FCount;
NewItem.ParentBoard := Board;
NewItem.RoundDate := ZERO_DATE;
NewItem.LastModified := ZERO_DATE;
NewItem.AgeSage := gasNew;
- Board.ListData.Add(NewItem);
+ Board.Add(NewItem);
end else begin
if Board.Items[index].No > NumCount then
Board.Items[index].AgeSage := gasAge
Board.Items[index].No := NumCount;
Board.Items[index].AllResCount := Rec.FCount;
- Board.ListData.Add(Board.Items[index]);
- Board.DeleteList(index);
end;
end;
+ //\8cÃ\82¢\83\8a\83X\83g\82Ì\8dí\8f\9c
+ for i := Board.Count - 1 downto 0 do begin
+ if( Board.Items[i].AgeSage = gasNull )and not (Board.Items[i].IsLogFile) then
+ Board.Delete(i);
+ end;
- //\90V\82µ\82¢\83\8a\83X\83g\82É\96³\82©\82Á\82½\83A\83C\83e\83\80\82ð\90V\82µ\82¢\83\8a\83X\83g\82É\92Ç\89Á
+ //\90V\82µ\82¢\83\8a\83X\83g\82É\96³\82©\82Á\82½\83A\83C\83e\83\80\82Ì\8dX\90V
for i := 0 to Board.Count - 1 do begin
- if Board.Items[i].IsLogFile then begin
+ if( Board.Items[i].AgeSage = gasNull )and (Board.Items[i].IsLogFile) then begin
inc(NumCount);
Board.Items[i].No := NumCount;
Board.Items[i].AllResCount := Board.Items[i].Count;
Board.Items[i].NewResCount := 0;
Board.Items[i].AgeSage := gasNone;
- Board.ListData.Add(Board.Items[i]);
end;
end;
-
- //\8cÃ\82¢\83\8a\83X\83g\82ð\8fÁ\82·\81i\83\8a\83X\83g\82Ì\82Ý\81B\83X\83\8c\83I\83u\83W\83F\83N\83g\8e©\91Ì\82Í\8fÁ\82³\82È\82¢\81j
- for i := Board.Count - 1 downto 0 do
- Board.DeleteList(i);
-
- //\90V\82µ\82¢\83\8a\83X\83g\82ð\83{\81[\83h\83I\83u\83W\83F\83N\83g\82É\92Ç\89Á
- for i := 0 to Board.ListData.Count - 1 do
- Board.Add(TThreadItem(Board.ListData[i]));
-
//\83\8a\83X\83g(subject.txt)\82ð\95Û\91¶
- // GikoSys.ForceDirectoriesEx(GikoSys.GetLogDir + Board.BBSID);
- // Body.SaveToFile(GikoSys.GetSubjectFileName(Board.BBSID));
GikoSys.ForceDirectoriesEx(ExtractFilePath(Board.GetSubjectFileName));
Body.SaveToFile(Board.GetSubjectFileName);
end;
finally
Body.Free;
- Board.ListData.Free;
end;
+
+
end;
{procedure TDownloadItem.SaveListFile;
}
procedure TDownloadItem.SaveItemFile;
var
- Body: TStringList;
+ Body, oldBody: TStringList;
Cnt: Integer;
OldCnt: Integer;
FileName: string;
ini: TMemIniFile;
Res: TResRec;
NewRes: Integer;
+ finish : Boolean;
+ loopCnt : Integer;
+// KokoTxt : string;
+// KokoIdx : Integer;
+// NewTxt : string;
+// NewIdx : Integer;
+// LastTxt : string;
+ LastIdx : Integer;
begin
FileName := ThreadItem.GetThreadFileName;
if not ThreadItem.IsBoardPlugInAvailable then begin
if Trim(Content) = '' then
Exit;
+
GikoSys.ForceDirectoriesEx(ExtractFilePath(FileName));
- // Cnt := 0;
+ // Cnt := 0;
Body := TStringList.Create;
+ NewRes := 0;
+ OldCnt := 0;
try
- // if FileExists(FileName) and (ResponseCode = 206) then begin
+ // 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;
- Body.LoadFromFile(FileName);
- OldCnt := Body.Count;
- Body.Text := Body.Text + Content;
- Body.SaveToFile(FileName);
- NewRes := Body.Count - OldCnt;
- Cnt := Body.Count;
+ loopCnt := 10;
+ repeat
+ finish := true;
+ try
+ Body.LoadFromFile(FileName);
+ OldCnt := Body.Count;
+ Body.Text := Body.Text + Content;
+ Body.SaveToFile(FileName);
+ NewRes := Body.Count - OldCnt;
+ except
+ on E:EFOpenError do begin
+ sleep(10);
+ Dec(loopCnt);
+ if loopCnt > 0 then
+ finish := false;
+ end;
+ end;
+ until finish;
+ //Cnt := Body.Count;
end else begin
- Body.Text := Content;
+ 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µ
+ 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;
+
+ LastIdx := oldBody.Count;
+ repeat
+ Dec(LastIdx);
+ OldCnt := Body.IndexOf(oldBody.Strings[ LastIdx ]) + 1;
+ until ( OldCnt <> 0 ) or (LastIdx = 0);
+
+ 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;
+ OldCnt := 0;
+ NewRes := Body.Count;
+ //Cnt := Body.Count;
+ end;
// if Body.Count > 0 then
// Body.Delete(0);
Body.SaveToFile(FileName);
ThreadItem.Title := Res.FTitle;
end;
ThreadItem.Size := 0;
- //ThreadItem.Count := 0;
- ThreadItem.AllResCount := 0;
- ThreadItem.NewResCount := 0;
- OldCnt := 0;
- NewRes := Body.Count;
- Cnt := Body.Count;
end;
Cnt := Body.Count;
finally
Body.Free;
end;
+
ThreadItem.Size := ThreadItem.Size + ContentLength;
ThreadItem.LastModified := LastModified;
ThreadItem.Count := Cnt;
- ThreadItem.AllResCount := Cnt;
+ //ThreadItem.AllResCount := Cnt;
ThreadItem.NewResCount := NewRes;
ThreadItem.NewReceive := OldCnt + 1;
end;
-
+ 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;