print all resource names

This commit is contained in:
rafael-aero
2021-06-28 15:43:40 +02:00
parent 3b7b592ac8
commit 2f3d2c00b6
2 changed files with 26 additions and 2 deletions

View File

@@ -6,6 +6,8 @@ namespace ElectronNET.CLI.Commands.Actions
{
public static void Do(string tempPath)
{
EmbeddedFileHelper.PrintAllResources();
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json");
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "build-helper.js");

View File

@@ -6,14 +6,36 @@ namespace ElectronNET.CLI
{
public static class EmbeddedFileHelper
{
private const string ResourcePath = "h5.ElectronNET.CLI.{0}";
private const string ResourcePath = "ElectronNET.CLI.{0}";
private static Stream GetTestResourceFileStream(string folderAndFileInProjectPath)
{
var asm = Assembly.GetExecutingAssembly();
var resource = string.Format(ResourcePath, folderAndFileInProjectPath);
return asm.GetManifestResourceStream(resource);
var stream = asm.GetManifestResourceStream(resource);
if(stream is null)
{
PrintAllResources();
Console.WriteLine("Was missing resource: {0}", resource);
return null;
}
else
{
return stream;
}
}
private static void PrintAllResources()
{
var asm = Assembly.GetExecutingAssembly();
foreach (var n in asm.GetManifestResourceNames())
{
Console.WriteLine("Found resource : {0}", n);
}
}
public static void DeployEmbeddedFile(string targetPath, string file, string namespacePath = "")