mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 09:44:47 +03:00
Tweaked json and jsv serializers
This commit is contained in:
parent
020c20bd7d
commit
a2f120b76b
@@ -18,5 +18,21 @@ namespace MediaBrowser.Common.Serialization
|
||||
{
|
||||
return ServiceStack.Text.TypeSerializer.DeserializeFromStream<T>(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);
|
||||
}
|
||||
}
|
||||
|
||||
public static T DeserializeFromFile<T>(string file)
|
||||
{
|
||||
using (Stream stream = File.OpenRead(file))
|
||||
{
|
||||
return ServiceStack.Text.TypeSerializer.DeserializeFromStream<T>(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user