1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-08 06:08:20 -05:00
IW4M-Admin/SharedLibraryCore/Helpers/ParsedInputResult.cs
Amos 4d1e7c2692
Refactor PromptClientInput to accept string array for prompt (#336)
* Refactor PromptClientInput to accept string array for prompt

Updated the `PromptClientInput` method to accept a string array instead of a single string. This change ensures that multiple prompts can be handled, improving input flexibility and client communication. Additionally, modified related method calls to maintain consistency with the new input type.

* Refactor PromptClientInput to support parsed result and errors

Updated PromptClientInput to handle parsed input results and return error messages instead of raw strings. Introduced ParsedInputResult<TResult> class to encapsulate parsing results and errors, enhancing client validation and feedback mechanism.
2024-08-05 16:09:50 +01:00

17 lines
405 B
C#

using System.Collections.Generic;
namespace SharedLibraryCore.Helpers;
public class ParsedInputResult<TResult>
{
public TResult? Result { get; set; }
public string? RawInput { get; set; }
public List<string> ErrorMessages { get; set; } = [];
public ParsedInputResult<TResult> WithError(string errorMessage)
{
ErrorMessages.Add(errorMessage);
return this;
}
}