OSDN Git Service

巡回ファイル関係の修正
authorh677 <h677>
Tue, 9 Dec 2003 19:26:51 +0000 (19:26 +0000)
committerh677 <h677>
Tue, 9 Dec 2003 19:26:51 +0000 (19:26 +0000)
Giko.dfm
Giko.pas
GikoSystem.pas
RoundData.pas

index 1e86c48..957ae16 100644 (file)
--- a/Giko.dfm
+++ b/Giko.dfm
@@ -5483,13 +5483,6 @@ object GikoForm: TGikoForm
       object N61: TMenuItem
         Caption = '-'
       end
-      object N441: TMenuItem
-        Caption = #12496#12479'44'#20197#21069#12398#24033#22238#12501#12449#12452#12523#12434#12467#12531#12496#12540#12488#12377#12427
-        OnClick = N441Click
-      end
-      object N63: TMenuItem
-        Caption = '-'
-      end
       object ExitMenu: TMenuItem
         Action = ExitAction
       end
index 4734958..7ce0be1 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -501,7 +501,6 @@ type
                ToolButton20: TToolButton;
                AHundredResButton: TToolButton;
                N60: TMenuItem;
-               N61: TMenuItem;
                ExportFavoriteFileAction1: TMenuItem;
                ExportFavoriteFile: TFileSaveAs;
                ToolButton21: TToolButton;
@@ -517,8 +516,7 @@ type
     N20: TMenuItem;
     N24: TMenuItem;
     N62: TMenuItem;
-    N63: TMenuItem;
-    N441: TMenuItem;
+    N61: TMenuItem;
                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure CabinetPanelHide(Sender: TObject);
@@ -824,7 +822,6 @@ type
                procedure UpBoardActionUpdate(Sender: TObject);
     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
       var Handled: Boolean);
-    procedure N441Click(Sender: TObject);
        private
                { Private \90é\8c¾ }
 
@@ -1118,9 +1115,6 @@ begin
        //\8eè\82Ì\83J\81[\83\\83\8b
        Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
 
-       //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
-       RoundList := TRoundList.Create;
-       RoundList.LoadRoundFile;
 
        //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
        AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
@@ -1129,9 +1123,20 @@ begin
        InitializeBoardPlugIns;
 
        EnabledCloseButton := True;
+
+
+       //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
+       RoundList := TRoundList.Create;
+       RoundList.LoadRoundBoardFile;
+
        // \83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
        GikoSys.ReadBoardFile;
-//     SetBoardTreeNode;                                                                               //\83c\83\8a\81[\82É\83{\81[\83h\92Ç\89Á
+
+       RoundList.LoadRoundThreadFile;
+
+
+
+    // SetBoardTreeNode;                                                                               //\83c\83\8a\81[\82É\83{\81[\83h\92Ç\89Á
        // \83\81\83j\83\85\81[\82É\92Ç\89Á
        for i := Length( BBSs ) - 1 downto 0 do begin
                try
@@ -1149,6 +1154,7 @@ begin
                end;
        end;
 
+
        // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
        FHistoryList := TList.Create;
 
@@ -8705,11 +8711,6 @@ begin
 
 end;
 
-procedure TGikoForm.N441Click(Sender: TObject);
-begin
-       RoundList.ConvertRoundFile;
-end;
-
 initialization
                                OleInitialize(nil);
 finalization
index ef6603f..b636da1 100644 (file)
@@ -3259,6 +3259,7 @@ begin
                                                        Board.Round                     := True;
                                                        Board.RoundName := RoundItem.RoundName;
                                                end;
+                        
                                                Category.Add(Board);
                                                Board.LoadSettings;
                                                Board.EndUpdate;
index 809e27b..f8f35d0 100644 (file)
@@ -16,8 +16,10 @@ type
                FItemList: TList;
                function GetCount(RoundType: TGikoRoundType): Integer;
                function GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
-               function ParseRoundLine(Line: string; RoundType: TGikoRoundType): TRoundItem;
-        function ParseOldRoundLine(Line: string; RoundType: TGikoRoundType): TRoundItem;
+               function ParseRoundBoardLine(Line: string): TRoundItem;
+        function ParseRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
+        function ParseOldRoundBoardLine(Line: string): TRoundItem;
+        function ParseOldRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
        public
                RoundNameList: TStringList;
 
@@ -35,8 +37,9 @@ type
                procedure SetRoundName(Board: TBoard; RoundName: string); overload;
                procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload;
 
