| 504 |
*履歴1 :新規作成 |
*履歴1 :新規作成 |
| 505 |
*************************************************************************) |
*************************************************************************) |
| 506 |
procedure TBBS2ch.ReadBoardFile; |
procedure TBBS2ch.ReadBoardFile; |
| 507 |
|
type |
| 508 |
|
// 最初の一つ(添え字 0)が BBS 名で、その後にカテゴリが続く |
| 509 |
|
TCategories = array of TCategory; |
| 510 |
var |
var |
| 511 |
i, j, k: integer; |
i, j, k: integer; |
| 512 |
kbound: Integer; |
jbound, kbound: Integer; |
| 513 |
idx: Integer; |
idx: Integer; |
| 514 |
ini: TMemIniFile; |
ini: TMemIniFile; |
| 515 |
CategoryList: TStringList; |
CategoryList: TStringList; |
| 520 |
RoundItem: TRoundItem; |
RoundItem: TRoundItem; |
| 521 |
BBSList: TStringList; |
BBSList: TStringList; |
| 522 |
CustomList: TStringList; |
CustomList: TStringList; |
| 523 |
BoardFileList: TStringList; |
BoardFileList: TStringList; |
| 524 |
|
|
| 525 |
|
plugInBBSs : array of TCategories; |
| 526 |
|
plugInCategories : TCategories; |
| 527 |
|
agent : string; |
| 528 |
|
major : DWORD; |
| 529 |
|
minor : DWORD; |
| 530 |
|
release : string; |
| 531 |
|
revision : DWORD; |
| 532 |
|
plugInIndex : Integer; |
| 533 |
|
const |
| 534 |
|
BBS_NAME_SIGNATURE = #$1B; // 絶対に板名としてあり得ない記号を使う |
| 535 |
begin |
begin |
| 536 |
ini := TMemIniFile.Create(''); |
ini := TMemIniFile.Create(''); |
| 537 |
BBSList := TStringList.Create; |
BBSList := TStringList.Create; |
| 538 |
CustomList := TStringList.Create; |
CustomList := TStringList.Create; |
| 539 |
BoardFileList := TStringList.Create; |
BoardFileList := TStringList.Create; |
| 540 |
try |
try |
| 541 |
|
// 板リストの読み込み |
| 542 |
|
// ※本当は TBBS2ch を掲示板の数だけ生成するべきだが |
| 543 |
|
// 最初から BBS2ch が 1 つ前提で作られているため、 |
| 544 |
|
// プラグインが変わるごとにダミーの TCategory を挟んで対処する |
| 545 |
|
|
| 546 |
|
// 2ちゃんねる |
| 547 |
if FileExists(GikoSys.GetBoardFileName) then |
if FileExists(GikoSys.GetBoardFileName) then |
| 548 |
BBSList.LoadFromFile(GikoSys.GetBoardFileName); |
BBSList.LoadFromFile(GikoSys.GetBoardFileName); |
| 549 |
|
// カスタム |
| 550 |
if FileExists(GikoSys.GetCustomBoardFileName) then |
if FileExists(GikoSys.GetCustomBoardFileName) then |
| 551 |
CustomList.LoadFromFile(GikoSys.GetCustomBoardFileName); |
CustomList.LoadFromFile(GikoSys.GetCustomBoardFileName); |
| 552 |
BBSList.AddStrings(CustomList); |
BBSList.AddStrings(CustomList); |
| 553 |
|
// Board フォルダ |
| 554 |
if DirectoryExists(GikoSys.Setting.GetBoardDir) then begin |
if DirectoryExists(GikoSys.Setting.GetBoardDir) then begin |
| 555 |
GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True ); |
GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True ); |
| 556 |
for i := BoardFileList.Count - 1 downto 0 do begin |
for i := BoardFileList.Count - 1 downto 0 do begin |
| 561 |
end; |
end; |
| 562 |
ini.SetStrings(BBSList); |
ini.SetStrings(BBSList); |
| 563 |
|
|
| 564 |
|
// プラグイン用のダミーカテゴリを生成 |
| 565 |
|
try |
| 566 |
|
k := Low( BoardPlugIns ); |
| 567 |
|
kbound := High( BoardPlugIns ); |
| 568 |
|
SetLength( |
| 569 |
|
plugInBBSs, |
| 570 |
|
Max( 0, kbound - k + 1 ) ); |
| 571 |
|
for k := k to kbound do begin |
| 572 |
|
SetLength( plugInBBSs[ k ], 1 ); |
| 573 |
|
if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin |
| 574 |
|
// BBS 名の代わりにとりあえずプラグイン名を入れておく |
| 575 |
|
// ※今後 BBS 名を入れるように改良すること |
| 576 |
|
plugInBBSs[ k ][ 0 ] := TCategory.Create; |
| 577 |
|
BoardPlugIns[ k ].VersionInfo( agent, major, minor, release, revision ); |
| 578 |
|
plugInBBSs[ k ][ 0 ].Title := BBS_NAME_SIGNATURE + agent; |
| 579 |
|
end; |
| 580 |
|
end; |
| 581 |
|
except |
| 582 |
|
end; |
| 583 |
|
|
| 584 |
|
// 2ちゃんねるを追加 |
| 585 |
|
Category := TCategory.Create; |
| 586 |
|
Category.Title := BBS_NAME_SIGNATURE + '2ちゃんねる'; |
| 587 |
|
BBS2ch.Add( Category ); |
| 588 |
|
|
| 589 |
CategoryList := TStringList.Create; |
CategoryList := TStringList.Create; |
| 590 |
BoardList := TStringList.Create; |
BoardList := TStringList.Create; |
| 591 |
try |
try |
| 596 |
Category := TCategory.Create; |
Category := TCategory.Create; |
| 597 |
Category.No := i + 1; |
Category.No := i + 1; |
| 598 |
Category.Title := CategoryList[i]; |
Category.Title := CategoryList[i]; |
| 599 |
|
plugInIndex := -1; |
| 600 |
|
|
| 601 |
for j := 0 to BoardList.Count - 1 do begin |
for j := 0 to BoardList.Count - 1 do begin |
| 602 |
Board := nil; |
Board := nil; |
| 609 |
if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin |
if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin |
| 610 |
if BoardPlugIns[ k ].AcceptURL( inistr ) then begin |
if BoardPlugIns[ k ].AcceptURL( inistr ) then begin |
| 611 |
Board := TBoard.Create( BoardPlugIns[ k ], inistr ); |
Board := TBoard.Create( BoardPlugIns[ k ], inistr ); |
| 612 |
|
plugInIndex := k; |
| 613 |
|
|
| 614 |
Break; |
Break; |
| 615 |
end; |
end; |
| 638 |
Category.Add(Board); |
Category.Add(Board); |
| 639 |
Board.EndUpdate; |
Board.EndUpdate; |
| 640 |
end; |
end; |
| 641 |
BBS2ch.Add(Category); |
if plugInIndex >= 0 then begin |
| 642 |
|
k := High( plugInBBSs[ plugInIndex ] ) + 1; |
| 643 |
|
SetLength( plugInBBSs[ plugInIndex ], k + 1 ); |
| 644 |
|
plugInBBSs[ plugInIndex ][ k ] := Category; |
| 645 |
|
end else begin |
| 646 |
|
BBS2ch.Add(Category); |
| 647 |
|
end; |
| 648 |
end; |
end; |
| 649 |
finally |
finally |
| 650 |
BoardList.Free; |
BoardList.Free; |
| 651 |
CategoryList.Free; |
CategoryList.Free; |
| 652 |
end; |
end; |
| 653 |
|
|
| 654 |
|
// プラグイン用のダミーカテゴリを末尾に追加 |
| 655 |
|
try |
| 656 |
|
k := Low( plugInBBSs ); |
| 657 |
|
kbound := High( plugInBBSs ); |
| 658 |
|
for k := k to kbound do begin |
| 659 |
|
j := Low( plugInBBSs[ k ] ); |
| 660 |
|
jbound := High( plugInBBSs[ k ] ); |
| 661 |
|
for j := j to jbound do begin |
| 662 |
|
BBS2ch.Add( plugInBBSs[ k ][ j ] ); |
| 663 |
|
end; |
| 664 |
|
end; |
| 665 |
|
except |
| 666 |
|
end; |
| 667 |
finally |
finally |
| 668 |
BBSList.Free; |
BBSList.Free; |
| 669 |
CustomList.Free; |
CustomList.Free; |