feat(debug): Enhance logging for task management and data handling

Added conditional logging for various functions in the DragonflyDB interface to improve debugging capabilities. This includes detailed logs for task processing, fetching, publishing, and subscribing actions, which are now only active in debug mode. Additionally, updated the buffer size and path handling in the main extension code for better performance and compatibility.
This commit is contained in:
Jacob Schmidt 2025-03-23 22:32:18 -05:00
parent 8733ad20f5
commit b23679a8c3
13 changed files with 274 additions and 119 deletions

Binary file not shown.

Binary file not shown.

View File

@ -39,10 +39,15 @@ params [["_taskType", "", [""]], ["_key", "", [""]], ["_keyField", "", [""]], ["
private _task = [_taskType, _key, _keyField, _index, _value, _function, _call, _netId]; private _task = [_taskType, _key, _keyField, _index, _value, _function, _call, _netId];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Added Task '%1' to Queue", _task]; #ifdef __ARMA__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Added Task '%1' to Queue", _task];
#endif
GVAR(taskQueue) pushBack _task; GVAR(taskQueue) pushBack _task;
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue: %1", GVAR(taskQueue)];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue Size: %1", count GVAR(taskQueue)]; #ifdef __ARMA__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue: %1", GVAR(taskQueue)];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue Size: %1", count GVAR(taskQueue)];
#endif
if !(GVAR(isProcessing)) then { [] spawn FUNC(processQueue); }; if !(GVAR(isProcessing)) then { [] spawn FUNC(processQueue); };

View File

@ -20,13 +20,15 @@
["uniqueID", "function", "index", "indextotal", "datachunk", "call", "netId"] ["uniqueID", "function", "index", "indextotal", "datachunk", "call", "netId"]
*/ */
diag_log _this; #ifdef __A3__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Input: %1", _this];
#endif
params ["_uniqueID", "_function", "_index", "_total", "_datachunk", "_call", "_netId"]; params ["_uniqueID", "_function", "_index", "_total", "_datachunk", "_call", "_netId"];
private _dataString = ""; private _dataString = "";
private _index_array = []; private _index_array = [];
private _count_total = -1; private _count_total = 0;
dragonfly_db_fetch_array pushBackUnique [_uniqueID, _function, _index, _total, _datachunk, _call, _netId]; dragonfly_db_fetch_array pushBackUnique [_uniqueID, _function, _index, _total, _datachunk, _call, _netId];
@ -42,13 +44,17 @@ _count_total = {
if (_count_total == _total) then { if (_count_total == _total) then {
_index_array sort true; _index_array sort true;
for "_i" from 0 to (_total - 1) do { {
_dataString = _dataString + ((_index_array select _i) select 1); _dataString = _dataString + (_x select 1);
}; } forEach _index_array;
diag_log _dataString; #ifdef __ARMA__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Data String: %1", _dataString];
#endif
[_uniqueID, _function, _call, (parseSimpleArray _dataString), _netId] call FUNC(handler); private _callValue = (_call == "true");
[_uniqueID, _function, _callValue, (parseSimpleArray _dataString), _netId] call FUNC(handler);
dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])}; dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])};
}; };

View File

