mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Reworked the TV model AGAIN #865
This commit is contained in:
parent
25526cc4d9
commit
1b5698b3ca
10 changed files with 141 additions and 114 deletions
|
@ -6,9 +6,14 @@ namespace Ombi.Helpers
|
|||
{
|
||||
public class ByteConverterHelper
|
||||
{
|
||||
private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
|
||||
{
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.Objects
|
||||
};
|
||||
public static byte[] ReturnBytes(object obj)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(obj);
|
||||
var json = JsonConvert.SerializeObject(obj, Settings);
|
||||
var bytes = Encoding.UTF8.GetBytes(json);
|
||||
|
||||
return bytes;
|
||||
|
@ -17,7 +22,7 @@ namespace Ombi.Helpers
|
|||
public static T ReturnObject<T>(byte[] bytes)
|
||||
{
|
||||
var json = Encoding.UTF8.GetString(bytes);
|
||||
var model = JsonConvert.DeserializeObject<T>(json);
|
||||
var model = JsonConvert.DeserializeObject<T>(json, Settings);
|
||||
return model;
|
||||
}
|
||||
public static string ReturnFromBytes(byte[] bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue