FItemList: TList;
function GetCount(RoundType: TGikoRoundType): Integer;
function GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
- function ParseRoundBoardLine(Line: string): TRoundItem;
- function ParseRoundThreadLine(Line: string): TRoundItem;
- function ParseOldRoundBoardLine(Line: string): TRoundItem;
- function ParseOldRoundThreadLine(Line: string): TRoundItem;
+ function ParseRoundBoardLine(Line: string): Boolean;
+ function ParseRoundThreadLine(Line: string): Boolean;
+ function ParseOldRoundBoardLine(Line: string): Boolean;
+ function ParseOldRoundThreadLine(Line: string): Boolean;
public
RoundNameList: TStringList;
property Count[RoundType: TGikoRoundType]: Integer read GetCount;
property OldFileRead: Boolean read FOldFileRead;
property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem;
- procedure SetRoundName(Board: TBoard; RoundName: string); overload;
- procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload;
-
procedure LoadRoundBoardFile;
procedure LoadRoundThreadFile;
procedure SaveRoundFile;
+
+ procedure URLReplace(oldURLs: TStringList; newURLs :TStringList);
end;
TRoundItem = class(TObject)
private
-// FBBSType: TGikoBBSType;
- FRoundName: string;
+ FItem : TObject;
FRoundType: TGikoRoundType;
- //Item : TObject;
- FURL : string;
- FBoardTitle: string;
- FThreadTitle: string;
- FFileName: string;
+ FTmpURL : string;
FBoolData: Boolean; //\82¢\82ë\82¢\82ë\8eg\82¤\82å\82£
+ function GetBoardTitle : string;
+ function GetThreadTitle : string;
+ function GetURL : string;
+ function GetFileName : string;
+ //! \8f\84\89ñ\96¼\8eæ\93¾
+ function GetRoundName : string;
public
-
- constructor Create;
- //property BBSType: TGikoBBSType read FBBSType write FBBSType;
- property RoundName: string read FRoundName write FRoundName;
+ constructor Create;
+ property Item : TObject read FItem;
+ property RoundName: string read GetRoundName;
property RoundType: TGikoRoundType read FRoundType write FRoundType;
- //property Item : TObject read FItem write FItem;
- property URL : string read FURL write FURL;
- property BoardTitle: string read FBoardTitle write FBoardTitle;
- property ThreadTitle: string read FThreadTitle write FThreadTitle;
- property FileName: string read FFileName write FFileName;
+ property URL : string read GetURL;
+ property TmpURL : string read FTmpURL write FTmpURL;
+ property BoardTitle: string read GetBoardTitle;
+ property ThreadTitle: string read GetThreadTitle;
+ property FileName: string read GEtFileName;
property BoolData: Boolean read FBoolData write FBoolData;
end;
ROUND_INDEX_VERSION: string = '2.00';
ERROR_BOARD_FILENAME: string = 'ErrorBoard.2ch'; //Error\8ds\82ð\95Û\8aÇ\82·\82é
ERROR_ITEM_FILENAME: string = 'ErrorItem.2ch'; //Error\8ds\82ð\95Û\8aÇ\82·\82é
+//! \8f\84\89ñ\83A\83C\83e\83\80\83R\83\93\83X\83g\83\89\83N\83^
constructor TRoundItem.Create;
begin
inherited Create;
end;
+//! \94Â\96¼\8eæ\93¾
+function TRoundItem.GetBoardTitle : string;
+begin
+ Result := '';
+ if( Self.FItem <> nil) then begin
+ if( Self.FItem is TBoard) then begin
+ Result := TBoard(Self.FItem).Title;
+ end else if( Self.FItem is TThreadItem) then begin
+ Result := TThreadItem(Self.FItem).ParentBoard.Title;
+ end;
+ end;
+end;
+//! \83X\83\8c\83b\83h\96¼\8eæ\93¾
+function TRoundItem.GetThreadTitle : string;
+begin
+ Result := '';
+ if( Self.FItem <> nil) then begin
+ if( Self.FItem is TThreadItem) then begin
+ Result := TThreadItem(Self.FItem).Title;
+ end;
+ end;
+end;
+//! URL\8eæ\93¾
+function TRoundItem.GetURL : string;
+begin
+ Result := '';
+ if( Self.FItem <> nil) then begin
+ if( Self.FItem is TBoard) then begin
+ Result := TBoard(Self.FItem).URL;
+ end else if( Self.FItem is TThreadItem) then begin
+ Result := TThreadItem(Self.FItem).URL;
+ end;
+ end;
+end;
+//! \83X\83\8c\83b\83h\82Ì\83t\83@\83C\96¼\8eæ\93¾
+function TRoundItem.GetFileName : string;
+begin
+ Result := '';
+ if( Self.FItem <> nil) then begin
+ if( Self.FItem is TThreadItem) then begin
+ Result := TThreadItem(Self.FItem).FileName;
+ end;
+ end;
+end;
+//! \8f\84\89ñ\96¼\8eæ\93¾
+function TRoundItem.GetRoundName : string;
+begin
+ Result := '';
+ if( Self.FItem <> nil) then begin
+ if( Self.FItem is TBoard) then begin
+ Result := TBoard(Self.FItem).RoundName;
+ end else if( Self.FItem is TThreadItem) then begin
+ Result := TThreadItem(Self.FItem).RoundName;
+ end;
+ end;
+end;
+//! \8f\84\89ñ\83\8a\83X\83g\83R\83\93\83X\83g\83\89\83N\83^
constructor TRoundList.Create;
begin
inherited;
RoundNameList.Duplicates := dupIgnore;
FOldFileRead := false;
end;
-
+//! \8f\84\89ñ\83\8a\83X\83g\83f\83X\83g\83\89\83N\83^
destructor TRoundList.Destroy;
begin
RoundNameList.Free;
FItemList.Free;
//inherited;
end;
-
+//! \8f\84\89ñ\97\\96ñ\92Ç\89Á\81i\94Â\81j
function TRoundList.Add(Board: TBoard): Integer;
var
idx: Integer;
idx := Find(Board);
if idx = -1 then begin
Item := TRoundItem.Create;
+ Item.FItem := Board;
// Item.BBSType := gbt2ch; //\82Æ\82è\82 \82¦\82¸
Item.RoundType := grtBoard;
-// Item.Item := Board;
- Item.URL := Board.URL;
- Item.BoardTitle := Board.Title;
- Item.ThreadTitle := '';
- Item.FileName := '';
- Item.RoundName := Board.RoundName;
Result := FBoardList.Add(Item);
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\92Ç\89Á\81i\83X\83\8c\83b\83h\81j
function TRoundList.Add(ThreadItem: TThreadItem): Integer;
var
idx: Integer;
idx := Find(ThreadItem);
if idx = -1 then begin
Item := TRoundItem.Create;
+ Item.FItem := ThreadItem;
// Item.BBSType := gbt2ch; //\82Æ\82è\82 \82¦\82¸
Item.RoundType := grtItem;
-// Item.Item := ThreadItem;
- Item.URL := Threaditem.URL;
- Item.BoardTitle := ThreadItem.ParentBoard.Title;
- Item.ThreadTitle := ThreadItem.Title;
- Item.FileName := ThreadItem.FileName;
- Item.RoundName := ThreadItem.RoundName;
Result := FItemList.Add(Item);
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81i\94Â\81j
procedure TRoundList.Delete(Board: TBoard);
var
idx: Integer;
- Item: TRoundItem;
begin
idx := Find(Board);
if idx <> -1 then begin
+ TBoard(TRoundItem(FBoardList[idx]).FItem).RoundName := '';
TRoundItem(FBoardList[idx]).Free;
FBoardList.Delete(idx);
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81i\83X\83\8c\83b\83h\81j
procedure TRoundList.Delete(ThreadItem: TThreadItem);
var
idx: Integer;
- Item: TRoundItem;
begin
idx := Find(ThreadItem);
if idx <> -1 then begin
+ TThreadItem(TRoundItem(FItemList[idx]).FItem).RoundName := '';
TRoundItem(FItemList[idx]).Free;
FItemList.Delete(idx);
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8fÁ\8b\8e
procedure TRoundList.Clear;
var
i: Integer;
TRoundItem(FBoardList[i]).Free;
FBoardList.Delete(i);
end;
+ FBoardList.Capacity := FBoardList.Count;
for i := FItemList.Count - 1 downto 0 do begin
if FItemList[i] <> nil then
TRoundItem(FItemList[i]).Free;
FItemList.Delete(i);
end;
+ FItemList.Capacity := FItemList.Count;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81i\94Â\81j
function TRoundList.Find(Board: TBoard): Integer;
var
i: Integer;
for i := 0 to FBoardList.Count - 1 do begin
Item := TRoundItem(FBoardList[i]);
if Item.FRoundType <> grtBoard then Continue;
- if Item.FURL = Board.URL then begin
+ if Item.FItem = Board then begin
Result := i;
Exit;
end;
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81i\83X\83\8c\83b\83h\81j
function TRoundList.Find(ThreadItem: TThreadItem): Integer;
var
i: Integer;
for i := 0 to FItemList.Count - 1 do begin
Item := TRoundItem(FItemList[i]);
if Item.FRoundType <> grtItem then Continue;
- if Item.FURL = ThreadItem.URL then begin
+ if Item.FItem = ThreadItem then begin
Result := i;
Exit;
end;
end;
end;
+//! \8f\84\89ñ\97\\96ñ\8c\9f\8dõ\81iURL\81{\83A\83C\83e\83\80\83^\83C\83v\81j
function TRoundList.Find(URL: string; RoundType: TGikoRoundType): Integer;
var
i: Integer;
Item: TRoundItem;
begin
Result := -1;
- for i := 0 to FItemList.Count - 1 do begin
- Item := TRoundItem(FItemList[i]);
- if Item.FRoundType <> RoundType then Continue;
- if Item.FURL = URL then begin
- Result := i;
- Exit;
+ if RoundType = grtItem then begin
+ for i := 0 to FItemList.Count - 1 do begin
+ Item := TRoundItem(FItemList[i]);
+ if Item.FRoundType <> RoundType then Continue;
+ if Item.URL = URL then begin
+ Result := i;
+ Exit;
+ end;
end;
- end;
+ end else begin
+ for i := 0 to FBoardList.Count - 1 do begin
+ Item := TRoundItem(FBoardList[i]);
+ if Item.FRoundType <> RoundType then Continue;
+ if Item.URL = URL then begin
+ Result := i;
+ Exit;
+ end;
+ end;
+ end;
end;
+//! \8f\84\89ñ\97\\96ñ\8dí\8f\9c\81iURL\81{\83A\83C\83e\83\80\83^\83C\83v\81j
procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType);
var
idx: Integer;
begin
idx := Find(URL, RoundType);
if idx <> -1 then begin
- Item := TRoundItem(FItemList[idx]);
- Item.Free;
- FItemList.Delete(idx);
- if RoundType = grtBoard then begin
- board := BBSsFindBoardFromURL(URL);
- board.Round := False;
- board.RoundName := '';
- end else begin
- threadItem := BBSsFindThreadFromURL(URL);
- threadItem.Round := false;
- threadItem.RoundName := '';
- end;
- end;
-end;
-procedure TRoundList.SetRoundName(Board: TBoard; RoundName: string);
-var
- idx: Integer;
- Item: TRoundItem;
-begin
- idx := Find(Board);
- if idx <> -1 then begin
- Item := TRoundItem(FBoardList[idx]);
- Item.RoundName := RoundName;
- end;
-end;
+ if RoundType = grtBoard then begin
+ Item := TRoundItem(FBoardList[idx]);
+ board := TBoard(Item);
+ Item.Free;
+ FBoardList.Delete(idx);
+ if board <> nil then begin
+ board.Round := False;
+ board.RoundName := '';
+ end;
+ end else begin
+ Item := TRoundItem(FItemList[idx]);
+ threadItem := TThreadItem(Item.FItem);
+ Item.Free;
+ FItemList.Delete(idx);
-procedure TRoundList.SetRoundName(ThreadItem: TThreadItem; RoundName: string);
-var
- idx: Integer;
- Item: TRoundItem;
-begin
- idx := Find(ThreadItem);
- if idx <> -1 then begin
- Item := TRoundItem(FItemList[idx]);
- Item.RoundName := RoundName;
+ if threadItem <> nil then begin
+ threadItem.Round := false;
+ threadItem.RoundName := '';
+ end;
+ end;
end;
end;
-
+//! \8f\84\89ñ\97\\96ñ\90\94\8eæ\93¾
function TRoundList.GetCount(RoundType: TGikoRoundType): Integer;
begin
Result := 0;
else if RoundType = grtItem then
Result := FItemList.Count;
end;
-
+//! \8f\84\89ñ\97\\96ñ\8eæ\93¾
function TRoundList.GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
begin
Result := nil;
Result := TRoundItem(FItemList[Index]);
end;
end;
+//! \83{\81[\83h\8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
procedure TRoundList.LoadRoundBoardFile;
var
i: Integer;
sl: TStringList;
- FileName: string;
- errorSl: TStringList;
- errorFileName: string;
- Item: TRoundItem;
+ FileName, bFileName: string;
+ errorSl: TStringList;
+ errorFileName: string;
+ delCount: Integer;
begin
sl := TStringList.Create;
- errorSl := TStringList.Create;
+ errorSl := TStringList.Create;
errorSl.Duplicates := dupIgnore;
try
//\83{\81[\83h\8f\84\89ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
FileName := GikoSys.GetConfigDir + ROUND_BOARD_FILENAME;
- //\83G\83\89\81[\8ds\95Û\91¶\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
- errorFileName := GikoSys.GetConfigDir + ERROR_BOARD_FILENAME;
+ bFileName := GikoSys.GetConfigDir + '~' + ROUND_BOARD_FILENAME;
+ //\83G\83\89\81[\8ds\95Û\91¶\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
+ errorFileName := GikoSys.GetConfigDir + ERROR_BOARD_FILENAME;
+
if FileExists(FileName) then begin
sl.LoadFromFile(FileName);
- if FileExists(errorFileName) then begin
- try
+ if FileExists(bFileName) then
+ DeleteFile(bFileName);
+ //\83o\83b\83N\83A\83b\83v\97p\82Ì\83t\83@\83C\83\8b\82ð\8dì\90¬\82·\82é
+ sl.SaveToFile(bFileName);
+ if FileExists(errorFileName) then begin
+ try
errorSl.LoadFromFile(errorFileName);
except
end;
end;
//Item := TRoundItem.Create;
+ delCount := 0;
//\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
if sl[0] = ROUND_INDEX_VERSION then begin
- for i := sl.Count - 1 downto 1 do begin
- Item := ParseRoundBoardLine(sl[i]);
- if Item <> nil then begin
- FBoardList.Add(Item);
- RoundNameList.Add(Item.RoundName);
- end else begin
- errorSl.Add( sl[i] );
- sl.Delete(i);
+ for i := 1 to sl.Count - 1 do begin
+ if not ParseRoundBoardLine(sl[i - delCount]) then begin
+ errorSl.Add( sl[i - delCount] );
+ sl.Delete(i- delCount);
+ Inc(delCount);
end;
end;
end else begin
if FOldFileRead then begin //\83M\83R\83i\83r\96{\91Ì\82ª\83{\81[\83h\83t\83@\83C\83\8b\82ð\82æ\82Ý\82Æ\82Á\82½\8cã\82¶\82á\82È\82¢\82Æ\83N\83\89\83b\83V\83\85\82·\82é\82Ì\82Å
- for i := sl.Count - 1 downto 1 do begin
- Item := ParseOldRoundBoardLine(sl[i]);
- if Item <> nil then begin
- FBoardList.Add(Item);
- RoundNameList.Add(Item.RoundName);
- end else begin
- errorSl.Add( sl[i] );
- sl.Delete(i);
+ for i := 1 to sl.Count - 1 do begin
+ if not ParseOldRoundBoardLine(sl[i - delCount]) then begin
+ errorSl.Add( sl[i- delCount] );
+ sl.Delete(i- delCount);
+ Inc(delCount);
end;
end;
end else
sl.Free;
end;
end;
+//! \83X\83\8c\83b\83h\8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
procedure TRoundList.LoadRoundThreadFile;
var
i: Integer;
- j: Integer;
sl: TStringList;
- FileName: string;
+ FileName, bFileName: string;
errorSl: TStringList;
errorFileName: string;
- Item: TRoundItem;
-// boardList : TStringList;
+ delCount: Integer;
begin
-// boardList := TStringList.Create;
-// boardList.Duplicates := dupIgnore;
errorSl := TStringList.Create;
errorSl.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;
- //\83G\83\89\81[\8ds\95Û\91¶\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
+ bFileName := GikoSys.GetConfigDir + '~' + ROUND_ITEM_FILENAME;
+ //\83G\83\89\81[\8ds\95Û\91¶\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
errorFileName := GikoSys.GetConfigDir + ERROR_ITEM_FILENAME;
if FileExists(FileName) then begin
sl.LoadFromFile(FileName);
- if FileExists(errorFileName) then begin
+ if FileExists(bFileName) then
+ DeleteFile(bFileName);
+ sl.SaveToFile(bFileName);
+ if FileExists(errorFileName) then begin
try
errorSl.LoadFromFile(errorFileName);
except
end;
end;
//Item := TRoundItem.Create;
+ delCount := 0;
//\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93
if sl[0] = ROUND_INDEX_VERSION then begin
- for i := sl.Count - 1 downto 1 do begin
- Item := ParseRoundThreadLine(sl[i]);
- if Item <> nil then begin
- FItemList.Add(Item);
- RoundNameList.Add(Item.RoundName);
- end else begin
- errorSl.Add(sl[i]);
- sl.Delete(i);
+ for i := 1 to sl.Count - 1 do begin
+ if not ParseRoundThreadLine(sl[i - delCount]) then begin
+ errorSl.Add(sl[i - delCount]);
+ sl.Delete(i - delCount);
+ Inc(delCount);
end;
end;
- end else begin
- LoadRoundBoardFile;
- for i := sl.Count - 1 downto 1 do begin
- Item := ParseOldRoundThreadLine(sl[i]);
- if Item <> nil then begin
- FItemList.Add(Item);
- RoundNameList.Add(Item.RoundName);
- end else begin
- errorSl.Add(sl[i]);
- sl.Delete(i);
+ end else begin
+ LoadRoundBoardFile;
+ for i := 1 to sl.Count - 1 do begin
+ if not ParseOldRoundThreadLine(sl[i - delCount]) then begin
+ errorSl.Add(sl[i - delCount]);
+ sl.Delete(i - delCount);
+ Inc(delCount);
end;
end;
end;
-// j := boardList.Count - 1;
-// while j >= 0 do begin
-// GikoSys.ReadSubjectFile( BBSsFindBoardFromURL( boardList[j] ) );
-// boardList.Delete(j);
-// Dec(j);
-// end;
if errorSl.Count > 0 then
errorSl.SaveToFile(errorFileName);
end;
finally
+ errorSl.Free;
sl.Free;
-// boardList.Free;
end;
end;
+//! \8f\84\89ñ\97\\96ñ\83t\83@\83C\83\8b\95Û\91¶
procedure TRoundList.SaveRoundFile;
var
i: integer;
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);
+ try
+ if Item.TmpURL <> '' then begin
+ s := Item.TmpURL + #1
+ + Item.BoardTitle + #1
+ + Item.RoundName;
+ end else begin
+ s := Item.URL + #1
+ + Item.BoardTitle + #1
+ + Item.RoundName;
+ end;
+ sl.Add(s);
+ except
+ end;
end;
sl.SaveToFile(FileName);
sl.Clear;
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);
+ try
+ if Item.TmpURL <> '' then begin
+ s := Item.TmpURL + #1
+ + Item.BoardTitle + #1
+ + Item.FileName + #1
+ + Item.ThreadTitle + #1
+ + Item.RoundName;
+ end else begin
+ s := Item.URL + #1
+ + Item.BoardTitle + #1
+ + Item.FileName + #1
+ + Item.ThreadTitle + #1
+ + Item.RoundName;
+ end;
+ sl.Add(s);
+ except
+ end;
end;
sl.SaveToFile(FileName);
finally
sl.Free;
end;
end;
-function TRoundList.ParseRoundBoardLine(Line: string): TRoundItem;
+function TRoundList.ParseRoundBoardLine(Line: string): Boolean;
var
s: string;
+ roundname: string;
+ board: TBoard;
i: Integer;
begin
- Result := TRoundItem.Create;
- Result.ThreadTitle := '';
- Result.FileName := '';
- Result.RoundType := grtBoard;
- for i := 0 to 2 do begin
- s := GikoSys.GetTokenIndex(Line, #1, i);
- try
- case i of
- 0:
- begin
- Result.URL := s;
- end;
- 1: Result.BoardTitle := s;
- 2: Result.RoundName := s;
- end;
- except
- Result := nil;
- Exit;
- end;
- end;
+ //Result := TRoundItem.Create;
+ //Result.ThreadTitle := '';
+ //Result.FileName := '';
+ //Result.RoundType := grtBoard;
+ board := nil;
+ for i := 0 to 2 do begin
+ s := GikoSys.GetTokenIndex(Line, #1, i);
+ try
+ case i of
+ 0:
+ begin
+ board := BBSsFindBoardFromURL(s);
+ //Result.URL := s;
+ end;
+ //1: Result.BoardTitle := s;
+ 2: roundname := s;
+ end;
+ except
+ Result := false;
+ Exit;
+ end;
+ end;
+ if( board <> nil ) then begin
+ if not board.Round then begin
+ board.RoundName := roundname;
+ RoundNameList.Add(roundname);
+ //RoundNameList.Find(roundname, i);
+ //board.RoundName := PChar(RoundNameList[i]);
+ board.Round := true;
+ end;
+ Result := true;
+ end else begin
+ Result := false;
+ end;
end;
-function TRoundList.ParseRoundThreadLine(Line: string): TRoundItem;
+function TRoundList.ParseRoundThreadLine(Line: string): Boolean;
var
s: string;
+ roundname: string;
+ threadItem: TThreadItem;
i: Integer;
- threadItem: TThreadItem;
+// threadItem: TThreadItem;
begin
- Result := TRoundItem.Create;
- Result.RoundType := grtItem;
- for i := 0 to 4 do begin
- s := GikoSys.GetTokenIndex(Line, #1, i);
- try
- case i of
- 0:
- begin
- Result.URL := s;
- //threadItem := BBSsFindThreadFromURL( s );
- //if threadItem <> nil then begin
- // BoardList.Add( threadItem.ParentBoard.URL );
- //end;
- end;
- 1: Result.BoardTitle := s;
- 2: Result.FileName := s;
- 3: Result.ThreadTitle := s;
- 4: Result.RoundName := s;
- end;
- except
- Result := nil;
- Exit;
- end;
- end;
+ //Result := TRoundItem.Create;
+ //Result.RoundType := grtItem;
+ threadItem := nil;
+ for i := 0 to 4 do begin
+ s := GikoSys.GetTokenIndex(Line, #1, i);
+ try
+ case i of
+ 0:
+ begin
+ //Result.URL := s;
+ threadItem := BBSsFindThreadFromURL( s );
+ //if threadItem <> nil then begin
+ // BoardList.Add( threadItem.ParentBoard.URL );
+ //end;
+ end;
+ //1: Result.BoardTitle := s;
+ //2: Result.FileName := s;
+ //3: Result.ThreadTitle := s;
+ 4: roundname := s;
+ end;
+ except
+ Result := false;
+ Exit;
+ end;
+ end;
+ if( threadItem <> nil ) then begin
+ if not threadItem.Round then begin
+ threadItem.RoundName := roundname;
+ RoundNameList.Add(roundname);
+ //RoundNameList.Find(roundname, i);
+ //threadItem.RoundName := PChar(RoundNameList[i]);
+ threadItem.Round := True;
+ end;
+ Result := true;
+ end else begin
+ Result := false;
+ end;
end;
-function TRoundList.ParseOldRoundBoardLine(Line: string): TRoundItem;
- var
- i: Integer;
+function TRoundList.ParseOldRoundBoardLine(Line: string): Boolean;
+ var
+ i: Integer;
s: string;
- board: TBoard;
+ roundname: string;
+ board: TBoard;
begin
- Result := TRoundItem.Create;
- Result.ThreadTitle := '';
- Result.FileName := '';
- Result.RoundType := grtBoard;
- for i := 0 to 2 do begin
- s := GikoSys.GetTokenIndex(Line, #1, i);
- try
- case i of
- 0:
- begin
- board := BBSs[ 0 ].FindBBSID( s );
- if board <> nil then begin
- Result.URL := board.URL;
- end else begin
- raise Exception.Create('\82±\82Ì\8f\84\89ñ\82Í\93Ç\82Ý\8d\9e\82ß\82È\82¢\82æ\81i\91½\95ª\8aO\95\94\94Â\81j');
- end;
- end;
- 1: Result.FBoardTitle := s;
- 2: Result.RoundName := s;
- end;
- except
- Result := nil;
- Exit;
- end;
- end;
+ //Result := TRoundItem.Create;
+ //Result.ThreadTitle := '';
+ //Result.FileName := '';
+ //Result.RoundType := grtBoard;
+ board := nil;
+ for i := 0 to 2 do begin
+ s := GikoSys.GetTokenIndex(Line, #1, i);
+ try
+ case i of
+ 0:
+ begin
+ board := BBSs[ 0 ].FindBBSID( s );
+ if board = nil then begin
+ raise Exception.Create('\82±\82Ì\8f\84\89ñ\82Í\93Ç\82Ý\8d\9e\82ß\82È\82¢\82æ\81i\91½\95ª\8aO\95\94\94Â\81j');
+ end;
+ end;
+ //1: Result.FBoardTitle := s;
+ 2: roundname := s;
+ end;
+ except
+ Result := false;
+ Exit;
+ end;
+ end;
+ if( board <> nil ) then begin
+ if not board.Round then begin
+ board.RoundName := roundname;
+ RoundNameList.Add(roundname);
+ //RoundNameList.Find(roundname, i);
+ //board.RoundName := PChar(RoundNameList[i]);
+ board.Round := true;
+ end;
+ Result := true;
+ end else begin
+ Result := false;
+ end;
end;
-function TRoundList.ParseOldRoundThreadLine(Line: string): TRoundItem;
- var
- i: Integer;
+function TRoundList.ParseOldRoundThreadLine(Line: string): Boolean;
+ var
+ i: Integer;
s: string;
+ roundname : string;
buf: string;
- board: TBoard;
-// threadItem: TThreadItem;
- bbsID: string;
+ board: TBoard;
+ threadItem: TThreadItem;
+ bbsID: string;
begin
- Result := TRoundItem.Create;
- Result.RoundType := grtItem;
- for i := 0 to 4 do begin
- s := GikoSys.GetTokenIndex(Line, #1, i);
- try
- case i of
- 0: bbsID := s;
- 1: Result.BoardTitle := s;
- 2:
- begin
- Result.FileName := s;
- board := BBSs[ 0 ].FindBBSID(bbsID);
- if board <> nil then begin
- buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1);
- Result.URL := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50';
- end else begin
- raise Exception.Create('\82±\82Ì\8f\84\89ñ\82Í\93Ç\82Ý\8d\9e\82ß\82È\82¢\82æ');
- end;
- end;
- 3: Result.ThreadTitle := s;
- 4: Result.RoundName := s;
- end;
- except
- Result := nil;
- Exit;
- end;
- end;
+// Result := TRoundItem.Create;
+// Result.RoundType := grtItem;
+ threadItem := nil;
+ for i := 0 to 4 do begin
+ s := GikoSys.GetTokenIndex(Line, #1, i);
+ try
+ case i of
+ 0: bbsID := s;
+ //1: Result.BoardTitle := s;
+ 2:
+ begin
+ //Result.FileName := s;
+ board := BBSs[ 0 ].FindBBSID(bbsID);
+ if board <> nil then begin
+ buf := Copy(board.GetSendURL,1,LastDelimiter('/', board.GetSendURL)-1);
+ buf := buf + '/read.cgi/'+ board.BBSID+ '/' +ChangeFileExt(s,'') + '/l50';
+ threadItem := BBSsFindThreadFromURL(buf);
+ end else begin
+ raise Exception.Create('\82±\82Ì\8f\84\89ñ\82Í\93Ç\82Ý\8d\9e\82ß\82È\82¢\82æ');
+ end;
+ end;
+ //3: Result.ThreadTitle := s;
+ 4: roundname := s;
+ end;
+ except
+ Result := false;
+ Exit;
+ end;
+ end;
+ if( threadItem <> nil ) then begin
+ if not threadItem.Round then begin
+ threadItem.RoundName := roundname;
+ RoundNameList.Add(roundname);
+ //RoundNameList.Find(roundname, i);
+ //threadItem.RoundName := PChar(RoundNameList[i]);
+ threadItem.Round := true;
+ end;
+ Result := true;
+ end else begin
+ Result := false;
+ end;
+
+end;
+procedure TRoundList.URLReplace(oldURLs: TStringList; newURLs :TStringList);
+var
+ i: Integer;
+ j: Integer;
+ tempString: string;
+ tmpURL: string;
+ oldHost: string;
+ oldBoardName: string;
+ newHost: string;
+ newBoardName: string;
+begin
+ if oldURLs.Count <> newURLs.Count then
+ Exit;
+ //\82±\82±\82©\82ç\81ABoard\82ÌURL\82Ì\95Ï\8dX
+ for j :=0 to oldURLs.Count - 1 do begin
+ for i :=0 to FBoardList.Count - 1 do begin
+ if TRoundItem(FBoardList[i]).URL = oldURLs[j] then
+ TRoundItem(FBoardList[i]).TmpURL := newURLs[j];
+ end;
+ end;
+ //\82±\82±\82Ü\82Å\81ABoard\82ÌURL\82Ì\95Ï\8dX
+
+ //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
+ //\96Ê\93|\82¾\82¯\82Çthread\82Í\82»\82ê\82¼\82êURL\82ð\83`\83\83\83b\83N\82µ\82È\82ª\82ç\82â\82Á\82Ä\82©\82È\82«\82á\82¢\82¯\82È\82¢\81B
+ for i := 0 to oldURLs.Count - 1 do begin
+ tmpURL := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
+ oldHost := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
+ oldBoardName := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
+ tmpURL := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
+ newHost := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
+ newBoardName := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
+
+ for j := 0 to FItemList.Count - 1 do begin
+ tempString := TRoundItem(FItemList[j]).URL;
+ if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
+ tempString := StringReplace(tempString, oldHost, newHost,[]);
+ TRoundItem(FItemList[j]).TmpURL := tempString;
+ end;
+ end;
+ end;
+ //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
+
end;
end.