Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/ItemDownload.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6.2.2 by yoffy, Thu Sep 9 16:20:33 2004 UTC revision 1.6.2.3 by yoffy, Fri Oct 8 05:44:52 2004 UTC
# Line 156  var Line 156  var
156          Idx: Integer;          Idx: Integer;
157          ATitle: string;          ATitle: string;
158          DownloadResult: Boolean;          DownloadResult: Boolean;
         foundPos: Integer;  
159          boardPlugIn     : TBoardPlugIn;          boardPlugIn     : TBoardPlugIn;
         listContent     : string;  
160          lastContent             : string;          lastContent             : string;
161          logFile                         : TFileStream;          logFile                         : TFileStream;
162          adjustMargin    : Integer;          adjustMargin    : Integer;
# Line 1177  end; Line 1175  end;
1175  }  }
1176  procedure TDownloadItem.SaveItemFile;  procedure TDownloadItem.SaveItemFile;
1177  var  var
1178          Body: TStringList;          Body, oldBody: TStringList;
1179          Cnt: Integer;          Cnt: Integer;
1180          OldCnt: Integer;          OldCnt: Integer;
1181          FileName: string;          FileName: string;
# Line 1186  var Line 1184  var
1184          NewRes: Integer;          NewRes: Integer;
1185          finish : Boolean;          finish : Boolean;
1186          loopCnt : Integer;          loopCnt : Integer;
1187          KokoTxt : string;  //      KokoTxt : string;
1188          KokoIdx : Integer;  //      KokoIdx : Integer;
1189          NewTxt  : string;  //      NewTxt  : string;
1190          NewIdx  : Integer;  //      NewIdx  : Integer;
1191          LastTxt : string;  //      LastTxt : string;
1192          LastIdx : Integer;          LastIdx : Integer;
1193  begin  begin
1194          FileName := ThreadItem.GetThreadFileName;          FileName := ThreadItem.GetThreadFileName;
# Line 1208  begin Line 1206  begin
1206                  try                  try
1207                  //              if FileExists(FileName) and (ResponseCode = 206) then begin                  //              if FileExists(FileName) and (ResponseCode = 206) then begin
1208                          if FileExists(FileName) and (State = gdsDiffComplete) then begin                          if FileExists(FileName) and (State = gdsDiffComplete) then begin
                 //                      Body.Text := Content;  
                 //                      if Body.Count > 0 then  
                 //                              Body.Delete(0);  
                 //                      Content := Body.Text;  
1209                                  loopCnt := 10;                                  loopCnt := 10;
1210                                  repeat                                  repeat
1211                                          finish := true;                                          finish := true;
# Line 1224  begin Line 1218  begin
1218                                          except                                          except
1219                                                  on E:EFOpenError do begin                                                  on E:EFOpenError do begin
1220                                                          sleep(10);                                                          sleep(10);
                                                         finish := false;  
1221                                                          Dec(loopCnt);                                                          Dec(loopCnt);
1222                                                            if loopCnt > 0 then
1223                                                                    finish := false;
1224                                                  end;                                                  end;
1225                                          end;                                          end;
1226                                  until finish and ( loopCnt > 0 );                                  until finish;
1227                                  //Cnt := Body.Count;                                  //Cnt := Body.Count;
1228                          end else begin                          end else begin
1229                                  if IsAbone then begin                                  if IsAbone then begin
1230                                          // あぼーんを検出したのでここまで読んだと新着レス番のつけなおし                                          // あぼーんを検出したのでここまで読んだと新着レス番のつけなおし
1231                                          loopCnt := 10;                                          oldBody := TStringList.Create;
1232                                          repeat                                          try
1233                                                  finish := true;                                                  loopCnt := 10;
1234                                                  try                                                  repeat
1235                                                          Body.LoadFromFile(FileName);                                                          finish := true;
1236                                                  except                                                          try
1237                                                          on E:EFOpenError do begin                                                                  oldBody.LoadFromFile(FileName);
1238                                                                  sleep(10);                                                          except
1239                                                                  finish := false;                                                                  on E:EFOpenError do begin
1240                                                                  Dec(loopCnt);                                                                          sleep(10);
1241                                                                            Dec(loopCnt);
1242                                                                            if loopCnt > 0 then
1243                                                                                    finish := false
1244                                                                            else
1245                                                                                    finish := true;
1246                                                                    end;
1247                                                          end;                                                          end;
1248                                                  end;                                                  until finish;
                                         until finish and ( loopCnt > 0 );  
                                         LastTxt := Body.Strings[ Body.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;  
1249    
1250                                          Body.Text := Content;                                                  Body.Text := Content;
1251                                          Body.Find( LastTxt, LastIdx );                                                  if (ThreadItem.Kokomade > 0) and (ThreadItem.Kokomade <= oldBody.Count) then begin
1252                                          OldCnt := LastIdx + 1;                                                          ThreadItem.Kokomade := Body.IndexOf(oldBody.Strings[ ThreadItem.Kokomade - 1 ]);
1253                                          NewRes := Body.Count - OldCnt;                                                          if ThreadItem.Kokomade <> -1 then ThreadItem.Kokomade := ThreadItem.Kokomade + 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 );  
                                                 if OldCnt < NewIdx then begin  
                                                         OldCnt := NewIdx;  
                                                         NewRes := Body.Count - NewIdx;  
1254                                                  end;                                                  end;
1255    
1256                                                    LastIdx := oldBody.Count;
1257                                                    repeat
1258                                                            Dec(LastIdx);
1259                                                            OldCnt := Body.IndexOf(oldBody.Strings[ LastIdx ]) + 1;
1260                                                    until ( OldCnt <> 0 ) or (LastIdx = 0);
1261    
1262                                                    if OldCnt >= Body.Count then OldCnt := Body.Count - 1;
1263                                                    NewRes := Body.Count - OldCnt;
1264    
1265    
1266                                            finally
1267                                                    oldBody.Free;
1268                                          end;                                          end;
1269    
1270                                  end else begin                                  end else begin
1271                                          Body.Text := Content;                                          Body.Text := Content;
1272                                          //ThreadItem.Count := 0;                                          //ThreadItem.Count := 0;
# Line 1303  begin Line 1299  begin
1299          ThreadItem.AllResCount := ThreadItem.Count;          ThreadItem.AllResCount := ThreadItem.Count;
1300          ThreadItem.IsLogFile := True;          ThreadItem.IsLogFile := True;
1301          ThreadItem.RoundDate := Now;          ThreadItem.RoundDate := Now;
1302          ThreadItem.UnRead := True;          if not ThreadItem.UnRead then begin
1303          ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1;                  ThreadItem.UnRead := True;
1304                    ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead + 1;
1305            end;
1306  //      if ThreadItem.RoundNo = 6 then  //      if ThreadItem.RoundNo = 6 then
1307  //              ThreadItem.RoundNo := 0;  //              ThreadItem.RoundNo := 0;
1308    

Legend:
Removed from v.1.6.2.2  
changed lines
  Added in v.1.6.2.3

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26