| 616 |
|
|
| 617 |
procedure TFavoriteDM.URLReplace(oldURLs: TStringList; newURLs: TStringList); |
procedure TFavoriteDM.URLReplace(oldURLs: TStringList; newURLs: TStringList); |
| 618 |
var |
var |
| 619 |
i, j : Integer; |
i : Integer; |
| 620 |
tmpURL: string; |
tmpURL: string; |
| 621 |
oldHost: string; |
oldHost: string; |
| 622 |
oldBoardName: string; |
oldBoardName: string; |
| 626 |
favBoard : TFavoriteBoardItem; |
favBoard : TFavoriteBoardItem; |
| 627 |
favThread : TFavoriteThreadItem; |
favThread : TFavoriteThreadItem; |
| 628 |
favorites : TTreeNodes; |
favorites : TTreeNodes; |
| 629 |
|
Node : TTreeNode; |
| 630 |
begin |
begin |
| 631 |
|
|
| 632 |
// 面倒だけどthreadはそれぞれURLをチェックしながらやってかなきゃいけない。 |
// 面倒だけどthreadはそれぞれURLをチェックしながらやってかなきゃいけない。 |
| 640 |
newHost := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) ); |
newHost := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) ); |
| 641 |
newBoardName := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/'; |
newBoardName := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/'; |
| 642 |
|
|
| 643 |
for j := favorites.Count - 1 downto 0 do begin |
Node := favorites.GetFirstNode.getFirstChild; |
| 644 |
|
while Node <> nil do begin |
| 645 |
try |
try |
| 646 |
if TObject( favorites.Item[ j ].Data ) is TFavoriteBoardItem then begin |
if TObject( Node.Data ) is TFavoriteBoardItem then begin |
| 647 |
favBoard := TFavoriteBoardItem( favorites.Item[ j ].Data ); |
favBoard := TFavoriteBoardItem( Node.Data ); |
| 648 |
if favBoard = nil then continue; |
if favBoard = nil then continue; |
| 649 |
tempString := favBoard.URL; |
tempString := favBoard.URL; |
| 650 |
if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin |
if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin |
| 651 |
tempString := StringReplace(tempString, oldHost, newHost,[]); |
tempString := StringReplace(tempString, oldHost, newHost,[]); |
| 652 |
favBoard.URL := tempString; |
favBoard.URL := tempString; |
| 653 |
end; |
end; |
| 654 |
end else if TObject( favorites.Item[ j ].Data ) is TFavoriteThreadItem then begin |
end else if TObject( Node.Data ) is TFavoriteThreadItem then begin |
| 655 |
favThread := TFavoriteThreadItem( favorites.Item[ j ].Data ); |
favThread := TFavoriteThreadItem( Node.Data ); |
| 656 |
if favThread = nil then continue; |
if favThread = nil then continue; |
| 657 |
tempString := favThread.URL; |
tempString := favThread.URL; |
| 658 |
if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin |
if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin |
| 662 |
end; |
end; |
| 663 |
except |
except |
| 664 |
end; |
end; |
| 665 |
|
Node := Node.GetNext; |
| 666 |
end; |
end; |
| 667 |
except |
except |
| 668 |
end; |
end; |