-        procedure ConvertRoundFile; //bata44\88È\91O\82ÌRoundfile\82ð\95Ï\8a·\82·\82é
-               procedure LoadRoundFile;
+        //procedure ConvertRoundFile; //bata44\88È\91O\82ÌRoundfile\82ð\95Ï\8a·\82·\82é
+               procedure LoadRoundBoardFile;
+        procedure LoadRoundThreadFile;
                procedure SaveRoundFile;
        end;
 
@@ -70,7 +73,7 @@ implementation
 const
        ROUND_BOARD_FILENAME: string = 'RoundBoard.2ch';        //\82 \82Æ\82ÅBoardGroup\82Ö\88Ú\93®
        ROUND_ITEM_FILENAME: string  = 'RoundItem.2ch';         //\93¯\8fã
-       ROUND_INDEX_VERSION: string = '1.00';
+       ROUND_INDEX_VERSION: string = '2.00';
 
 constructor TRoundList.Create;
 begin
@@ -102,7 +105,8 @@ begin
                Item := TRoundItem.Create;
 //             Item.BBSType := gbt2ch; //\82Æ\82è\82 \82¦\82¸
                Item.RoundType := grtBoard;
-    Item.Item := Board;
+       Item.Item := Board;
+        Item.URL := Board.URL;
                Item.BoardTitle := Board.Title;
                Item.ThreadTitle := '';
                Item.FileName := '';
@@ -181,7 +185,7 @@ begin
        for i := 0 to FBoardList.Count - 1 do begin
                Item := TRoundItem(FBoardList[i]);
                if Item.FRoundType <> grtBoard then Continue;
-               if Item.Item = Board then begin
+               if Item.FURL = Board.URL then begin
                        Result := i;
                        Exit;
                end;
@@ -197,7 +201,7 @@ begin
        for i := 0 to FItemList.Count - 1 do begin
                Item := TRoundItem(FItemList[i]);
                if Item.FRoundType <> grtItem then Continue;
-               if Item.Item = ThreadItem then begin
+               if Item.FURL = ThreadItem.URL then begin
                        Result := i;
                        Exit;
                end;
@@ -248,8 +252,7 @@ begin
                        Result := TRoundItem(FItemList[Index]);
        end;
 end;
-
-procedure TRoundList.LoadRoundFile;
+procedure TRoundList.LoadRoundBoardFile;
 var
        i: Integer;
        sl: TStringList;
@@ -262,29 +265,68 @@ begin
                FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME;
                if FileExists(FileName) then begin
                        sl.LoadFromFile(FileName);
-                       //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93\82È\82Ì\82Å\96³\8e\8b
-                       for i := 1 to sl.Count - 1 do begin
-                               Item := ParseRoundLine(sl[i], grtBoard);
-                               FBoardList.Add(Item);
-                               RoundNameList.Add(Item.RoundName);
-                       end;
+            //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
+                       if sl[0] = ROUND_INDEX_VERSION then begin
+                               for i := 1 to sl.Count - 1 do begin
+                                       Item := ParseRoundBoardLine(sl[i]);
+                                       FBoardList.Add(Item);
+                                       RoundNameList.Add(Item.RoundName);
+                               end;
+            end else begin
+                               for i := 1 to sl.Count - 1 do begin
+                                       Item := ParseOldRoundBoardLine(sl[i]);
+                                       FBoardList.Add(Item);
+                                       RoundNameList.Add(Item.RoundName);
+                               end;
+            end;
                end;
+       finally
+               sl.Free;
+       end;
+end;
+procedure TRoundList.LoadRoundThreadFile;
+var
+       i: Integer;
+    j: Integer;
+       sl: TStringList;
+       FileName: string;
+       Item: TRoundItem;
+    boardList : TStringList;
+begin
+    boardList := TStringList.Create;
+    boardList.Duplicates := dupIgnore;
+       sl := TStringList.Create;
+       try
                //\83X\83\8c\8f\84\89ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
                FileName := GikoSys.GetConfigDir + ROUND_ITEM_FILENAME;
                if FileExists(FileName) then begin
                        sl.LoadFromFile(FileName);
-                       //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93\82È\82Ì\82Å\96³\8e\8b
-                       for i := 1 to sl.Count - 1 do begin
-                               Item := ParseRoundLine(sl[i], grtItem);
-                               FItemList.Add(Item);
-                               RoundNameList.Add(Item.RoundName);
-                       end;
+                       //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
+            if sl[0] = ROUND_INDEX_VERSION then begin
+                               for i := 1 to sl.Count - 1 do begin
+                                       Item := ParseRoundThreadLine(sl[i], boardList);
+                                       FItemList.Add(Item);
+                                       RoundNameList.Add(Item.RoundName);
+                               end;
+            end else begin
+                for i := 1 to sl.Count - 1 do begin
+                                       Item := ParseOldRoundThreadLine(sl[i], boardList);
+                                       FItemList.Add(Item);
+                                       RoundNameList.Add(Item.RoundName);
+                               end;
+            end;
                end;
