mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
rework additional repositories
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
namespace Emby.Server.Implementations.Data
|
||||
@@ -25,7 +27,12 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
public static byte[] ToGuidParamValue(this string str)
|
||||
{
|
||||
return new Guid(str).ToByteArray();
|
||||
return ToGuidParamValue(new Guid(str));
|
||||
}
|
||||
|
||||
public static byte[] ToGuidParamValue(this Guid guid)
|
||||
{
|
||||
return guid.ToByteArray();
|
||||
}
|
||||
|
||||
public static Guid ReadGuid(this IResultSetValue result)
|
||||
@@ -101,5 +108,24 @@ namespace Emby.Server.Implementations.Data
|
||||
DateTimeFormatInfo.InvariantInfo,
|
||||
DateTimeStyles.None).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes to bytes.
|
||||
/// </summary>
|
||||
/// <returns>System.Byte[][].</returns>
|
||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
||||
public static byte[] SerializeToBytes(this IJsonSerializer json, object obj, IMemoryStreamFactory streamProvider)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
throw new ArgumentNullException("obj");
|
||||
}
|
||||
|
||||
using (var stream = streamProvider.CreateNew())
|
||||
{
|
||||
json.SerializeToStream(obj, stream);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user