OSDN Git Service

個別あぼ〜んに関する不具合の修正
[gikonavigoeson/gikonavi.git] / AbonUnit.pas
index aedbf52..aecd96c 100644 (file)
@@ -19,7 +19,7 @@ type
     Ftokens : array of array of string;
     FAbonRes : array of TIndiviAbon;
     FAbonString : String;
-    FCutoffNum : Integer; //\82±\82Ì\90\94\88È\8fã\98A\91±\82·\82é\93¯\82\89p\8e\9a\82ðNG\83\8f\81[\83h\82Æ\82·\82é
+//    FCutoffNum : Integer; //\82±\82Ì\90\94\88È\8fã\98A\91±\82·\82é\93¯\82\89p\8e\9a\82ðNG\83\8f\81[\83h\82Æ\82·\82é
     FDeleterlo : Boolean; //&rlo;\82ð\8dí\82é\82© //\92Ç\89Á&lro;\82à\8dí\82é
     FReplaceul :Boolean ; //<ul>\83^\83O\82ð<br>\83^\83O\82É\92u\8a·\82·\82é\82©
     FReverse : Boolean ;  //NG\83\8f\81[\83h\82Å\82Ì\82 \82Ú\81`\82ñ\82Ì\8c\8b\89Ê\82ð\94½\93]\82³\82¹\82é\82©
@@ -30,6 +30,7 @@ type
     FIndividualFileName : String;      //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82Ì\83t\83@\83C\83\8b\96¼
     FReturnNGwordLineNum : Boolean;    //NG\83\8f\81[\83h\82Ì\8ds\90\94\82ð\95Ô\82·\81B
     FSetNGResAnchor : Boolean; //NG\82É\8aY\93\96\82µ\82½\82Æ\82«\82É\96{\95\82É\82»\82Ì\83\8c\83X\82Ö\82Ì\83\8c\83X\83A\83\93\83J\81[\82ð\82Â\82¯\82é\82©\82Ç\82¤\82©
+    FDeleteSyria: Boolean;     //\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\91Î\8dô\81i&#1792~&#1871\81j
     procedure SetTokens(index: integer ; argline:String);
     function Getlistpath() : String;
     procedure Setlistpath(const Value : String);
@@ -51,6 +52,7 @@ type
     property NGwordname : String read FNGwordname write FNGwordname;
        property ReturnNGwordLineNum : Boolean read FReturnNGwordLineNum write FReturnNGwordLineNum default false;
     property SetNGResAnchor : Boolean read FSetNGResAnchor write FSetNGResAnchor default false;
+    property DeleteSyria : Boolean read FDeleteSyria write FDeleteSyria default false;
     procedure Setroot(root :String);
     function Getroot() : String;
 
@@ -61,591 +63,537 @@ type
     function ReLoadFromNGwordFile() : Boolean;
     procedure LoadFromStringList( bufstl : TStringList );
     function CheckAbonPopupRes(line : String) :Boolean;