+        j := boardList.Count - 1;
+        while j >= 0 do begin
+               GikoSys.ReadSubjectFile( BBSsFindBoardFromURL( boardList[j] ) );
+            boardList.Delete(j);
+               Dec(j);
+        end;
        finally
                sl.Free;
+        boardList.Free;
        end;
 end;
-
 procedure TRoundList.SaveRoundFile;
 var
        i: integer;
@@ -324,125 +366,85 @@ begin
                sl.Free;
        end;
 end;
-
-function TRoundList.ParseRoundLine(Line: string; RoundType: TGikoRoundType): TRoundItem;
+function TRoundList.ParseRoundBoardLine(Line: string): TRoundItem;
 var
        s: string;
        i: Integer;
 begin
        Result := TRoundItem.Create;
-       if RoundType = grtBoard then begin
-               Result.ThreadTitle := '';
-               Result.FileName := '';
-               Result.RoundType := grtBoard;
-               for i := 0 to 2 do begin
-                       s := GikoSys.GetTokenIndex(Line, #1, i);
-                       case i of
-                               0:
-               begin
-               Result.URL := s;
-            Result.Item := BBSsFindBoardFromURL( s );
-          end;
-                               1: Result.BoardTitle := s;
-                               2: Result.RoundName := s;
-                       end;
-               end;
-       end else if RoundType = grtItem then begin
-               Result.RoundType := grtItem;
-               for i := 0 to 4 do begin
-                       s := GikoSys.GetTokenIndex(Line, #1, i);
-                       case i of
-                               0:
+    Result.ThreadTitle := '';
+    Result.FileName := '';
+    Result.RoundType := grtBoard;
+    for i := 0 to 2 do begin
+       s := GikoSys.GetTokenIndex(Line, #1, i);
+        case i of
+               0:
                begin
-               Result.URL := s;
-            Result.Item := BBSsFindThreadFromURL( s );
-          end;
-                               1: Result.BoardTitle := s;
-                               2: Result.FileName := s;
-                               3: Result.ThreadTitle := s;
-                               4: Result.RoundName := s;
-                       end;
-               end;
-       end;
+                       Result.URL := s;
+               Result.Item := BBSsFindBoardFromURL( s );
+               end;
+            1: Result.BoardTitle := s;
+            2: Result.RoundName := s;
+        end;
+    end;
 end;
-procedure TRoundList.ConvertRoundFile;
+
+function TRoundList.ParseRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
 var
+       s: string;
        i: Integer;
-       sl: TStringList;
-       FileName: string;
-       Item: TRoundItem;
+    threadItem: TThreadItem;
 begin
-    FBoardList.Clear;
-    FItemList.Clear;
-
-       sl := TStringList.Create;
-       try
-               //\83{\81[\83h\8f\84\89ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
-               FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME;
-               if FileExists(FileName) then begin
-                       sl.LoadFromFile(FileName);
-                       //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93\82È\82Ì\82Å\96³\8e\8b
-                       for i := 1 to sl.Count - 1 do begin
-                               Item := ParseOldRoundLine(sl[i], grtBoard);
-                               FBoardList.Add(Item);
-                               RoundNameList.Add(Item.RoundName);
-                       end;
-               end;
-               //\83X\83\8c\8f\84\89ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
-               FileName := GikoSys.GetConfigDir + ROUND_ITEM_FILENAME;
-               if FileExists(FileName) then begin
-                       sl.LoadFromFile(FileName);
-                       //\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93\82È\82Ì\82Å\96³\8e\8b
-                       for i := 1 to sl.Count - 1 do begin
-                               Item := ParseOldRoundLine(sl[i], grtItem);
-                               FItemList.Add(Item);
-                               RoundNameList.Add(Item.RoundName);
-                       end;
-               end;
-       finally
-               sl.Free;
-       end;
+    Result := TRoundItem.Create;
+       Result.RoundType := grtItem;
+    for i := 0 to 4 do begin
+       s := GikoSys.GetTokenIndex(Line, #1, i);
+        case i of
+               0:
+               begin
+                       Result.URL := s;
+                threadItem := BBSsFindThreadFromURL( s );
+                if threadItem <> nil then begin
+                       Result.Item := threadItem;
+                       BoardList.Add( threadItem.ParentBoard.URL );
+                end;
+               end;
+            1: Result.BoardTitle := s;
+            2: Result.FileName := s;
+            3: Result.ThreadTitle := s;
+                       4: Result.RoundName := s;
+        end;
+    end;
 end;
-{
-var
-       i: integer;
-       FileName: string;
-       sl: TStringList;
+
+function TRoundList.ParseOldRoundBoardLine(Line: string): TRoundItem;
+    var
+    i: Integer;
        s: string;
-       Item: TRoundItem;
+       buf: string;
+    board: TBoard;
+    threadItem: TThreadItem;
 begin
-       GikoSys.ForceDirectoriesEx(GikoSys.GetConfigDir);
+       Result := TRoundItem.Create;
+    Result.ThreadTitle := '';
+    Result.FileName := '';
+    Result.RoundType := grtBoard;
+    for i := 0 to 1 do begin
+       s := GikoSys.GetTokenIndex(Line, #1, i);
+        case i of
+               0:
+               begin
+               Result.BoardTitle := s;
+               board := BBSs[ 0 ].FindBBSID( s );
+                       Result.URL := board.URL;
+               Result.Item := BBSsFindBoardFromURL( Result.URL );
+               end;
+            1: Result.RoundName := s;
+        end;
+    end;
+end;
 
-       sl := TStringList.Create;
-       try
-               FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME;
-               sl.Add(ROUND_INDEX_VERSION);
-               for i := 0 to FBoardList.Count - 1 do begin
-                       Item := TRoundItem(FBoardList[i]);
-                       s := Item.URL + #1
-                                + Item.BoardTitle + #1
-                                + Item.RoundName;
-                       sl.Add(s);
-               end;
-               sl.SaveToFile(FileName);
-               sl.Clear;
-               FileName := GikoSys.GetConfigDir + ROUND_ITEM_FILENAME;
-               sl.Add(ROUND_INDEX_VERSION);
-               for i := 0 to FItemList.Count - 1 do begin
-                       Item := TRoundItem(FItemList[i]);
-                       s := Item.URL + #1
-                                + Item.BoardTitle + #1
-                                + Item.FileName + #1
-                                + Item.ThreadTitle + #1
-                                + Item.RoundName;
-                       sl.Add(s);
-               end;
-               sl.SaveToFile(FileName);
-       finally
-               sl.Free;
-       end;
-}
-function TRoundList.ParseOldRoundLine(Line: string; RoundType: TGikoRoundType): TRoundItem;
+function TRoundList.ParseOldRoundThreadLine(Line: string; var BoardList : TStringList): TRoundItem;
     var
     i: Integer;
        s: string;
@@ -451,34 +453,17 @@ function TRoundList.ParseOldRoundLine(Line: string; RoundType: TGikoRoundType):
     threadItem: TThreadItem;
 begin
        Result := TRoundItem.Create;
-       if RoundType = grtBoard then begin
-               Result.ThreadTitle := '';
-               Result.FileName := '';
-               Result.RoundType := grtBoard;
-               for i := 0 to 1 do begin
-                       s := GikoSys.GetTokenIndex(Line, #1, i);
-                       case i of
-                               0:
-               begin
-            Result.BoardTitle := s;
-            board := BBSs[ 0 ].FindBBSID( s );
-               Result.URL := board.URL;
-            Result.Item := BBSsFindBoardFromURL( Result.URL );
-          end;
-                               1: Result.RoundName := s;
-                       end;
-               end;
-       end else if RoundType = grtItem then begin
-               Result.RoundType := grtItem;
-               for i := 0 to 3 do begin
-                       s := GikoSys.GetTokenIndex(Line, #1, i);
-                       case i of
-                               0: Result.BoardTitle := s;
-               1:
+    Result.RoundType := grtItem;
+    for i := 0 to 3 do begin
+       s := GikoSys.GetTokenIndex(Line, #1, i);
+        case i of
+               0: Result.BoardTitle := s;
+            1:
                begin
                Result.FileName := s;
                 board := BBSs[ 0 ].FindBoardFromTitle(Result.BoardTitle);
                 if board <> nil then begin
+                    BoardList.Add(board.URL);
                     buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1);
                                        Result.URL := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50';
                     threadItem := BBSsFindThreadFromURL(Result.URL);
@@ -487,13 +472,10 @@ begin
                     end;
                 end;
             end;
-                               2: Result.ThreadTitle := s;
-                               3: Result.RoundName := s;
-                       end;
-               end;
-       end;
+            2: Result.ThreadTitle := s;
+            3: Result.RoundName := s;
+        end;
+    end;
 end;
 
-
-
 end.