using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; namespace SlatedGameToolkit.Framework.Utilities { public static class EmbeddedResUtils { public static string ReadEmbeddedResourceText(string name) { string res; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("SlatedGameToolkit.Framework.Resources.{0}", name))) { using (StreamReader reader = new StreamReader(stream)) { res = reader.ReadToEnd(); } } return res; } public static byte[] ReadEmbeddedResourceData(string name) { byte[] res; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("SlatedGameToolkit.Framework.Resources.{0}", name))) { byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); res = buffer; } return res; } } }