Small update
This commit is contained in:
parent
77441ec126
commit
b1cd13a557
2 changed files with 12 additions and 12 deletions
|
@ -22,15 +22,15 @@ namespace Wrapper_Api_SequentMicrosystems.Main
|
||||||
/// <exception cref="Exception">Error message</exception>
|
/// <exception cref="Exception">Error message</exception>
|
||||||
public async Task<Type?> GetData<Type>(string Endpoint)
|
public async Task<Type?> GetData<Type>(string Endpoint)
|
||||||
{
|
{
|
||||||
HttpResponseMessage response = await _httpClient.GetAsync(Endpoint);
|
string response = await _httpClient.GetStringAsync(Endpoint);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
try
|
||||||
{
|
{
|
||||||
return JsonConvert.DeserializeObject<Type>(await response.Content.ReadAsStringAsync());
|
return JsonConvert.DeserializeObject<Type>(response);//await response.Content.ReadAsStringAsync());
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex) { }
|
||||||
{
|
{
|
||||||
throw new Exception(response.EnsureSuccessStatusCode().Content.ToString());
|
throw new Exception("GetData deserialize error");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,14 @@ namespace Wrapper_Api_SequentMicrosystems.RTD8TM
|
||||||
/// <returns>Deserialized data from API</returns>
|
/// <returns>Deserialized data from API</returns>
|
||||||
public async Task<SortedList<byte, float[]>> Get(string address)
|
public async Task<SortedList<byte, float[]>> Get(string address)
|
||||||
{
|
{
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
return await _client.GetData<SortedList<byte, float[]>>($"{address}api/RTDDA");
|
return await _client.GetData<SortedList<byte, float[]>>($"{address}api/RTDDA");
|
||||||
}
|
//}
|
||||||
catch //(Exception ex)
|
//catch (Exception ex)
|
||||||
{
|
//{
|
||||||
return new();
|
// throw new Exception(ex.Message);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Reference in a new issue