mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-28 21:06:32 +01:00
Tweaked plugin downloading a bit
This commit is contained in:
parent
7f8a477278
commit
fc735e9187
@@ -52,6 +52,13 @@ namespace MediaBrowser.Common.Serialization
|
||||
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
|
||||
}
|
||||
|
||||
public static object DeserializeFromStream(Stream stream, Type type)
|
||||
{
|
||||
Configure();
|
||||
|
||||
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
|
||||
}
|
||||
|
||||
private static bool IsConfigured = false;
|
||||
private static void Configure()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
@@ -19,11 +20,16 @@ namespace MediaBrowser.Common.Serialization
|
||||
return ServiceStack.Text.TypeSerializer.DeserializeFromStream<T>(stream);
|
||||
}
|
||||
|
||||
public static object DeserializeFromStream(Stream stream, Type type)
|
||||
{
|
||||
return ServiceStack.Text.TypeSerializer.DeserializeFromStream(type, stream);
|
||||
}
|
||||
|
||||
public static void SerializeToFile<T>(T obj, string file)
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
{
|
||||
ServiceStack.Text.TypeSerializer.SerializeToStream<T>(obj, stream);
|
||||
SerializeToStream<T>(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +37,7 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
using (Stream stream = File.OpenRead(file))
|
||||
{
|
||||
return ServiceStack.Text.TypeSerializer.DeserializeFromStream<T>(stream);
|
||||
return DeserializeFromStream<T>(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
@@ -18,6 +19,11 @@ namespace MediaBrowser.Common.Serialization
|
||||
return ProtoBuf.Serializer.Deserialize<T>(stream);
|
||||
}
|
||||
|
||||
public static object DeserializeFromStream(Stream stream, Type type)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void SerializeToFile<T>(T obj, string file)
|
||||
{
|
||||
using (Stream stream = File.Open(file, FileMode.Create))
|
||||
|
||||
@@ -39,6 +39,14 @@ namespace MediaBrowser.Common.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
public static void SerializeToFile(object obj, string file)
|
||||
{
|
||||
using (FileStream stream = new FileStream(file, FileMode.Create))
|
||||
{
|
||||
ServiceStack.Text.XmlSerializer.SerializeToStream(obj, stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static object DeserializeFromFile(Type type, string file)
|
||||
{
|
||||
using (Stream stream = File.OpenRead(file))
|
||||
|
||||
Reference in New Issue
Block a user