-    function FindNGwords(line : String) : Boolean; overload;//1\83\89\83C\83\93\82¸\82Â\97p\81B
-    function FindNGwords(line : String; var NGwordsLineNum : Integer) : Boolean; overload;//1\83\89\83C\83\93\82¸\82Â\97p\81B
-    function Cutoff(line : String) : Boolean; //CutOff\92l\88È\8fã\8cÂ\82Ì\93¯\82\89p\90\94\82ª\95À\82ñ\82Å\82¢\82½\82çtrue
-    //\82 \82Ú\81`\82ñ\8f\88\97\9d(NG\83\8f\81[\83h\82Å\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O)
-    procedure Execute(var ThreadStrings : TStringList); overload;
-    procedure Execute(var ThreadStrings : TStringList; NGwords : TStringList); overload;
-    procedure Execute(var ThreadStrings : TStringList; NGwords : TStrings); overload;
-    //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82µ\82å\82è
-    procedure IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String);
-    procedure AddIndividualAbon( ResNum : Integer ; option : Integer);
-    procedure DeleteIndividualAbon( ResNum : Integer);
-    function GetAbonResCount() : Integer;
-    function GetAbonResString(Num : Integer) : String;
-    function CheckIndividualAbonList(ResNum : Integer) : Boolean;
-    //--
-    function ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; overload;//DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    function ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    function ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    function ReverseExecuteFile(datfilepath : String) : Boolean; overload; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    function ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    function ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-    //--
-    procedure EditNGwords();  //NGword.txt\82ð\8aJ\82­\81B
-    function ShowAllTokens() : String;  //\83f\83o\83b\83O\97p
-    //--
-    procedure GoHome();//List\82Ì\82P\8ds\96Ú\82ð\93Ç\82Þ
-    function GoForward() : Boolean; //List\82Ì\88ê\82Â\8e\9f\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
-    function GoBack() : Boolean; //List\82Ì\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
+       function FindNGwords(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1\83\89\83C\83\93\82¸\82Â\97p\81B
+       function FindNGwordsEx(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1\83\89\83C\83\93\82¸\82Â\97p\81B
+       //\82 \82Ú\81`\82ñ\8f\88\97\9d(NG\83\8f\81[\83h\82Å\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O)
+       procedure Execute(var ThreadStrings : TStringList); overload;
+       procedure Execute(var ThreadStrings : TStringList; NGwords : TStringList); overload;
+       procedure Execute(var ThreadStrings : TStringList; NGwords : TStrings); overload;
+       procedure Execute(var ResString : String; ResNumber : Integer); overload;       //\8eå\82Éplugin\82©\82ç\82ÌDat To HTML \97p
+       procedure ExecuteEx(var ThreadStrings : TStringList); overload;
+       procedure ExecuteEx(var ThreadStrings : TStringList; NGwords : TStringList); overload;
+       procedure ExecuteEx(var ThreadStrings : TStringList; NGwords : TStrings); overload;
+       procedure ExecuteEx(var ResString : String; ResNumber : Integer); overload;     //\8eå\82Éplugin\82©\82ç\82ÌDat To HTML \97p
+
+       //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82µ\82å\82è
+       procedure IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String); overload;
+       procedure IndividualAbon(var ResString : String; SetResNumFile : String; ResNumber : Integer); overload;
+       procedure AddIndividualAbon( ResNum : Integer ; option : Integer; SetResNumFile : String);
+       procedure DeleteIndividualAbon( ResNum : Integer); overload;
+       procedure DeleteIndividualAbon( ResNum : Integer; SetResNumFile : String); overload;
+
+       function GetAbonResCount() : Integer; overload;
+       function GetAbonResCount(SetResNumFile : String) : Integer; overload;
+
+       function GetAbonResString(Num : Integer) : String;
+       function CheckIndividualAbonList(ResNum : Integer) : Boolean;
+
+       procedure EditNGwords();  //NGword.txt\82ð\8aJ\82­\81B
+       function ShowAllTokens() : String;  //\83f\83o\83b\83O\97p
+       //--
+       procedure GoHome();//List\82Ì\82P\8ds\96Ú\82ð\93Ç\82Þ
+       function GoForward() : Boolean; //List\82Ì\88ê\82Â\8e\9f\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
+       function GoBack() : Boolean; //List\82Ì\88ê\82Â\91O\82ÌNG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
+       //--
+       function TreatSyria(AString: string): string;
   end;
 var
-    Abon1 :TAbon;
+       Abon1 :TAbon;
 const
-    NGwordListFileName : String = 'NGwords.list';
+       NGwordListFileName : String = 'NGwords.list';
 
 implementation
 
+uses MojuUtils;
+
 constructor TAbon.Create;
 begin
-    // \8f\89\8aú\89»
-    FAbonString := '&nbsp;<>&nbsp;<>&nbsp;<>&nbsp;&nbsp;<><>';
-    FCreateNGwordFile := true;
-    SetLength(FAbonRes,1);
-    FAbonRes[0].Res := 0;
-    FAbonRes[0].option := -1;
+       // \8f\89\8aú\89»
+       FAbonString := '&nbsp;<>&nbsp;<>&nbsp;<>&nbsp;&nbsp;<><>';
+       FCreateNGwordFile := true;
+       SetLength(FAbonRes,1);
+       FAbonRes[0].Res := 0;
+       FAbonRes[0].option := -1;
 
 end;
 
 destructor TAbon.Destroy;
 begin
-    inherited;
+       inherited;
 end;
 //root\82ÍExe\config\NGwords\83t\83H\83\8b\83_
 procedure TAbon.Setroot(root :String);
 var
-    bufStringList : TStringList;
+       bufStringList : TStringList;
 begin
-    bufStringList := TStringList.Create;
-    try
-        if not DirectoryExists(root) then begin
-            CreateDir(root);
-        end;
-        if root[Length(root)] <> '\' then begin
-            root := root + '\';
-        end;
-        Flistpath := root + NGwordListFileName;
-        LoadListFile(Flistpath, bufStringList);
-    finally
-        bufStringList.Free;
-    end;
-    Froot := root;
+       bufStringList := TStringList.Create;
+       try
+               if not DirectoryExists(root) then begin
+                       CreateDir(root);
+               end;
+               if root[Length(root)] <> '\' then begin
+                       root := root + '\';
+               end;
+               Flistpath := root + NGwordListFileName;
+               LoadListFile(Flistpath, bufStringList);
+       finally
+               bufStringList.Free;
+       end;
+       Froot := root;
 end;
 function TAbon.Getroot() : String;
 begin
-    Result := Froot;
+       Result := Froot;
 end;
 //NGwordpath\82ÍNGword.txt\82Ì\83t\83\8b\83p\83X
 procedure TAbon.SetNGwordpath(path :String);
 begin
-    FNGwordpath := Getfullpath(path);
-    LoadFromNGwordFile(FNGwordpath);
+       FNGwordpath := Getfullpath(path);
+       LoadFromNGwordFile(FNGwordpath);
 end;
 function TAbon.GetNGwordpath() : String;
 begin
-    Result :=  FNGwordpath;
+       Result :=  FNGwordpath;
 end;
 //\83t\83\8b\83p\83X\82Å\82È\82¯\82ê\82Î\83t\83\8b\83p\83X\82É\82µ\82Ä\95Ô\82·\81B
 function TAbon.Getfullpath(argpath : String) : String;
 begin
-    if AnsiPos(':\',argpath) <> 2 then begin  //\83h\83\89\83C\83u\82©\82ç\82Ì\83t\83\8b\83p\83X\82ª\96³\82¯\82ê\82Î
-        if Getroot() = '' then begin
-            Result := '';    //root\83p\83X\82ª\90Ý\92è\82³\82ê\82Ä\82È\82¢\82©\8bó\82É\82·\82é
-        end else begin
-            if (Froot[Length(Froot)] = '\') and (argpath[1] = '\') then begin  //\90æ\93ª\82Ì\\82ð\8dí\8f\9c
-                Delete(argpath,1,1);
-            end;
-            Insert( Getroot(), argpath , 1);//root\83p\83X\82ð\91}\93ü
-            Result := argpath;
-        end;
-    end else begin
-        Result := argpath;
-    end;
+       if AnsiPos(':\',argpath) <> 2 then begin  //\83h\83\89\83C\83u\82©\82ç\82Ì\83t\83\8b\83p\83X\82ª\96³\82¯\82ê\82Î
+               if Getroot() = '' then begin
+                       Result := '';    //root\83p\83X\82ª\90Ý\92è\82³\82ê\82Ä\82È\82¢\82©\8bó\82É\82·\82é
+               end else begin
+                       if (Froot[Length(Froot)] = '\') and (argpath[1] = '\') then begin  //\90æ\93ª\82Ì\\82ð\8dí\8f\9c
+                               Delete(argpath,1,1);
+                       end;
+                       Insert( Getroot(), argpath , 1);//root\83p\83X\82ð\91}\93ü
+                       Result := argpath;
+               end;
+       end else begin
+               Result := argpath;
+       end;
 
 end;
 //NGword\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý
 function TAbon.LoadFromNGwordFile(path :String) : boolean;
 var
-    bufstl : TStringList;
-begin
-    path := Getfullpath(path);
-    if path = '' then begin
-        Result := false;
-    end else begin
-        bufstl := TStringList.Create;
-        try
-            try
-                bufstl.LoadFromFile(path);
-                LoadFromStringList( bufstl );
-                Result := true;
-            except
-                if CreateNGwordFile = true then begin
-                    bufstl.SaveToFile(path);
-                end;
-                Result := false;
-            end;
-        finally
-            bufstl.Free;
-        end;
-    end;
+       bufstl : TStringList;
+begin
+       path := Getfullpath(path);
+       if path = '' then begin
+               Result := false;
+       end else begin
+               bufstl := TStringList.Create;
+               try
+                       try
+                               bufstl.LoadFromFile(path);
+                               LoadFromStringList( bufstl );
+                               Result := true;
+                       except
+                               if CreateNGwordFile = true then begin
+                                       bufstl.SaveToFile(path);
+                               end;
+                               Result := false;
+                       end;
+               finally
+                       bufstl.Free;
+               end;
+       end;
 
 end;
 //NGword\83\8a\83X\83g\93Ç\82Ý\8d\9e\82Ý
 procedure TAbon.LoadFromStringList( bufstl : TStringList );
 var
-    i : integer;
-begin
-    try
-        for i := bufstl.Count -1  downto 0 do begin
-            if bufstl.Strings[i] = '' then begin
-                bufstl.Delete(i);
-            end;
-        end;
-        SetLength(Ftokens,bufstl.Count);
-        for i := 0  to bufstl.Count -1 do begin
-            SetTokens(i , bufstl.Strings[i]);
-        end;
+       i : integer;
+begin
+       try
+               for i := bufstl.Count -1  downto 0 do begin
+                       if bufstl.Strings[i] = '' then begin
+                               bufstl.Delete(i);
+                       end;
+               end;
+               SetLength(Ftokens,bufstl.Count);
+               for i := 0  to bufstl.Count -1 do begin
+                       SetTokens(i , bufstl.Strings[i]);
+               end;
 
-    except
-        Exit;
-    end;
+       except
+               Exit;
+       end;
 end;
 //NGwordpath\82ª\8aù\82É\90Ý\92è\82³\82ê\82Ä\82¢\82é\82Æ\82«\82Ì\83\8a\83\8d\81[\83h\97p\8aÖ\90\94
 function TAbon.ReLoadFromNGwordFile() : boolean;
 begin
-    if GetNGwordpath() ='' then begin
-        Result := false;
-    end else begin
-        Result := LoadFromNGwordFile( GetNGwordpath() );
-    end;
+       if GetNGwordpath() ='' then begin
+               Result := false;
+       end else begin
+               Result := LoadFromNGwordFile( GetNGwordpath() );
+       end;
 end;
 function TAbon.Getlistpath() : String;
 begin
-    Result := Flistpath;
+       Result := Flistpath;
 end;
 procedure TAbon.Setlistpath(const Value : String);
 begin
-    Flistpath := Getfullpath(Value);
+       Flistpath := Getfullpath(Value);
 end;
 //\88ê\8ds\82Ì\92\86\82Ì\83g\81[\83N\83\93\82ð\90Ø\82è\95ª\82¯\82Ä\83Z\83b\83g
 procedure TAbon.SetTokens(index: integer ; argline : String);
 var
-    ret : Integer;
-    bufstl : TStringList;
-    i : Integer;
-    pos : Integer;
-    buftoken : String;
-begin
-    pos := 0;
-    bufstl := TStringList.Create;
-    try
-        if Length(argline) > 0 then begin
-               pos := AnsiPos(#9,argline);
-           while pos <> 0 DO begin
-                buftoken := Copy(argline,1,pos-1);
-                Delete(argline,1,pos);
-                if Length(buftoken) > 0 then begin
-                               bufstl.Append(buftoken);
-                end;
-                   pos := AnsiPos(#9,argline);
-           end;
-               if Length(argline) > 0 then begin
-                       bufstl.Append(argline);
-           end;
-               ret := bufstl.Count;
-               SetLength(Ftokens[index],ret);
-               for i := 0 to bufstl.Count - 1  do begin
-                       Ftokens[index][i] := bufstl.Strings[i];
-               end;
-        end;
-    finally
-       bufstl.Free;
-    end;
+       ret : Integer;
+       bufstl : TStringList;
+       i : Integer;
+       pos : Integer;
+       buftoken : String;
+begin
+       pos := 0;
+       bufstl := TStringList.Create;
+       try
+               if Length(argline) > 0 then begin
+                       pos := AnsiPos(#9,argline);
+                       while pos <> 0 DO begin
+                               buftoken := Copy(argline,1,pos-1);
+                               Delete(argline,1,pos);
+                               if Length(buftoken) > 0 then begin
+                                       bufstl.Append(buftoken);
+                               end else if ( bufstl.Count = 0 ) then begin
+                                       bufstl.Append('');
+                               end;
+                               pos := AnsiPos(#9,argline);
+                       end;
+                       if Length(argline) > 0 then begin
+                               bufstl.Append(argline);
+                       end;
+                       ret := bufstl.Count;
+                       SetLength(Ftokens[index],ret);
+                       for i := 0 to bufstl.Count - 1  do begin
+                               Ftokens[index][i] := bufstl.Strings[i];
+                       end;
+               end;
+       finally
+               bufstl.Free;
+       end;
 
 end;
 //Debug\97p\82¿\82á\82ñ\82ÆNG\83\8f\81[\83h\82ð\8fE\82¦\82Ä\82¢\82é\82©
 function TAbon.ShowAllTokens() : String;
 var
-    i : Integer;
-    j : Integer;
-    ret : String;
-begin
-    for i := 0 to High(Ftokens) do begin
-        for j := 0 to High(Ftokens[i]) do begin
-            ret := ret + Ftokens[i][j];
-        end;
-    end;
-    Result := ret;
-
+       i : Integer;
+       j : Integer;
+       ret : String;
+begin
+       for i := 0 to High(Ftokens) do begin
+               for j := 0 to High(Ftokens[i]) do begin
+                       ret := ret + Ftokens[i][j];
+               end;
+       end;
+       Result := ret;
 
 
-end;
 
-//****************************************************************************//
-//NG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82½\82çtrue\82ð\95Ô\82·\81B
-function TAbon.FindNGwords(line : String) : Boolean;
-var
-    lines : Integer;
-    cells : Integer;
-    hit : Boolean;
-    bufline : String;
-begin
-    hit := false;
-    if AnsiPos(FAbonString,line) <> 1 then begin
-        for lines := 0 to High(Ftokens) do begin
-               hit := true;
-            bufline := line;
-            for cells := 0 to High(Ftokens[lines]) do begin
-                if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
-                       hit := false;
-                    break;
-                end else begin
-                       Delete(bufline,AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
-                end;
-            end;
-            if hit = true then begin
-               break;
-            end;
-        end;
-    end;
-    Result := hit;
 end;
-//NG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82çtrue\82ð\95Ô\82µ\81A\82»\82ÌNG\83\8f\81[\83h\82Ì\8ds\90\94\82ðNGwordsLineNum\82É\93ü\82ê\82Ä\95Ô\82·
-function TAbon.FindNGwords(line : String; var NGwordsLineNum : Integer) : Boolean;
+//NG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82çtrue\82ð\95Ô\82µ\81A\82»\82ÌNG\83\8f\81[\83h\82Ì\8ds\90\94\82ðNGwordsLineNum\82É\93ü\82ê\82Ä\95Ô\82·\81B
+//\82à\82µ\82à\93§\96¾\82 \82Ú\81`\82ñ\82É\82·\82é\82È\82çInbisible\82ðtrue\82É\82µ\82Ä\95Ô\82·
+function TAbon.FindNGwords(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean; //1\83\89\83C\83\93\82¸\82Â\97p\81B
 var
-    lines : Integer;
-    cells : Integer;
-    hit : Boolean;
-    bufline : String;
-begin
-    hit := false;
-    if AnsiPos(FAbonString,line) <> 1 then begin
-        for lines := 0 to High(Ftokens) do begin
-               hit := true;
-            bufline := line;
-            for cells := 0 to High(Ftokens[lines]) do begin
-                if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
-                       hit := false;
-                    break;
-                end else begin
-                       Delete(bufline,AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
-                end;
-            end;
-            if hit = true then begin
-                NGwordsLineNum := lines + 1;
-               break;
-            end;
-        end;
-    end;
-    Result := hit;
-end;
-//CutOff\92l\88È\8fã\8cÂ\82Ì\93¯\82\89p\90\94\82ª\95À\82ñ\82Å\82¢\82½\82çtrue
-function TAbon.Cutoff(line : String) : Boolean;
+       lines : Integer;
+       cells : Integer;
+       hit : Boolean;
+       bufline : String;
+       start : Integer;
+begin
+       hit := false;
+       if AnsiPos(FAbonString,line) <> 1 then begin
+               for lines := 0 to High(Ftokens) do begin
+                       hit := true;
+                       bufline := line;
+                       if Ftokens[lines][0] <> ''  then begin
+                               Invisible := false;
+                               start := 0;
+                       end else begin
+                               Invisible := true;
+                               start := 1;
+                       end;
+
+                       for cells := start to High(Ftokens[lines]) do begin
+                               if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
+                                       hit := false;
+                                       break;
+                               end else begin
+                                       Delete(bufline,AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
+                               end;
+                       end;
+                       if hit = true then begin
+                               NGwordsLineNum := lines + 1;
+                               break;
+                       end;
+               end;
+       end;
+       Result := hit;
+end;
+//NG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82çtrue\82ð\95Ô\82µ\81A\82»\82ÌNG\83\8f\81[\83h\82Ì\8ds\90\94\82ðNGwordsLineNum\82É\93ü\82ê\82Ä\95Ô\82·\81B
+//\82à\82µ\82à\93§\96¾\82 \82Ú\81`\82ñ\82É\82·\82é\82È\82çInbisible\82ðtrue\82É\82µ\82Ä\95Ô\82·
+//\94¼\8ap\91S\8ap\96³\8e\8b
+function TAbon.FindNGwordsEx(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1\83\89\83C\83\93\82¸\82Â\97p\81B
 var
-    i : Integer;
-    sheed : AnsiChar;
-    buf : String;
-    ret : Bool;
-begin
-    ret := false;
-    if FCutoffNum <> 0 then begin
-        for i := 65 to 90 do begin
-            sheed := Chr(i);
-            buf := DupeString(sheed, FCutoffNum);
-            if AnsiContainsText(line, buf) = true then begin
-                ret := true;
-                break;
-            end;
-        end;
-    end;
-    Result := ret;
+       lines : Integer;
+       cells : Integer;
+       hit : Boolean;
+       bufline : String;
+       start : Integer;
+begin
+       hit := false;
+       if AnsiPos(FAbonString,line) <> 1 then begin
+               for lines := 0 to High(Ftokens) do begin
+                       hit := true;
+                       bufline := line;
+                       if Ftokens[lines][0] <> ''  then begin
+                               Invisible := false;
+                               start := 0;
+                       end else begin
+                               Invisible := true;
+                               start := 1;
+                       end;
+
+                       for cells := start to High(Ftokens[lines]) do begin
+                               if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
+                                       hit := false;
+                                       break;
+                               end else begin
+                                       Delete(bufline, AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
+                               end;
+                       end;
+                       if hit = true then begin
+                               NGwordsLineNum := lines + 1;
+                               break;
+                       end;
+               end;
+       end;
+       Result := hit;
 end;
 //\96\96\94ö\82Ì\83u\81[\83\8b\92l\82Ítrue\82¾\82Æ\81ANG\83\8f\81[\83h\82ð\8aÜ\82Þ\82à\82Ì\82¾\82¯\82ð\95Ô\82·\81B
 procedure TAbon.Execute(var ThreadStrings : TStringList);
 var
-    i : Integer;
-    NGwordsLine : Integer;
-    bufline : String;
-begin
-    //FRetStrings.Clear;
-    if not ReturnNGwordLineNum then begin
-    //if ReturnNGwordLineNum then begin
-       for i:=0 to ThreadStrings.Count - 1 do begin
-               if FindNGwords(ThreadStrings.Strings[i]) <> Reverse  then begin
-                if not SetNGResAnchor then
-                       ThreadStrings.Strings[i] := FAbonString
-                else
-                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<>&gt;%d<><>',[(i+1)]);
-               end else begin
-               bufline := ThreadStrings.Strings[i];
-               if Deleterlo = true then begin
-                       bufline := AnsiReplaceText( bufline,'&rlo;','' );
-                    bufline := AnsiReplaceText( bufline,'&lro;','' );
-               end;
-               if Replaceul = true then begin
-                       bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
-                       bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
-               end;
-               ThreadStrings.Strings[i] := bufline;
-               end;
-       end;
-    end else begin
-       for i:=0 to ThreadStrings.Count - 1 do begin
-            NGwordsLine := 0;
-               if FindNGwords(ThreadStrings.Strings[i], NGwordsLine) <> Reverse  then begin
-                if not SetNGResAnchor then
-                    ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B><><>',[NGwordsLine])
-                else
-                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B>&gt;%d <><>',[NGwordsLine,(i+1)]);
-               end else begin
-               bufline := ThreadStrings.Strings[i];
-               if Deleterlo = true then begin
-                       bufline := AnsiReplaceText( bufline,'&rlo;','' );
-                    bufline := AnsiReplaceText( bufline,'&lro;','' );
-               end;
-               if Replaceul = true then begin
-                       bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
-                       bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
-               end;
-               ThreadStrings.Strings[i] := bufline;
-               end;
-       end;
-
-    end;
-
+       i : Integer;
+       NGwordsLine : Integer;
+       bufline : String;
+       invisi : Boolean;
+begin
+       for i:=0 to ThreadStrings.Count - 1 do begin
+               NGwordsLine := 0;
+               if FindNGwords(ThreadStrings.Strings[i], NGwordsLine ,invisi) <> Reverse  then begin
+                       if invisi = true then begin
+                               ThreadStrings.Strings[i] := '';
+                       end else begin
+                               if not ReturnNGwordLineNum and not SetNGResAnchor then begin
+                                       ThreadStrings.Strings[i] := FAbonString;
+                               end else if not ReturnNGwordLineNum then begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<>&gt;%d<><>',[(i+1)]);
+                               end else if not SetNGResAnchor then begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B><><>',[NGwordsLine]);
+                               end else begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B>&gt;%d <><>',[NGwordsLine,(i+1)]);
+                               end;
+                       end;
+               end else begin
+                       bufline := ThreadStrings.Strings[i];
+                       if Deleterlo = true then begin
+                               bufline := CustomStringReplace(bufline,'&rlo;','');
+                               bufline := CustomStringReplace(bufline,'&lro;','');
+                       end;
+                       if Replaceul = true then begin
+                               bufline := CustomStringReplace( bufline,'<ul>','<br>' );
+                               bufline := CustomStringReplace( bufline,'</ul>','<br>' );
+                       end;
+                       if DeleteSyria = true then
+                               bufline := TreatSyria(bufline);
+                       ThreadStrings.Strings[i] := bufline;
+               end;
+       end;
+end;
+procedure TAbon.Execute(var ResString : String; ResNumber : Integer);
+var
+       NGwordsLine : Integer;
+       bufline : String;
+       invisi : Boolean;
+begin
+       NGwordsLine := 0;
+       if FindNGwords(ResString, NGwordsLine ,invisi) <> Reverse  then begin
+               if invisi = true then begin
+                       ResString := '';
+               end else begin
+                       if not ReturnNGwordLineNum and not SetNGResAnchor then begin
+                               ResString := FAbonString;
+                       end else if not ReturnNGwordLineNum then begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<>&gt;%d<><>',[(ResNumber)]);
+                       end else if not SetNGResAnchor then begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B><><>',[NGwordsLine]);
+                       end else begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B>&gt;%d <><>',[NGwordsLine,(ResNumber)]);
+                       end;
+               end;
+       end else begin
+               bufline := ResString;
+               if Deleterlo = true then begin
+                       bufline := CustomStringReplace( bufline,'&rlo;','' );
+                       bufline := CustomStringReplace( bufline,'&lro;','' );
+               end;
+               if Replaceul = true then begin
+                       bufline := CustomStringReplace( bufline,'<ul>','<br>' );
+                       bufline := CustomStringReplace( bufline,'</ul>','<br>' );
+               end;
+               if DeleteSyria = true then
+                       bufline := TreatSyria(bufline);
+               ResString := bufline;
+       end;
 end;
+
 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStringList);
 var
-    i : Integer;
+       i : Integer;
 begin
-    SetLength(Ftokens,NGwords.Count);
-    for i := 0  to NGwords.Count -1 do begin
-        SetTokens(i , NGwords.Strings[i]);
-    end;
-    Execute(ThreadStrings);
+       SetLength(Ftokens,NGwords.Count);
+       for i := 0  to NGwords.Count -1 do begin
+               SetTokens(i , NGwords.Strings[i]);
+       end;
+       Execute(ThreadStrings);
 
 end;
 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStrings);
 var
-    i : Integer;
-    buf : TStringList;
+       i : Integer;
+       buf : TStringList;
 begin
-    buf := TStringList.Create;
-    buf.AddStrings(NGwords);
-    SetLength(Ftokens,buf.Count);
-    for i := 0  to buf.Count -1 do begin
-        SetTokens(i , buf.Strings[i]);
-    end;
-    Execute(ThreadStrings);
-    buf.Free;
+       buf := TStringList.Create;
+       buf.AddStrings(NGwords);
+       SetLength(Ftokens,buf.Count);
+       for i := 0  to buf.Count -1 do begin
+               SetTokens(i , buf.Strings[i]);
+       end;
+       Execute(ThreadStrings);
+       buf.Free;
 end;
 
-
-//****************************************************************************//
-//DAT\82ð\92¼\82É\82¢\82\82é\93z\82ç===========================================================
-//NG\83\8f\81[\83h\82ð\8aÜ\82Þ\83\8c\83X\82Ì\90æ\93ª\82É\82 \82Ú\81[\82ñ\82ð\91}\93ü
-function TAbon.ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-var
-    datstl : TStringList;
-    ret : Boolean;
-    i : Integer;
-begin
-    datstl := TStringList.Create;
-    ret := true;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            for i := 0 to datstl.Count -1 do begin
-                if FindNGwords(datstl.Strings[i]) = true  then begin
-                    datstl.Strings[i] := FAbonString + datstl.Strings[i]
-                end;
-            end;
-
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
-
-end;
-//\8ew\92è\82³\82ê\82½\83\8c\83X\94Ô\82Ì\90æ\93ª\82É\82 \82Ú\81[\82ñ\91}\93ü
-function TAbon.ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
+//\96\96\94ö\82Ì\83u\81[\83\8b\92l\82Ítrue\82¾\82Æ\81ANG\83\8f\81[\83h\82ð\8aÜ\82Þ\82à\82Ì\82¾\82¯\82ð\95Ô\82·\81B
+procedure TAbon.ExecuteEx(var ThreadStrings : TStringList);
 var
-    datstl : TStringList;
-    ret : Boolean;
-begin
-    ret := true;
-    datstl := TStringList.Create;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            if (resnum > 0) and (resnum <= datstl.Count) then begin
-                if AnsiPos(FAbonString, datstl.Strings[resnum-1]) <> 1 then begin
-                    datstl.Strings[resnum-1] := FAbonString + datstl.Strings[resnum-1];
-                end;
-            end;
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
-end;
-//firstres\82©\82çcount\8cÂ\82Ì\83\8c\83X\82Ì\90æ\93ª\82É\82 \82Ú\81[\82ñ\91}\93ü
-function TAbon.ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
+       i : Integer;
+       NGwordsLine : Integer;
+       bufline : String;
+       invisi : Boolean;
+begin
+       for i:=0 to ThreadStrings.Count - 1 do begin
+               NGwordsLine := 0;
+               if FindNGwordsEx(ThreadStrings.Strings[i], NGwordsLine ,invisi) <> Reverse  then begin
+                       if invisi = true then begin
+                               ThreadStrings.Strings[i] := '';
+                       end else begin
+                               if not ReturnNGwordLineNum and not SetNGResAnchor then begin
+                                       ThreadStrings.Strings[i] := FAbonString;
+                               end else if not ReturnNGwordLineNum then begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<>&gt;%d<><>',[(i+1)]);
+                               end else if not SetNGResAnchor then begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B><><>',[NGwordsLine]);
+                               end else begin
+                                       ThreadStrings.Strings[i] := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B>&gt;%d <><>',[NGwordsLine,(i+1)]);
+                               end;
+                       end;
+               end else begin
+                       bufline := ThreadStrings.Strings[i];
+                       if Deleterlo = true then begin
+                               bufline := CustomStringReplace(bufline,'&rlo;','');
+                               bufline := CustomStringReplace(bufline,'&lro;','');
+                       end;
+                       if Replaceul = true then begin
+                               bufline := CustomStringReplace( bufline,'<ul>','<br>' );
+                               bufline := CustomStringReplace( bufline,'</ul>','<br>' );
+                       end;
+                       if DeleteSyria = true then
+                               bufline := TreatSyria(bufline);
+                       ThreadStrings.Strings[i] := bufline;
+               end;
+       end;
+end;
+procedure TAbon.ExecuteEx(var ResString : String; ResNumber : Integer);
 var
-    datstl : TStringList;
-    i : Integer;
-    endnum : Integer; //\8fI\82í\82è\82Ì\83\8c\83X\94Ô
-    ret : Boolean;
-begin
-    ret := true;
-    datstl := TStringList.Create;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            if (firstres > 0) and (firstres <= datstl.Count) then begin
-                if firstres + count -1 > datstl.Count then begin
-                    endnum := datstl.Count;
-                end else if count <= 0 then begin
-                    endnum := firstres + 1;
-                end else begin
-                    endnum := firstres + count -1;
-                end;
-
-                for i := firstres to endnum do begin
-                    if AnsiPos(FAbonString, datstl.Strings[i-1]) <> 1 then begin
-                        datstl.Strings[i-1] := FAbonString + datstl.Strings[i-1];
-                    end;
-                end;
-            end;
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
+       NGwordsLine : Integer;
+       bufline : String;
+       invisi : Boolean;
+begin
+       NGwordsLine := 0;
+       if FindNGwordsEx(ResString, NGwordsLine ,invisi) <> Reverse  then begin
+               if invisi = true then begin
+                       ResString := '';
+               end else begin
+                       if not ReturnNGwordLineNum and not SetNGResAnchor then begin
+                               ResString := FAbonString;
+                       end else if not ReturnNGwordLineNum then begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<>&gt;%d<><>',[(ResNumber)]);
+                       end else if not SetNGResAnchor then begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B><><>',[NGwordsLine]);
+                       end else begin
+                               ResString := Format('&nbsp;<>&nbsp;<>&nbsp;<><B> %d \8ds\96Ú\82ÌNG\83\8f\81[\83h\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B</B>&gt;%d <><>',[NGwordsLine,(ResNumber)]);
+                       end;
+               end;
+       end else begin
+               bufline := ResString;
+               if Deleterlo = true then begin
+                       bufline := CustomStringReplace( bufline,'&rlo;','' );
+                       bufline := CustomStringReplace( bufline,'&lro;','' );
+               end;
+               if Replaceul = true then begin
+                       bufline := CustomStringReplace( bufline,'<ul>','<br>' );
+                       bufline := CustomStringReplace( bufline,'</ul>','<br>' );
+               end;
+               if DeleteSyria = true then
+                       bufline := TreatSyria(bufline);
+               ResString := bufline;
+       end;
 end;
-//DAT\82ð\92¼\82É\82¢\82\82é\93z\82ç==========\82±\82±\82Ü\82Å=========================================
 
-//\8c³\82É\96ß\82·\93z\82ç==================================================================
-function TAbon.ReverseExecuteFile(datfilepath : String) : Boolean; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
+procedure TAbon.ExecuteEx(var ThreadStrings : TStringList; NGwords : TStringList);
 var
-    datstl : TStringList;
-    i : Integer;
-    buf : String;
-    ret : Boolean;
-begin
-    ret := true;
-    datstl := TStringList.Create;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            for i:=0 to datstl.Count -1  do begin
-                if AnsiPos(FAbonString, datstl.Strings[i]) = 1 then begin
-                    buf := datstl.Strings[i];
-                    Delete(buf,1,Length(FAbonString));
-                    datstl.Strings[i] := buf;
-                end;
-            end;
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
-
-end;
-function TAbon.ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
-var
-    datstl : TStringList;
-    buf : String;
-    ret : Boolean;
+       i : Integer;
 begin
-    ret := true;
-    datstl := TStringList.Create;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            if (resnum > 0) and (resnum <= datstl.Count) then begin
-                if AnsiPos(FAbonString, datstl.Strings[resnum-1]) = 1 then begin
-                    buf := datstl.Strings[resnum-1];
-                    Delete(buf,1,Length(FAbonString));
-                    datstl.Strings[resnum-1] := buf;
-                end;
-            end;
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
+       SetLength(Ftokens,NGwords.Count);
+       for i := 0  to NGwords.Count -1 do begin
+               SetTokens(i , NGwords.Strings[i]);
+       end;
+       ExecuteEx(ThreadStrings);
 
 end;
-function TAbon.ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean;//DAT\83t\83@\83C\83\8b\82ð\92¼\82É\82¢\82\82é
+procedure TAbon.ExecuteEx(var ThreadStrings : TStringList; NGwords : TStrings);
 var
-    datstl : TStringList;
-    i : Integer;
-    endnum : Integer; //\8fI\82í\82è\82Ì\83\8c\83X\94Ô
-    buf : String;
-    ret : Boolean;
+       i : Integer;
+       buf : TStringList;
 begin
-    ret := true;
-    datstl := TStringList.Create;
-    try
-        try
-            datstl.LoadFromFile(datfilepath);
-            if (firstres > 0) and (firstres <= datstl.Count) then begin
-                if firstres + count -1 > datstl.Count then begin
-                    endnum := datstl.Count;
-                end else if count <= 0 then begin
-                    endnum := firstres + 1;
-                end else begin
-                    endnum := firstres + count -1;
-                end;
-                for i := firstres to endnum do begin
-                    if AnsiPos(FAbonString, datstl.Strings[i-1]) = 1 then begin
-                        buf := datstl.Strings[i-1];
-                        Delete(buf,1,Length(FAbonString));
-                        datstl.Strings[i-1] := buf;
-                    end;
-                end;
-            end;
-            datstl.SaveToFile(datfilepath);
-        except
-            ret := false;
-        end;
-    finally
-        datstl.Free;
-    end;
-    Result := ret;
+       buf := TStringList.Create;
+       buf.AddStrings(NGwords);
+       SetLength(Ftokens,buf.Count);
+       for i := 0  to buf.Count -1 do begin
+               SetTokens(i , buf.Strings[i]);
+       end;
+       ExecuteEx(ThreadStrings);
+       buf.Free;
 end;
-//\8c³\82É\96ß\82·\93z\82ç=================\82±\82±\82Ü\82Å=========================================
+
+//****************************************************************************//
 //\8c»\8dÝ\83Z\83b\83g\82³\82ê\82Ä\82¢\82éNGword.txt\82ð\8aJ\82­
 procedure TAbon.EditNGwords();
 begin
-    ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);
+       ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);
 end;
 //\83|\83b\83v\83A\83b\83v\97p\94»\92è\8aÖ\90\94
 function TAbon.CheckAbonPopupRes(line : String) :Boolean;
+var
+       i: Integer;
+       v: boolean;
 begin
-    if AbonPopupRes = true then begin
-        Result := FindNGwords(line);
-    end else begin
-        Result := false;
-    end;
+       if AbonPopupRes = true then begin
+               Result := FindNGwords(line, i ,v);
+       end else begin
+               Result := false;
+       end;
 end;
 //\95¡\90\94\82ÌNG\83\8f\81[\83h\83e\83L\83X\83g\82ð\93Ç\82Ý\8d\9e\82Þ==============================================
 //List\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ
@@ -733,6 +681,31 @@ begin
         FAbonRes[0].option := -1;
     end;
 end;
+procedure TAbon.IndividualAbon(var ResString : String; SetResNumFile : String; ResNumber : Integer);
+var
+       i : Integer;
+begin
+       if FileExists(SetResNumFile) = true then begin
+       if LoadFromSetResNumFile(SetResNumFile) = true then begin
+               for i := 0 to High(FAbonRes) do begin
+                 if FAbonRes[i].Res = ResNumber then begin
+                       if FAbonRes[i].option = 0 then begin
+                       ResString := '';
+                    end else begin
+                        ResString := '\82 \82Ú\81`\82ñ<>\82 \82Ú\81`\82ñ<>\82 \82Ú\81`\82ñ<>\82 \82Ú\81`\82ñ<>';
+                    end;
+                    Exit;
+                 end;
+            end;
+        end;
+    end else begin
+        FIndividualFileName := SetResNumFile;
+       SetLength(FAbonRes,1);
+        FAbonRes[0].Res := 0;
+        FAbonRes[0].option := -1;
+    end;
+end;
+
 //\8cÂ\95Ê\82 \82Ú\81`\82ñ\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý\8aÖ\90\94
 function TAbon.LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
 var
@@ -770,35 +743,41 @@ begin
     Result := true;
 end;
 //\8cÂ\95Ê\82 \82Ú\81`\82ñ\83t\83@\83C\83\8b\82É\92Ç\89Á
-procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer);
+procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer; SetResNumFile : String);
 var
        IndividualFile : TStringList;
-    linebuf : String;
-    i : Integer;
-begin
-    IndividualFile := TStringList.Create;
-       if FAbonRes[0].Res <> 0 then begin
-        for i := 0 to High(FAbonRes) do begin
-            if FAbonRes[i].Res <> ResNum then begin
-                       linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);
-               IndividualFile.Append(linebuf);
-            end;
-        end;
-    end;
-    linebuf := IntToStr(ResNum) + '-' + IntToStr(option);
-    IndividualFile.Append(linebuf);
-    try
-       IndividualFile.SaveToFile(FIndividualFileName);
-    finally
-        IndividualFile.Free;
-    end;
+       i, j : Integer;
+begin
+       IndividualFile := TStringList.Create;
+       try
+               if FileExists(SetResNumFile) then begin
+                       IndividualFile.LoadFromFile(SetResNumFile);
+                       i := -1;
+                       for j := 0 to IndividualFile.Count -1 do begin
+                               if AnsiPos(IntToStr(ResNum) + '-', IndividualFile[j]) = 1 then begin
+                                       i := j;
+                                       break;
+                               end;
+                       end;
+                       if i = -1 then
+                               IndividualFile.Add(IntToStr(ResNum) + '-' + IntToStr(option))
+                       else
+                               IndividualFile[j] := IntToStr(ResNum) + '-' + IntToStr(option);
+
+               end else begin
+                       IndividualFile.Add(IntToStr(ResNum) + '-' + IntToStr(option));
+               end;
+               IndividualFile.SaveToFile(SetResNumFile);
+       finally
+               IndividualFile.Free;
+       end;
 end;
 //\8cÂ\95Ê\82 \82Ú\81`\82ñ\83t\83@\83C\83\8b\82©\82ç\8dí\8f\9c
 procedure TAbon.DeleteIndividualAbon( ResNum : Integer);
 var
        IndividualFile : TStringList;
-    linebuf : String;
-    i : Integer;
+       linebuf : String;
+       i : Integer;
 begin
     IndividualFile := TStringList.Create;
        if FAbonRes[0].Res <> 0 then begin
@@ -810,53 +789,149 @@ begin
         end;
     end;
        if IndividualFile.Count <> 0 then begin
-       try
-               IndividualFile.SaveToFile(FIndividualFileName);
-       finally
-               IndividualFile.Free;
-       end;
-    end else begin
-       if FileExists(FIndividualFileName) = true then begin
-               DeleteFile(FIndividualFileName);
-        end;
-    end;
+               try
+                       IndividualFile.SaveToFile(FIndividualFileName);
+               finally
+                       IndividualFile.Free;
+               end;
+       end else begin
+               if FileExists(FIndividualFileName) = true then begin
+                       DeleteFile(FIndividualFileName);
+               end;
+       end;
 end;
 //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82Ì\83\8a\83X\83g\82Ì\8cÂ\90\94\82ð\95Ô\82·
 function TAbon.GetAbonResCount() : Integer;
 var
        i : Integer;
 begin
-    if FAbonRes[0].Res = 0 then begin
-       Result := 0
-    end else begin
+       if FAbonRes[0].Res = 0 then begin
+               Result := 0
+       end else begin
                i := High(FAbonRes);
-        Result := i+1;
-    end;
+               Result := i+1;
+       end;
 end;
 //\8cÂ\95Ê\82 \82Ú\81`\82ñ\82Ì\83\8a\83X\83g\82Ì\82\8e\8ds\96Ú\82Ì\83\8c\83X\82ð\95\8e\9a\97ñ\82Å\95Ô\82·
 function TAbon.GetAbonResString(Num : Integer) : String;
 begin
        if (Num <= High(FAbonRes)) and (Num >= 0) then begin
-       Result := IntToStr(FAbonRes[Num].Res);
-    end else begin
-       Result := '';
-    end;
+               Result := IntToStr(FAbonRes[Num].Res);
+       end else begin
+               Result := '';
+       end;
 end;
+function TAbon.GetAbonResCount(SetResNumFile : String) : Integer;
+var
+       bufStringList : TStringList;
+begin
+       Result := 0;
+       if FileExists(SetResNumFile) then begin
+               bufStringList := TStringList.Create;
+               try
+                       try
+                               bufStringList.LoadFromFile(SetResNumFile);
+                               Result := bufStringList.Count;
+                       except
+                       end;
+               finally
+                       bufStringList.Free;
+               end;
+       end;
+end;
+procedure TAbon.DeleteIndividualAbon( ResNum : Integer; SetResNumFile : String);
+var
+       i: Integer;
+       bufStringList : TStringList;
+begin
+       if FileExists(SetResNumFile) then begin
+               bufStringList := TStringList.Create;
+               try
+                       try
+                               bufStringList.LoadFromFile(SetResNumFile);
+                               i := bufStringList.IndexOf(IntToStr(ResNum)+'-');
+                               if i > 0 then
+                                       bufStringList.Delete(i);
+                       except
+                       end;
+               finally
+                       bufStringList.Free;
+               end;
+       end;
+end;
+
 //\83|\83b\83v\83A\83b\83v\82Ì\94»\92è\97p
 function TAbon.CheckIndividualAbonList(ResNum : Integer) : Boolean;
 var
        i : Integer;
 begin
        if FAbonRes[0].Res <> 0 then begin
-       for i := 0 to High(FAbonRes) do begin
-               if FAbonRes[i].Res = ResNum then begin
-               Result := true;
-                Exit;
-            end;
-        end;
-    end;
-    Result := false;
-    
+               for i := 0 to High(FAbonRes) do begin
+                       if FAbonRes[i].Res = ResNum then begin
+                               Result := true;
+                               Exit;
+                       end;
+               end;
+       end;
+       Result := false;
+
 end;
+//\83V\83\8a\83A\8cê\83u\83\89\83N\83\89\91Î\8dô
+function TAbon.TreatSyria(AString: string): string;
+var
+       //count: Integer; //(&#1792~&#1871)
+       pos: Integer;
+       tmp: string;
+begin
+       pos := AnsiPos('&#18', AString);
+       while pos <> 0  do begin
+               if StrToIntDef(Copy(AString, pos+4, 2), -1) > 0 then begin
+                       if (AString[pos+6] = ';' )  or (AString[pos+6] = ' ') then begin
+                               tmp := tmp + Copy(AString, 1, pos - 1);
+                               Delete(AString, 1, pos+6);
+                       end else if StrToIntDef(AString[pos+6], -1) = -1 then begin
+                               tmp := tmp + Copy(AString, 1, pos - 1);
+                               Delete(AString, 1, pos+5);
+                       end else begin
+                               tmp := tmp + Copy(AString, 1, pos + 5);
+                               Delete(AString, 1, pos+5);
+                       end;
+               end else begin
+                       tmp := tmp + Copy(AString, 1, pos + 5);
+                       Delete(AString, 1, pos+5);
+               end;
+               pos := AnsiPos('&#18', AString);
+       end;
+       if Length(AString) > 0 then
+               tmp := tmp + AString;
+       AString := tmp;
+       tmp := '';
+
+       pos := AnsiPos('&#179', AString);
+       while pos <> 0 do begin
+               if StrToIntDef(Copy(AString, pos+5, 1), 0) > 2 then begin
+                       if (AString[pos+6] = ';') or (AString[pos+6] = ' ') then begin
+                               tmp := tmp + Copy(AString, 1, pos - 1);
+                               Delete(AString, 1, pos+6);
+                       end else if StrToIntDef(AString[pos+6], -1) = -1 then begin
+                               tmp := tmp + Copy(AString, 1, pos - 1);
+                               Delete(AString, 1, pos+5);
+                       end else begin
+                               tmp := tmp + Copy(AString, 1, pos + 5);
+                               Delete(AString, 1, pos+5);
+                       end;
+               end else begin
+                       tmp := tmp + Copy(AString, 1, pos + 5);
+                       Delete(AString, 1, pos+5);
+               end;
+               pos := AnsiPos('&#179', AString);
+       end;
+       if Length(AString) > 0 then
+               tmp := tmp + AString;
+       Result := tmp;
+end;
+
+
+
 end.