This commit is contained in:
Archi
2023-11-14 20:01:29 +01:00
parent b34f18497d
commit f2ff2f4929
45 changed files with 156 additions and 616 deletions

View File

@@ -186,6 +186,6 @@ public sealed class ASFController : ArchiController {
message = success ? Strings.Success : Strings.WarningFailed;
}
return Ok(new GenericResponse<string>(success, message!, version?.ToString()));
return Ok(new GenericResponse<string>(success, message, version?.ToString()));
}
}

View File

@@ -62,10 +62,8 @@ public sealed class CommandController : ArchiController {
string command = request.Command;
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
if (command.Length == commandPrefix!.Length) {
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix, StringComparison.Ordinal)) {
if (command.Length == commandPrefix.Length) {
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(command))));
}

View File

@@ -96,7 +96,7 @@ public sealed class NLogController : ArchiController {
}
if (!HttpContext.WebSockets.IsWebSocketRequest) {
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError!, $"{nameof(HttpContext.WebSockets.IsWebSocketRequest)}: {HttpContext.WebSockets.IsWebSocketRequest}")));
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{nameof(HttpContext.WebSockets.IsWebSocketRequest)}: {HttpContext.WebSockets.IsWebSocketRequest}")));
}
// From now on we can return only EmptyResult as the response stream is already being used by existing websocket connection

View File

@@ -67,8 +67,7 @@ public sealed class TypeController : ArchiController {
string? unifiedName = field.FieldType.GetUnifiedName();
if (!string.IsNullOrEmpty(unifiedName)) {
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
body[jsonProperty.PropertyName ?? field.Name] = unifiedName!;
body[jsonProperty.PropertyName ?? field.Name] = unifiedName;
}
}
}
@@ -80,8 +79,7 @@ public sealed class TypeController : ArchiController {
string? unifiedName = property.PropertyType.GetUnifiedName();
if (!string.IsNullOrEmpty(unifiedName)) {
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
body[jsonProperty.PropertyName ?? property.Name] = unifiedName!;
body[jsonProperty.PropertyName ?? property.Name] = unifiedName;
}
}
}
@@ -104,10 +102,7 @@ public sealed class TypeController : ArchiController {
continue;
}
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
body[valueText!] = valueObjText!;
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
body[valueText] = valueObjText;
}
}