OSDN Git Service

This commit was manufactured by cvs2svn to create branch 'Bb62'.
[gikonavigoeson/gikonavi.git] / RoundData.pas
index 3380a8b..631222a 100644 (file)
@@ -38,9 +38,6 @@ type
                property Count[RoundType: TGikoRoundType]: Integer read GetCount;
         property OldFileRead: Boolean read FOldFileRead;
                property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem;
-               //procedure SetRoundName(Board: TBoard; RoundName: string); overload;
-               //procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload;
-
                procedure LoadRoundBoardFile;
         procedure LoadRoundThreadFile;
                procedure SaveRoundFile;
@@ -50,30 +47,21 @@ type
 
        TRoundItem = class(TObject)
        private
-//
                FItem           : TObject;
-//             FBBSType: TGikoBBSType;
-               FRoundName: string;
                FRoundType: TGikoRoundType;
-       //Item                  : TObject;
-               //FURL          : string;
-               //FBoardTitle: string;
-               //FThreadTitle: string;
-               //FFileName: string;
                FTmpURL : string;
                FBoolData: Boolean;             //\82¢\82ë\82¢\82ë\8eg\82¤\82å\82£
                function GetBoardTitle : string;
                function GetThreadTitle : string;
                function GetURL : string;
                function GetFileName : string;
+        //! \8f\84\89ñ\96¼\8eæ\93¾
+        function GetRoundName : string;
        public
-
                constructor Create;
                property Item : TObject read FItem;
-       //property BBSType: TGikoBBSType read FBBSType write FBBSType;
-               property RoundName: string read FRoundName write FRoundName;
+               property RoundName: string read GetRoundName;
                property RoundType: TGikoRoundType read FRoundType write FRoundType;
-       //property Item : TObject read FItem write FItem;
                property URL : string read GetURL;
                property TmpURL : string read FTmpURL write FTmpURL;
                property BoardTitle: string read GetBoardTitle;
@@ -92,10 +80,12 @@ const
        ROUND_INDEX_VERSION: string = '2.00';
     ERROR_BOARD_FILENAME: string = 'ErrorBoard.2ch'; //Error\8ds\82ð\95Û\8aÇ\82·\82é
     ERROR_ITEM_FILENAME: string = 'ErrorItem.2ch'; //Error\8ds\82ð\95Û\8aÇ\82·\82é
+//! \8f\84\89ñ\83A\83C\83e\83\80\83R\83\93\83X\83g\83\89\83N\83^
 constructor TRoundItem.Create;
 begin
        inherited Create;
 end;
+//! \94Â\96¼\8eæ\93¾
 function TRoundItem.GetBoardTitle : string;
 begin
        Result := '';
@@ -107,6 +97,7 @@ begin
                end;
        end;
 end;
+//! \83X\83\8c\83b\83h\96¼\8eæ\93¾
 function TRoundItem.GetThreadTitle : string;
 begin
        Result := '';
@@ -116,6 +107,7 @@ begin
                end;
        end;
 end;
+//! URL\8eæ\93¾
 function TRoundItem.GetURL     : string;
 begin
        Result := '';
@@ -127,6 +119,7 @@ begin
                end;
        end;
 end;
+//! \83X\83\8c\83b\83h\82Ì\83t\83@\83C\96¼\8eæ\93¾
 function TRoundItem.GetFileName : string;
 begin
        Result := '';
@@ -136,6 +129,19 @@ begin
                end;
        end;
 end;
+//! \8f\84\89ñ\96¼\8eæ\93¾
+function TRoundItem.GetRoundName : string;
+begin
+       Result := '';
+       if( Self.FItem <> nil) then begin
+               if( Self.FItem is TBoard) then begin
+                       Result := TBoard(Self.FItem).RoundName;
+               end else if( Self.FItem is TThreadItem) then begin
+                       Result := TThreadItem(Self.FItem).RoundName;
+               end;
+       end;
+end;
+//! \8f\84\89ñ\83\8a\83X\83g\83R\83\93\83X\83g\83\89\83N\83^
 constructor TRoundList.Create;
 begin
        inherited;
@@ -146,7 +152,7 @@ begin
        RoundNameList.Duplicates := dupIgnore;
     FOldFileRead := false;
 end;
