Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/AbonUnit.pas

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

revision 1.27 by h677, Wed Sep 8 16:14:01 2004 UTC revision 1.28 by h677, Fri Oct 8 15:12:52 2004 UTC
# Line 78  type Line 78  type
78          //個別あぼ〜んしょり          //個別あぼ〜んしょり
79          procedure IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String); overload;          procedure IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String); overload;
80          procedure IndividualAbon(var ResString : String; SetResNumFile : String; ResNumber : Integer); overload;          procedure IndividualAbon(var ResString : String; SetResNumFile : String; ResNumber : Integer); overload;
81          procedure AddIndividualAbon( ResNum : Integer ; option : Integer);          procedure AddIndividualAbon( ResNum : Integer ; option : Integer; SetResNumFile : String);
82          procedure DeleteIndividualAbon( ResNum : Integer);          procedure DeleteIndividualAbon( ResNum : Integer); overload;
83          function GetAbonResCount() : Integer;          procedure DeleteIndividualAbon( ResNum : Integer; SetResNumFile : String); overload;
84    
85            function GetAbonResCount() : Integer; overload;
86            function GetAbonResCount(SetResNumFile : String) : Integer; overload;
87    
88          function GetAbonResString(Num : Integer) : String;          function GetAbonResString(Num : Integer) : String;
89          function CheckIndividualAbonList(ResNum : Integer) : Boolean;          function CheckIndividualAbonList(ResNum : Integer) : Boolean;
90    
# Line 739  begin Line 743  begin
743      Result := true;      Result := true;
744  end;  end;
745  //個別あぼ〜んファイルに追加  //個別あぼ〜んファイルに追加
746  procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer);  procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer; SetResNumFile : String);
747  var  var
748          IndividualFile : TStringList;          IndividualFile : TStringList;
749      linebuf : String;          i, j : Integer;
     i : Integer;  
