Files
Electron.NET/ElectronNET.CLI/EmbeddedFileHelper.cs
Robert Muehsig 606d78ca42 install command?
2017-10-04 23:11:23 +02:00

36 lines
1.1 KiB
C#

using System;
using System.IO;
using System.Reflection;
namespace ElectronNET.CLI
{
public static class EmbeddedFileHelper
{
private const string ResourcePath = "ElectronNET.CLI.{0}";
public static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
return asm.GetManifestResourceStream(resource);
}
public static string GetTestResourceFileContent(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
using (var stream = asm.GetManifestResourceStream(resource))
{
if (stream != null)
{
var reader = new StreamReader(stream);
return reader.ReadToEnd();
}
}
return String.Empty;
}
}
}