| 1 |
unit NewBoard; |
| 2 |
|
| 3 |
interface |
| 4 |
|
| 5 |
uses |
| 6 |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
| 7 |
Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent, |
| 8 |
IdTCPConnection, IdTCPClient, IdHTTP, IDException, StdCtrls, IniFiles, |
| 9 |
GikoSystem, BoardGroup; |
| 10 |
|
| 11 |
type |
| 12 |
TNewBoardItem = record |
| 13 |
FResponseCode: Integer; |
| 14 |
FContent: string; |
| 15 |
end; |
| 16 |
|
| 17 |
TNewBoardDialog = class(TForm) |
| 18 |
Label1: TLabel; |
| 19 |
MessageMemo: TMemo; |
| 20 |
UpdateButton: TButton; |
| 21 |
CloseButton: TButton; |
| 22 |
Indy: TIdHTTP; |
| 23 |
IdAntiFreeze: TIdAntiFreeze; |
| 24 |
StopButton: TButton; |
| 25 |
BoardURLComboBox: TComboBox; |
| 26 |
Label13: TLabel; |
| 27 |
EditIgnoreListsButton: TButton; |
| 28 |
Label2: TLabel; |
| 29 |
procedure UpdateButtonClick(Sender: TObject); |
| 30 |
procedure StopButtonClick(Sender: TObject); |
| 31 |
procedure CloseButtonClick(Sender: TObject); |
| 32 |
procedure FormCreate(Sender: TObject); |
| 33 |
procedure EditIgnoreListsButtonClick(Sender: TObject); |
| 34 |
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
| 35 |
private |
| 36 |
{ Private ツ静ゥツ固セ } |
| 37 |
IgnoreLists : TStringList; |
| 38 |
FAbort: Boolean; |
| 39 |
function BoardDownload(const URL: String): TNewBoardItem; |
| 40 |
function BoardLoardFromFile(const FilePath: String): String; |
| 41 |
function UpdateURL(s: string): boolean; |
| 42 |
procedure SetIgnoreCategory(b: boolean); |
| 43 |
procedure EditIgnoreList(Sender: TObject); |
| 44 |
procedure UpdateIgnoreList(Sender: TObject); |
| 45 |
function CheckDeleteItem(ini: TMemIniFile): Boolean; |
| 46 |
public |
| 47 |
{ Public ツ静ゥツ固セ } |
| 48 |
class procedure InitHTTPClient(client : TIdHTTP); |
| 49 |
end; |
| 50 |
|
| 51 |
var |
| 52 |
NewBoardDialog: TNewBoardDialog; |
| 53 |
|
| 54 |
|
| 55 |
implementation |
| 56 |
|
| 57 |
uses Giko, IdHeaderList, MojuUtils, GikoDataModule; |
| 58 |
|
| 59 |
{$R *.dfm} |
| 60 |
|
| 61 |
procedure TNewBoardDialog.UpdateButtonClick(Sender: TObject); |
| 62 |
var |
| 63 |
Item: TNewBoardItem; |
| 64 |
URL : String; |
| 65 |
protocol, host, path, document, port, bookmark: String; |
| 66 |
TabURLs: TStringList; |
| 67 |
begin |
| 68 |
try |
| 69 |
MessageMemo.Clear; |
| 70 |
GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1; |
| 71 |
FAbort := False; |
| 72 |
UpdateButton.Enabled := False; |
| 73 |
StopButton.Enabled := True; |
| 74 |
CloseButton.Enabled := False; |
| 75 |
EditIgnoreListsButton.Enabled := False; |
| 76 |
URL := BoardURLComboBox.Text; |
| 77 |
GikoSys.ParseURI(URL, protocol, host, path, document, port, bookmark); |
| 78 |
if (protocol = '') then begin |
| 79 |
Item.FContent := BoardLoardFromFile(URL); |
| 80 |
end else if (AnsiPos('http', protocol) > 0) then begin |
| 81 |
Item := BoardDownload(URL); |
| 82 |
end; |
| 83 |
StopButton.Enabled := False; |
| 84 |
if FAbort then |
| 85 |
Exit; |
| 86 |
if Item.FContent <> '' then begin |
| 87 |
TabURLs := TStringList.Create; |
| 88 |
try |
| 89 |
GikoDM.GetTabURLs(TabURLs); |
| 90 |
if (UpdateURL(Item.FContent)) then begin |
| 91 |
GikoForm.ReloadBBS; |
| 92 |
end; |
| 93 |
GikoDM.OpenURLs(TabURLs); |
| 94 |
finally |
| 95 |
TabURLs.Free; |
| 96 |
end; |
| 97 |
end else |
| 98 |
MessageMemo.Lines.Add('ツダツウツδ督δ債ーツドツで楪篠クツ敗ツてセツづ慊てセツね拏' + IntToStr(Item.FResponseCode) + ']'); |
| 99 |
finally |
| 100 |
UpdateButton.Enabled := True; |
| 101 |
StopButton.Enabled := False; |
| 102 |
CloseButton.Enabled := True; |
| 103 |
EditIgnoreListsButton.Enabled := True; |
| 104 |
end; |
| 105 |
end; |
| 106 |
|
| 107 |
procedure TNewBoardDialog.StopButtonClick(Sender: TObject); |
| 108 |
begin |
| 109 |
FAbort := True; |
| 110 |
Indy.DisconnectSocket; |
| 111 |
end; |
| 112 |
|
| 113 |
procedure TNewBoardDialog.CloseButtonClick(Sender: TObject); |
| 114 |
begin |
| 115 |
Close; |
| 116 |
end; |
| 117 |
|
| 118 |
function TNewBoardDialog.BoardDownload(const URL: String): TNewBoardItem; |
| 119 |
var |
| 120 |
Stream: TMemoryStream; |
| 121 |
s: string; |
| 122 |
i: Integer; |
| 123 |
begin |
| 124 |
InitHTTPClient( Indy ); |
| 125 |
|
| 126 |
Indy.Request.UserAgent := GikoSys.GetUserAgent; |
| 127 |
Indy.Request.Referer := ''; |
| 128 |
Indy.Request.AcceptEncoding := 'gzip'; |
| 129 |
|
| 130 |
Indy.Request.CacheControl := 'no-cache'; |
| 131 |
Indy.Request.CustomHeaders.Add('Pragma: no-cache'); |
| 132 |
|
| 133 |
// s := ''; |
| 134 |
Stream := TMemoryStream.Create; |
| 135 |
try |
| 136 |
try |
| 137 |
MessageMemo.Lines.Add('ツ案個嫁淞て堋焼卍渉環で?ツづァツ柴?毒セツてセツづ慊ね?#39;); |
| 138 |
//MessageMemo.Lines.Add(GikoSys.Setting.BoardURL2ch); |
| 139 |
MessageMemo.Lines.Add(URL); |
| 140 |
MessageMemo.Lines.Add('ツダツウツδ督δ債ーツドツて堕開ツ始ツてセツづ慊ね?#39;); |
| 141 |
IdAntiFreeze.Active := True; |
| 142 |
try |
| 143 |
Indy.Get(URL, Stream); |
| 144 |
finally |
| 145 |
IdAntiFreeze.Active := False; |
| 146 |
end; |
| 147 |
Result.FContent := GikoSys.GzipDecompress(Stream, Indy.Response.ContentEncoding); |
| 148 |
MessageMemo.Lines.Add('ツダツウツδ督δ債ーツドツで楪看スツ稜。ツてセツづ慊てセツね?#39;); |
| 149 |
except |
| 150 |
on E: EIdConnectException do begin |
| 151 |
MessageMemo.Lines.Add(''); |
| 152 |
MessageMemo.Lines.Add('ツ静堋惰?で楪篠クツ敗ツてセツづ慊てセツね ツ嫁?静シツづ「ツプツδ債キツシツ、FWツて堋湘ウツ妥板て堕塚崢づ猟づ?つュツでセツでつね?#39;); |
| 153 |
MessageMemo.Lines.Add('FWツて堕禿シツて卍づ?ね伉づゥツ人ツづ債静敖墜債て堕確ツ認ツてセツづ?つュツでセツでつね?#39;); |
| 154 |
MessageMemo.Lines.Add('NECツて啀Cツて堋焼卍債?づ恒C GATEツで楪闇、ツでつて堕てセツづ?ね伉づゥツ嘉つ能ツ税、ツで楪債つね伉てケツね?#39;); |
| 155 |
MessageMemo.Lines.Add('Message: ' + E.Message); |
| 156 |
end; |
| 157 |
on E: Exception do begin |
| 158 |
if FAbort then |
| 159 |
MessageMemo.Lines.Add('ツダツウツδ督δ債ーツドツて堕陳?断ツてセツづ慊てセツね?#39;) |
| 160 |
else begin |
| 161 |
MessageMemo.Lines.Add('ツダツウツδ督δ債ーツドツで楪篠クツ敗ツてセツづ慊てセツね?#39;); |
| 162 |
MessageMemo.Lines.Add('ResponseCode: ' + IntToStr(Indy.ResponseCode)); |
| 163 |
MessageMemo.Lines.Add('Message: ' + E.Message); |
| 164 |
MessageMemo.Lines.Add('------------------------'); |
| 165 |
for i := 0 to Indy.Response.RawHeaders.Count - 1 do begin |
| 166 |
s := Indy.Response.RawHeaders.Names[i]; |
| 167 |
s := s + ': ' + Indy.Response.RawHeaders.Values[s]; |
| 168 |
MessageMemo.Lines.Add(s); |
| 169 |
end; |
| 170 |
MessageMemo.Lines.Add('------------------------'); |
| 171 |
end; |
| 172 |
end; |
| 173 |
end; |
| 174 |
Result.FResponseCode := Indy.ResponseCode; |
| 175 |
finally |
| 176 |
Stream.Free; |
| 177 |
end; |
| 178 |
end; |
| 179 |
|
| 180 |
function TNewBoardDialog.UpdateURL(s: string): boolean; |
| 181 |
var |
| 182 |
i: Integer; |
| 183 |
idx: Integer; |
| 184 |
idx1: Integer; |
| 185 |
idx2: Integer; |
| 186 |
tmp: string; |
| 187 |
URL: string; |
| 188 |
Title: string; |
| 189 |
cate: string; |
| 190 |
Board: TBoard; |
| 191 |
Change: Boolean; |
| 192 |
Ignore: Boolean; |
| 193 |
ini: TMemIniFile; |
| 194 |
oldURLs : TStringList; |
| 195 |
newURLs : TStringList; |
| 196 |
begin |
| 197 |
Change := False; |
| 198 |
MessageMemo.Lines.Add('ツ新ツ氾つ、ツ氾6RLツ米篠更ツチツェツッツクツて堕開ツ始ツてセツづ慊ね?#39;); |
| 199 |
MessageMemo.Lines.Add(''); |
| 200 |
s := CustomStringReplace(s, '<B>', '<b>', true); |
| 201 |
s := CustomStringReplace(s, '<BR>', '<br>', true); |
| 202 |
s := CustomStringReplace(s, '</B>', '</b>', true); |
| 203 |
s := CustomStringReplace(s, '<A HREF', '<a href', true); |
| 204 |
s := CustomStringReplace(s, '</A', '</a', true); |
| 205 |
cate := ''; |
| 206 |
|
| 207 |
oldURLs := TStringList.Create; |
| 208 |
newURLs := TStringList.Create; |
| 209 |
|
| 210 |
try |
| 211 |
|
| 212 |
GikoSys.ForceDirectoriesEx(GikoSys.GetConfigDir); |
| 213 |
ini := TMemIniFile.Create(GikoSys.GetBoardFileName); |
| 214 |
try |
| 215 |
// |
| 216 |
//ツ催ュツ渉慊オツプツシツδ?δ督で楪選ツ惰堕でつて卍づ?ね伉づゥツ焼卍債?づ債クツδ環ア |
| 217 |
|
| 218 |
ini.Clear; |
| 219 |
|
| 220 |
while True do begin |
| 221 |
idx1 := AnsiPos('<b>', s); |
| 222 |
idx2 := AnsiPos('<a', s); |
| 223 |
if (idx1 = 0) and (idx2 = 0) then Break; |
| 224 |
|
| 225 |
if idx1 < idx2 then begin |
| 226 |
//<br> |
| 227 |
idx := AnsiPos('</b>', s); |
| 228 |
if idx = 0 then begin |
| 229 |
s := Copy(s, idx1 + 4, Length(s)); |
| 230 |
continue; |
| 231 |
end; |
| 232 |
tmp := Copy(s, idx1, (idx - idx1) + 4); |
| 233 |
tmp := CustomStringReplace(tmp, '<b>', ''); |
| 234 |
tmp := CustomStringReplace(tmp, '</b>', ''); |
| 235 |
Ignore := false; |
| 236 |
for i := 0 to IgnoreLists.Count - 1 do begin |
| 237 |
if tmp = Trim(IgnoreLists[i]) then begin |
| 238 |
cate := ''; |
| 239 |
s := Copy(s, idx + 5, Length(s)); |
| 240 |
Ignore := True; |
| 241 |
break; |
| 242 |
end; |
| 243 |
end; |
| 244 |
if Ignore then |
| 245 |
Continue; |
| 246 |
{ |
| 247 |
if (tmp = 'ツつィツね?ね?づ?#39;) or |
| 248 |
(tmp = 'ツ禿?米伉甘ゥツ夏?#39;) or |
| 249 |
(tmp = 'ツづ慊でシツBツBツS') or |
| 250 |
(tmp = 'ツチツδδッツト') or |
| 251 |
(tmp = 'ツつィツ絵ツで?ツで、') or |
| 252 |
(tmp = 'ツ運ツ営ツ暗?毒?#39;) or |
| 253 |
(tmp = 'ツツツーツδ仰稜「') or |
| 254 |
(tmp = 'ツ打コツて堋サツイツト') then begin |
| 255 |
cate := ''; |
| 256 |
s := Copy(s, idx + 5, Length(s)); |
| 257 |
Continue; |
| 258 |
end; |
| 259 |
} |
| 260 |
s := Copy(s, idx + 5, Length(s)); |
| 261 |
cate := tmp; |
| 262 |
end else begin |
| 263 |
//<a href= |
| 264 |
if cate = '' then begin |
| 265 |
s := Copy(s, idx2 + 2, Length(s)); |
| 266 |
end else begin |
| 267 |
idx := AnsiPos('</a>', s); |
| 268 |
tmp := Copy(s, idx2, (idx - idx2) + 4); |
| 269 |
tmp := CustomStringReplace(tmp, '<a href=', ''); |
| 270 |
tmp := CustomStringReplace(tmp, '</a>', ''); |
| 271 |
tmp := CustomStringReplace(tmp, 'TARGET=_blank', ''); |
| 272 |
i := AnsiPos('>', tmp); |
| 273 |
if i <> 0 then begin |
| 274 |
URL := Trim(Copy(tmp, 1, i - 1)); |
| 275 |
Title := Copy(tmp, i + 1, Length(tmp)); |
| 276 |
// BBSsツで楪凝ウツ妥篠催エ |
| 277 |
if Length(BBSs) = 0 then begin |
| 278 |
Board := nil; |
| 279 |
end else begin |
| 280 |
Board := BBSs[ 0 ].FindBoardFromTitle(Title); |
| 281 |
end; |
| 282 |
if Board = nil then begin |
| 283 |
MessageMemo.Lines.Add('ツ新ツ氾つ津?嘉?「' + Title + '(' + URL + ')ツ」'); |
| 284 |
ini.WriteString(cate, Title, URL); |
| 285 |
Change := True; |
| 286 |
end else begin |
| 287 |
if Board.URL <> URL then begin |
| 288 |
MessageMemo.Lines.Add('URLツ米篠更ツ「' + Board.Title + '(' + URL +')ツ」'); |
| 289 |
ini.WriteString(cate, Title, URL); |
| 290 |
oldURLs.Add(Board.URL); |
| 291 |
newURLs.Add(URL); |
| 292 |
Change := True; |
| 293 |
end else begin |
| 294 |
ini.WriteString(cate, Title, URL); |
| 295 |
end; |
| 296 |
end; |
| 297 |
end else begin |
| 298 |
s := Copy(s, idx2 + 2, Length(s)); |
| 299 |
Continue; |
| 300 |
end; |
| 301 |
s := Copy(s, idx + 5, Length(s)); |
| 302 |
end; |
| 303 |
end; |
| 304 |
end; |
| 305 |
// ツカツテツゴツδ?ツ氾つで楪個クツづ?ね敖でセツでサツでセツて?hangeツフツδ可グツで楪ね敖ね敖て個ね伉て?で、ツて堋妥篠催エ |
| 306 |
if not Change then begin |
| 307 |
Change := CheckDeleteItem(ini); |
| 308 |
end; |
| 309 |
finally |
| 310 |
if Change then |
| 311 |
ini.UpdateFile; |
| 312 |
ini.Free; |
| 313 |
end; |
| 314 |
MessageMemo.Lines.Add(''); |
| 315 |
if Change then begin |
| 316 |
GikoForm.FavoritesURLReplace(oldURLs, newURLs); |
| 317 |
GikoForm.RoundListURLReplace(oldURLs, newURLs); |
| 318 |
GikoForm.TabFileURLReplace(oldURLs, newURLs); |
| 319 |
MessageMemo.Lines.Add('ツ新ツ氾つ、ツ氾6RLツ米篠更ツチツェツッツクツで楪看スツ稜。ツてセツづ慊てセツね?#39;); |
| 320 |
MessageMemo.Lines.Add('ツ「ツ陛つで崢づゥツ」ツボツタツδ督て堕可淞てセツづ?つュツでセツでつね?#39;); |
| 321 |
end else |
| 322 |
MessageMemo.Lines.Add('ツ新ツ氾つ、ツ氾6RLツ米篠更ツづ ツつ?ツて債づ慊で。ツで?てケツてセツね?#39;); |
| 323 |
finally |
| 324 |
oldURLs.Free; |
| 325 |
newURLs.Free; |
| 326 |
end; |
| 327 |
Result := Change; |
| 328 |
end; |
| 329 |
//! ツ催ュツ渉慊カツテツゴツδ?ツ氾つチツェツッツク |
| 330 |
function TNewBoardDialog.CheckDeleteItem(ini: TMemIniFile): Boolean; |
| 331 |
var |
| 332 |
URL: string; |
| 333 |
Title: string; |
| 334 |
orgini: TMemIniFile; |
| 335 |
orgStrings, newStrings: TStringList; |
| 336 |
i: Integer; |
| 337 |
begin |
| 338 |
orgini := TMemIniFile.Create(GikoSys.GetBoardFileName); |
| 339 |
orgStrings := TStringList.Create; |
| 340 |
newStrings := TStringList.Create; |
| 341 |
try |
| 342 |
ini.ReadSections(newStrings); |
| 343 |
orgini.ReadSections(orgStrings); |
| 344 |
if (newStrings.Count <> orgStrings.Count) then begin |
| 345 |
//ツカツテツゴツδ環津?嘉?づ債、ツ氾つで楪津?嘉?づ可て個づゥツて堋てケツチツェツッツクツてセツて個つュツづ?で閉ね伉ね?/span> |
| 346 |
//ツカツテツゴツδ環て堋催ュツ渉慊チツェツッツク |
| 347 |
for i := 0 to orgStrings.Count - 1 do begin |
| 348 |
if (newStrings.IndexOf(orgStrings[i]) = -1) then begin |
| 349 |
MessageMemo.Lines.Add('ツカツテツゴツδ環催ュツ渉慊「' + orgStrings[i] + 'ツ」'); |
| 350 |
end; |
| 351 |
end; |
| 352 |
Result := True; |
| 353 |
end else begin |
| 354 |
// ツ氾つて堋青板チツェツッツク |
| 355 |
ini.GetStrings(newStrings); |
| 356 |
orgini.GetStrings(orgStrings); |
| 357 |
if (newStrings.Count <> orgStrings.Count) then begin |
| 358 |
// ツ氾つて堋催ュツ渉慊チツェツッツク |
| 359 |
for i := 0 to orgStrings.Count - 1 do begin |
| 360 |
if (newStrings.IndexOf(orgStrings[i]) = -1) then begin |
| 361 |
Title := Copy(orgStrings[i], 1 , AnsiPos('=',orgStrings[i]) - 1); |
| 362 |
URL := Copy(orgStrings[i], |
| 363 |
AnsiPos('=',orgStrings[i]) + 1, Length(orgStrings[i])); |
| 364 |
MessageMemo.Lines.Add('ツ氾つ催ュツ渉慊「' + Title + '(' + URL +')ツ」'); |
| 365 |
end; |
| 366 |
end; |
| 367 |
Result := True; |
| 368 |
end; |
| 369 |
end; |
| 370 |
finally |
| 371 |
orgStrings.Free; |
| 372 |
newStrings.Free; |
| 373 |
orgini.Free; |
| 374 |
end; |
| 375 |
end; |
| 376 |
procedure TNewBoardDialog.FormCreate(Sender: TObject); |
| 377 |
begin |
| 378 |
StopButton.Enabled := False; |
| 379 |
BoardURLComboBox.Clear; |
| 380 |
BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs); |
| 381 |
try |
| 382 |
BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1; |
| 383 |
except |
| 384 |
BoardURLComboBox.ItemIndex := 0; |
| 385 |
end; |
| 386 |
SetIgnoreCategory(false); |
| 387 |
end; |
| 388 |
//ツ氾つ更ツ新ツて堋渉慊外ツカツテツゴツδ環δ環スツトツて堋登ツ録 |
| 389 |
{['ツつィツね?ね?づ?#39;, 'ツ禿?米伉甘ゥツ夏?#39;, 'ツづ慊でシツBツBツS', 'ツチツδδッツト', 'ツつィツ絵ツで?ツで、', 'ツ運ツ営ツ暗?毒?#39;, 'ツツツーツδ仰稜「', 'ツ打コツて堋サツイツト']} |
| 390 |
procedure TNewBoardDialog.SetIgnoreCategory(b: boolean); |
| 391 |
begin |
| 392 |
IgnoreLists := TStringList.Create; |
| 393 |
if not( FileExists(GikoSys.Setting.GetIgnoreFileName) ) or ( b )then begin |
| 394 |
IgnoreLists.Add('ツつィツね?ね?づ?#39;); |
| 395 |
IgnoreLists.Add('ツ禿?米伉甘ゥツ夏?#39;); |
| 396 |
IgnoreLists.Add('ツづ慊でシツBツBツS'); |
| 397 |
IgnoreLists.Add('ツチツδδッツト'); |
| 398 |
IgnoreLists.Add('ツつィツ絵ツで?ツで、'); |
| 399 |
IgnoreLists.Add('ツ運ツ営ツ暗?毒?#39;); |
| 400 |
IgnoreLists.Add('ツツツーツδ仰稜「'); |
| 401 |
IgnoreLists.Add('ツ打コツて堋サツイツト'); |
| 402 |
end else begin |
| 403 |
try |
| 404 |
IgnoreLists.LoadFromFile(GikoSys.Setting.GetIgnoreFileName); |
| 405 |
except |
| 406 |
IgnoreLists.Free; |
| 407 |
SetIgnoreCategory(true); |
| 408 |
end; |
| 409 |
end; |
| 410 |
end; |
| 411 |
|
| 412 |
procedure TNewBoardDialog.EditIgnoreListsButtonClick(Sender: TObject); |
| 413 |
begin |
| 414 |
EditIgnoreList(Sender); |
| 415 |
EditIgnoreListsButton.OnClick := UpdateIgnoreList; |
| 416 |
end; |
| 417 |
procedure TNewBoardDialog.EditIgnoreList(Sender: TObject); |
| 418 |
var |
| 419 |
i: Integer; |
| 420 |
begin |
| 421 |
EditIgnoreListsButton.Caption := 'ツ渉慊外ツカツテツゴツδ環ーツ更ツ新'; |
| 422 |
Label2.Caption := 'ツ各ツ1ツ行ツづ可カツテツゴツδ環滅コツて堕記ツ禿シツてセツづ?つュツでセツでつね伉。ツ(ツ嘉シツ行ツづ垢trl+Enterツ)'; |
| 423 |
UpdateButton.Enabled := false; |
| 424 |
//MessageMemo.ReadOnly := false; |
| 425 |
MessageMemo.Clear; |
| 426 |
for i := 0 to IgnoreLists.Count - 1 do |
| 427 |
MessageMemo.Lines.Add(IgnoreLists[i]); |
| 428 |
end; |
| 429 |
procedure TNewBoardDialog.UpdateIgnoreList(Sender: TObject); |
| 430 |
var |
| 431 |
i: Integer; |
| 432 |
begin |
| 433 |
Label2.Caption := ''; |
| 434 |
UpdateButton.Enabled := true; |
| 435 |
EditIgnoreListsButton.Caption := 'ツ渉慊外ツカツテツゴツδ環ーツ頁?集'; |
| 436 |
IgnoreLists.Clear; |
| 437 |
for i := 0 to MessageMemo.Lines.Count - 1 do |
| 438 |
IgnoreLists.Add(MessageMemo.Lines[i]); |
| 439 |
IgnoreLists.SaveToFile(GikoSys.Setting.GetIgnoreFileName); |
| 440 |
IgnoreLists.Free; |
| 441 |
SetIgnoreCategory(false); |
| 442 |
//MessageMemo.ReadOnly := true; |
| 443 |
MessageMemo.Clear; |
| 444 |
EditIgnoreListsButton.OnClick := EditIgnoreListsButtonClick; |
| 445 |
end; |
| 446 |
|
| 447 |
procedure TNewBoardDialog.FormClose(Sender: TObject; |
| 448 |
var Action: TCloseAction); |
| 449 |
begin |
| 450 |
IgnoreLists.Free; |
| 451 |
end; |
| 452 |
//! ツδ債ーツカツδ仰フツァツイツδ仰て堕δ債ーツドツね?づゥ |
| 453 |
function TNewBoardDialog.BoardLoardFromFile(const FilePath: String): String; |
| 454 |
var |
| 455 |
html : TStringList; |
| 456 |
begin |
| 457 |
Result := ''; |
| 458 |
// ツフツァツイツδ仰で楪打崢催敖てセツづ?ね伉づゥツで?ツチツェツッツク |
| 459 |
if (FileExists(FilePath)) then begin |
| 460 |
html := TStringList.Create(); |
| 461 |
try |
| 462 |
html.LoadFromFile(FilePath); |
| 463 |
Result := html.Text; |
| 464 |
finally |
| 465 |
html.Free; |
| 466 |
end; |
| 467 |
end; |
| 468 |
end; |
| 469 |
|
| 470 |
class procedure TNewBoardDialog.InitHTTPClient(client : TIdHTTP); |
| 471 |
begin |
| 472 |
client.Request.Clear; |
| 473 |
client.Request.CustomHeaders.Clear; |
| 474 |
client.Request.UserAgent := GikoSys.GetUserAgent; |
| 475 |
client.RecvBufferSize := Gikosys.Setting.RecvBufferSize; |
| 476 |
client.ProxyParams.BasicAuthentication := False; |
| 477 |
client.ReadTimeout := GikoSys.Setting.ReadTimeOut; |
| 478 |
|
| 479 |
if GikoSys.Setting.ReadProxy then begin |
| 480 |
if GikoSys.Setting.ProxyProtocol then |
| 481 |
client.ProtocolVersion := pv1_1 |
| 482 |
else |
| 483 |
client.ProtocolVersion := pv1_0; |
| 484 |
client.ProxyParams.ProxyServer := GikoSys.Setting.ReadProxyAddress; |
| 485 |
client.ProxyParams.ProxyPort := GikoSys.Setting.ReadProxyPort; |
| 486 |
client.ProxyParams.ProxyUsername := GikoSys.Setting.ReadProxyUserID; |
| 487 |
client.ProxyParams.ProxyPassword := GikoSys.Setting.ReadProxyPassword; |
| 488 |
if GikoSys.Setting.ReadProxyUserID <> '' then |
| 489 |
client.ProxyParams.BasicAuthentication := True; |
| 490 |
end else begin |
| 491 |
if GikoSys.Setting.Protocol then |
| 492 |
client.ProtocolVersion := pv1_1 |
| 493 |
else |
| 494 |
client.ProtocolVersion := pv1_0; |
| 495 |
client.ProxyParams.ProxyServer := ''; |
| 496 |
client.ProxyParams.ProxyPort := 80; |
| 497 |
client.ProxyParams.ProxyUsername := ''; |
| 498 |
client.ProxyParams.ProxyPassword := ''; |
| 499 |
end; |
| 500 |
end; |
| 501 |
end. |