mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
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.
This commit is contained in:
16
SharedLibraryCore/Helpers/ParsedInputResult.cs
Normal file
16
SharedLibraryCore/Helpers/ParsedInputResult.cs
Normal file
@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user