OSDN Git Service

スレッドのレス番号のポップアップメニューのこのIDをNGワードに追加機能を追加
[gikonavigoeson/gikonavi.git] / AbonUnit.pas
index 484b75d..927c368 100644 (file)
@@ -115,6 +115,7 @@ type
        //--
        function TreatSyria(AString: string): string;
     //--
+    function AddToken(AString: string; Invisible: Boolean): Boolean;
   end;
 var
        Abon1 :TAbon;
@@ -905,6 +906,32 @@ begin
        Result := Result + AString;
 end;
 
+// NG\83\8f\81[\83h\83t\83@\83C\83\8b\82É\92Ç\89Á \92Ç\89Á\82³\82ê\82½\8fê\8d\87\81ATrue\82ª\82©\82¦\82é
+function TAbon.AddToken(AString: string; Invisible: Boolean): Boolean;
+var
+       bufStringList : TStringList;
+    ngword: String;
+begin
+    Result := False;
+    if FileExists(GetNGwordpath) then begin
+        bufStringList := TStringList.Create;
+        try
+            bufStringList.LoadFromFile(GetNGwordpath);
+            if (Invisible) then begin
+                ngword := #9 + AString;
+            end else begin
+                ngword := AString;
+            end;
+            if (bufStringList.IndexOf(ngword) = -1) then begin
+                bufStringList.Add(ngword);
+                bufStringList.SaveToFile(GetNGwordpath);
+                Result := True;
+            end;
+        finally
+            bufStringList.Free;
+        end;
+    end;
+end;
 
 
 end.