OSDN Git Service

RoundListが持ってるスレのデータはpluginが解放するかもしれないから、
[gikonavigoeson/gikonavi.git] / RoundData.pas
index 11b78c8..883a42d 100644 (file)
@@ -18,9 +18,9 @@ type
                function GetCount(RoundType: TGikoRoundType): Integer;
                function GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
                function ParseRoundBoardLine(Line: string): TRoundItem;
-        function ParseRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
+        function ParseRoundThreadLine(Line: string): TRoundItem;
         function ParseOldRoundBoardLine(Line: string): TRoundItem;
-        function ParseOldRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
+        function ParseOldRoundThreadLine(Line: string): TRoundItem;
        public
                RoundNameList: TStringList;
 
@@ -154,8 +154,7 @@ var
 begin
        idx := Find(Board);
        if idx <> -1 then begin
-               Item := TRoundItem(FBoardList[idx]);
-               Item.Free;
+               TRoundItem(FBoardList[idx]).Free;
                FBoardList.Delete(idx);
        end;
 end;
@@ -167,8 +166,7 @@ var
 begin
        idx := Find(ThreadItem);
        if idx <> -1 then begin
-               Item := TRoundItem(FItemList[idx]);
-               Item.Free;
+               TRoundItem(FItemList[idx]).Free;
                FItemList.Delete(idx);
        end;
 end;
@@ -178,11 +176,13 @@ var
        i: Integer;
 begin
        for i := FBoardList.Count - 1 downto 0 do begin
-               TRoundItem(FBoardList[i]).Free;
+        if FBoardList[i] <> nil then
+                       TRoundItem(FBoardList[i]).Free;
                FBoardList.Delete(i);
        end;
        for i := FItemList.Count - 1 downto 0 do begin
-               TRoundItem(FItemList[i]).Free;
+        if FItemList[i] <> nil then
+                       TRoundItem(FItemList[i]).Free;
                FItemList.Delete(i);
        end;
 end;
@@ -371,10 +371,10 @@ var
     errorSl: TStringList;
     errorFileName: string;
        Item: TRoundItem;
-    boardList : TStringList;
+//    boardList : TStringList;
 begin
-    boardList := TStringList.Create;
-    boardList.Duplicates := dupIgnore;
+//    boardList := TStringList.Create;
+//    boardList.Duplicates := dupIgnore;
     errorSl := TStringList.Create;
        errorSl.Duplicates := dupIgnore;
        sl := TStringList.Create;
@@ -395,7 +395,7 @@ begin
                        //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
             if sl[0] = ROUND_INDEX_VERSION then begin
                                for i := sl.Count - 1 downto 1 do begin
-                                       Item := ParseRoundThreadLine(sl[i], boardList);
+                                       Item := ParseRoundThreadLine(sl[i]);
                     if Item <> nil then begin
                                                FItemList.Add(Item);
                                                RoundNameList.Add(Item.RoundName);
@@ -407,7 +407,7 @@ begin
             end else begin
                 LoadRoundBoardFile;
                 for i := sl.Count - 1 downto 1 do begin
-                                       Item := ParseOldRoundThreadLine(sl[i], boardList);
+                                       Item := ParseOldRoundThreadLine(sl[i]);
                     if Item <> nil then begin
                                                FItemList.Add(Item);
                                                RoundNameList.Add(Item.RoundName);
@@ -417,18 +417,18 @@ begin
                     end;
                                end;
             end;
-               j := boardList.Count - 1;
-           while j >= 0 do begin
-                       GikoSys.ReadSubjectFile( BBSsFindBoardFromURL( boardList[j] ) );
-                   boardList.Delete(j);
-               Dec(j);
-               end;
+//             j := boardList.Count - 1;
+//         while j >= 0 do begin
+//                     GikoSys.ReadSubjectFile( BBSsFindBoardFromURL( boardList[j] ) );
+//                 boardList.Delete(j);
+//             Dec(j);
+//             end;
             if errorSl.Count > 0 then
                errorSl.SaveToFile(errorFileName);
                end;
        finally
                sl.Free;
-        boardList.Free;
+//        boardList.Free;
        end;
 end;
 procedure TRoundList.SaveRoundFile;
@@ -497,7 +497,7 @@ begin
     end;
 end;
 
-function TRoundList.ParseRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
+function TRoundList.ParseRoundThreadLine(Line: string): TRoundItem;
 var
        s: string;
        i: Integer;
@@ -512,10 +512,10 @@ begin
                 0:
                 begin
                     Result.URL := s;
-                    threadItem := BBSsFindThreadFromURL( s );
-                    if threadItem <> nil then begin
-                        BoardList.Add( threadItem.ParentBoard.URL );
-                    end;
+                    //threadItem := BBSsFindThreadFromURL( s );
+                    //if threadItem <> nil then begin
+                    //    BoardList.Add( threadItem.ParentBoard.URL );
+                    //end;
                 end;
                 1: Result.BoardTitle := s;
                 2: Result.FileName := s;
@@ -562,7 +562,7 @@ begin
     end;
 end;
 
-function TRoundList.ParseOldRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
+function TRoundList.ParseOldRoundThreadLine(Line: string): TRoundItem;
     var
     i: Integer;
        s: string;
@@ -584,7 +584,7 @@ begin
                        Result.FileName := s;
                        board := BBSs[ 0 ].FindBoardFromTitle(Result.BoardTitle);
                    if board <> nil then begin
-                           BoardList.Add(board.URL);
+                           //BoardList.Add(board.URL);
                        buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1);
                                                Result.URL := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50';
                    end else begin