OSDN Git Service

・板リストファイルに対し遅延読み出しを行うようになった。
authoryoffy <yoffy>
Mon, 8 Mar 2004 05:31:43 +0000 (05:31 +0000)
committeryoffy <yoffy>
Mon, 8 Mar 2004 05:31:43 +0000 (05:31 +0000)
・TBBS.GetLogFolder は BBS 個別のログフォルダではなく
 一貫して2ちゃんねるのログフォルダのみを返していたため誤使用を避けるため削除した。
・代わりに板リストファイルを指す TBBS.FilePath を追加。
(代わりと言っても、TBBS.FilePath とログフォルダのパスは関連性は無い)

BoardGroup.pas

index d2cf79e..14bf42e 100644 (file)
@@ -70,21 +70,22 @@ type
        TBoard = class;
        TThreadItem = class;
 
-       //\82Æ\82è\82 \82¦\82¸\82Q\82¿\82á\82ñ\82Ë\82é\82Ì\83\8b\81[\83g
+       // BBS \82Ì\83\8b\81[\83g
        TBBS = class(TList)
        private
                FTitle: string;
-               FLogFolder: string;
+               FFilePath : string;                                             // \94Â\83\8a\83X\83g\82Ì\83p\83X
                FExpand: Boolean;
                FKubetsuChk: Boolean;                                   //\8di\8d\9e\82Ý\8e\9e\91å\95\8e\9a\8f¬\95\8e\9a\8bæ\95Ê
                FSelectText: string;                                    //\8di\8d\9e\82Ý\95\8e\9a\97ñ
                FShortSelectText: string;
+               FIsBoardFileRead : Boolean;             // \94Â\83\8a\83X\83g\82Í\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82é\82©\81H
 
                function GetCategory(index: integer): TCategory;
                procedure SetCategory(index: integer; value: TCategory);
                procedure SetSelectText(s: string);
        public
-               constructor Create(LogFolder: string);
+               constructor Create( boardFilePath : string );
                destructor Destroy; override;
 
                function Add(item: TCategory): integer;
@@ -97,7 +98,7 @@ type
                function FindThreadFromURL( inURL : string ) : TThreadItem;
                function FindThreadItem(BBSID: string; FileName: string): TThreadItem;
                function FindCategoryFromTitle( inTitle : string ) : TCategory;
-               function GetLogFolder: string;
+               property FilePath : string read FFilePath write FFilePath;
 
                property Items[index: integer]: TCategory read GetCategory write SetCategory;
                property Title: string read FTitle write FTitle;
@@ -106,6 +107,8 @@ type
                property KubetsuChk: Boolean read FKubetsuChk write FKubetsuChk;
                property SelectText: string read FSelectText write SetSelectText;
                property ShortSelectText: string read FShortSelectText write FShortSelectText;
+
+               property        IsBoardFileRead : Boolean read FIsBoardFileRead write FIsBoardFileRead;
        end;
 
        //\83J\83e\83S\83\8a
@@ -382,20 +385,18 @@ const
 //     COLUMN_BOARD:                   array[0..3] of string = ('\94Â\96¼', '\8eæ\93¾\90\94', '\8f\84\89ñ\97\\96ñ', '\91O\89ñ\8f\84\89ñ\93ú\8e\9e');
 //     COLUMN_THREADITEM: array[0..3] of string = ('\83X\83\8c\83b\83h\96¼', '\83J\83E\83\93\83g', '\8f\84\89ñ\97\\96ñ', '\91O\89ñ\8f\84\89ñ\93ú\8e\9e');
 
+// BBSID \82ð\97p\82¢\82é 2 \82¿\82á\82ñ\82Ë\82é\82Ì\82Ý\92T\82µ\8fo\82µ\82Ü\82·
+// BBSID \82Ì\8eg\97p\82Í\8bÉ\97Í\94ð\82¯\82Ä\82­\82¾\82³\82¢\81B
+// \89Â\94\\82È\8fê\8d\87\82Í URL \82ð\8eg\97p\82µ\82Ä\82­\82¾\82³\82¢\81B
 function       BBSsFindBoardFromBBSID(
        inBBSID : string
 ) : TBoard;
