init
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
using System.IO;
|
||||
|
||||
namespace DatabaseMigrationScripts
|
||||
{
|
||||
public class EmbeddedResource
|
||||
{
|
||||
private EmbeddedResource()
|
||||
{
|
||||
}
|
||||
|
||||
public static StreamReader GetStream(System.Reflection.Assembly assembly, string name)
|
||||
{
|
||||
foreach (var resName in assembly.GetManifestResourceNames())
|
||||
{
|
||||
if (resName.EndsWith(name))
|
||||
{
|
||||
return new StreamReader(assembly.GetManifestResourceStream(resName));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetString(System.Reflection.Assembly assembly, string name)
|
||||
{
|
||||
var sr = GetStream(assembly, name);
|
||||
var data = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
return data;
|
||||
}
|
||||
|
||||
public static string GetString(string name)
|
||||
{
|
||||
return GetString(typeof(EmbeddedResource).Assembly, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user