Skip to content

Commit 7f6f776

Browse files
committed
new RemoveDBKey method
1 parent 21b5510 commit 7f6f776

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Code/FileSystem/Structures/Database.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ value is DynamicTextValue
9494
public void RemoveKey(string key, bool save = true)
9595
{
9696
_db.Remove(key);
97+
if (save) Save();
9798
}
9899

99100
public TryGet<DatabaseValue> HasKey(string key)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using JetBrains.Annotations;
2+
using SER.Code.ArgumentSystem.Arguments;
3+
using SER.Code.ArgumentSystem.BaseArguments;
4+
using SER.Code.MethodSystem.BaseMethods.Synchronous;
5+
6+
namespace SER.Code.MethodSystem.Methods.DatabaseMethods;
7+
8+
[UsedImplicitly]
9+
public class RemoveDBKeyMethod : SynchronousMethod
10+
{
11+
public override string Description => "Removes a key from a database.";
12+
13+
public override Argument[] ExpectedArguments { get; } =
14+
[
15+
new DatabaseArgument("database"),
16+
new TextArgument("key")
17+
];
18+
19+
public override void Execute()
20+
{
21+
Args.GetDatabase("database").RemoveKey(Args.GetText("key"));
22+
}
23+
}

0 commit comments

Comments
 (0)