2017-05-31 01:31:56 -04:00
|
|
|
|
using System;
|
2019-02-18 20:30:38 -05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-05-31 01:31:56 -04:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Helpers
|
2017-05-31 01:31:56 -04:00
|
|
|
|
{
|
|
|
|
|
public class MessageToken
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; private set; }
|
2019-02-18 20:30:38 -05:00
|
|
|
|
private readonly Func<Server, Task<object>> _asyncValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MessageToken(string Name, Func<Server, Task<object>> Value)
|
2017-05-31 01:31:56 -04:00
|
|
|
|
{
|
|
|
|
|
this.Name = Name;
|
2019-02-18 20:30:38 -05:00
|
|
|
|
_asyncValue = Value;
|
2017-05-31 01:31:56 -04:00
|
|
|
|
}
|
2019-02-18 20:30:38 -05:00
|
|
|
|
|
|
|
|
|
public Task<object> ProcessAsync(Server server)
|
2017-05-31 01:31:56 -04:00
|
|
|
|
{
|
2019-02-18 20:30:38 -05:00
|
|
|
|
return _asyncValue(server);
|
2017-05-31 01:31:56 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|