@ -41,25 +41,123 @@ while { count GVAR(taskQueue) > 0} do {
private _call = _task select 6; private _call = _task select 6;
private _netId = _task select 7; private _netId = _task select 7;
diag_log text format ["Initializing Task: %1", _task]; #ifdef __ARMA__DEBUG__
diag_log text format ["Initializing Task: %1", _task];
#endif
switch (_taskType) do { switch (_taskType) do {
case "get": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _function, _call, _netId] call FUNC(get); }; case "get": {
case "set": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _value] call FUNC(set); }; #ifdef __ARMA_DEBUG__
case "del": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key] call FUNC(delete); }; diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
case "hget": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_keyField, _function, _call, _netId] call FUNC(hashGet); }; #endif
case "hgetid": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _keyField, _function, _call, _netId] call FUNC(hashGetId); };
case "hgetall": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_function, _call, _netId] call FUNC(hashGetAll); }; [_key, _function, _call, _netId] call FUNC(get);
case "hgetallid": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _function, _call, _netId] call FUNC(hashGetAllId); }; };
case "hset": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_keyField, _value] call FUNC(hashSet); }; case "set": {
case "hsetbulk": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_value] call FUNC(hashSetBulk); }; #ifdef __ARMA_DEBUG__
case "hsetid": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _keyField, _value] call FUNC(hashSetId); }; diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
case "hsetidbulk": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_value] call FUNC(hashSetIdBulk); }; #endif
case "listadd": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _value] call FUNC(listAdd); };
case "listidx": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _index, _function, _call, _netId] call FUNC(listGet); }; [_key, _value] call FUNC(set);
case "listrng": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _function, _call, _netId] call FUNC(listLoad); }; };
case "listrem": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _index] call FUNC(listRemove); }; case "del": {
case "listset": { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType]; [_key, _index, _value] call FUNC(listSet); }; #ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key] call FUNC(delete);
};
case "hget": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_keyField, _function, _call, _netId] call FUNC(hashGet);
};
case "hgetid": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _keyField, _function, _call, _netId] call FUNC(hashGetId);
};
case "hgetall": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_function, _call, _netId] call FUNC(hashGetAll);
};
case "hgetallid": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _function, _call, _netId] call FUNC(hashGetAllId);
};
case "hset": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_keyField, _value] call FUNC(hashSet);
};
case "hsetbulk": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_value] call FUNC(hashSetBulk);
};
case "hsetid": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _keyField, _value] call FUNC(hashSetId);
};
case "hsetidbulk": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_value] call FUNC(hashSetIdBulk);
};
case "listadd": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _value] call FUNC(listAdd);
};
case "listidx": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _index, _function, _call, _netId] call FUNC(listGet);
};
case "listrng": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _function, _call, _netId] call FUNC(listLoad);
};
case "listrem": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _index] call FUNC(listRemove);
};
case "listset": {
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_processQueue' Processing Task '%1'", _taskType];
#endif
[_key, _index, _value] call FUNC(listSet);
};
}; };
sleep 1; sleep 1;

View File

@ -46,7 +46,9 @@ if (_count_total == _total) then {
_dataString = _dataString + ((_index_array select _i) select 1); _dataString = _dataString + ((_index_array select _i) select 1);
}; };
diag_log _dataString; #ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data String: %1", _dataString];
#endif
[_uniqueID, _eventType, _eventName, (parseSimpleArray _dataString), _target] call FUNC(pubSubHandler); [_uniqueID, _eventType, _eventName, (parseSimpleArray _dataString), _target] call FUNC(pubSubHandler);

View File

@ -45,6 +45,8 @@ private _formattedArgs = _args apply { if (_x isEqualType "") then { str _x } el
private _extensionArgs = _formattedArgs joinString ","; private _extensionArgs = _formattedArgs joinString ",";
private _result = "ArmaDragonflyClient" callExtension ["publish", [_extensionArgs]]; private _result = "ArmaDragonflyClient" callExtension ["publish", [_extensionArgs]];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Published message to channel '%1': '%2'", _channel, _message]; #ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Published message to channel '%1': '%2'", _channel, _message];
#endif
true true

View File

@ -67,6 +67,8 @@ private _formattedArgs = _args apply { if (_x isEqualType "") then { str _x } el
private _extensionArgs = _formattedArgs joinString ","; private _extensionArgs = _formattedArgs joinString ",";
private _result = "ArmaDragonflyClient" callExtension ["subscribe", [_extensionArgs]]; private _result = "ArmaDragonflyClient" callExtension ["subscribe", [_extensionArgs]];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Subscribed to channel '%1' with event type '%2' and event name '%3'", _channel, _eventType, _eventName]; #ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Subscribed to channel '%1' with event type '%2' and event name '%3'", _channel, _eventType, _eventName];
#endif
true true

View File

@ -31,4 +31,5 @@
_res = _this; _res = _this;
dragonfly_db_test = _res; dragonfly_db_test = _res;
hint format ["%1", _res]; hint format ["%1", _res];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_test' Result: %1", _res];

