Compare commits
No commits in common. "2a19973ba49667da7f620f9a93699197f1cfcdc2" and "f7fde44e7be75eaacfddf72bc8ce6b24353767dd" have entirely different histories.
2a19973ba4
...
f7fde44e7b
23
.gitignore
vendored
23
.gitignore
vendored
@ -19,7 +19,7 @@ mono_crash.*
|
|||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
# [Rr]elease/
|
[Rr]elease/
|
||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
@ -27,7 +27,7 @@ x86/
|
|||||||
[Aa][Rr][Mm]/
|
[Aa][Rr][Mm]/
|
||||||
[Aa][Rr][Mm]64/
|
[Aa][Rr][Mm]64/
|
||||||
bld/
|
bld/
|
||||||
# [Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
@ -177,8 +177,7 @@ DocProject/Help/Html2
|
|||||||
DocProject/Help/html
|
DocProject/Help/html
|
||||||
|
|
||||||
# Click-Once directory
|
# Click-Once directory
|
||||||
native/
|
publish/
|
||||||
# publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
# Publish Web Output
|
||||||
*.[Pp]ublish.xml
|
*.[Pp]ublish.xml
|
||||||
@ -240,11 +239,6 @@ ClientBin/
|
|||||||
*.pfx
|
*.pfx
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
*.deps.json
|
|
||||||
*.dll.dbg
|
|
||||||
*.so.dbg
|
|
||||||
extension/bin/Release/net8.0/linux-x64/ArmaRAMDb_x64.dll
|
|
||||||
extension/bin/Release/net8.0/win-x64/ArmaRAMDb_x64.dll
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
# Including strong name files can present a security risk
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
@ -404,4 +398,13 @@ FodyWeavers.xsd
|
|||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
# Hemtt
|
# Hemtt
|
||||||
.hemttout/
|
*.pbo
|
||||||
|
.hemttout
|
||||||
|
hemtt
|
||||||
|
hemtt.exe
|
||||||
|
*.biprivatekey
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
|
||||||
|
/target
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#ifdef DEBUG_ENABLED_MAIN
|
#ifdef DEBUG_ENABLED_MAIN
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_SETTINGS_MAIN
|
#ifdef DEBUG_SETTINGS_MAIN
|
||||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
|
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,8 +10,4 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="PublishAllPlatforms">
|
|
||||||
<Exec Command="dotnet publish -f net8.0 -c Release -r win-x64 -p:PublishAot=true -p:NativeLib=Shared -p:SelfContained=true" />
|
|
||||||
<Exec Command="wsl -e bash -ic "dotnet publish -f net8.0 -c Release -r linux-x64 -p:PublishAot=true -p:NativeLib=Shared -p:SelfContained=true"" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
# Build Windows DLL
|
|
||||||
dotnet publish -f net8.0 -c Release -r win-x64 -p:PublishAot=true -p:NativeLib=Shared -p:SelfContained=true
|
|
||||||
|
|
||||||
# Build Linux SO using WSL
|
|
||||||
wsl -e bash -ic "dotnet publish -f net8.0 -c Release -r linux-x64 -p:PublishAot=true -p:NativeLib=Shared -p:SelfContained=true"
|
|
@ -6,12 +6,25 @@ namespace ArmaRAMDb
|
|||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, string>> _hashTables = RAMDb._hashTables;
|
private static readonly ConcurrentDictionary<string, ConcurrentDictionary<string, string>> _hashTables = RAMDb._hashTables;
|
||||||
|
|
||||||
public static bool HashDelete(string tableName)
|
public static bool HashSet(string tableName, string key, string value)
|
||||||
{
|
{
|
||||||
var result = _hashTables.TryRemove(tableName, out _);
|
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
|
||||||
|
table.AddOrUpdate(key, value, (_, _) => value);
|
||||||
|
|
||||||
Main.Log($"HashDelete: {tableName} - Success: {result}", "debug");
|
Main.Log($"HashSet: {tableName} - {key} - {value}", "debug");
|
||||||
return result;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool HashSetBulk(string tableName, Dictionary<string, string> values)
|
||||||
|
{
|
||||||
|
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
|
||||||
|
foreach (var kv in values)
|
||||||
|
{
|
||||||
|
table.AddOrUpdate(kv.Key, kv.Value, (_, _) => kv.Value);
|
||||||
|
Main.Log($"HashSetBulk: {tableName} - {kv.Key} - {kv.Value}", "debug");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string HashGet(string tableName, string key)
|
public static string HashGet(string tableName, string key)
|
||||||
@ -49,12 +62,12 @@ namespace ArmaRAMDb
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HashRemove(string tableName, string key)
|
public static bool HashDelete(string tableName, string key)
|
||||||
{
|
{
|
||||||
if (_hashTables.TryGetValue(tableName, out var table))
|
if (_hashTables.TryGetValue(tableName, out var table))
|
||||||
{
|
{
|
||||||
var result = table.TryRemove(key, out _);
|
var result = table.TryRemove(key, out _);
|
||||||
Main.Log($"HashRemove: {tableName} - {key} - Success: {result}", "debug");
|
Main.Log($"HashDelete: {tableName} - {key} - Success: {result}", "debug");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,25 +75,12 @@ namespace ArmaRAMDb
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HashSet(string tableName, string key, string value)
|
public static bool DeleteHashTable(string tableName)
|
||||||
{
|
{
|
||||||
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
|
var result = _hashTables.TryRemove(tableName, out _);
|
||||||
table.AddOrUpdate(key, value, (_, _) => value);
|
|
||||||
|
|
||||||
Main.Log($"HashSet: {tableName} - {key} - {value}", "debug");
|
Main.Log($"DeleteHashTable: {tableName} - Success: {result}", "debug");
|
||||||
return true;
|
return result;
|
||||||
}
|
|
||||||
|
|
||||||
public static bool HashSetBulk(string tableName, Dictionary<string, string> values)
|
|
||||||
{
|
|
||||||
var table = _hashTables.GetOrAdd(tableName, _ => new ConcurrentDictionary<string, string>());
|
|
||||||
foreach (var kv in values)
|
|
||||||
{
|
|
||||||
table.AddOrUpdate(kv.Key, kv.Value, (_, _) => kv.Value);
|
|
||||||
Main.Log($"HashSetBulk: {tableName} - {kv.Key} - {kv.Value}", "debug");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,6 +6,14 @@ namespace ArmaRAMDb
|
|||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, string> _keyValues = RAMDb._keyValues;
|
private static readonly ConcurrentDictionary<string, string> _keyValues = RAMDb._keyValues;
|
||||||
|
|
||||||
|
public static bool SetValue(string key, string value)
|
||||||
|
{
|
||||||
|
_keyValues.AddOrUpdate(key, value, (_, _) => value);
|
||||||
|
|
||||||
|
Main.Log($"SetValue: {key} - Value: {value}", "debug");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetValue(string key)
|
public static string GetValue(string key)
|
||||||
{
|
{
|
||||||
string value = _keyValues.TryGetValue(key, out string data) ? data : string.Empty;
|
string value = _keyValues.TryGetValue(key, out string data) ? data : string.Empty;
|
||||||
@ -21,13 +29,5 @@ namespace ArmaRAMDb
|
|||||||
Main.Log($"DeleteValue: {key} - Success: {result}", "debug");
|
Main.Log($"DeleteValue: {key} - Success: {result}", "debug");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SetValue(string key, string value)
|
|
||||||
{
|
|
||||||
_keyValues.AddOrUpdate(key, value, (_, _) => value);
|
|
||||||
|
|
||||||
Main.Log($"SetValue: {key} - Value: {value}", "debug");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,14 +6,14 @@ namespace ArmaRAMDb
|
|||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, List<string>> _lists = RAMDb._lists;
|
private static readonly ConcurrentDictionary<string, List<string>> _lists = RAMDb._lists;
|
||||||
|
|
||||||
public static bool ListAdd(string listName, string value)
|
public static bool ListPush(string listName, string value)
|
||||||
{
|
{
|
||||||
if (_lists.TryGetValue(listName, out var list))
|
if (_lists.TryGetValue(listName, out var list))
|
||||||
{
|
{
|
||||||
lock (list)
|
lock (list)
|
||||||
{
|
{
|
||||||
list.Add(value);
|
list.Add(value);
|
||||||
Main.Log($"ListAdd: {listName} - Value: {value}", "debug");
|
Main.Log($"ListPush: {listName} - Value: {value}", "debug");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,22 +22,14 @@ namespace ArmaRAMDb
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ListDelete(string listName)
|
public static string ListGet(string listName, int index)
|
||||||
{
|
|
||||||
var result = _lists.TryRemove(listName, out _);
|
|
||||||
|
|
||||||
Main.Log($"ListDelete: {listName} - Success: {result}", "debug");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ListIndex(string listName, int index)
|
|
||||||
{
|
{
|
||||||
if (_lists.TryGetValue(listName, out var list))
|
if (_lists.TryGetValue(listName, out var list))
|
||||||
{
|
{
|
||||||
lock (list)
|
lock (list)
|
||||||
{
|
{
|
||||||
string value = index >= 0 && index < list.Count ? list[index] : string.Empty;
|
string value = index >= 0 && index < list.Count ? list[index] : string.Empty;
|
||||||
Main.Log($"ListIndex: {listName} - Index: {index} - Value: {value}", "debug");
|
Main.Log($"ListGet: {listName} - Index: {index} - Value: {value}", "debug");
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,46 +38,26 @@ namespace ArmaRAMDb
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<string> ListRange(string listName, int startIndex, int endIndex)
|
public static List<string> GetList(string listName)
|
||||||
{
|
{
|
||||||
|
Main.Log($"Getting contents for list: {listName}", "debug");
|
||||||
|
|
||||||
if (_lists.TryGetValue(listName, out var list))
|
if (_lists.TryGetValue(listName, out var list))
|
||||||
{
|
{
|
||||||
lock (list)
|
var contents = new List<string>(list);
|
||||||
|
Main.Log($"Found {contents.Count} entries in list {listName}", "debug");
|
||||||
|
foreach (var item in contents)
|
||||||
{
|
{
|
||||||
startIndex = Math.Max(0, startIndex);
|
Main.Log($"Value: {item}", "debug");
|
||||||
endIndex = Math.Min(list.Count - 1, endIndex);
|
|
||||||
|
|
||||||
if (startIndex <= endIndex)
|
|
||||||
{
|
|
||||||
int count = endIndex - startIndex + 1;
|
|
||||||
var value = list.GetRange(startIndex, count);
|
|
||||||
Main.Log($"ListRange: {listName} - StartIndex: {startIndex} - EndIndex: {endIndex} - Count: {count}", "debug");
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
Main.Log($"List not found: {listName}", "debug");
|
Main.Log($"List not found: {listName}", "debug");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ListRemove(string listName, string value)
|
public static bool ListDelete(string listName, int index)
|
||||||
{
|
|
||||||
if (_lists.TryGetValue(listName, out var list))
|
|
||||||
{
|
|
||||||
lock (list)
|
|
||||||
{
|
|
||||||
int removedCount = list.RemoveAll(item => item == value);
|
|
||||||
Main.Log($"ListRemove: {listName} - Value: {value} - Removed Count: {removedCount}", "debug");
|
|
||||||
return removedCount > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Main.Log($"List not found: {listName}", "debug");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool ListSet(string listName, int index, string value)
|
|
||||||
{
|
{
|
||||||
if (_lists.TryGetValue(listName, out var list))
|
if (_lists.TryGetValue(listName, out var list))
|
||||||
{
|
{
|
||||||
@ -93,8 +65,9 @@ namespace ArmaRAMDb
|
|||||||
{
|
{
|
||||||
if (index >= 0 && index < list.Count)
|
if (index >= 0 && index < list.Count)
|
||||||
{
|
{
|
||||||
list[index] = value;
|
string value = list[index];
|
||||||
Main.Log($"ListSet: {listName} - Index: {index} - Value: {value}", "debug");
|
list.RemoveAt(index);
|
||||||
|
Main.Log($"ListDelete: {listName} - Index: {index} - Value: {value}", "debug");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,5 +76,13 @@ namespace ArmaRAMDb
|
|||||||
Main.Log($"List not found: {listName}", "debug");
|
Main.Log($"List not found: {listName}", "debug");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool DeleteList(string listName)
|
||||||
|
{
|
||||||
|
var result = _lists.TryRemove(listName, out _);
|
||||||
|
|
||||||
|
Main.Log($"DeleteList: {listName} - Success: {result}", "debug");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -195,89 +195,25 @@ namespace ArmaRAMDb
|
|||||||
|
|
||||||
switch (func.ToLower())
|
switch (func.ToLower())
|
||||||
{
|
{
|
||||||
case "del":
|
|
||||||
HandleDeleteOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "get":
|
|
||||||
HandleGetOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_get\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "hdel":
|
|
||||||
HandleHashDeleteOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "hdelid":
|
|
||||||
HandleHashDeleteIdOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "hget":
|
|
||||||
HandleHashGetOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_hget\",{args[1]}]");
|
|
||||||
return 100;
|
|
||||||
case "hgetid":
|
|
||||||
HandleHashGetIdOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_hgetid\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "hgetall":
|
|
||||||
HandleHashGetAllOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_hgetall\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "hgetallid":
|
|
||||||
HandleHashGetAllIdOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_hgetallid\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "hrem":
|
|
||||||
HandleHashRemoveOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "hremid":
|
|
||||||
HandleHashRemoveIdOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "hset":
|
case "hset":
|
||||||
HandleHashSetOperation(args, argc);
|
HandleHashSetOperation(args, argc);
|
||||||
WriteOutput(output, "Async");
|
WriteOutput(output, "Async");
|
||||||
return 200;
|
return 200;
|
||||||
case "hsetid":
|
|
||||||
HandleHashSetIdOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "hsetbulk":
|
case "hsetbulk":
|
||||||
HandleHashSetBulkOperation(args, argc);
|
HandleHashSetBulkOperation(args, argc);
|
||||||
WriteOutput(output, "Async");
|
WriteOutput(output, "Async");
|
||||||
return 200;
|
return 200;
|
||||||
case "hsetbulkid":
|
case "hget":
|
||||||
HandleHashSetBulkIdOperation(args, argc);
|
HandleHashGetOperation(args, argc);
|
||||||
WriteOutput(output, "Async");
|
WriteOutput(output, $"[\"{_id}_hget\",{args[1]}]");
|
||||||
return 200;
|
return 100;
|
||||||
|
case "hgetall":
|
||||||
|
HandleHashGetAllOperation(args, argc);
|
||||||
|
WriteOutput(output, $"[\"{_id}_hgetall\",{args[0]}]");
|
||||||
|
return 100;
|
||||||
case "isloaded":
|
case "isloaded":
|
||||||
WriteOutput(output, ARDB_ISLOADED.ToString().ToLower());
|
WriteOutput(output, ARDB_ISLOADED.ToString().ToLower());
|
||||||
return 100;
|
return 100;
|
||||||
case "listadd":
|
|
||||||
HandleListAddOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "listdel":
|
|
||||||
HandleListDeleteOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "listidx":
|
|
||||||
HandleListIndexOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_listindex\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "listrng":
|
|
||||||
HandleListRangeOperation(args, argc);
|
|
||||||
WriteOutput(output, $"[\"{_id}_listrange\",{args[0]}]");
|
|
||||||
return 100;
|
|
||||||
case "listrem":
|
|
||||||
HandleListRemoveOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "listset":
|
|
||||||
HandleListSetOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "load":
|
case "load":
|
||||||
LoadData();
|
LoadData();
|
||||||
WriteOutput(output, "Data loaded");
|
WriteOutput(output, "Data loaded");
|
||||||
@ -286,15 +222,11 @@ namespace ArmaRAMDb
|
|||||||
SaveData();
|
SaveData();
|
||||||
WriteOutput(output, "Data saved");
|
WriteOutput(output, "Data saved");
|
||||||
return 100;
|
return 100;
|
||||||
case "set":
|
|
||||||
HandleSetOperation(args, argc);
|
|
||||||
WriteOutput(output, "Async");
|
|
||||||
return 200;
|
|
||||||
case "version":
|
case "version":
|
||||||
WriteOutput(output, ARDB_VERSION);
|
WriteOutput(output, ARDB_VERSION);
|
||||||
return 100;
|
return 100;
|
||||||
default:
|
default:
|
||||||
WriteOutput(output, "Available functions: delete, get, hget, hgetid, hgetall, hgetallid, hset, hsetid, hsetbulk, hsetbulkid, isloaded, load, save, set, version");
|
WriteOutput(output, "Available functions: hset, hsetbulk, hget, hgetall, isloaded, load, save, version");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,77 +283,6 @@ namespace ArmaRAMDb
|
|||||||
Log("Data loaded from XML", "action");
|
Log("Data loaded from XML", "action");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashDeleteOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
HashStore.HashDelete(STEAMID);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashDeleteIdOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
HashStore.HashDelete(args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashGetOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var value = HashStore.HashGet(STEAMID, args[0]);
|
|
||||||
|
|
||||||
Log($"HashGet: {SerializeList([value])}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[1].Trim('"'), SerializeList([value]));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashGetIdOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var value = HashStore.HashGet(args[0], args[1]);
|
|
||||||
|
|
||||||
Log($"HashGetId: {SerializeList([value])}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[2].Trim('"'), SerializeList([value]));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashGetAllOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var contents = HashStore.HashGetAll(STEAMID);
|
|
||||||
var list = contents.SelectMany(kv => new[] { kv.Key, kv.Value }).ToList();
|
|
||||||
|
|
||||||
Log($"HashGetAll: {SerializeList(list)}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[0].Trim('"'), SerializeList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashGetAllIdOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var hashId = args[0];
|
|
||||||
var contents = HashStore.HashGetAll(hashId);
|
|
||||||
var list = contents.SelectMany(kv => new[] { kv.Key, kv.Value }).ToList();
|
|
||||||
|
|
||||||
Log($"HashGetAllId: {SerializeList(list)}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[1].Trim('"'), SerializeList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashRemoveOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
HashStore.HashRemove(STEAMID, args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashRemoveIdOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var value = HashStore.HashRemove(args[0], args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
#pragma warning disable IDE0060 // Remove unused parameter
|
||||||
private static void HandleHashSetOperation(List<string> args, int argc)
|
private static void HandleHashSetOperation(List<string> args, int argc)
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#pragma warning restore IDE0060 // Remove unused parameter
|
||||||
@ -430,14 +291,6 @@ namespace ArmaRAMDb
|
|||||||
HashStore.HashSet(STEAMID, args[0], args[1]);
|
HashStore.HashSet(STEAMID, args[0], args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleHashSetIdOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
Log($"HashSetId: {SerializeList(args)}", "debug");
|
|
||||||
HashStore.HashSet(args[0], args[1], args[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
#pragma warning disable IDE0060 // Remove unused parameter
|
||||||
private static void HandleHashSetBulkOperation(List<string> args, int argc)
|
private static void HandleHashSetBulkOperation(List<string> args, int argc)
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#pragma warning restore IDE0060 // Remove unused parameter
|
||||||
@ -456,122 +309,24 @@ namespace ArmaRAMDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
#pragma warning disable IDE0060 // Remove unused parameter
|
||||||
private static void HandleHashSetBulkIdOperation(List<string> args, int argc)
|
private static void HandleHashGetOperation(List<string> args, int argc)
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#pragma warning restore IDE0060 // Remove unused parameter
|
||||||
{
|
{
|
||||||
var hashId = args[0];
|
var value = HashStore.HashGet(STEAMID, args[0]);
|
||||||
var values = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
for (int i = 1; i < args.Count; i += 2)
|
Log($"HashGet: {SerializeList([value])}", "debug");
|
||||||
{
|
|
||||||
string key = args[i];
|
|
||||||
string value = args[i + 1];
|
|
||||||
values.Add(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log($"BulkHashSetId: Keys={string.Join(",", values.Keys)}", "debug");
|
|
||||||
HashStore.HashSetBulk(hashId, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListAddOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var key = args[0];
|
|
||||||
var value = args[1];
|
|
||||||
|
|
||||||
Log($"ListAdd: {SerializeList([key, value])}", "debug");
|
|
||||||
ListStore.ListAdd(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListDeleteOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var listId = args[0];
|
|
||||||
|
|
||||||
Log($"ListDelete: {SerializeList([listId])}", "debug");
|
|
||||||
ListStore.ListDelete(listId);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListIndexOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var listId = args[0];
|
|
||||||
var key = args[1];
|
|
||||||
var value = ListStore.ListIndex(listId, int.Parse(key));
|
|
||||||
|
|
||||||
Log($"ListIndex: {SerializeList([key, value])}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[2].Trim('"'), SerializeList([value]));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListRangeOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var listId = args[0];
|
|
||||||
var startIndex = int.Parse(args[1]);
|
|
||||||
var endIndex = int.Parse(args[2]);
|
|
||||||
|
|
||||||
var values = ListStore.ListRange(listId, startIndex, endIndex);
|
|
||||||
|
|
||||||
Log($"ListRange: ListId={listId} Start={startIndex} End={endIndex} Values={SerializeList(values)}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[3].Trim('"'), SerializeList(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListRemoveOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var listId = args[0];
|
|
||||||
var index = int.Parse(args[1]);
|
|
||||||
|
|
||||||
ListStore.ListSet(listId, index, "RAMDBREMOVE");
|
|
||||||
ListStore.ListRemove(listId, "RAMDBREMOVE");
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleListSetOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var listId = args[0];
|
|
||||||
var index = int.Parse(args[1]);
|
|
||||||
var value = args[2];
|
|
||||||
|
|
||||||
ListStore.ListSet(listId, index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleSetOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var key = args[0];
|
|
||||||
var value = args[1];
|
|
||||||
|
|
||||||
KeyValueStore.SetValue(key, value);
|
|
||||||
Log($"Set: Key={key} Value={value}", "debug");
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
|
||||||
private static void HandleGetOperation(List<string> args, int argc)
|
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
|
||||||
{
|
|
||||||
var key = args[0];
|
|
||||||
var value = KeyValueStore.GetValue(key);
|
|
||||||
|
|
||||||
Log($"Get: Key={key} Value={value}", "debug");
|
|
||||||
Callback("ArmaRAMDb", args[1].Trim('"'), SerializeList([value]));
|
Callback("ArmaRAMDb", args[1].Trim('"'), SerializeList([value]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
#pragma warning disable IDE0060 // Remove unused parameter
|
||||||
private static void HandleDeleteOperation(List<string> args, int argc)
|
private static void HandleHashGetAllOperation(List<string> args, int argc)
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#pragma warning restore IDE0060 // Remove unused parameter
|
||||||
{
|
{
|
||||||
var key = args[0];
|
var contents = HashStore.HashGetAll(STEAMID);
|
||||||
|
var list = contents.SelectMany(kv => new[] { kv.Key, kv.Value }).ToList();
|
||||||
|
|
||||||
KeyValueStore.DeleteValue(key);
|
Log($"HashGetAll: {SerializeList(list)}", "debug");
|
||||||
Log($"Delete: Key={key}", "debug");
|
Callback("ArmaRAMDb", args[0].Trim('"'), SerializeList(list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user