mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 19:40:05 -07:00
Added the SickRage API integration
This commit is contained in:
parent
6e04e2effe
commit
f21cd89a74
14 changed files with 295 additions and 3 deletions
27
src/Ombi.Helpers/JsonConvertHelper.cs
Normal file
27
src/Ombi.Helpers/JsonConvertHelper.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ombi.Helpers
|
||||
{
|
||||
public static class JsonConvertHelper
|
||||
{
|
||||
public static T[] ParseObjectToArray<T>(object ambiguousObject)
|
||||
{
|
||||
var json = ambiguousObject.ToString();
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
return new T[0]; // Could return null here instead.
|
||||
}
|
||||
if (json.TrimStart().StartsWith("["))
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T[]>(json);
|
||||
}
|
||||
if (json.TrimStart().Equals("{}"))
|
||||
{
|
||||
return new T[0];
|
||||
}
|
||||
|
||||
return new T[1] { JsonConvert.DeserializeObject<T>(json) };
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue