Skip to content

Commit 21b5510

Browse files
committed
DatabaseValue ctor change because JSON went brrrr
1 parent aad0ed8 commit 21b5510

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Code/FileSystem/Structures/Database.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ namespace SER.Code.FileSystem.Structures;
99

1010
public class Database
1111
{
12-
public readonly struct DatabaseValue(Type originalType, object value)
12+
public readonly struct DatabaseValue(string type, object value)
1313
{
14-
public string Type { get; } = originalType.AccurateName;
14+
public string Type { get; } = type;
1515
public object Value { get; } = value;
1616
}
1717

@@ -82,11 +82,20 @@ public Result TrySet(string key, Value value, bool save = true)
8282
return $"Value '{value}' cannot be stored in databases";
8383
}
8484

85-
_db[key] = new(value is DynamicTextValue ? typeof(StaticTextValue) : value.GetType(), saveVal);
85+
_db[key] = new(
86+
value is DynamicTextValue
87+
? typeof(StaticTextValue).AccurateName
88+
: value.GetType().AccurateName, saveVal
89+
);
8690
if (save) Save();
8791
return true;
8892
}
8993

94+
public void RemoveKey(string key, bool save = true)
95+
{
96+
_db.Remove(key);
97+
}
98+
9099
public TryGet<DatabaseValue> HasKey(string key)
91100
{
92101
if (!_db.TryGetValue(key, out var val))

0 commit comments

Comments
 (0)