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.3 by h677, Sun Oct 5 14:31:47 2003 UTC revision 1.3.2.1 by yoffy, Mon Apr 19 22:46:49 2004 UTC
# Line 6  uses Line 6  uses
6          Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,          Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7          Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,          Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
8          IdTCPConnection, IdTCPClient, IdHTTP, IDException, StdCtrls, IniFiles,          IdTCPConnection, IdTCPClient, IdHTTP, IDException, StdCtrls, IniFiles,
9          GikoSystem, BoardGroup;          GikoSystem, BoardGroup, MojuUtils;
10    
11  type  type
12          TNewBoardItem = record          TNewBoardItem = record
# Line 180  var Line 180  var
180          Board: TBoard;          Board: TBoard;
181          Change: Boolean;          Change: Boolean;
182          ini: TMemIniFile;          ini: TMemIniFile;
183        oldURLs : TStringList;
184        newURLs : TStringList;
185  begin  begin
186          Change := False;          Change := False;
187          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');          MessageMemo.Lines.Add('新板、板URL変更チェックを開始します');
188          MessageMemo.Lines.Add('');          MessageMemo.Lines.Add('');
189          s := StringReplace(s, '<B>', '<b>', [rfReplaceAll, rfIgnoreCase]);          s := CustomStringReplace(s, '<B>', '<b>', true);
190          s := StringReplace(s, '<BR>', '<br>', [rfReplaceAll, rfIgnoreCase]);          s := CustomStringReplace(s, '<BR>', '<br>', true);
191          s := StringReplace(s, '</B>', '</b>', [rfReplaceAll, rfIgnoreCase]);          s := CustomStringReplace(s, '</B>', '</b>', true);
192          s := StringReplace(s, '<A HREF', '<a href', [rfReplaceAll, rfIgnoreCase]);          s := CustomStringReplace(s, '<A HREF', '<a href', true);
193          s := StringReplace(s, '</A', '</a', [rfReplaceAll, rfIgnoreCase]);          s := CustomStringReplace(s, '</A', '</a', true);
194          cate := '';          cate := '';
195          GikoSys.ForceDirectoriesEx(GikoSys.GetConfigDir);  
196          ini := TMemIniFile.Create(GikoSys.GetBoardFileName);      oldURLs := TStringList.Create;
197        newURLs := TStringList.Create;
198    
199          try          try
                 //  
                 //削除オプションが選択されている場合はクリア  
200    
201                  ini.Clear;                  GikoSys.ForceDirectoriesEx(GikoSys.GetConfigDir);
202                  while True do begin                  ini := TMemIniFile.Create(GikoSys.GetBoardFileName);
203                          idx1 := AnsiPos('<b>', s);                  try
204                          idx2 := AnsiPos('<a', s);                          //
205                          if (idx1 = 0) and (idx2 = 0) then Break;                          //削除オプションが選択されている場合はクリア
206    
207                          if idx1 < idx2 then begin                          ini.Clear;
208                                  //<br>  
209                                  idx := AnsiPos('</b>', s);                          while True do begin
210                                  if idx = 0 then begin                                  idx1 := AnsiPos('<b>', s);
211                                          s := Copy(s, idx1 + 4, Length(s));                                  idx2 := AnsiPos('<a', s);
212                                          continue;                                  if (idx1 = 0) and (idx2 = 0) then Break;
213                                  end;  
214                                  tmp := Copy(s, idx1, (idx - idx1) + 4);                                  if idx1 < idx2 then begin
215                                  tmp := StringReplace(tmp, '<b>', '', [rfReplaceAll]);                                          //<br>
216                                  tmp := StringReplace(tmp, '</b>', '', [rfReplaceAll]);                                          idx := AnsiPos('</b>', s);
217                                            if idx = 0 then begin
218                                  if (tmp = 'おすすめ') or                                                  s := Copy(s, idx1 + 4, Length(s));
219                                           (tmp = '特別企画') or                                                  continue;
220                                           (tmp = 'まちBBS') or                                          end;
221                                           (tmp = 'チャット') or                                          tmp := Copy(s, idx1, (idx - idx1) + 4);
222                                           (tmp = 'お絵かき') or                                          tmp := CustomStringReplace(tmp, '<b>', '');
223                                           (tmp = '運営') or                                          tmp := CustomStringReplace(tmp, '</b>', '');
224                                           (tmp = 'ツール類') or  
225                                           (tmp = '他のサイト') then begin                                          if (tmp = 'おすすめ') or
226                                          cate := '';                                                   (tmp = '特別企画') or
227                                                     (tmp = 'まちBBS') or
228                                                     (tmp = 'チャット') or
229                                                     (tmp = 'お絵かき') or
230                                                     (tmp = '運営案内') or
231                                                     (tmp = 'ツール類') or
232                                                     (tmp = '他のサイト') then begin
233                                                    cate := '';
234                                                    s := Copy(s, idx + 5, Length(s));
235                                                    Continue;
236                                            end;
237                                          s := Copy(s, idx + 5, Length(s));                                          s := Copy(s, idx + 5, Length(s));
238                                          Continue;                                          cate := tmp;
                                 end;  
                                 s := Copy(s, idx + 5, Length(s));  
                                 cate := tmp;  
                         end else begin  
                                 //<a href=  
                                 if cate = '' then begin  
                                         s := Copy(s, idx2 + 2, Length(s));  