View File

@ -18,11 +18,11 @@ namespace ArmaDragonflyClient
public class Main public class Main
{ {
private const string ADC_VERSION = "1.0.0"; private const string ADC_VERSION = "1.0.0";
public const int ADC_BUFFERSIZE = 1024; public const int ADC_BUFFERSIZE = 10240;
public static string ADC_HOST {get; private set; } = "127.0.0.1"; public static string ADC_HOST {get; private set; } = "127.0.0.1";
public static int ADC_PORT {get; private set; } = 6379; public static int ADC_PORT {get; private set; } = 6379;
public static string ADC_PASSWORD {get; private set; } = "xyz123"; public static string ADC_PASSWORD {get; private set; } = "xyz123";
public static string ADC_LOGFOLDER {get; private set; } = "\\@dragonfly\\logs"; public static string ADC_LOGFOLDER {get; private set; } = $"{Path.DirectorySeparatorChar}@dragonfly{Path.DirectorySeparatorChar}logs";
public static bool ADC_DEBUG {get; private set; } = false; public static bool ADC_DEBUG {get; private set; } = false;
public static bool ADC_INITCHECK {get; private set; } = false; public static bool ADC_INITCHECK {get; private set; } = false;
public static string STEAMID {get; private set; } = ""; public static string STEAMID {get; private set; } = "";
@ -50,12 +50,12 @@ namespace ArmaDragonflyClient
} }
if (str == "") if (str == "")
str = "@dragonfly\\config.xml"; str = $"{Path.DirectorySeparatorChar}@dragonfly{Path.DirectorySeparatorChar}config.xml";
if (File.Exists(Environment.CurrentDirectory + "\\" + str)) if (File.Exists(Environment.CurrentDirectory + $"{Path.DirectorySeparatorChar}{str}"))
{ {
List<string> strList = []; List<string> strList = [];
List<string> list = XElement.Load(Environment.CurrentDirectory + "\\" + str).Elements().Select<XElement, string>((Func<XElement, string>)(eintrag => (string)eintrag)).ToList<string>(); List<string> list = [.. XElement.Load(Environment.CurrentDirectory + $"{Path.DirectorySeparatorChar}{str}").Elements().Select(eintrag => (string)eintrag)];
ADC_HOST = list[0]; ADC_HOST = list[0];
ADC_PORT = Convert.ToInt32(list[1]); ADC_PORT = Convert.ToInt32(list[1]);
ADC_PASSWORD = list[2]; ADC_PASSWORD = list[2];
@ -64,7 +64,7 @@ namespace ArmaDragonflyClient
if (bool.TryParse(list[4], out bool res2)) if (bool.TryParse(list[4], out bool res2))
ADC_DEBUG = res2; ADC_DEBUG = res2;
Log(string.Format("Config file found! Context Mode: {3}! Debug Mode: {4}! Changed Server Settings to: {0}:{1}:{2}!", (object)ADC_HOST, (object)ADC_PORT, (object)ADC_PASSWORD, (object)ADC_CONTEXTLOG, (object)ADC_DEBUG), "action"); Log($"Config file found! Context Mode: {ADC_CONTEXTLOG}! Debug Mode: {ADC_DEBUG}! Changed Server Settings to: {ADC_HOST}:{ADC_PORT}:{ADC_PASSWORD}!", "action");
} }
else else
{ {
@ -341,12 +341,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_get"; string _uniqueID = $"{_id}_get";
if (argsCnt == 2) switch (argsCnt)
await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID); {
if (argsCnt == 3) case 2:
await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"')); await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID);
if (argsCnt == 4) break;
await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"')); case 3:
await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'));
break;
case 4:
await DragonflyDB.DragonflyGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"'));
break;
}
}); });
} }
@ -390,12 +396,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_listidx"; string _uniqueID = $"{_id}_listidx";
if (argsCnt == 3) switch (argsCnt)
await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID); {
if (argsCnt == 4) case 3:
await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"')); await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID);
if (argsCnt == 5) break;
await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'), argsArr[4].Trim('"')); case 4:
await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'));
break;
case 5:
await DragonflyDB.DragonflyListIndexAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'), argsArr[4].Trim('"'));
break;
}
}); });
} }
@ -413,12 +425,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_listrng"; string _uniqueID = $"{_id}_listrng";
if (argsCnt == 4) switch (argsCnt)
await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID); {
if (argsCnt == 5) case 4:
await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID, argsArr[4].Trim('"')); await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID);
if (argsCnt == 6) break;
await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID, argsArr[4].Trim('"'), argsArr[5].Trim('"')); case 5:
await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID, argsArr[4].Trim('"'));
break;
case 6:
await DragonflyDB.DragonflyListRangeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), argsArr[3].Trim('"'), _uniqueID, argsArr[4].Trim('"'), argsArr[5].Trim('"'));
break;
}
}); });
} }
@ -442,16 +460,17 @@ namespace ArmaDragonflyClient
{ {
Task.Run(async () => Task.Run(async () =>
{ {
if (argsCnt > 2) switch (argsCnt)
{ {
for (var i = 0; i < argsCnt; i += 2) case > 2:
{ for (var i = 0; i < argsCnt; i += 2)
await DragonflyDB.DragonflyHashSetAsync(STEAMID, argsArr[i].Trim('"'), argsArr[i + 1]); {
} await DragonflyDB.DragonflyHashSetAsync(STEAMID, argsArr[i].Trim('"'), argsArr[i + 1]);
} }
else break;
{ default:
await DragonflyDB.DragonflyHashSetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1]); await DragonflyDB.DragonflyHashSetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1]);
break;
} }
}); });
} }
@ -459,16 +478,17 @@ namespace ArmaDragonflyClient
private static void HandleHSetIdOperation(List<string> argsArr, int argsCnt) private static void HandleHSetIdOperation(List<string> argsArr, int argsCnt)
{ {
Task.Run(async () => { Task.Run(async () => {
if (argsCnt > 4) switch (argsCnt)
{ {
for (var i = 1; i < argsCnt; i += 2) case > 4:
{ for (var i = 1; i < argsCnt; i += 2)
await DragonflyDB.DragonflyHashSetAsync(argsArr[0].Trim('"'), argsArr[i].Trim('"'), argsArr[i + 1]); {
} await DragonflyDB.DragonflyHashSetAsync(argsArr[0].Trim('"'), argsArr[i].Trim('"'), argsArr[i + 1]);
} }
else break;
{ default:
await DragonflyDB.DragonflyHashSetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2]); await DragonflyDB.DragonflyHashSetAsync(argsArr[0].Trim('"'), argsArr[1], argsArr[2]);
break;
} }
}); });
} }
@ -478,12 +498,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_hget"; string _uniqueID = $"{_id}_hget";
if (argsCnt == 2) switch (argsCnt)
await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID); {
if (argsCnt == 3) case 2:
await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"')); await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID);
if (argsCnt == 4) break;
await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"')); case 3:
await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'));
break;
case 4:
await DragonflyDB.DragonflyHashGetAsync(STEAMID, argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"'));
break;
}
}); });
} }
@ -492,12 +518,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_hgetid"; string _uniqueID = $"{_id}_hgetid";
if (argsCnt == 3) switch (argsCnt)
await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID); {
if (argsCnt == 4) case 3:
await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"')); await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID);
if (argsCnt == 5) break;
await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'), argsArr[4].Trim('"')); case 4:
await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'));
break;
case 5:
await DragonflyDB.DragonflyHashGetAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'), argsArr[4].Trim('"'));
break;
}
}); });
} }
@ -506,12 +538,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_hgetall"; string _uniqueID = $"{_id}_hgetall";
if (argsCnt == 1) switch (argsCnt)
await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID); {
if (argsCnt == 2) case 1:
await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID, argsArr[1].Trim('"')); await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID);
if (argsCnt == 3) break;
await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID, argsArr[1].Trim('"'), argsArr[2].Trim('"')); case 2:
await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID, argsArr[1].Trim('"'));
break;
case 3:
await DragonflyDB.DragonflyHashGetAllAsync(STEAMID, argsArr[0].Trim('"'), _uniqueID, argsArr[1].Trim('"'), argsArr[2].Trim('"'));
break;
}
}); });
} }
@ -520,12 +558,18 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_hgetallid"; string _uniqueID = $"{_id}_hgetallid";
if (argsCnt == 2) switch (argsCnt)
await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID); {
if (argsCnt == 3) case 2:
await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"')); await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID);
if (argsCnt == 4) break;
await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"')); case 3:
await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'));
break;
case 4:
await DragonflyDB.DragonflyHashGetAllAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), _uniqueID, argsArr[2].Trim('"'), argsArr[3].Trim('"'));
break;
}
}); });
} }
@ -594,10 +638,15 @@ namespace ArmaDragonflyClient
Task.Run(async () => Task.Run(async () =>
{ {
string _uniqueID = $"{_id}_subscribe"; string _uniqueID = $"{_id}_subscribe";
if (argsCnt == 3) switch (argsCnt)
await DragonflyDB.DragonflySubscribeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID); {
if (argsCnt == 4) case 3:
await DragonflyDB.DragonflySubscribeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"')); await DragonflyDB.DragonflySubscribeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID);
break;
case 4:
await DragonflyDB.DragonflySubscribeAsync(argsArr[0].Trim('"'), argsArr[1].Trim('"'), argsArr[2].Trim('"'), _uniqueID, argsArr[3].Trim('"'));
break;
}
}); });
} }
} }

