Compare commits

...

2 Commits

Author SHA1 Message Date
Jacob Schmidt
192ddb67d9 Merge branch 'master' of https://gitea.innovativedevsolutions.org/IDSolutions/ramdb
All checks were successful
Build / Build (push) Successful in 29s
2025-03-22 14:41:19 -05:00
Jacob Schmidt
5e4cfcb945 feat: Improved ListRange functionality and updated build artifacts
This commit enhances the `ListRangeAsync` function within the ArmaRAMDb extension and updates the build artifacts.

Specifically, the following changes were made:

*   **ListStore.cs:**
    *   Modified `ListRangeAsync` to handle an `endIndex` of -1, treating it as the last element of the list.
    *   Added checks to ensure valid ranges and return an empty array if the range is invalid or the result is empty.
    *   Added a check to return an empty array if the list is not found.
*   **Build Artifacts:**
    *   Updated the `ArmaRAMDb_x64.dll` and `ArmaRAMDb_x64.so` files in the root directory and the extension/bin/Release/net8.0/win-x64/publish and extension/bin/Release/net8.0/linux-x64/publish directories.
2025-03-22 14:41:15 -05:00
5 changed files with 16 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -60,15 +60,19 @@ namespace ArmaRAMDb
}
public static async Task ListRangeAsync(string listName, string startIndex, string endIndex, string function, string uniqueId, string entity = null, string call = "false", int bufferSize = Main.ARDB_BUFFERSIZE)
{
{
await Task.Yield();
if (_lists.TryGetValue(listName, out var list))
{
lock (list)
{
int start = int.Parse(startIndex);
int end = int.Parse(endIndex);
if (end == -1)
end = list.Count - 1;
start = Math.Max(0, start);
end = Math.Min(list.Count - 1, end);
@ -80,8 +84,18 @@ namespace ArmaRAMDb
Main.Log($"ListRange: {listName} - StartIndex: {start} - EndIndex: {end} - Count: {count}", "debug");
Utils.CheckByteCount(uniqueId, $"[{data}]", function, entity, Convert.ToBoolean(call), bufferSize);
}
else
{
Main.Log($"ListRange: {listName} - Invalid range or empty result", "debug");
Utils.CheckByteCount(uniqueId, "[]", function, entity, Convert.ToBoolean(call), bufferSize);
}
}
}
else
{
Main.Log($"ListRange: {listName} - List not found", "debug");
Utils.CheckByteCount(uniqueId, "[]", function, entity, Convert.ToBoolean(call), bufferSize);
}
}
public static async Task ListSetAsync(string listName, string index, string value)