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;
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;
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
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 := '';
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;
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;
Result := TRoundItem(FItemList[Index]);
end;
end;
-
-procedure TRoundList.LoadRoundFile;
+procedure TRoundList.LoadRoundBoardFile;
var
i: Integer;
sl: TStringList;
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;
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;
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);
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.