From c8c152ae68d0a9b569abc63dc385fc7376944cbe Mon Sep 17 00:00:00 2001 From: Sakurai Date: Mon, 12 Aug 2024 12:30:07 +0900 Subject: [PATCH] =?UTF-8?q?#2=20=E3=81=AE=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IO/IStore.cs | 4 ++++ IO/LocalStore.cs | 10 ++++++++++ JsonDB.cs | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/IO/IStore.cs b/IO/IStore.cs index a39ca26..a726f53 100644 --- a/IO/IStore.cs +++ b/IO/IStore.cs @@ -6,5 +6,9 @@ public interface IStore : IDisposable public bool Add(T item); + public bool Has(T item); + + public bool Remove(T item); + public IEnumerable GetValues(); } diff --git a/IO/LocalStore.cs b/IO/LocalStore.cs index 1f60230..f0fd036 100644 --- a/IO/LocalStore.cs +++ b/IO/LocalStore.cs @@ -53,6 +53,16 @@ public class LocalStore : IStore return true; } + public bool Has(T item) + { + return this.items.Contains(item); + } + + public bool Remove(T item) + { + return this.items.Remove(item); + } + public IEnumerable GetValues() { return this.items.ToList(); diff --git a/JsonDB.cs b/JsonDB.cs index b9eb24a..fd2d58c 100644 --- a/JsonDB.cs +++ b/JsonDB.cs @@ -26,6 +26,16 @@ public class JsonDB : IDisposable return this.store.Add(item); } + public bool Has(T item) + { + return this.store.Has(item); + } + + public bool Remove(T item) + { + return this.store.Remove(item); + } + public IEnumerable GetValues() { return this.store.GetValues();