239                                  end else begin                                  end else begin
240                                          idx := AnsiPos('</a>', s);                                          //<a href=
241                                          tmp := Copy(s, idx2, (idx - idx2) + 4);                                          if cate = '' then begin
242                                          tmp := StringReplace(tmp, '<a href=', '', [rfReplaceAll]);                                                  s := Copy(s, idx2 + 2, Length(s));
243                                          tmp := StringReplace(tmp, '</a>', '', [rfReplaceAll]);                                          end else begin
244                                          i := AnsiPos('>', tmp);                                                  idx := AnsiPos('</a>', s);
245                                          if i <> 0 then begin                                                  tmp := Copy(s, idx2, (idx - idx2) + 4);
246                                                  URL := Copy(tmp, 1, i - 1);                                                  tmp := CustomStringReplace(tmp, '<a href=', '');
247                                                  Title := Copy(tmp, i + 1, Length(tmp));                                                  tmp := CustomStringReplace(tmp, '</a>', '');
248                                                  Board := BBS2ch.FindBoardFromTitle(Title);                          tmp := CustomStringReplace(tmp, 'TARGET=_blank', '');
249                                                  if Board = nil then begin                                                  i := AnsiPos('>', tmp);
250                                                          MessageMemo.Lines.Add('新板追加「' + Title + '(' + URL + ')」');                                                  if i <> 0 then begin
251                                                          ini.WriteString(cate, Title, URL);                                                          URL := Copy(tmp, 1, i - 1);
252                                                          Change := True;                                                          Title := Copy(tmp, i + 1, Length(tmp));
253                                Board := BBSs[ 0 ].FindBoardFromTitle(Title);
254                                if Board = nil then begin
255                                    MessageMemo.Lines.Add('新板追加「' + Title + '(' + URL + ')」');
256                                    ini.WriteString(cate, Title, URL);
257                                    Change := True;
258                                end else begin
259                                    if Board.URL <> URL then begin
260                                            MessageMemo.Lines.Add('URL変更「' + Board.Title + '(' + URL +')」');
261                                        ini.WriteString(cate, Title, URL);
262                                        oldURLs.Add(Board.URL);
263                                        newURLs.Add(URL);
264                                        Change := True;
265                                    end else begin
266                                            ini.WriteString(cate, Title, URL);
267                                    end;
268                                end;
269                                                  end else begin                                                  end else begin
270                                                          if Board.URL <> URL then begin                                                          s := Copy(s, idx2 + 2, Length(s));
271                                                                  MessageMemo.Lines.Add('URL変更「' + Board.Title + '(' + URL +')」');                                                          Continue;
                                                                 ini.WriteString(cate, Title, URL);  
                                                                 Change := True;  
                                                         end else begin  
                                                                 ini.WriteString(cate, Title, URL);  
                                                         end;  
272                                                  end;                                                  end;
273                                          end else begin                                                  s := Copy(s, idx + 5, Length(s));
                                                 s := Copy(s, idx2 + 2, Length(s));  
                                                 Continue;  
274                                          end;                                          end;
                                         s := Copy(s, idx + 5, Length(s));  
275                                  end;                                  end;
276                          end;                          end;
277                    finally
278                            if Change then
279                                    ini.UpdateFile;
280                            ini.Free;
281                  end;                  end;
282          finally                  MessageMemo.Lines.Add('');
283                  if Change then              if Change then begin
284                          ini.UpdateFile;              GikoForm.FavoritesURLReplace(oldURLs, newURLs);
285                  ini.Free;              GikoForm.RoundListURLReplace(oldURLs, newURLs);
286          end;                          MessageMemo.Lines.Add('新板、板URL変更チェックが完了しました');
287          MessageMemo.Lines.Add('');                          MessageMemo.Lines.Add('「閉じる」ボタンを押してください');
288          if Change then begin                  end else
289                  MessageMemo.Lines.Add('新板、板URL変更チェックが完了しました');                          MessageMemo.Lines.Add('新板、板URL変更は ありませんでした');
290                  MessageMemo.Lines.Add('「閉じる」ボタンを押してください');      finally
291          end else          oldURLs.Free;
292                  MessageMemo.Lines.Add('新板、板URL変更は ありませんでした');          newURLs.Free;
293        end;
294  end;  end;
295    
296  procedure TNewBoardDialog.FormCreate(Sender: TObject);  procedure TNewBoardDialog.FormCreate(Sender: TObject);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.3.2.1

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