750  begin  begin
751      IndividualFile := TStringList.Create;          IndividualFile := TStringList.Create;
752          if FAbonRes[0].Res <> 0 then begin          try
753          for i := 0 to High(FAbonRes) do begin                  if FileExists(SetResNumFile) then begin
754              if FAbonRes[i].Res <> ResNum then begin                          IndividualFile.LoadFromFile(SetResNumFile);
755                          linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);                          i := -1;
756                  IndividualFile.Append(linebuf);                          for j := 0 to IndividualFile.Count -1 do begin
757              end;                                  if AnsiPos(IntToStr(ResNum) + '-', IndividualFile[j]) = 1 then begin
758          end;                                          i := j;
759      end;                                          break;
760      linebuf := IntToStr(ResNum) + '-' + IntToStr(option);                                  end;
761      IndividualFile.Append(linebuf);                          end;
762      try                          if i = -1 then
763          IndividualFile.SaveToFile(FIndividualFileName);                                  IndividualFile.Add(IntToStr(ResNum) + '-' + IntToStr(option))
764      finally                          else
765          IndividualFile.Free;                                  IndividualFile[j] := IntToStr(ResNum) + '-' + IntToStr(option);
766      end;  
767                    end else begin
768                            IndividualFile.Add(IntToStr(ResNum) + '-' + IntToStr(option));
769                    end;
770                    IndividualFile.SaveToFile(SetResNumFile);
771            finally
772                    IndividualFile.Free;
773            end;
774  end;  end;
775  //個別あぼ〜んファイルから削除  //個別あぼ〜んファイルから削除
776  procedure TAbon.DeleteIndividualAbon( ResNum : Integer);  procedure TAbon.DeleteIndividualAbon( ResNum : Integer);
777  var  var
778          IndividualFile : TStringList;          IndividualFile : TStringList;
779      linebuf : String;          linebuf : String;
780      i : Integer;          i : Integer;
781  begin  begin
782      IndividualFile := TStringList.Create;      IndividualFile := TStringList.Create;
783          if FAbonRes[0].Res <> 0 then begin          if FAbonRes[0].Res <> 0 then begin
# Line 779  begin Line 789  begin
789          end;          end;
790      end;      end;
791          if IndividualFile.Count <> 0 then begin          if IndividualFile.Count <> 0 then begin
792          try                  try
793                  IndividualFile.SaveToFile(FIndividualFileName);                          IndividualFile.SaveToFile(FIndividualFileName);
794          finally                  finally
795                  IndividualFile.Free;                          IndividualFile.Free;
796          end;                  end;
797      end else begin          end else begin
798          if FileExists(FIndividualFileName) = true then begin                  if FileExists(FIndividualFileName) = true then begin
799                  DeleteFile(FIndividualFileName);                          DeleteFile(FIndividualFileName);
800          end;                  end;
801      end;          end;
802  end;  end;
803  //個別あぼ〜んのリストの個数を返す  //個別あぼ〜んのリストの個数を返す
804  function TAbon.GetAbonResCount() : Integer;  function TAbon.GetAbonResCount() : Integer;
805  var  var
806          i : Integer;          i : Integer;
807  begin  begin
808      if FAbonRes[0].Res = 0 then begin          if FAbonRes[0].Res = 0 then begin
809          Result := 0                  Result := 0
810      end else begin          end else begin
811                  i := High(FAbonRes);                  i := High(FAbonRes);
812          Result := i+1;                  Result := i+1;
813      end;          end;
814  end;  end;
815  //個別あぼ〜んのリストのn行目のレスを文字列で返す  //個別あぼ〜んのリストのn行目のレスを文字列で返す
816  function TAbon.GetAbonResString(Num : Integer) : String;  function TAbon.GetAbonResString(Num : Integer) : String;
817  begin  begin
818          if (Num <= High(FAbonRes)) and (Num >= 0) then begin          if (Num <= High(FAbonRes)) and (Num >= 0) then begin
819          Result := IntToStr(FAbonRes[Num].Res);                  Result := IntToStr(FAbonRes[Num].Res);
820      end else begin          end else begin
821          Result := '';                  Result := '';
822      end;          end;
823    end;
824    function TAbon.GetAbonResCount(SetResNumFile : String) : Integer;
825    var
826            bufStringList : TStringList;
827    begin
828            Result := 0;
829            if FileExists(SetResNumFile) then begin
830                    bufStringList := TStringList.Create;
831                    try
832                            try
833                                    bufStringList.LoadFromFile(SetResNumFile);
834                                    Result := bufStringList.Count;
835                            except
836                            end;
837                    finally
838                            bufStringList.Free;
839                    end;
840            end;
841  end;  end;
842    procedure TAbon.DeleteIndividualAbon( ResNum : Integer; SetResNumFile : String);
843    var
844            i: Integer;
845            bufStringList : TStringList;
846    begin
847            if FileExists(SetResNumFile) then begin
848                    bufStringList := TStringList.Create;
849                    try
850                            try
851                                    bufStringList.LoadFromFile(SetResNumFile);
852                                    i := bufStringList.IndexOf(IntToStr(ResNum)+'-');
853                                    if i > 0 then
854                                            bufStringList.Delete(i);
855                            except
856                            end;
857                    finally
858                            bufStringList.Free;
859                    end;
860            end;
861    end;
862    
863  //ポップアップの判定用  //ポップアップの判定用
864  function TAbon.CheckIndividualAbonList(ResNum : Integer) : Boolean;  function TAbon.CheckIndividualAbonList(ResNum : Integer) : Boolean;
865  var  var
866          i : Integer;          i : Integer;
867  begin  begin
868          if FAbonRes[0].Res <> 0 then begin          if FAbonRes[0].Res <> 0 then begin
869          for i := 0 to High(FAbonRes) do begin                  for i := 0 to High(FAbonRes) do begin
870                  if FAbonRes[i].Res = ResNum then begin                          if FAbonRes[i].Res = ResNum then begin
871                  Result := true;                                  Result := true;
872                  Exit;                                  Exit;
873              end;                          end;
874          end;                  end;
875      end;          end;
876          Result := false;          Result := false;
877    
878  end;  end;
# Line 881  begin Line 930  begin
930                  tmp := tmp + AString;                  tmp := tmp + AString;
931          Result := tmp;          Result := tmp;
932  end;  end;
933    
934    
935    
936  end.  end.
937    

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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