Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/NewBoard.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11 by h677, Tue Mar 30 12:44:57 2004 UTC revision 1.12 by h677, Mon May 3 14:13:58 2004 UTC
# Line 18  type Line 18  type
18                  Label1: TLabel;                  Label1: TLabel;
19                  MessageMemo: TMemo;                  MessageMemo: TMemo;
20                  UpdateButton: TButton;                  UpdateButton: TButton;
21      CloseButton: TButton;          CloseButton: TButton;
22                  Indy: TIdHTTP;                  Indy: TIdHTTP;
23                  IdAntiFreeze: TIdAntiFreeze;                  IdAntiFreeze: TIdAntiFreeze;
24                  StopButton: TButton;                  StopButton: TButton;
25                  Label2: TLabel;                  Label2: TLabel;
26      BoardURLComboBox: TComboBox;          BoardURLComboBox: TComboBox;
27      Label13: TLabel;          Label13: TLabel;
28            EditIgnoreListsButton: TButton;
29                  procedure UpdateButtonClick(Sender: TObject);                  procedure UpdateButtonClick(Sender: TObject);
30                  procedure StopButtonClick(Sender: TObject);                  procedure StopButtonClick(Sender: TObject);
31                  procedure CloseButtonClick(Sender: TObject);                  procedure CloseButtonClick(Sender: TObject);
32                  procedure FormCreate(Sender: TObject);                  procedure FormCreate(Sender: TObject);
33            procedure EditIgnoreListsButtonClick(Sender: TObject);
34        procedure FormClose(Sender: TObject; var Action: TCloseAction);
35          private          private
36                  { Private 宣言 }                  { Private 宣言 }
37                    IgnoreLists : TStringList;
38                  FAbort: Boolean;                  FAbort: Boolean;
39                  function BoardDownload: TNewBoardItem;                  function BoardDownload: TNewBoardItem;
40                  procedure UpdateURL(s: string);                  procedure UpdateURL(s: string);
41                    procedure SetIgnoreCategory(b: boolean);
42                    procedure EditIgnoreList(Sender: TObject);
43                    procedure UpdateIgnoreList(Sender: TObject);
44          public          public
45                  { Public 宣言 }                  { Public 宣言 }
46          end;          end;
# Line 41  type Line 48  type
48  var  var
49          NewBoardDialog: TNewBoardDialog;          NewBoardDialog: TNewBoardDialog;
50    
51    
52  implementation  implementation
53    
54  uses Giko, IdHeaderList;  uses Giko, IdHeaderList;
# Line 170  end; Line 178  end;
178  procedure TNewBoardDialog.UpdateURL(s: string);  procedure TNewBoardDialog.UpdateURL(s: string);
179  var  var
180          i: Integer;          i: Integer;
181            j: Integer;
182          idx: Integer;          idx: Integer;
183          idx1: Integer;          idx1: Integer;
184          idx2: Integer;          idx2: Integer;
# Line 179  var Line 188  var
188          cate: string;          cate: string;
189          Board: TBoard;          Board: TBoard;
190          Change: Boolean;          Change: Boolean;
191            Ignore: Boolean;
192          ini: TMemIniFile;          ini: TMemIniFile;
193      oldURLs : TStringList;          oldURLs : TStringList;
194      newURLs : TStringList;          newURLs : TStringList;
195  begin  begin
196          Change := False;          Change := False;
197          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');
# Line 193  begin Line 203  begin
203          s := CustomStringReplace(s, '</A', '</a', true);          s := CustomStringReplace(s, '</A', '</a', true);
204          cate := '';          cate := '';
205    
206      oldURLs := TStringList.Create;          oldURLs := TStringList.Create;
207      newURLs := TStringList.Create;          newURLs := TStringList.Create;
208    
209          try          try
210    
# Line 221  begin Line 231  begin
231                                          tmp := Copy(s, idx1, (idx - idx1) + 4);                                          tmp := Copy(s, idx1, (idx - idx1) + 4);
232                                          tmp := CustomStringReplace(tmp, '<b>', '');                                          tmp := CustomStringReplace(tmp, '<b>', '');
233                                          tmp := CustomStringReplace(tmp, '</b>', '');                                          tmp := CustomStringReplace(tmp, '</b>', '');
234                                            Ignore := false;
235                                            for i := 0 to IgnoreLists.Count - 1 do begin
236                                                    if tmp = Trim(IgnoreLists[i]) then begin
237                                                            cate := '';
238                                                            s := Copy(s, idx + 5, Length(s));
239                                                            Ignore := True;
240                                                            break;
241                                                    end;
242                                            end;
243                                            if Ignore then
244                                                    Continue;
245                                            {
246                                          if (tmp = 'おすすめ') or                                          if (tmp = 'おすすめ') or
247                                                   (tmp = '特別企画') or                                                   (tmp = '特別企画') or
248                                                   (tmp = 'まちBBS') or                                                   (tmp = 'まちBBS') or
# Line 234  begin Line 255  begin
255                                                  s := Copy(s, idx + 5, Length(s));                                                  s := Copy(s, idx + 5, Length(s));
256                                                  Continue;                                                  Continue;
257                                          end;                                          end;
258                                            }
259                                          s := Copy(s, idx + 5, Length(s));                                          s := Copy(s, idx + 5, Length(s));
260                                          cate := tmp;                                          cate := tmp;
261                                  end else begin                                  end else begin
# Line 290  begin Line 312  begin
312      finally      finally
313          oldURLs.Free;          oldURLs.Free;
314          newURLs.Free;          newURLs.Free;
315      end;          end;
316  end;  end;
317    
318  procedure TNewBoardDialog.FormCreate(Sender: TObject);  procedure TNewBoardDialog.FormCreate(Sender: TObject);
319  begin  begin
320          StopButton.Enabled := False;          StopButton.Enabled := False;
321      BoardURLComboBox.Clear;          BoardURLComboBox.Clear;
322      BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);          BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
323      try          try
324          BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;                  BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
325      except          except
326          BoardURLComboBox.ItemIndex := 0;                  BoardURLComboBox.ItemIndex := 0;
327      end;          end;
328            SetIgnoreCategory(false);
329    end;
330    //板更新の除外カテゴリリストの登録
331    {['おすすめ', '特別企画', 'まちBBS', 'チャット', 'お絵かき', '運営案内', 'ツール類', '他のサイト']}
332    procedure TNewBoardDialog.SetIgnoreCategory(b: boolean);
333    begin
334            IgnoreLists := TStringList.Create;
335            if not( FileExists(GikoSys.Setting.GetIgnoreFileName) ) or ( b )then begin
336                    IgnoreLists.Add('おすすめ');
337                    IgnoreLists.Add('特別企画');
338                    IgnoreLists.Add('まちBBS');
339                    IgnoreLists.Add('チャット');
340                    IgnoreLists.Add('お絵かき');
341                    IgnoreLists.Add('運営案内');
342                    IgnoreLists.Add('ツール類');
343                    IgnoreLists.Add('他のサイト');
344            end else begin
345                    try
346                            IgnoreLists.LoadFromFile(GikoSys.Setting.GetIgnoreFileName);
347                    except
348                            IgnoreLists.Free;
349                            SetIgnoreCategory(true);
350                    end;
351            end;
352    end;
353    
354    procedure TNewBoardDialog.EditIgnoreListsButtonClick(Sender: TObject);
355    begin
356            EditIgnoreList(Sender);
357            EditIgnoreListsButton.OnClick := UpdateIgnoreList;
358    end;
359    procedure TNewBoardDialog.EditIgnoreList(Sender: TObject);
360    var
361            i: Integer;
362    begin
363            EditIgnoreListsButton.Caption := '除外カテゴリー更新';
364            Label2.Caption := '各1行にカテゴリ名を記入してください。(改行はCtrl+Enter)';
365            UpdateButton.Enabled := false;
366            //MessageMemo.ReadOnly := false;
367            MessageMemo.Clear;
368            for i := 0 to IgnoreLists.Count - 1 do
369                    MessageMemo.Lines.Add(IgnoreLists[i]);
370    end;
371    procedure TNewBoardDialog.UpdateIgnoreList(Sender: TObject);
372    var
373            i: Integer;
374    begin
375            Label2.Caption := '※現在、開いているタブやヒストリなどは板更新時にクリアされます';
376        UpdateButton.Enabled := true;
377            EditIgnoreListsButton.Caption := '除外カテゴリー編集';
378            IgnoreLists.Clear;
379            for i := 0 to MessageMemo.Lines.Count - 1 do
380                    IgnoreLists.Add(MessageMemo.Lines[i]);
381            IgnoreLists.SaveToFile(GikoSys.Setting.GetIgnoreFileName);
382            IgnoreLists.Free;
383            SetIgnoreCategory(false);
384            //MessageMemo.ReadOnly := true;
385            MessageMemo.Clear;
386            EditIgnoreListsButton.OnClick := EditIgnoreListsButtonClick;
387    end;
388    
389    procedure TNewBoardDialog.FormClose(Sender: TObject;
390      var Action: TCloseAction);
391    begin
392            IgnoreLists.Free;
393  end;  end;
394    
395  end.  end.

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26