Get Resource As Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public static class Utils
{
public static List<Byte> GetResourceAsBytes(string ResourcePath)
{
List<Byte> result = new List<byte>();
Uri uri = new Uri(ResourcePath, UriKind.Relative);
System.Windows.Resources.StreamResourceInfo sri = System.Windows.Application.GetResourceStream(uri);
System.IO.Stream componentStream = sri.Stream;
Byte[] bytes = new Byte[componentStream.Length];
int size = componentStream.Read(bytes, 0, (int)componentStream.Length);
result.AddRange(bytes);
return result;
}
}
Related examples in the same category