23 lines
499 B
C#
23 lines
499 B
C#
using System.Reflection;
|
|
|
|
namespace RobloxLegacy.Utilities;
|
|
|
|
public class Resource(string name)
|
|
{
|
|
private Stream? GetStream()
|
|
{
|
|
var assembly = Assembly.GetExecutingAssembly();
|
|
return assembly.GetManifestResourceStream(name);
|
|
}
|
|
|
|
public byte[]? GetBytes()
|
|
{
|
|
using var stream = GetStream();
|
|
if (stream == null)
|
|
return null;
|
|
|
|
using var ms = new MemoryStream();
|
|
stream.CopyTo(ms);
|
|
return ms.ToArray();
|
|
}
|
|
} |