You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Common/Extensions/ResourceExtensions.cs

24 lines
631 B

using System.IO;
using System.Reflection;
namespace NzbDrone.Common.Extensions
{
public static class ResourceExtensions
{
public static byte[] GetManifestResourceBytes(this Assembly assembly, string name)
{
var stream = assembly.GetManifestResourceStream(name);
var result = new byte[stream.Length];
var read = stream.Read(result, 0, result.Length);
if (read != result.Length)
{
throw new EndOfStreamException("Reached end of stream before reading enough bytes.");
}
return result;
}
}
}