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/ResourceExtensions.cs

29 lines
740 B

using NzbDrone.Common.EnsureThat;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace NzbDrone.Common
{
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;
}
}
}