Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/RoundData.pas

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

revision 1.19.2.3 by h677, Sat Jun 4 02:51:09 2005 UTC revision 1.26 by eggcake, Fri Oct 10 13:41:33 2008 UTC
# Line 38  type Line 38  type
38                  property Count[RoundType: TGikoRoundType]: Integer read GetCount;                  property Count[RoundType: TGikoRoundType]: Integer read GetCount;
39          property OldFileRead: Boolean read FOldFileRead;          property OldFileRead: Boolean read FOldFileRead;
40                  property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem;                  property Items[Index: integer; RoundType: TGikoRoundType]: TRoundItem read GetRoundItem;
                 //procedure SetRoundName(Board: TBoard; RoundName: string); overload;  
                 //procedure SetRoundName(ThreadItem: TThreadItem; RoundName: string); overload;  
   
41                  procedure LoadRoundBoardFile;                  procedure LoadRoundBoardFile;
42          procedure LoadRoundThreadFile;          procedure LoadRoundThreadFile;
43                  procedure SaveRoundFile;                  procedure SaveRoundFile;
# Line 50  type Line 47  type
47    
48          TRoundItem = class(TObject)          TRoundItem = class(TObject)
49          private          private
 //  
50                  FItem           : TObject;                  FItem           : TObject;
                 FBBSType: TGikoBBSType;  
                 FRoundName: string;  
51                  FRoundType: TGikoRoundType;                  FRoundType: TGikoRoundType;
         //Item                  : TObject;  
                 //FURL          : string;  
                 //FBoardTitle: string;  
                 //FThreadTitle: string;  
                 //FFileName: string;  
52                  FTmpURL : string;                  FTmpURL : string;
53                  FBoolData: Boolean;             //いろいろ使うょぅ                  FBoolData: Boolean;             //いろいろ使うょぅ
54                  function GetBoardTitle : string;                  function GetBoardTitle : string;
55                  function GetThreadTitle : string;                  function GetThreadTitle : string;
56                  function GetURL : string;                  function GetURL : string;
57                  function GetFileName : string;                  function GetFileName : string;
58            //! 巡回名取得
59            function GetRoundName : string;
60          public          public
   
61                  constructor Create;                  constructor Create;
62                  property Item : TObject read FItem;                  property Item : TObject read FItem;
63          //property BBSType: TGikoBBSType read FBBSType write FBBSType;                  property RoundName: string read GetRoundName;
                 property RoundName: string read FRoundName write FRoundName;  
64                  property RoundType: TGikoRoundType read FRoundType write FRoundType;                  property RoundType: TGikoRoundType read FRoundType write FRoundType;
         //property Item : TObject read FItem write FItem;  