-
+//! \8f\84\89ñ\83\8a\83X\83g\83f\83X\83g\83\89\83N\83^
 destructor TRoundList.Destroy;
 begin
        RoundNameList.Free;
@@ -155,7 +161,7 @@ begin
        FItemList.Free;
        //inherited;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\92Ç\89Á\81i\94Â\81j
 function TRoundList.Add(Board: TBoard): Integer;
 var
        idx: Integer;
@@ -163,22 +169,15 @@ var
 begin
     Result := -1;
        idx := Find(Board);
-       //RoundNameList.Add(Board.RoundName);
        if idx = -1 then begin
                Item := TRoundItem.Create;
                Item.FItem := Board;
 //             Item.BBSType := gbt2ch; //\82Æ\82è\82 \82¦\82¸
                Item.RoundType := grtBoard;
-//     Item.Item := Board;
-               //Item.URL := Board.URL;
-               //Item.BoardTitle := Board.Title;
-               //Item.ThreadTitle := '';
-               //Item.FileName := '';
-               Item.RoundName := Board.RoundName;
                Result := FBoardList.Add(Item);
        end;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\92Ç\89Á\81i\83X\83\8c\83b\83h\81j
 function TRoundList.Add(ThreadItem: TThreadItem): Integer;
 var
        idx: Integer;
@@ -186,26 +185,18 @@ var
 begin
     Result := -1;
        idx := Find(ThreadItem);
-       //RoundNameList.Add(ThreadItem.RoundName);
        if idx = -1 then begin
                Item := TRoundItem.Create;
                Item.FItem := ThreadItem;
 //             Item.BBSType := gbt2ch; //\82Æ\82è\82 \82¦\82¸
                Item.RoundType := grtItem;
-//             Item.Item := ThreadItem;
-               //Item.URL := Threaditem.URL;
-               //Item.BoardTitle := ThreadItem.ParentBoard.Title;
-               //Item.ThreadTitle := ThreadItem.Title;
-               //Item.FileName := ThreadItem.FileName;
-               Item.RoundName := ThreadItem.RoundName;
                Result := FItemList.Add(Item);
        end;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81i\94Â\81j
 procedure TRoundList.Delete(Board: TBoard);
 var
        idx: Integer;
-//     Item: TRoundItem;
 begin
        idx := Find(Board);
        if idx <> -1 then begin
@@ -214,11 +205,10 @@ begin
                FBoardList.Delete(idx);
        end;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81i\83X\83\8c\83b\83h\81j
 procedure TRoundList.Delete(ThreadItem: TThreadItem);
 var
        idx: Integer;
-//     Item: TRoundItem;
 begin
        idx := Find(ThreadItem);
        if idx <> -1 then begin
@@ -227,7 +217,7 @@ begin
                FItemList.Delete(idx);
        end;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8fÁ\8b\8e
 procedure TRoundList.Clear;
 var
        i: Integer;
@@ -245,7 +235,7 @@ begin
        end;
     FItemList.Capacity := FItemList.Count;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81i\94Â\81j
 function TRoundList.Find(Board: TBoard): Integer;
 var
        i: Integer;
@@ -261,7 +251,7 @@ begin
                end;
        end;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81i\83X\83\8c\83b\83h\81j
 function TRoundList.Find(ThreadItem: TThreadItem): Integer;
 var
        i: Integer;
