*************************************************************************)
procedure TGikoSys.ReadBoardFile;
var
- i, j, k: integer;
- kbound: Integer;
idx: Integer;
ini: TMemIniFile;
CategoryList: TStringList;
Board: TBoard;
inistr: string;
RoundItem: TRoundItem;
- BBSList: TStringList;
- CustomList: TStringList;
- BoardFileList: TStringList;
-
- plugInBBSs : array of TBBS;
- agent : string;
- major : DWORD;
- minor : DWORD;
- release : string;
- revision : DWORD;
- plugInIndex : Integer;
- bbs2channel : TBBS;
- bbsCustom : TBBS;
+
+ // BBS \94z\97ñ(1 \83{\81[\83h\83t\83@\83C\83\8b\82É\82Â\82« 1 \8d\80\96Ú)
+ bbsList : array of TStringList;
+ boardFileList : TStringList;
+
+ i, iBound : Integer;
+ j, jBound : Integer;
+ k, kBound : Integer;
+ l, lBound : Integer;
begin
ini := TMemIniFile.Create('');
- BBSList := TStringList.Create;
- CustomList := TStringList.Create;
- BoardFileList := TStringList.Create;
try
- // \94Â\83\8a\83X\83g\82Ì\93Ç\82Ý\8d\9e\82Ý
-
- // \82Q\82¿\82á\82ñ\82Ë\82é
- if FileExists(GikoSys.GetBoardFileName) then
- BBSList.LoadFromFile(GikoSys.GetBoardFileName);
- // \83J\83X\83^\83\80
- if FileExists(GikoSys.GetCustomBoardFileName) then
- CustomList.LoadFromFile(GikoSys.GetCustomBoardFileName);
- BBSList.AddStrings(CustomList);
- // Board \83t\83H\83\8b\83_
- if DirectoryExists(GikoSys.Setting.GetBoardDir) then begin
- GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
- for i := BoardFileList.Count - 1 downto 0 do begin
- CustomList.Clear;
- CustomList.LoadFromFile( BoardFileList[ i ] );
- BBSList.AddStrings( CustomList );
- end;
- end;
- ini.SetStrings(BBSList);
-
+ // BBS \82Ì\8aJ\95ú
try
for i := 0 to Length( BBSs ) - 1 do
BBSs[ i ].Free;
end;
SetLength( BBSs, 0 );
- // \82Q\82¿\82á\82ñ\82Ë\82é\82ð\90¶\90¬
- bbs2channel := TBBS.Create( GikoSys.Setting.LogFolder );
- bbs2channel.Title := '\82Q\82¿\82á\82ñ\82Ë\82é';
- i := Length( BBSs );
- SetLength( BBSs, i + 1 );
- BBSs[ i ] := bbs2channel;
-
- // \83J\83X\83^\83\80 BBS \82ð\90¶\90¬
- bbsCustom := TBBS.Create( GikoSys.Setting.LogFolder );
- bbsCustom.Title := '\82»\82Ì\91¼';
- i := Length( BBSs );
- SetLength( BBSs, i + 1 );
- BBSs[ i ] := bbsCustom;
-
- // \83v\83\89\83O\83C\83\93\97p BBS \82ð\90¶\90¬
- try
- kbound := Length( BoardPlugIns );
- SetLength( plugInBBSs, kbound );
- i := Length( BBSs );
- SetLength( BBSs, i + kbound );
- Dec( kbound );
- for k := 0 to kbound do begin
- if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
- // BBS \96¼\82Ì\91ã\82í\82è\82É\82Æ\82è\82 \82¦\82¸\83v\83\89\83O\83C\83\93\96¼\82ð\93ü\82ê\82Ä\82¨\82
- // \81¦\8d¡\8cã BBS \96¼\82ð\93ü\82ê\82é\82æ\82¤\82É\89ü\97Ç\82·\82é\82±\82Æ
- BoardPlugIns[ k ].VersionInfo( agent, major, minor, release, revision );
- plugInBBSs[ k ] := TBBS.Create( GikoSys.Setting.LogFolder );
- plugInBBSs[ k ].Title := agent;
- BBSs[ i + k ] := plugInBBSs[ k ];
- end;
- end;
- except
- end;
+ // \94Â\83\8a\83X\83g\82Ì\97ñ\8b\93
+ if FileExists( GikoSys.GetBoardFileName ) then begin
+ l := Length( bbsList );
+ SetLength( bbsList, l + 1 );
+ bbsList[ l ] := TStringList.Create;
+ bbsList[ l ].LoadFromFile( GikoSys.GetBoardFileName );
+
+ SetLength( BBSs, l + 1 );
+ BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
+ BBSs[ l ].Title := '\82Q\82¿\82á\82ñ\82Ë\82é';
+ end;
+
+ if FileExists( GikoSys.GetCustomBoardFileName ) then begin
+ l := Length( bbsList );
+ SetLength( bbsList, l + 1 );
+ bbsList[ l ] := TStringList.Create;
+ bbsList[ l ].LoadFromFile( GikoSys.GetCustomBoardFileName );
+
+ SetLength( BBSs, l + 1 );
+ BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
+ BBSs[ l ].Title := '\82»\82Ì\91¼';
+ end;
- CategoryList := TStringList.Create;
- BoardList := TStringList.Create;
- try
- ini.ReadSections(CategoryList);
- for i := 0 to CategoryList.Count - 1 do begin
-
- ini.ReadSection(CategoryList[i], BoardList);
- Category := TCategory.Create;
- Category.No := i + 1;
- Category.Title := CategoryList[i];
- // \82¿\82å\82Á\82Æ\83g\83\8a\83b\83L\81[\82¾\82ª\81A
- // plugInIndex >= 0 \81c\81c \83v\83\89\83O\83C\83\93\82ð\8eg\97p\81BBoardPlugIns \82Ì\93Y\82¦\8e\9a\82É\82È\82é
- // plugInIndex = -1 \81c\81c \82Q\82¿\82á\82ñ\82Ë\82é
- // other \81c\81c \82»\82Ì\91¼
- plugInIndex := -99999;
-
- for j := 0 to BoardList.Count - 1 do begin
- Board := nil;
- inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
-
- //===== \83v\83\89\83O\83C\83\93
- try
- kbound := High( BoardPlugIns );
- for k := Low( BoardPlugIns ) to kbound do begin
- if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
- if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
- Board := TBoard.Create( BoardPlugIns[ k ], inistr );
- plugInIndex := k;
-
- Break;
- end;
- end;
- end;
- except
- // exception \82ª\94\90¶\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
- end;
-
- if Board = nil then begin
- Board := TBoard.Create( nil, inistr );
- if GikoSys.Is2chHost( GikoSys.UrlToServer( inistr ) ) then
- plugInIndex := -1;
- end;
- Board.BeginUpdate;
- Board.No := j + 1;
- Board.Title := BoardList[j];
- Board.BBSID := GikoSys.UrlToID(inistr);
- Board.RoundDate := ZERO_DATE;
-
- idx := RoundList.Find(Board);
- if idx <> -1 then begin
- RoundItem := RoundList.Items[idx, grtBoard];
- Board.Round := True;
- Board.RoundName := RoundItem.RoundName;
- end;
- Category.Add(Board);
- Board.EndUpdate;
- end;
- if plugInIndex >= 0 then begin
- plugInBBSs[ plugInIndex ].Add( Category );
- end else if plugInIndex = -1 then begin
- bbs2channel.Add( Category );
- end else begin
- bbsCustom.Add( Category );
- end;
- end;
- finally
- BoardList.Free;
- CategoryList.Free;
+ // Board \83t\83H\83\8b\83_
+ if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
+ BoardFileList := TStringList.Create;
+ try
+ GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
+ l := Length( bbsList );
+ for i := BoardFileList.Count - 1 downto 0 do begin
+ SetLength( bbsList, l + 1 );
+ bbsList[ l ] := TStringList.Create;
+ bbsList[ l ].LoadFromFile( BoardFileList[ i ] );
+
+ SetLength( BBSs, l + 1 );
+ BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
+ BBSs[ l ].Title := ExtractFileName( BoardFileList[ i ] );
+
+ Inc( l );
+ end;
+ finally
+ BoardFileList.Free;
+ end;
end;
+
+ lBound := Length( bbsList ) - 1;
+ for l := 0 to lBound do begin
+ ini.SetStrings( bbsList[ l ] );
+ CategoryList := TStringList.Create;
+ BoardList := TStringList.Create;
+ try
+ ini.ReadSections( CategoryList );
+
+ iBound := CategoryList.Count - 1;
+ for i := 0 to iBound do begin
+ ini.ReadSection( CategoryList[i], BoardList );
+ Category := TCategory.Create;
+ Category.No := i + 1;
+ Category.Title := CategoryList[i];
+
+ jBound := BoardList.Count - 1;
+ for j := 0 to jBound do begin
+ Board := nil;
+ inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
+
+ //===== \83v\83\89\83O\83C\83\93
+ try
+ kBound := Length( BoardPlugIns ) - 1;
+ for k := 0 to kBound do begin
+ if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
+ if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
+ Board := TBoard.Create( BoardPlugIns[ k ], inistr );
+
+ Break;
+ end;
+ end;
+ end;
+ except
+ // exception \82ª\94\90¶\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
+ end;
+
+ if Board = nil then
+ Board := TBoard.Create( nil, inistr );
+ Board.BeginUpdate;
+ Board.No := j + 1;
+ Board.Title := BoardList[j];
+ Board.BBSID := GikoSys.UrlToID(inistr);
+ Board.RoundDate := ZERO_DATE;
+
+ idx := RoundList.Find(Board);
+ if idx <> -1 then begin
+ RoundItem := RoundList.Items[idx, grtBoard];
+ Board.Round := True;
+ Board.RoundName := RoundItem.RoundName;
+ end;
+ Category.Add(Board);
+ Board.EndUpdate;
+ end;
+
+ BBSs[ l ].Add( Category );
+ end;
+ finally
+ BoardList.Free;
+ CategoryList.Free;
+ end;
+ end;
finally
- BBSList.Free;
- CustomList.Free;
- BoardFileList.Free;
ini.Free;
+ lBound := Length( bbsList ) - 1;
+ for l := 0 to lBound do
+ bbsList[ l ].Free;
end;
end;