65                  property URL : string read GetURL;                  property URL : string read GetURL;
66                  property TmpURL : string read FTmpURL write FTmpURL;                  property TmpURL : string read FTmpURL write FTmpURL;
67                  property BoardTitle: string read GetBoardTitle;                  property BoardTitle: string read GetBoardTitle;
# Line 92  const Line 80  const
80          ROUND_INDEX_VERSION: string = '2.00';          ROUND_INDEX_VERSION: string = '2.00';
81      ERROR_BOARD_FILENAME: string = 'ErrorBoard.2ch'; //Error行を保管する      ERROR_BOARD_FILENAME: string = 'ErrorBoard.2ch'; //Error行を保管する
82      ERROR_ITEM_FILENAME: string = 'ErrorItem.2ch'; //Error行を保管する      ERROR_ITEM_FILENAME: string = 'ErrorItem.2ch'; //Error行を保管する
83    //! 巡回アイテムコンストラクタ
84  constructor TRoundItem.Create;  constructor TRoundItem.Create;
85  begin  begin
86          inherited Create;          inherited Create;
87  end;  end;
88    //! 板名取得
89  function TRoundItem.GetBoardTitle : string;  function TRoundItem.GetBoardTitle : string;
90  begin  begin
91          Result := '';          Result := '';
# Line 107  begin Line 97  begin
97                  end;                  end;
98          end;          end;
99  end;  end;
100    //! スレッド名取得
101  function TRoundItem.GetThreadTitle : string;  function TRoundItem.GetThreadTitle : string;
102  begin  begin
103          Result := '';          Result := '';
# Line 116  begin Line 107  begin
107                  end;                  end;
108          end;          end;
109  end;  end;
110    //! URL取得
111  function TRoundItem.GetURL      : string;  function TRoundItem.GetURL      : string;
112  begin  begin
113          Result := '';          Result := '';
# Line 127  begin Line 119  begin
119                  end;                  end;
120          end;          end;
121  end;  end;
122    //! スレッドのファイ名取得
123  function TRoundItem.GetFileName : string;  function TRoundItem.GetFileName : string;
124  begin  begin
125          Result := '';          Result := '';
# Line 136  begin Line 129  begin
129                  end;                  end;
130          end;          end;
131  end;  end;
132    //! 巡回名取得
133    function TRoundItem.GetRoundName : string;
134    begin
135            Result := '';
136            if( Self.FItem <> nil) then begin
137                    if( Self.FItem is TBoard) then begin
138                            Result := TBoard(Self.FItem).RoundName;
139                    end else if( Self.FItem is TThreadItem) then begin
140                            Result := TThreadItem(Self.FItem).RoundName;
141                    end;
142            end;
143    end;
144    //! 巡回リストコンストラクタ
145  constructor TRoundList.Create;  constructor TRoundList.Create;
146  begin  begin
147          inherited;          inherited;
# Line 146  begin Line 152  begin
152          RoundNameList.Duplicates := dupIgnore;          RoundNameList.Duplicates := dupIgnore;
153      FOldFileRead := false;      FOldFileRead := false;
154  end;  end;
155    //! 巡回リストデストラクタ
156  destructor TRoundList.Destroy;  destructor TRoundList.Destroy;
157  begin  begin
158          RoundNameList.Free;          RoundNameList.Free;
# Line 155  begin Line 161  begin
161          FItemList.Free;          FItemList.Free;
162          //inherited;          //inherited;
163  end;  end;
164    //! 巡回予約追加(板)
165  function TRoundList.Add(Board: TBoard): Integer;  function TRoundList.Add(Board: TBoard): Integer;
166  var  var
167          idx: Integer;          idx: Integer;
# Line 163  var Line 169  var
169  begin  begin
170      Result := -1;      Result := -1;
171          idx := Find(Board);          idx := Find(Board);
         //RoundNameList.Add(Board.RoundName);  
172          if idx = -1 then begin          if idx = -1 then begin
173                  Item := TRoundItem.Create;                  Item := TRoundItem.Create;
174                  Item.FItem := Board;                  Item.FItem := Board;
175  //              Item.BBSType := gbt2ch; //とりあえず  //              Item.BBSType := gbt2ch; //とりあえず
176                  Item.RoundType := grtBoard;                  Item.RoundType := grtBoard;
 //      Item.Item := Board;  
                 //Item.URL := Board.URL;  
                 //Item.BoardTitle := Board.Title;  
                 //Item.ThreadTitle := '';  
                 //Item.FileName := '';  
                 Item.RoundName := Board.RoundName;  
177                  Result := FBoardList.Add(Item);                  Result := FBoardList.Add(Item);
178          end;          end;
179  end;  end;
180    //! 巡回予約追加(スレッド)
181  function TRoundList.Add(ThreadItem: TThreadItem): Integer;  function TRoundList.Add(ThreadItem: TThreadItem): Integer;
182  var  var
183          idx: Integer;          idx: Integer;
# Line 186  var Line 185  var
185  begin  begin
186      Result := -1;      Result := -1;
187          idx := Find(ThreadItem);          idx := Find(ThreadItem);
         //RoundNameList.Add(ThreadItem.RoundName);  
188          if idx = -1 then begin          if idx = -1 then begin
189                  Item := TRoundItem.Create;                  Item := TRoundItem.Create;
190                  Item.FItem := ThreadItem;                  Item.FItem := ThreadItem;
191  //              Item.BBSType := gbt2ch; //とりあえず  //              Item.BBSType := gbt2ch; //とりあえず
192                  Item.RoundType := grtItem;                  Item.RoundType := grtItem;
 //              Item.Item := ThreadItem;  
                 //Item.URL := Threaditem.URL;  
                 //Item.BoardTitle := ThreadItem.ParentBoard.Title;  
                 //Item.ThreadTitle := ThreadItem.Title;  
                 //Item.FileName := ThreadItem.FileName;  
                 Item.RoundName := ThreadItem.RoundName;  
193                  Result := FItemList.Add(Item);                  Result := FItemList.Add(Item);
194          end;          end;
195  end;  end;
196    //! 巡回予約削除(板)
197  procedure TRoundList.Delete(Board: TBoard);  procedure TRoundList.Delete(Board: TBoard);
198  var  var
199          idx: Integer;          idx: Integer;
 //      Item: TRoundItem;  
200  begin  begin
201          idx := Find(Board);          idx := Find(Board);
202          if idx <> -1 then begin          if idx <> -1 then begin
# Line 214  begin Line 205  begin
205                  FBoardList.Delete(idx);                  FBoardList.Delete(idx);
206          end;          end;
207  end;  end;
208    //! 巡回予約削除(スレッド)
209  procedure TRoundList.Delete(ThreadItem: TThreadItem);  procedure TRoundList.Delete(ThreadItem: TThreadItem);
210  var  var
211          idx: Integer;          idx: Integer;
 //      Item: TRoundItem;  
212  begin  begin
213          idx := Find(ThreadItem);          idx := Find(ThreadItem);
214          if idx <> -1 then begin          if idx <> -1 then begin
# Line 227  begin Line 217  begin
217                  FItemList.Delete(idx);                  FItemList.Delete(idx);
218          end;          end;
219  end;  end;
220    //! 巡回予約消去
221  procedure TRoundList.Clear;  procedure TRoundList.Clear;
222  var  var
223          i: Integer;          i: Integer;
# Line 245  begin Line 235  begin
235          end;          end;
236      FItemList.Capacity := FItemList.Count;      FItemList.Capacity := FItemList.Count;
237  end;  end;
238    //! 巡回予約検索(板)
239  function TRoundList.Find(Board: TBoard): Integer;  function TRoundList.Find(Board: TBoard): Integer;
240  var  var
241          i: Integer;          i: Integer;
# Line 261  begin Line 251  begin
251                  end;                  end;
252          end;          end;
253  end;  end;
254    //! 巡回予約検索(スレッド)
255  function TRoundList.Find(ThreadItem: TThreadItem): Integer;  function TRoundList.Find(ThreadItem: TThreadItem): Integer;
256  var  var
257          i: Integer;          i: Integer;
# Line 277  begin Line 267  begin
267                  end;                  end;
268          end;          end;
269  end;  end;
270    //! 巡回予約検索(URL+アイテムタイプ)
271  function TRoundList.Find(URL: string; RoundType: TGikoRoundType): Integer;  function TRoundList.Find(URL: string; RoundType: TGikoRoundType): Integer;
272  var  var
273          i: Integer;          i: Integer;
# Line 303  begin Line 294  begin
294                  end;                  end;
295      end;      end;
296  end;  end;
297    //! 巡回予約削除(URL+アイテムタイプ)
298  procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType);  procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType);
299  var  var
300          idx: Integer;          idx: Integer;
# Line 318  begin Line 310  begin
310                          board := TBoard(Item);                          board := TBoard(Item);
311                          Item.Free;                          Item.Free;
312                          FBoardList.Delete(idx);                          FBoardList.Delete(idx);
                         //board := BBSsFindBoardFromURL(URL);  
313                          if board <> nil then begin                          if board <> nil then begin
314                                  board.Round := False;                                  board.Round := False;
315                                  board.RoundName := '';                                  board.RoundName := '';
# Line 329  begin Line 320  begin
320                          Item.Free;                          Item.Free;
321                          FItemList.Delete(idx);                          FItemList.Delete(idx);
322    
                         //threadItem := BBSsFindThreadFromURL(URL);  