-var
-       i                               : Integer;
 begin
 
-       for i := Length( BBSs ) - 1 downto 0 do begin
-               Result := BBSs[ i ].FindBBSID( inBBSID );
-               if Result <> nil then
-                       Exit;
-       end;
+       if not BBSs[ 0 ].IsBoardFileRead then
+       GikoSys.ReadBoardFile( BBSs[ 0 ] );
 
-       Result := nil;
+       Result := BBSs[ 0 ].FindBBSID( inBBSID );
 
 end;
 
@@ -454,11 +455,11 @@ end;
  *\8b@\94\\96¼\81FTBBS\83R\83\93\83X\83g\83\89\83N\83^
  *Public
  *************************************************************************)
-constructor TBBS.Create(LogFolder: string);
+constructor TBBS.Create( boardFilePath : string );
 begin
        inherited Create;
        Title := BBS2CH_NAME;
-       FLogFolder := LogFolder;
+       FFilePath := boardFilePath;
 end;
 
 (*************************************************************************
@@ -599,16 +600,6 @@ begin
 
 end;
 
-(*************************************************************************
- *\83\8d\83O\83t\83H\83\8b\83_\8eæ\93¾
- *
- *************************************************************************)
-function TBBS.GetLogFolder: string;
-begin
-       Result := IncludeTrailingPathDelimiter(FLogFolder)
-                                       + BBS2CH_LOG_FOLDER + PATH_DELIM;
-end;
-
 procedure TBBS.SetSelectText(s: string);
 begin
        FSelectText := s;
@@ -992,8 +983,8 @@ begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME
        else
-               FileName := ParentCategory.ParenTBBS.GetLogFolder
-                                                       + BBSID + PATH_DELIM + FOLDER_INI_FILENAME;
+               FileName := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                                                       + BBS2CH_LOG_FOLDER + BBSID + PATH_DELIM + FOLDER_INI_FILENAME;
 
        if not FileExists(FileName) then
                Exit;
@@ -1050,8 +1041,8 @@ begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath )
        else
-               FileName := ParentCategory.ParenTBBS.GetLogFolder
-                                                       + BBSID + PATH_DELIM;
+               FileName := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                                                       + BBS2CH_LOG_FOLDER + BBSID + PATH_DELIM;
        if not GikoSys.DirectoryExistsEx(FileName) then
                GikoSys.ForceDirectoriesEx(FileName);
        FileName := FileName + FOLDER_INI_FILENAME;
@@ -1107,8 +1098,8 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := ParentCategory.ParenTBBS.GetLogFolder
-                                               + BBSID + PATH_DELIM + SUBJECT_FILENAME;
+               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                                               + BBS2CH_LOG_FOLDER + BBSID + PATH_DELIM + SUBJECT_FILENAME;
 end;
 
 // \83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b\96¼(folder.idx)\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
@@ -1117,8 +1108,8 @@ begin
        if Length( FilePath ) > 0 then
                Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME
        else
-               Result := ParentCategory.ParenTBBS.GetLogFolder
-                                               + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME;
+               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                                               + BBS2CH_LOG_FOLDER + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME;
 end;
 
 // \83X\83\8c\97§\82Ä\91\97\90MURL
@@ -1627,8 +1618,8 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := ParentBoard.ParentCategory.ParenTBBS.GetLogFolder
-                                               + ParentBoard.BBSID + PATH_DELIM + FileName;
+               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                                               + BBS2CH_LOG_FOLDER + ParentBoard.BBSID + PATH_DELIM + FileName;
 end;
 
 procedure TThreadItem.SetLastModified(d: TDateTime);