refactor implementation

This commit is contained in:
Gregor Biswanger
2017-10-05 21:28:47 +02:00
parent 27e5f87ccd
commit d224e7b1ad
5 changed files with 71 additions and 125 deletions

View File

@@ -8,7 +8,7 @@ namespace ElectronNET.CLI
{
private const string ResourcePath = "ElectronNET.CLI.{0}";
public static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
private static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
@@ -16,7 +16,7 @@ namespace ElectronNET.CLI
return asm.GetManifestResourceStream(resource);
}
public static string GetTestResourceFileContent(string folderAndFileInProjectPath)
private static string GetTestResourceFileContent(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
@@ -32,5 +32,13 @@ namespace ElectronNET.CLI
return String.Empty;
}
public static void DeployEmbeddedFile(string targetPath, string file)
{
using (var fileStream = File.Create(Path.Combine(targetPath, file)))
{
var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + file);
streamFromEmbeddedFile.CopyTo(fileStream);
}
}
}
}