mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-22 23:15:25 +00:00
print all resource names
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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 = "")
|
||||
|
||||
Reference in New Issue
Block a user