View File

@ -52,22 +52,9 @@ namespace ArmaDragonflyClient
data = BuildArray(data); data = BuildArray(data);
Main.Log($"{data}", "debug"); Main.Log($"{data}", "debug");
string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call},{data},\"{entity}\"]"; string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call.ToString().ToLower()},{data},\"{entity}\"]";
Main.Log($"{dataAsString}", "debug"); Main.Log($"{dataAsString}", "debug");
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString);
// if (entity == null)
// {
// string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call},{data}]";
// Main.Log($"{dataAsString}", "debug");
// Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString);
// }
// else
// {
// string dataAsString = $"[\"{uniqueId}\",\"{function}\",{call},{data},\"{entity}\"]";
// Main.Log($"{dataAsString}", "debug");
// Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_handler", dataAsString);
// };
} }
else else
{ {
@ -77,9 +64,11 @@ namespace ArmaDragonflyClient
var chunks = SplitIntoChunks(data, bufferSize); var chunks = SplitIntoChunks(data, bufferSize);
int totalChunks = chunks.Count; int totalChunks = chunks.Count;
foreach (string chunk in chunks) for (int i = 0; i < chunks.Count; i++)
{ {
string chunkAsString = $"[{uniqueId},{function},{chunks.IndexOf(chunk)},{totalChunks},\"{chunk}\",{call},\"{entity}\"]"; string escapedChunk = chunks[i].Replace("\"", "\"\"");
string callString = call ? "true" : "false";
string chunkAsString = $"[\"{uniqueId}\",\"{function}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{callString}\",\"{entity}\"]";
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_fetch", chunkAsString); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_fetch", chunkAsString);
} }
} }
@ -105,9 +94,10 @@ namespace ArmaDragonflyClient
var chunks = SplitIntoChunks(data, bufferSize); var chunks = SplitIntoChunks(data, bufferSize);
int totalChunks = chunks.Count; int totalChunks = chunks.Count;
foreach (string chunk in chunks) for (int i = 0; i < chunks.Count; i++)
{ {
string chunkAsString = $"[{uniqueId},{eventType},{eventName},{chunks.IndexOf(chunk)},{totalChunks},\"{chunk}\",\"{target}\"]"; string escapedChunk = chunks[i].Replace("\"", "\"\"");
string chunkAsString = $"[\"{uniqueId}\",\"{eventType}\",\"{eventName}\",{i+1},{totalChunks},\"{escapedChunk}\",\"{target}\"]";
Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubFetch", chunkAsString); Main.Callback("ArmaDragonflyClient", "dragonfly_db_fnc_pubSubFetch", chunkAsString);
} }
} }