@@ -277,6 +267,7 @@ begin
                end;
        end;
 end;
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81iURL\81{\83A\83C\83e\83\80\83^\83C\83v\81j
 function TRoundList.Find(URL: string; RoundType: TGikoRoundType): Integer;
 var
        i: Integer;
@@ -303,6 +294,7 @@ begin
                end;
     end;
 end;
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81iURL\81{\83A\83C\83e\83\80\83^\83C\83v\81j
 procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType);
 var
        idx: Integer;
@@ -318,7 +310,6 @@ begin
                        board := TBoard(Item);
                        Item.Free;
                        FBoardList.Delete(idx);
-                       //board := BBSsFindBoardFromURL(URL);
                        if board <> nil then begin
                                board.Round := False;
                                board.RoundName := '';
@@ -329,7 +320,6 @@ begin
                        Item.Free;
                        FItemList.Delete(idx);
 
-                       //threadItem := BBSsFindThreadFromURL(URL);
             if threadItem <> nil then begin
                    threadItem.Round := false;
                threadItem.RoundName := '';
@@ -337,32 +327,7 @@ begin
         end;
        end;
 end;
-{
-procedure TRoundList.SetRoundName(Board: TBoard; RoundName: string);
-var
-       idx: Integer;
-       Item: TRoundItem;
-begin
-       idx := Find(Board);
-       if idx <> -1 then begin
-               Item := TRoundItem(FBoardList[idx]);
-               Item.RoundName := RoundName;
-       end;
-end;
-}
-{
-procedure TRoundList.SetRoundName(ThreadItem: TThreadItem; RoundName: string);
-var
-       idx: Integer;
-       Item: TRoundItem;
-begin
-       idx := Find(ThreadItem);
-       if idx <> -1 then begin
-               Item := TRoundItem(FItemList[idx]);
-               Item.RoundName := RoundName;
-       end;
-end;
-}
+//! \8f\84\89ñ\97\\96ñ\90\94\8eæ\93¾
 function TRoundList.GetCount(RoundType: TGikoRoundType): Integer;
 begin
        Result := 0;
@@ -371,7 +336,7 @@ begin
        else if RoundType = grtItem then
                Result := FItemList.Count;
 end;
-
+//! \8f\84\89ñ\97\\96ñ\8eæ\93¾
 function TRoundList.GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
 begin
        Result := nil;
@@ -383,6 +348,7 @@ begin
                        Result := TRoundItem(FItemList[Index]);
        end;
 end;
+//! \83{\81[\83h\8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
 procedure TRoundList.LoadRoundBoardFile;
 var
        i: Integer;
@@ -390,7 +356,6 @@ var
        FileName, bFileName: string;
        errorSl: TStringList;
        errorFileName: string;
-       //Item: TRoundItem;
        delCount: Integer;
 begin
        sl := TStringList.Create;
@@ -416,6 +381,12 @@ begin
                 end;
             end;
             //Item := TRoundItem.Create;
+
+            if sl.Count = 0 then begin
+                //\83G\83\89\81[\97\8e\82¿\82·\82é\82È\82Ç\82µ\82Ä\83t\83@\83C\83\8b\82Ì\93à\97e\82ª\8bó\82¾\82Æ\83G\83\89\81[\82É\82È\82é\91Î\8dô
+                sl.Add(ROUND_INDEX_VERSION);
+            end;
+
             delCount := 0;
             //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
                        if sl[0] = ROUND_INDEX_VERSION then begin
@@ -446,20 +417,16 @@ begin
                sl.Free;
        end;
 end;
+//! \83X\83\8c\83b\83h\8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
 procedure TRoundList.LoadRoundThreadFile;
 var
        i: Integer;
-//    j: Integer;
        sl: TStringList;
        FileName, bFileName: string;
     errorSl: TStringList;
     errorFileName: string;
-//     Item: TRoundItem;
     delCount: Integer;
-//    boardList : TStringList;
 begin
-//    boardList := TStringList.Create;
-//    boardList.Duplicates := dupIgnore;
     errorSl := TStringList.Create;
        errorSl.Duplicates := dupIgnore;
        sl := TStringList.Create;
@@ -481,6 +448,11 @@ begin
                 end;
             end;
             //Item := TRoundItem.Create;
+            if sl.Count = 0 then begin
+                //\83G\83\89\81[\97\8e\82¿\82·\82é\82È\82Ç\82µ\82Ä\83t\83@\83C\83\8b\82Ì\93à\97e\82ª\8bó\82¾\82Æ\83G\83\89\81[\82É\82È\82é\91Î\8dô
+                sl.Add(ROUND_INDEX_VERSION);
+            end;
+
             delCount := 0;
                        //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
             if sl[0] = ROUND_INDEX_VERSION then begin
@@ -501,21 +473,15 @@ begin
                     end;
                                end;
             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
                errorSl.Free;
                sl.Free;
-//        boardList.Free;
        end;
 end;
+//! \8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\95Û\91
 procedure TRoundList.SaveRoundFile;
 var
        i: integer;