Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
85b80bf
commit 52f5542
Showing
4 changed files
with
118 additions
and
93 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace ElectronNET.CLI.Commands.Actions | ||
{ | ||
public static class DeployEmbeddedElectronFiles | ||
{ | ||
public static void Do(string tempPath) | ||
{ | ||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js"); | ||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json"); | ||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json"); | ||
|
||
string hostApiFolder = Path.Combine(tempPath, "api"); | ||
if (Directory.Exists(hostApiFolder) == false) | ||
{ | ||
Directory.CreateDirectory(hostApiFolder); | ||
} | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "ipc.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "app.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "browserWindows.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "dialog.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "menu.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "notification.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "tray.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "webContents.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "globalShortcut.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "shell.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "screen.js", "api."); | ||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "clipboard.js", "api."); | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
|
||
namespace ElectronNET.CLI.Commands.Actions | ||
{ | ||
public static class GetTargetPlatformInformation | ||
{ | ||
public struct GetTargetPlatformInformationResult | ||
{ | ||
public string DesiredPlatform { get; set; } | ||
public string NetCorePublishRid { get; set; } | ||
public string ElectronPackerPlatform { get; set; } | ||
|
||
} | ||
|
||
public static GetTargetPlatformInformationResult Do(string desiredPlatform) | ||
{ | ||
string netCorePublishRid = string.Empty; | ||
string electronPackerPlatform = string.Empty; | ||
|
||
switch (desiredPlatform) | ||
{ | ||
case "win": | ||
netCorePublishRid = "win-x64"; | ||
electronPackerPlatform = "win32"; | ||
break; | ||
case "osx": | ||
netCorePublishRid = "osx-x64"; | ||
electronPackerPlatform = "darwin"; | ||
break; | ||
case "linux": | ||
netCorePublishRid = "linux-x64"; | ||
electronPackerPlatform = "linux"; | ||
break; | ||
default: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
desiredPlatform = "win"; | ||
netCorePublishRid = "win-x64"; | ||
electronPackerPlatform = "win32"; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
desiredPlatform = "osx"; | ||
netCorePublishRid = "osx-x64"; | ||
electronPackerPlatform = "darwin"; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
desiredPlatform = "linux"; | ||
netCorePublishRid = "linux-x64"; | ||
electronPackerPlatform = "linux"; | ||
} | ||
|
||
break; | ||
} | ||
|
||
return new GetTargetPlatformInformationResult() | ||
{ | ||
DesiredPlatform = desiredPlatform, | ||
ElectronPackerPlatform = electronPackerPlatform, | ||
NetCorePublishRid = netCorePublishRid | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters