| 36 |
{ Private 宣言 } |
{ Private 宣言 } |
| 37 |
IgnoreLists : TStringList; |
IgnoreLists : TStringList; |
| 38 |
FAbort: Boolean; |
FAbort: Boolean; |
| 39 |
function BoardDownload: TNewBoardItem; |
function BoardDownload(const URL: String): TNewBoardItem; |
| 40 |
procedure UpdateURL(s: string); |
function BoardLoardFromFile(const FilePath: String): String; |
| 41 |
|
function UpdateURL(s: string): boolean; |
| 42 |
procedure SetIgnoreCategory(b: boolean); |
procedure SetIgnoreCategory(b: boolean); |
| 43 |
procedure EditIgnoreList(Sender: TObject); |
procedure EditIgnoreList(Sender: TObject); |
| 44 |
procedure UpdateIgnoreList(Sender: TObject); |
procedure UpdateIgnoreList(Sender: TObject); |
| 59 |
procedure TNewBoardDialog.UpdateButtonClick(Sender: TObject); |
procedure TNewBoardDialog.UpdateButtonClick(Sender: TObject); |
| 60 |
var |
var |
| 61 |
Item: TNewBoardItem; |
Item: TNewBoardItem; |
| 62 |
|
URL : String; |
| 63 |
|
protocol, host, path, document, port, bookmark: String; |
| 64 |
begin |
begin |
| 65 |
try |
try |
| 66 |
GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1; |
GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1; |
| 69 |
StopButton.Enabled := True; |
StopButton.Enabled := True; |
| 70 |
CloseButton.Enabled := False; |
CloseButton.Enabled := False; |
| 71 |
EditIgnoreListsButton.Enabled := False; |
EditIgnoreListsButton.Enabled := False; |
| 72 |
Item := BoardDownload; |
URL := BoardURLComboBox.Text; |
| 73 |
|
GikoSys.ParseURI(URL, protocol, host, path, document, port, bookmark); |
| 74 |
|
Writeln(protocol); |
| 75 |
|
if (protocol = '') then begin |
| 76 |
|
Item.FContent := BoardLoardFromFile(URL); |
| 77 |
|
end else if (AnsiPos('http', protocol) > 0) then begin |
| 78 |
|
Item := BoardDownload(URL); |
| 79 |
|
end; |
| 80 |
StopButton.Enabled := False; |
StopButton.Enabled := False; |
| 81 |
if FAbort then |
if FAbort then |
| 82 |
Exit; |
Exit; |
| 84 |
GikoDM.TabsSaveAction.Tag := 1; |
GikoDM.TabsSaveAction.Tag := 1; |
| 85 |
GikoDM.TabsOpenAction.Tag := 1; |
GikoDM.TabsOpenAction.Tag := 1; |
| 86 |
GikoDM.TabsSaveAction.Execute; |
GikoDM.TabsSaveAction.Execute; |
| 87 |
UpdateURL(Item.FContent); |
if (UpdateURL(Item.FContent)) then begin |
| 88 |
GikoForm.ReloadBBS; |
GikoForm.ReloadBBS; |
| 89 |
|
end; |
| 90 |
GikoDM.TabsSaveAction.Tag := 0; |
GikoDM.TabsSaveAction.Tag := 0; |
| 91 |
GikoDM.TabsOpenAction.Tag := 0; |
GikoDM.TabsOpenAction.Tag := 0; |
| 92 |
end else |
end else |
| 110 |
Close; |
Close; |
| 111 |
end; |
end; |
| 112 |
|
|
| 113 |
function TNewBoardDialog.BoardDownload: TNewBoardItem; |
function TNewBoardDialog.BoardDownload(const URL: String): TNewBoardItem; |
| 114 |
var |
var |
|
URL: string; |
|
| 115 |
Stream: TMemoryStream; |
Stream: TMemoryStream; |
| 116 |
s: string; |
s: string; |
| 117 |
i: Integer; |
i: Integer; |
| 142 |
Indy.ProxyParams.ProxyPassword := ''; |
Indy.ProxyParams.ProxyPassword := ''; |
| 143 |
end; |
end; |
| 144 |
//URL := GikoSys.Setting.BoardURL2ch; |
//URL := GikoSys.Setting.BoardURL2ch; |
| 145 |
URL := BoardURLComboBox.Text; |
//URL := BoardURLComboBox.Text; |
| 146 |
Indy.Request.UserAgent := GikoSys.GetUserAgent; |
Indy.Request.UserAgent := GikoSys.GetUserAgent; |
| 147 |
Indy.Request.Referer := ''; |
Indy.Request.Referer := ''; |
| 148 |
Indy.Request.AcceptEncoding := 'gzip'; |
Indy.Request.AcceptEncoding := 'gzip'; |
| 197 |
end; |
end; |
| 198 |
end; |
end; |
| 199 |
|
|
| 200 |
procedure TNewBoardDialog.UpdateURL(s: string); |
function TNewBoardDialog.UpdateURL(s: string): boolean; |
| 201 |
var |
var |
| 202 |
i: Integer; |
i: Integer; |
|
// j: Integer; |
|
| 203 |
idx: Integer; |
idx: Integer; |
| 204 |
idx1: Integer; |
idx1: Integer; |
| 205 |
idx2: Integer; |
idx2: Integer; |
| 335 |
oldURLs.Free; |
oldURLs.Free; |
| 336 |
newURLs.Free; |
newURLs.Free; |
| 337 |
end; |
end; |
| 338 |
|
Result := Change; |
| 339 |
end; |
end; |
| 340 |
|
|
| 341 |
procedure TNewBoardDialog.FormCreate(Sender: TObject); |
procedure TNewBoardDialog.FormCreate(Sender: TObject); |
| 414 |
begin |
begin |
| 415 |
IgnoreLists.Free; |
IgnoreLists.Free; |
| 416 |
end; |
end; |
| 417 |
|
//! ローカルファイルをロードする |
| 418 |
|
function TNewBoardDialog.BoardLoardFromFile(const FilePath: String): String; |
| 419 |
|
var |
| 420 |
|
html : TStringList; |
| 421 |
|
begin |
| 422 |
|
Result := ''; |
| 423 |
|
// ファイルが存在しているかチェック |
| 424 |
|
if (FileExists(FilePath)) then begin |
| 425 |
|
html := TStringList.Create(); |
| 426 |
|
try |
| 427 |
|
html.LoadFromFile(FilePath); |
| 428 |
|
Result := html.Text; |
| 429 |
|
finally |
| 430 |
|
html.Free; |
| 431 |
|
end; |
| 432 |
|
end; |
| 433 |
|
end; |
| 434 |
end. |
end. |