323              if threadItem <> nil then begin              if threadItem <> nil then begin
324                      threadItem.Round := false;                      threadItem.Round := false;
325                  threadItem.RoundName := '';                  threadItem.RoundName := '';
# Line 337  begin Line 327  begin
327          end;          end;
328          end;          end;
329  end;  end;
330  {  //! 巡回予約数取得
 procedure TRoundList.SetRoundName(Board: TBoard; RoundName: string);  
 var  
         idx: Integer;  
         Item: TRoundItem;  
 begin  
         idx := Find(Board);  
         if idx <> -1 then begin  
                 Item := TRoundItem(FBoardList[idx]);  
                 Item.RoundName := RoundName;  
         end;  
 end;  
 }  
 {  
 procedure TRoundList.SetRoundName(ThreadItem: TThreadItem; RoundName: string);  
 var  
         idx: Integer;  
         Item: TRoundItem;  
 begin  
         idx := Find(ThreadItem);  
         if idx <> -1 then begin  
                 Item := TRoundItem(FItemList[idx]);  
                 Item.RoundName := RoundName;  
         end;  
 end;  
 }  
331  function TRoundList.GetCount(RoundType: TGikoRoundType): Integer;  function TRoundList.GetCount(RoundType: TGikoRoundType): Integer;
332  begin  begin
333          Result := 0;          Result := 0;
# Line 371  begin Line 336  begin
336          else if RoundType = grtItem then          else if RoundType = grtItem then
337                  Result := FItemList.Count;                  Result := FItemList.Count;
338  end;  end;
339    //! 巡回予約取得
340  function TRoundList.GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;  function TRoundList.GetRoundItem(Index: Integer; RoundType: TGikoRoundType): TRoundItem;
341  begin  begin
342          Result := nil;          Result := nil;
# Line 383  begin Line 348  begin
348                          Result := TRoundItem(FItemList[Index]);                          Result := TRoundItem(FItemList[Index]);
349          end;          end;
350  end;  end;
351    //! ボード巡回予約ファイル読み込み
352  procedure TRoundList.LoadRoundBoardFile;  procedure TRoundList.LoadRoundBoardFile;
353  var  var
354          i: Integer;          i: Integer;
# Line 390  var Line 356  var
356          FileName, bFileName: string;          FileName, bFileName: string;
357          errorSl: TStringList;          errorSl: TStringList;
358          errorFileName: string;          errorFileName: string;
         //Item: TRoundItem;  
359          delCount: Integer;          delCount: Integer;
360  begin  begin
361          sl := TStringList.Create;          sl := TStringList.Create;
# Line 416  begin Line 381  begin
381                  end;                  end;
382              end;              end;
383              //Item := TRoundItem.Create;              //Item := TRoundItem.Create;
384    
385                if sl.Count = 0 then begin
386                    //エラー落ちするなどしてファイルの内容が空だとエラーになる対策
387                    sl.Add(ROUND_INDEX_VERSION);
388                end;
389    
390              delCount := 0;              delCount := 0;
391              //1行目はバージョン              //1行目はバージョン
392                          if sl[0] = ROUND_INDEX_VERSION then begin                          if sl[0] = ROUND_INDEX_VERSION then begin
# Line 446  begin Line 417  begin
417                  sl.Free;                  sl.Free;
418          end;          end;
419  end;  end;
420    //! スレッド巡回予約ファイル読み込み
421  procedure TRoundList.LoadRoundThreadFile;  procedure TRoundList.LoadRoundThreadFile;
422  var  var
423          i: Integer;          i: Integer;
 //    j: Integer;  
424          sl: TStringList;          sl: TStringList;
425          FileName, bFileName: string;          FileName, bFileName: string;
426      errorSl: TStringList;      errorSl: TStringList;
427      errorFileName: string;      errorFileName: string;
 //      Item: TRoundItem;  
428      delCount: Integer;      delCount: Integer;
 //    boardList : TStringList;  
429  begin  begin
 //    boardList := TStringList.Create;  
 //    boardList.Duplicates := dupIgnore;  
