EmbeddedResource.cs 608 B

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