IW4M-Admin/SharedLibraryCore/Helpers/MessageToken.cs

26 lines
593 B
C#
Raw Normal View History

using System;
using System.Threading;
using System.Threading.Tasks;
2018-04-08 02:44:42 -04:00
namespace SharedLibraryCore.Helpers
{
public class MessageToken
{
public string Name { get; private set; }
2019-02-19 20:39:09 -05:00
private readonly Func<Server, Task<string>> _asyncValue;
2019-02-19 20:39:09 -05:00
public MessageToken(string Name, Func<Server, Task<string>> Value)
{
this.Name = Name;
_asyncValue = Value;
}
2019-02-19 20:39:09 -05:00
public async Task<string> ProcessAsync(Server server)
{
2019-02-19 20:39:09 -05:00
string result = await _asyncValue(server);
return result;
}
}
}