public async Task<getUpdatesResponse> GetUpdates(DateTime time)
{
var created = DateTime.Now.ToUniversalTime();
var nonce = GetNonce();
var createdStr = created.ToString("yyyy-MM-ddTHH:mm:ssZ");
var password = Encoding.UTF8.GetBytes(GetSha1String(nonce + createdStr + _password));
var request = new GetUpdatesRequest
{
from = DateTime.Now,
_reqLogin = new ReqLogin
{
UserName = _username,
Password = Convert.ToBase64String(password),
Nonce = Convert.ToBase64String(Encoding.UTF8.GetBytes(nonce)),
Created = createdStr
},
};
var result = await _service.getUpdatesAsync(request).ConfigureAwait(false);
return result;
}
private static string GetNonce()
{
var phrase = Guid.NewGuid().ToString();
return phrase;
}
private string GetSha1String(string phrase)
{
var sha1Hasher = new SHA1CryptoServiceProvider();
var hashedDataBytes = sha1Hasher.ComputeHash(Encoding.UTF8.GetBytes(phrase));
return Convert.ToBase64String(hashedDataBytes);
}
var result = await _repository.GetWithPredicate(predicate: p => p. == service.Name, order: null, include: null, token);