EmbeddedResource.cs 522 B

12345678910111213141516171819202122
  1. using System.IO;
  2. using System.Reflection;
  3. namespace BepInEx.Patcher
  4. {
  5. internal static class EmbeddedResource
  6. {
  7. public static byte[] Get(string resourceName)
  8. {
  9. using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
  10. {
  11. int length = (int)stream.Length;
  12. byte[] buffer = new byte[length];
  13. stream.Read(buffer, 0, length);
  14. return buffer;
  15. }
  16. }
  17. }
  18. }