| 12 |
|
|
| 13 |
TRoundList = class(TObject) |
TRoundList = class(TObject) |
| 14 |
private |
private |
| 15 |
|
FOldFileRead: Boolean; |
| 16 |
FBoardList: TList; |
FBoardList: TList; |
| 17 |
FItemList: TList; |
FItemList: TList; |
| 18 |
function GetCount(RoundType: TGikoRoundType): Integer; |
function GetCount(RoundType: TGikoRoundType): Integer; |
| 30 |
function Add(ThreadItem: TThreadItem): Integer; overload; |
function Add(ThreadItem: TThreadItem): Integer; overload; |
| 31 |
procedure Delete(Board: TBoard); overload; |
procedure Delete(Board: TBoard); overload; |
| 32 |
procedure Delete(ThreadItem: TThreadItem); overload; |
procedure Delete(ThreadItem: TThreadItem); overload; |
| 33 |
|
procedure Delete(URL: string; RoundType: TGikoRoundType); overload; |
| 34 |
procedure Clear; |
procedure Clear; |
| 35 |
function Find(Board: TBoard): Integer; overload; |
function Find(Board: TBoard): Integer; overload; |
| 36 |
function Find(ThreadItem: TThreadItem): Integer; overload; |
function Find(ThreadItem: TThreadItem): Integer; overload; |
| 37 |
|
function Find(URL: string; RoundType: TGikoRoundType): Integer; overload; |
| 38 |
property Count[RoundType: TGikoRoundType]: Integer read GetCount; |
property Count[RoundType: TGikoRoundType]: Integer read GetCount; |
| 39 |
|
property OldFileRead: Boolean read FOldFileRead; |
| 40 |
property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem; |
property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem; |
| 41 |
procedure SetRoundName(Board: TBoard; RoundName: string); overload; |
procedure SetRoundName(Board: TBoard; RoundName: string); overload; |
| 42 |
procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload; |
procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload; |
| 43 |
|
|
|
//procedure ConvertRoundFile; //bata44以前のRoundfileを変換する |
|
| 44 |
procedure LoadRoundBoardFile; |
procedure LoadRoundBoardFile; |
| 45 |
procedure LoadRoundThreadFile; |
procedure LoadRoundThreadFile; |
| 46 |
procedure SaveRoundFile; |
procedure SaveRoundFile; |
| 51 |
// FBBSType: TGikoBBSType; |
// FBBSType: TGikoBBSType; |
| 52 |
FRoundName: string; |
FRoundName: string; |
| 53 |
FRoundType: TGikoRoundType; |
FRoundType: TGikoRoundType; |
| 54 |
FItem : TObject; |
//Item : TObject; |
| 55 |
FURL : string; |
FURL : string; |
| 56 |
FBoardTitle: string; |
FBoardTitle: string; |
| 57 |
FThreadTitle: string; |
FThreadTitle: string; |
| 58 |
FFileName: string; |
FFileName: string; |
| 59 |
FBoolData: Boolean; //いろいろ使うょぅ |
FBoolData: Boolean; //いろいろ使うょぅ |
| 60 |
public |
public |
| 61 |
// property BBSType: TGikoBBSType read FBBSType write FBBSType; |
|
| 62 |
|
constructor Create; |
| 63 |
|
//property BBSType: TGikoBBSType read FBBSType write FBBSType; |
| 64 |
property RoundName: string read FRoundName write FRoundName; |
property RoundName: string read FRoundName write FRoundName; |
| 65 |
property RoundType: TGikoRoundType read FRoundType write FRoundType; |
property RoundType: TGikoRoundType read FRoundType write FRoundType; |
| 66 |
property Item : TObject read FItem write FItem; |
//property Item : TObject read FItem write FItem; |
| 67 |
property URL : string read FURL write FURL; |
property URL : string read FURL write FURL; |
| 68 |
property BoardTitle: string read FBoardTitle write FBoardTitle; |
property BoardTitle: string read FBoardTitle write FBoardTitle; |
| 69 |
property ThreadTitle: string read FThreadTitle write FThreadTitle; |
property ThreadTitle: string read FThreadTitle write FThreadTitle; |
| 80 |
ROUND_ITEM_FILENAME: string = 'RoundItem.2ch'; //同上 |
ROUND_ITEM_FILENAME: string = 'RoundItem.2ch'; //同上 |
| 81 |
ROUND_INDEX_VERSION: string = '2.00'; |
ROUND_INDEX_VERSION: string = '2.00'; |
| 82 |
|
|
| 83 |
|
constructor TRoundItem.Create; |
| 84 |
|
begin |
| 85 |
|
inherited Create; |
| 86 |
|
end; |
| 87 |
constructor TRoundList.Create; |
constructor TRoundList.Create; |
| 88 |
begin |
begin |
| 89 |
inherited; |
inherited; |
| 92 |
RoundNameList := TStringList.Create; |
RoundNameList := TStringList.Create; |
| 93 |
RoundNameList.Sorted := True; |
RoundNameList.Sorted := True; |
| 94 |
RoundNameList.Duplicates := dupIgnore; |
RoundNameList.Duplicates := dupIgnore; |
| 95 |
|
FOldFileRead := false; |
| 96 |
end; |
end; |
| 97 |
|
|
| 98 |
destructor TRoundList.Destroy; |
destructor TRoundList.Destroy; |
| 115 |
Item := TRoundItem.Create; |
Item := TRoundItem.Create; |
| 116 |
// Item.BBSType := gbt2ch; //とりあえず |
// Item.BBSType := gbt2ch; //とりあえず |
| 117 |
Item.RoundType := grtBoard; |
Item.RoundType := grtBoard; |
| 118 |
Item.Item := Board; |
// Item.Item := Board; |
| 119 |
Item.URL := Board.URL; |
Item.URL := Board.URL; |
| 120 |
Item.BoardTitle := Board.Title; |
Item.BoardTitle := Board.Title; |
| 121 |
Item.ThreadTitle := ''; |
Item.ThreadTitle := ''; |
| 136 |
Item := TRoundItem.Create; |
Item := TRoundItem.Create; |
| 137 |
// Item.BBSType := gbt2ch; //とりあえず |
// Item.BBSType := gbt2ch; //とりあえず |
| 138 |
Item.RoundType := grtItem; |
Item.RoundType := grtItem; |
| 139 |
Item.Item := ThreadItem; |
// Item.Item := ThreadItem; |
| 140 |
Item.URL := Threaditem.URL; |
Item.URL := Threaditem.URL; |
| 141 |
Item.BoardTitle := ThreadItem.ParentBoard.Title; |
Item.BoardTitle := ThreadItem.ParentBoard.Title; |
| 142 |
Item.ThreadTitle := ThreadItem.Title; |
Item.ThreadTitle := ThreadItem.Title; |
| 217 |
end; |
end; |
| 218 |
end; |
end; |
| 219 |
end; |
end; |
| 220 |
|
function TRoundList.Find(URL: string; RoundType: TGikoRoundType): Integer; |
| 221 |
|
var |
| 222 |
|
i: Integer; |
| 223 |
|
Item: TRoundItem; |
| 224 |
|
begin |
| 225 |
|
Result := -1; |
| 226 |
|
for i := 0 to FItemList.Count - 1 do begin |
| 227 |
|
Item := TRoundItem(FItemList[i]); |
| 228 |
|
if Item.FRoundType <> RoundType then Continue; |
| 229 |
|
if Item.FURL = URL then begin |
| 230 |
|
Result := i; |
| 231 |
|
Exit; |
| 232 |
|
end; |
| 233 |
|
end; |
| 234 |
|
end; |
| 235 |
|
procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType); |
| 236 |
|
var |
| 237 |
|
idx: Integer; |
| 238 |
|
Item: TRoundItem; |
| 239 |
|
board: TBoard; |
| 240 |
|
threadItem: TThreadItem; |
| 241 |
|
begin |
| 242 |
|
idx := Find(URL, RoundType); |
| 243 |
|
if idx <> -1 then begin |
| 244 |
|
Item := TRoundItem(FItemList[idx]); |
| 245 |
|
Item.Free; |
| 246 |
|
FItemList.Delete(idx); |
| 247 |
|
if RoundType = grtBoard then begin |
| 248 |
|
board := BBSsFindBoardFromURL(URL); |
| 249 |
|
board.Round := False; |
| 250 |
|
board.RoundName := ''; |
| 251 |
|
end else begin |
| 252 |
|
threadItem := BBSsFindThreadFromURL(URL); |
| 253 |
|
threadItem.Round := false; |
| 254 |
|
threadItem.RoundName := ''; |
| 255 |
|
end; |
| 256 |
|
end; |
| 257 |
|
end; |
| 258 |
|
|
| 259 |
procedure TRoundList.SetRoundName(Board: TBoard; RoundName: string); |
procedure TRoundList.SetRoundName(Board: TBoard; RoundName: string); |
| 260 |
var |
var |
| 313 |
FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME; |
FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME; |
| 314 |
if FileExists(FileName) then begin |
if FileExists(FileName) then begin |
| 315 |
sl.LoadFromFile(FileName); |
sl.LoadFromFile(FileName); |
| 316 |
|
Item := TRoundItem.Create; |
| 317 |
//1行目はバージョン |
//1行目はバージョン |
| 318 |
if sl[0] = ROUND_INDEX_VERSION then begin |
if sl[0] = ROUND_INDEX_VERSION then begin |
| 319 |
for i := 1 to sl.Count - 1 do begin |
for i := 1 to sl.Count - 1 do begin |
| 320 |
|
|
| 321 |
Item := ParseRoundBoardLine(sl[i]); |
Item := ParseRoundBoardLine(sl[i]); |
| 322 |
FBoardList.Add(Item); |
FBoardList.Add(Item); |
| 323 |
RoundNameList.Add(Item.RoundName); |
RoundNameList.Add(Item.RoundName); |
| 324 |
end; |
end; |
| 325 |
end else begin |
end else begin |
| 326 |
for i := 1 to sl.Count - 1 do begin |
if FOldFileRead then begin //ギコナビ本体がボードファイルをよみとった後じゃないとクラッシュするので |
| 327 |
Item := ParseOldRoundBoardLine(sl[i]); |
for i := 1 to sl.Count - 1 do begin |
| 328 |
FBoardList.Add(Item); |
Item := ParseOldRoundBoardLine(sl[i]); |
| 329 |
RoundNameList.Add(Item.RoundName); |
FBoardList.Add(Item); |
| 330 |
end; |
RoundNameList.Add(Item.RoundName); |
| 331 |
|
end; |
| 332 |
|
end else |
| 333 |
|
FOldFileRead := true; |
| 334 |
end; |
end; |
| 335 |
end; |
end; |
| 336 |
finally |
finally |
| 354 |
FileName := GikoSys.GetConfigDir + ROUND_ITEM_FILENAME; |
FileName := GikoSys.GetConfigDir + ROUND_ITEM_FILENAME; |
| 355 |
if FileExists(FileName) then begin |
if FileExists(FileName) then begin |
| 356 |
sl.LoadFromFile(FileName); |
sl.LoadFromFile(FileName); |
| 357 |
|
Item := TRoundItem.Create; |
| 358 |
//1行目はバージョン |
//1行目はバージョン |
| 359 |
if sl[0] = ROUND_INDEX_VERSION then begin |
if sl[0] = ROUND_INDEX_VERSION then begin |
| 360 |
for i := 1 to sl.Count - 1 do begin |
for i := 1 to sl.Count - 1 do begin |
| 361 |
|
|
| 362 |
Item := ParseRoundThreadLine(sl[i], boardList); |
Item := ParseRoundThreadLine(sl[i], boardList); |
| 363 |
FItemList.Add(Item); |
FItemList.Add(Item); |
| 364 |
RoundNameList.Add(Item.RoundName); |
RoundNameList.Add(Item.RoundName); |
| 365 |
end; |
end; |
| 366 |
end else begin |
end else begin |
| 367 |
|
LoadRoundBoardFile; |
| 368 |
for i := 1 to sl.Count - 1 do begin |
for i := 1 to sl.Count - 1 do begin |
| 369 |
Item := ParseOldRoundThreadLine(sl[i], boardList); |
Item := ParseOldRoundThreadLine(sl[i], boardList); |
| 370 |
FItemList.Add(Item); |
FItemList.Add(Item); |
| 437 |
0: |
0: |
| 438 |
begin |
begin |
| 439 |
Result.URL := s; |
Result.URL := s; |
|
Result.Item := BBSsFindBoardFromURL( s ); |
|
| 440 |
end; |
end; |
| 441 |
1: Result.BoardTitle := s; |
1: Result.BoardTitle := s; |
| 442 |
2: Result.RoundName := s; |
2: Result.RoundName := s; |
| 460 |
Result.URL := s; |
Result.URL := s; |
| 461 |
threadItem := BBSsFindThreadFromURL( s ); |
threadItem := BBSsFindThreadFromURL( s ); |
| 462 |
if threadItem <> nil then begin |
if threadItem <> nil then begin |
|
Result.Item := threadItem; |
|
| 463 |
BoardList.Add( threadItem.ParentBoard.URL ); |
BoardList.Add( threadItem.ParentBoard.URL ); |
| 464 |
end; |
end; |
| 465 |
end; |
end; |
| 475 |
var |
var |
| 476 |
i: Integer; |
i: Integer; |
| 477 |
s: string; |
s: string; |
|
buf: string; |
|
| 478 |
board: TBoard; |
board: TBoard; |
|
threadItem: TThreadItem; |
|
| 479 |
begin |
begin |
| 480 |
Result := TRoundItem.Create; |
Result := TRoundItem.Create; |
| 481 |
Result.ThreadTitle := ''; |
Result.ThreadTitle := ''; |
| 482 |
Result.FileName := ''; |
Result.FileName := ''; |
| 483 |
Result.RoundType := grtBoard; |
Result.RoundType := grtBoard; |
| 484 |
for i := 0 to 1 do begin |
for i := 0 to 2 do begin |
| 485 |
s := GikoSys.GetTokenIndex(Line, #1, i); |
s := GikoSys.GetTokenIndex(Line, #1, i); |
| 486 |
case i of |
case i of |
| 487 |
0: |
0: |
| 488 |
begin |
begin |
|
Result.BoardTitle := s; |
|
| 489 |
board := BBSs[ 0 ].FindBBSID( s ); |
board := BBSs[ 0 ].FindBBSID( s ); |
| 490 |
Result.URL := board.URL; |
Result.URL := board.URL; |
|
Result.Item := BBSsFindBoardFromURL( Result.URL ); |
|
| 491 |
end; |
end; |
| 492 |
1: Result.RoundName := s; |
1: Result.FBoardTitle := s; |
| 493 |
|
2: Result.RoundName := s; |
| 494 |
end; |
end; |
| 495 |
end; |
end; |
| 496 |
end; |
end; |
| 502 |
buf: string; |
buf: string; |
| 503 |
board: TBoard; |
board: TBoard; |
| 504 |
threadItem: TThreadItem; |
threadItem: TThreadItem; |
| 505 |
|
bbsID: string; |
| 506 |
begin |
begin |
| 507 |
Result := TRoundItem.Create; |
Result := TRoundItem.Create; |
| 508 |
Result.RoundType := grtItem; |
Result.RoundType := grtItem; |
| 509 |
for i := 0 to 3 do begin |
for i := 0 to 4 do begin |
| 510 |
s := GikoSys.GetTokenIndex(Line, #1, i); |
s := GikoSys.GetTokenIndex(Line, #1, i); |
| 511 |
case i of |
case i of |
| 512 |
0: Result.BoardTitle := s; |
0: bbsID := s; |
| 513 |
1: |
1: Result.BoardTitle := s; |
| 514 |
|
2: |
| 515 |
begin |
begin |
| 516 |
Result.FileName := s; |
Result.FileName := s; |
| 517 |
board := BBSs[ 0 ].FindBoardFromTitle(Result.BoardTitle); |
board := BBSs[ 0 ].FindBoardFromTitle(Result.BoardTitle); |
| 519 |
BoardList.Add(board.URL); |
BoardList.Add(board.URL); |
| 520 |
buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1); |
buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1); |
| 521 |
Result.URL := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50'; |
Result.URL := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50'; |
|
threadItem := BBSsFindThreadFromURL(Result.URL); |
|
|
if threadItem <> nil then begin |
|
|
Result.Item := threadItem; |
|
|
end; |
|
| 522 |
end; |
end; |
| 523 |
end; |
end; |
| 524 |
2: Result.ThreadTitle := s; |
3: Result.ThreadTitle := s; |
| 525 |
3: Result.RoundName := s; |
4: Result.RoundName := s; |
| 526 |
end; |
end; |
| 527 |
end; |
end; |
| 528 |
end; |
end; |