430      errorSl := TStringList.Create;      errorSl := TStringList.Create;
431          errorSl.Duplicates := dupIgnore;          errorSl.Duplicates := dupIgnore;
432          sl := TStringList.Create;          sl := TStringList.Create;
# Line 481  begin Line 448  begin
448                  end;                  end;
449              end;              end;
450              //Item := TRoundItem.Create;              //Item := TRoundItem.Create;
451                if sl.Count = 0 then begin
452                    //エラー落ちするなどしてファイルの内容が空だとエラーになる対策
453                    sl.Add(ROUND_INDEX_VERSION);
454                end;
455    
456              delCount := 0;              delCount := 0;
457                          //1行目はバージョン                          //1行目はバージョン
458              if sl[0] = ROUND_INDEX_VERSION then begin              if sl[0] = ROUND_INDEX_VERSION then begin
# Line 501  begin Line 473  begin
473                      end;                      end;
474                                  end;                                  end;
475              end;              end;
 //              j := boardList.Count - 1;  
 //          while j >= 0 do begin  
 //                      GikoSys.ReadSubjectFile( BBSsFindBoardFromURL( boardList[j] ) );  
 //                  boardList.Delete(j);  
 //              Dec(j);  
 //              end;  
476              if errorSl.Count > 0 then              if errorSl.Count > 0 then
477                  errorSl.SaveToFile(errorFileName);                  errorSl.SaveToFile(errorFileName);
478                  end;                  end;
479          finally          finally
480                  errorSl.Free;                  errorSl.Free;
481                  sl.Free;                  sl.Free;
 //        boardList.Free;  
482          end;          end;
483  end;  end;
484    //! 巡回予約ファイル保存
485  procedure TRoundList.SaveRoundFile;  procedure TRoundList.SaveRoundFile;
486  var  var
487          i: integer;          i: integer;
# Line 532  begin Line 498  begin
498                  sl.Add(ROUND_INDEX_VERSION);                  sl.Add(ROUND_INDEX_VERSION);
499                  for i := 0 to FBoardList.Count - 1 do begin                  for i := 0 to FBoardList.Count - 1 do begin
500                          Item := TRoundItem(FBoardList[i]);                          Item := TRoundItem(FBoardList[i]);
501                          if Item.TmpURL <> '' then begin                          try
502                                  s := Item.TmpURL + #1                                  if Item.TmpURL <> '' then begin
503                                           + Item.BoardTitle + #1                                          s := Item.TmpURL + #1
504                                           + Item.RoundName;                                                   + Item.BoardTitle + #1
505                          end else begin                                                   + Item.RoundName;
506                                  s := Item.URL + #1                                  end else begin
507                                           + Item.BoardTitle + #1                                          s := Item.URL + #1
508                                           + Item.RoundName;                                                   + Item.BoardTitle + #1
509                                                     + Item.RoundName;
510                                    end;
511                                    sl.Add(s);
512                            except
513                          end;                          end;
                         sl.Add(s);  
514                  end;                  end;
515                  sl.SaveToFile(FileName);                  sl.SaveToFile(FileName);
516                  sl.Clear;                  sl.Clear;
# Line 549  begin Line 518  begin
518                  sl.Add(ROUND_INDEX_VERSION);                  sl.Add(ROUND_INDEX_VERSION);
519                  for i := 0 to FItemList.Count - 1 do begin                  for i := 0 to FItemList.Count - 1 do begin
520                          Item := TRoundItem(FItemList[i]);                          Item := TRoundItem(FItemList[i]);
521                          if Item.TmpURL <> '' then begin                          try
522                                  s := Item.TmpURL + #1                                  if Item.TmpURL <> '' then begin
523                                   + Item.BoardTitle + #1                                          s := Item.TmpURL + #1
524                                   + Item.FileName + #1                                           + Item.BoardTitle + #1
525                                   + Item.ThreadTitle + #1                                           + Item.FileName + #1
526                                   + Item.RoundName;                                           + Item.ThreadTitle + #1
527                          end else begin                                           + Item.RoundName;
528                                  s := Item.URL + #1                                  end else begin
529                                   + Item.BoardTitle + #1                                          s := Item.URL + #1
530                                   + Item.FileName + #1                                           + Item.BoardTitle + #1
531                                   + Item.ThreadTitle + #1                                           + Item.FileName + #1
532                                   + Item.RoundName;                                           + Item.ThreadTitle + #1
533                                             + Item.RoundName;
534                                    end;
535                                    sl.Add(s);
536                            except
537                          end;                          end;
                         sl.Add(s);  
538                  end;                  end;
539                  sl.SaveToFile(FileName);                  sl.SaveToFile(FileName);
540          finally          finally

Legend:
Removed from v.1.19.2.3  
changed lines
  Added in v.1.26

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