Advertisement
xxGHz

Untitled

Jul 31st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. public static void ExtractFile(string extPath, string asmPath)
  2.     {
  3.         PS3.ExtractFile(PS3.iAsm, extPath, "GUI.Resources." + asmPath);
  4.     }
  5.  
  6.     public static void ExtractFile(Assembly _asm, string extPath, string asmPath)
  7.     {
  8.         byte[] bytes = PS3.ExtractBytes(_asm, asmPath);
  9.         if (extPath.Contains("\\"))
  10.         {
  11.             Directory.CreateDirectory(Path.GetDirectoryName(extPath));
  12.         }
  13.         File.WriteAllBytes(extPath, bytes);
  14.     }
  15.  
  16.     public static byte[] ExtractBytes(string asmPath)
  17.     {
  18.         return PS3.ExtractBytes(PS3.iAsm, "GUI.Resources." + asmPath);
  19.     }
  20.     public static byte[] ExtractBytes(Assembly _asm, string asmPath)
  21.     {
  22.         byte[] result;
  23.         using (Stream manifestResourceStream = _asm.GetManifestResourceStream(asmPath))
  24.         {
  25.             using (MemoryStream memStream = new MemoryStream())
  26.             {
  27.                 manifestResourceStream.CopyTo(memStream);
  28.                 result = memStream.ToArray();
  29.             }
  30.         }
  31.         return result;
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement