├── .devops └── build-nuget.yaml ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── dependabot.yml ├── .gitignore ├── .vscode ├── launch.json ├── tasks.json └── tasks.json.old ├── ElectronSharp.API.Tests ├── ElectronSharp.API.Tests.csproj ├── EmbeddedResources │ ├── UpdateInfoWithReleaseNotesArray.json │ ├── UpdateInfoWithReleaseNotesString.json │ └── UpdateInfoWithoutReleaseNotes.json ├── UpdateInfoDeserializationTests.cs └── Usings.cs ├── ElectronSharp.API ├── App.cs ├── AutoUpdater.cs ├── BridgeConnector.cs ├── BridgeSettings.cs ├── BrowserView.cs ├── BrowserWindow.cs ├── Clipboard.cs ├── CommandLine.cs ├── Cookies.cs ├── DesktopCapturer.cs ├── Dialog.cs ├── Dock.cs ├── Electron.Experimental.cs ├── Electron.cs ├── ElectronSharp.API.csproj ├── Entities │ ├── AboutPanelOptions.cs │ ├── AddRepresentationOptions.cs │ ├── AppDetailsOptions.cs │ ├── AutoResizeOptions.cs │ ├── BackgroundMaterial.cs │ ├── BitmapOptions.cs │ ├── Blob.cs │ ├── BlockMapDataHolder.cs │ ├── BrowserViewConstructorOptions.cs │ ├── BrowserWindowOptions.cs │ ├── CPUUsage.cs │ ├── Certificate.cs │ ├── CertificatePrincipal.cs │ ├── CertificateTrustDialogOptions.cs │ ├── ChromeExtensionInfo.cs │ ├── ClearStorageDataOptions.cs │ ├── Cookie.cs │ ├── CookieChangedCause.cs │ ├── CookieDetails.cs │ ├── CookieFilter.cs │ ├── CookieRemovedResponse.cs │ ├── CreateFromBitmapOptions.cs │ ├── CreateFromBufferOptions.cs │ ├── CreateInterruptedDownloadOptions.cs │ ├── Data.cs │ ├── DefaultFontFamily.cs │ ├── DesktopCapturerSource.cs │ ├── DevToolsMode.cs │ ├── Display.cs │ ├── DisplayBalloonOptions.cs │ ├── DockBounceType.cs │ ├── EnableNetworkEmulationOptions.cs │ ├── Extension.cs │ ├── FileFilter.cs │ ├── FileIconOptions.cs │ ├── FileIconSize.cs │ ├── FocusOptions.cs │ ├── GPUFeatureStatus.cs │ ├── GPUInfo.cs │ ├── GpuInfoType.cs │ ├── IPostData.cs │ ├── ImportCertificateOptions.cs │ ├── JumpListCategory.cs │ ├── JumpListCategoryType.cs │ ├── JumpListItem.cs │ ├── JumpListItemType.cs │ ├── JumpListSettings.cs │ ├── LoadURLOptions.cs │ ├── LoginItemSettings.cs │ ├── LoginItemSettingsOptions.cs │ ├── LoginSettings.cs │ ├── MemoryInfo.cs │ ├── MenuItem.cs │ ├── MenuRole.cs │ ├── MenuType.cs │ ├── MessageBoxOptions.cs │ ├── MessageBoxResult.cs │ ├── MessageBoxType.cs │ ├── NativeImage.cs │ ├── NativeImageJsonConverter.cs │ ├── NotificationAction.cs │ ├── NotificationOptions.cs │ ├── OnTopLevel.cs │ ├── OpenDevToolsOptions.cs │ ├── OpenDialogOptions.cs │ ├── OpenDialogProperty.cs │ ├── OpenExternalOptions.cs │ ├── PathName.cs │ ├── Point.cs │ ├── PrintOptions.cs │ ├── PrintToPDFOptions.cs │ ├── PrinterInfo.cs │ ├── ProcessMetric.cs │ ├── ProgressBarMode.cs │ ├── ProgressBarOptions.cs │ ├── ProgressInfo.cs │ ├── ProxyConfig.cs │ ├── ReadBookmark.cs │ ├── Rectangle.cs │ ├── RelaunchOptions.cs │ ├── RemovePassword.cs │ ├── ResizeOptions.cs │ ├── SaveDialogOptions.cs │ ├── Scheme.cs │ ├── SecondInstanceResponse.cs │ ├── SemVer.cs │ ├── Serialization │ │ └── ReleaseNotesConverter.cs │ ├── ShortcutDetails.cs │ ├── ShortcutLinkOperation.cs │ ├── Size.cs │ ├── SourcesOption.cs │ ├── ThemeSourceMode.cs │ ├── ThumbarButton.cs │ ├── ThumbarButtonFlag.cs │ ├── TitleBarStyle.cs │ ├── TrayClickEventArgs.cs │ ├── TrayClickEventResponse.cs │ ├── UpdateCancellationToken.cs │ ├── UpdateCheckResult.cs │ ├── UpdateFileInfo.cs │ ├── UpdateInfo.cs │ ├── UploadFile.cs │ ├── UploadRawData.cs │ ├── UserTask.cs │ ├── Vibrancy.cs │ ├── VisibleOnAllWorkspacesOptions.cs │ ├── WebPreferences.cs │ └── WindowButtonPosition.cs ├── Events.cs ├── Extensions │ ├── EnumExtensions.cs │ ├── MenuItemExtensions.cs │ └── ThumbarButtonExtensions.cs ├── GlobalShortcut.cs ├── HostHook.cs ├── HybridSupport.cs ├── IpcMain.cs ├── LifetimeServiceHost.cs ├── Menu.cs ├── MenuResponse.cs ├── NativeTheme.cs ├── Notification.cs ├── PackageIcon.png ├── PowerMonitor.cs ├── ProcessHelper.cs ├── QuitEventArgs.cs ├── Screen.cs ├── ServiceCollectionExtensions.cs ├── Session.cs ├── Shell.cs ├── SocketIO │ ├── ByteArrayConverter.cs │ ├── DisconnectReason.cs │ ├── EventHandlers.cs │ ├── Extensions │ │ ├── CancellationTokenSourceExtensions.cs │ │ ├── DisposableExtensions.cs │ │ ├── EventHandlerExtensions.cs │ │ └── SocketIOEventExtensions.cs │ ├── JsonSerializer │ │ ├── ByteArrayConverter.cs │ │ ├── IJsonSerializer.cs │ │ ├── JsonSerializeResult.cs │ │ └── SystemTextJsonSerializer.cs │ ├── LICENSE │ ├── Messages │ │ ├── BinaryMessage.cs │ │ ├── ClientAckMessage.cs │ │ ├── ClientBinaryAckMessage.cs │ │ ├── ConnectedMessage.cs │ │ ├── DisconnectedMessage.cs │ │ ├── ErrorMessage.cs │ │ ├── EventMessage.cs │ │ ├── IMessage.cs │ │ ├── MessageFactory.cs │ │ ├── MessageType.cs │ │ ├── OpenedMessage.cs │ │ ├── PingMessage.cs │ │ ├── PongMessage.cs │ │ ├── ServerAckMessage.cs │ │ └── ServerBinaryAckMessage.cs │ ├── NewtonsoftJsonSerializer.cs │ ├── SocketIO.cs │ ├── SocketIOOptions.cs │ ├── SocketIOResponse.cs │ ├── Transport │ │ ├── BaseTransport.cs │ │ ├── Eio3HttpPollingHandler.cs │ │ ├── Eio4HttpPollingHandler.cs │ │ ├── HttpPollingHandler.cs │ │ ├── HttpTransport.cs │ │ ├── IClientWebSocket.cs │ │ ├── IHttpPollingHandler.cs │ │ ├── Payload.cs │ │ ├── SystemNetWebSocketsClientWebSocket.cs │ │ ├── TransportMessageType.cs │ │ ├── TransportProtocol.cs │ │ └── WebSocketTransport.cs │ └── UriConverters │ │ ├── IUriConverter.cs │ │ └── UriConverter.cs ├── Tray.cs ├── WebContents.cs ├── WebHostBuilderExtensions.cs └── WindowManager.cs ├── ElectronSharp.CLI ├── Commands │ ├── Actions │ │ ├── DeployEmbeddedElectronFiles.cs │ │ ├── DirectoryCopy.cs │ │ └── GetTargetPlatformInformation.cs │ ├── AddCommand.cs │ ├── BuildCommand.cs │ ├── CommandOption.cs │ ├── ICommand.cs │ ├── InitCommand.cs │ ├── StartElectronCommand.cs │ └── VersionCommand.cs ├── ElectronSharp.CLI.csproj ├── EmbeddedFileHelper.cs ├── PackageIcon.png ├── ProcessHelper.cs ├── Program.cs ├── Properties │ └── launchSettings.json └── SimpleCommandLineParser.cs ├── ElectronSharp.Host ├── .eslintrc.json ├── .gitignore ├── .vscode │ ├── launch.json │ └── tasks.json ├── ElectronHostHook │ ├── .gitignore │ ├── connector.js │ ├── connector.js.map │ ├── connector.ts │ ├── index.js │ ├── index.js.map │ ├── index.ts │ ├── package.json │ └── tsconfig.json ├── api │ ├── app.js │ ├── app.js.map │ ├── app.ts │ ├── autoUpdater.js │ ├── autoUpdater.js.map │ ├── autoUpdater.ts │ ├── browserView.js │ ├── browserView.js.map │ ├── browserView.ts │ ├── browserWindows.js │ ├── browserWindows.js.map │ ├── browserWindows.ts │ ├── clipboard.js │ ├── clipboard.js.map │ ├── clipboard.ts │ ├── commandLine.js │ ├── commandLine.js.map │ ├── commandLine.ts │ ├── desktopCapturer.js │ ├── desktopCapturer.js.map │ ├── desktopCapturer.ts │ ├── dialog.js │ ├── dialog.js.map │ ├── dialog.ts │ ├── dock.js │ ├── dock.js.map │ ├── dock.ts │ ├── globalShortcut.js │ ├── globalShortcut.js.map │ ├── globalShortcut.ts │ ├── ipc.js │ ├── ipc.js.map │ ├── ipc.ts │ ├── menu.js │ ├── menu.js.map │ ├── menu.ts │ ├── nativeTheme.js │ ├── nativeTheme.js.map │ ├── nativeTheme.ts │ ├── notification.js │ ├── notification.js.map │ ├── notification.ts │ ├── powerMonitor.js │ ├── powerMonitor.js.map │ ├── powerMonitor.ts │ ├── screen.js │ ├── screen.js.map │ ├── screen.ts │ ├── shell.js │ ├── shell.js.map │ ├── shell.ts │ ├── tray.js │ ├── tray.js.map │ ├── tray.ts │ ├── webContents.js │ ├── webContents.js.map │ └── webContents.ts ├── build-helper.js ├── electron.manifest.json ├── main.js ├── package-lock.json ├── package.json ├── splashscreen │ └── index.html ├── tsconfig.json └── tslint.json ├── ElectronSharp.SampleApp ├── Assets │ ├── electron.ico │ └── electron_32x32.png ├── Controllers │ ├── AboutController.cs │ ├── AppSysInformationController.cs │ ├── ClipboardController.cs │ ├── CrashHangController.cs │ ├── DesktopCapturerController.cs │ ├── DialogsController.cs │ ├── HomeController.cs │ ├── HostHookController.cs │ ├── IpcController.cs │ ├── ManageWindowsController.cs │ ├── MenusController.cs │ ├── NotificationsController.cs │ ├── PdfController.cs │ ├── ShellController.cs │ ├── ShortcutsController.cs │ ├── TrayController.cs │ ├── UpdateController.cs │ └── WindowsController.cs ├── ElectronHostHook │ ├── .gitignore │ ├── connector.js │ ├── connector.js.map │ ├── connector.ts │ ├── excelCreator.js │ ├── excelCreator.js.map │ ├── excelCreator.ts │ ├── index.js │ ├── index.js.map │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── ElectronSharp.SampleApp.csproj ├── Program.cs ├── Properties │ └── launchSettings.json ├── Startup.cs ├── Views │ ├── About │ │ └── Index.cshtml │ ├── AppSysInformation │ │ └── Index.cshtml │ ├── Clipboard │ │ └── Index.cshtml │ ├── CrashHang │ │ ├── Index.cshtml │ │ ├── ProcessCrash.cshtml │ │ └── ProcessHang.cshtml │ ├── DesktopCapturer │ │ └── Index.cshtml │ ├── Dialogs │ │ └── Index.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── HostHook │ │ └── Index.cshtml │ ├── Ipc │ │ └── Index.cshtml │ ├── Menus │ │ └── Index.cshtml │ ├── Notifications │ │ └── Index.cshtml │ ├── Pdf │ │ └── Index.cshtml │ ├── Shell │ │ └── Index.cshtml │ ├── Shortcuts │ │ └── Index.cshtml │ ├── Tray │ │ └── Index.cshtml │ ├── Update │ │ └── Index.cshtml │ └── Windows │ │ ├── DemoWindow.cshtml │ │ ├── HandleErrorCrashes.cshtml │ │ └── Index.cshtml ├── appsettings.Development.json ├── appsettings.json ├── electron.manifest.json └── wwwroot │ └── assets │ ├── app-icon │ ├── mac │ │ └── app.icns │ ├── png │ │ ├── 1024.png │ │ ├── 128.png │ │ ├── 16.png │ │ ├── 24.png │ │ ├── 256.png │ │ ├── 32.png │ │ ├── 48.png │ │ ├── 512.png │ │ └── 64.png │ └── win │ │ └── app.ico │ ├── code-blocks.js │ ├── css │ ├── about.css │ ├── demo.css │ ├── fonts │ │ ├── SourceCodePro-Regular.ttf │ │ ├── SourceSansPro-Black.otf │ │ ├── SourceSansPro-BlackIt.otf │ │ ├── SourceSansPro-Bold.otf │ │ ├── SourceSansPro-BoldIt.otf │ │ ├── SourceSansPro-ExtraLight.otf │ │ ├── SourceSansPro-ExtraLightIt.otf │ │ ├── SourceSansPro-It.otf │ │ ├── SourceSansPro-Light.otf │ │ ├── SourceSansPro-LightIt.otf │ │ ├── SourceSansPro-Regular.otf │ │ ├── SourceSansPro-Semibold.otf │ │ └── SourceSansPro-SemiboldIt.otf │ ├── github.css │ ├── global.css │ ├── highlight.min.css │ ├── nativize.css │ ├── nav.css │ ├── print.css │ ├── section.css │ └── variables.css │ ├── demo-btns.js │ ├── ex-links.js │ ├── highlight.min.js │ ├── img │ ├── about.png │ ├── about@2x.png │ ├── diagram.png │ ├── heart.jpg │ ├── icons.svg │ ├── loading.gif │ ├── programming.png │ └── ui-terminology.png │ ├── imports.js │ ├── mac │ ├── child.plist │ ├── info.plist │ └── parent.plist │ ├── nav.js │ └── tiles │ ├── SampleAppx.150x150.png │ ├── SampleAppx.310x150.png │ ├── SampleAppx.44x44.png │ └── SampleAppx.50x50.png ├── ElectronSharp.sln ├── LICENSE ├── README.md ├── Releaser ├── Program.cs └── Releaser.csproj └── assets ├── electron-sharp-logo.afdesign └── electron-sharp-logo.svg /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | 13 | 14 | * **Version**: 15 | 16 | 17 | 18 | 19 | * **Target**: 20 | 21 | 22 | 23 | Steps to Reproduce: 24 | 25 | 1. 26 | 2. 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: Feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to find out which attributes exist for C# debugging 3 | // Use hover for the description of the existing attributes 4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Launch (console)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceRoot}/ElectronSharp.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll", 14 | "args": [], 15 | "cwd": "${workspaceRoot}/ElectronSharp.CLI", 16 | // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window 17 | "console": "internalConsole", 18 | "stopAtEntry": false, 19 | "internalConsoleOptions": "openOnSessionStart" 20 | }, 21 | { 22 | "name": ".NET Core Attach", 23 | "type": "coreclr", 24 | "request": "attach", 25 | "processId": "${command:pickProcess}" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "command": "dotnet", 4 | "args": [], 5 | "tasks": [ 6 | { 7 | "label": "build", 8 | "type": "shell", 9 | "command": "dotnet", 10 | "args": [ 11 | "build", 12 | "${workspaceRoot}/ElectronSharp.CLI/ElectronSharp.CLI.csproj" 13 | ], 14 | "problemMatcher": "$msCompile", 15 | "group": { 16 | "_id": "build", 17 | "isDefault": false 18 | } 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /.vscode/tasks.json.old: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "dotnet", 4 | "isShellCommand": true, 5 | "args": [], 6 | "tasks": [ 7 | { 8 | "taskName": "build", 9 | "args": [ 10 | "${workspaceRoot}/ElectronNET.CLI/ElectronNET.CLI.csproj" 11 | ], 12 | "isBuildCommand": true, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /ElectronSharp.API.Tests/ElectronSharp.API.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | runtime; build; native; contentfiles; analyzers; buildtransitive 29 | all 30 | 31 | 32 | runtime; build; native; contentfiles; analyzers; buildtransitive 33 | all 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ElectronSharp.API.Tests/EmbeddedResources/UpdateInfoWithReleaseNotesString.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.68", 3 | "files": [ 4 | { 5 | "url": "MyCoolProgram.Setup.1.0.68.exe", 6 | "sha512": "kmWSqPrTessAw3ETjU0jx+Qnb16lLaIDD6mdownUcin00YIcfX9oNo4mz353uKSDfkdGa3ULh8JLksU1NJywpw==", 7 | "size": 144159184 8 | } 9 | ], 10 | "path": "MyCoolProgram.Setup.1.0.68.exe", 11 | "sha512": "kmWSqPrTessAw3ETjU0jx+Qnb16lLaIDD6mdownUcin00YIcfX9oNo4mz353uKSDfkdGa3ULh8JLksU1NJywpw==", 12 | "releaseDate": "2022-12-05T09:02:50.475Z", 13 | "releaseNotes": "[ { \"version\": \"1.2.3\", \"notes\": [ \"First note.\", \"Second note.\"] } ]" 14 | } -------------------------------------------------------------------------------- /ElectronSharp.API.Tests/EmbeddedResources/UpdateInfoWithoutReleaseNotes.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.68", 3 | "files": [ 4 | { 5 | "url": "MyCoolProgram.Setup.1.0.68.exe", 6 | "sha512": "kmWSqPrTessAw3ETjU0jx+Qnb16lLaIDD6mdownUcin00YIcfX9oNo4mz353uKSDfkdGa3ULh8JLksU1NJywpw==", 7 | "size": 144159184 8 | } 9 | ], 10 | "path": "MyCoolProgram.Setup.1.0.68.exe", 11 | "sha512": "kmWSqPrTessAw3ETjU0jx+Qnb16lLaIDD6mdownUcin00YIcfX9oNo4mz353uKSDfkdGa3ULh8JLksU1NJywpw==", 12 | "releaseDate": "2022-12-05T09:02:50.475Z" 13 | } -------------------------------------------------------------------------------- /ElectronSharp.API.Tests/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | global using FluentAssertions; -------------------------------------------------------------------------------- /ElectronSharp.API/BridgeSettings.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | /// 4 | /// 5 | /// 6 | public static class BridgeSettings 7 | { 8 | /// 9 | /// Gets the socket port. 10 | /// 11 | /// 12 | /// The socket port. 13 | /// 14 | public static string SocketPort { get; internal set; } 15 | 16 | /// 17 | /// Gets the web port. 18 | /// 19 | /// 20 | /// The web port. 21 | /// 22 | public static string WebPort { get; internal set; } 23 | 24 | /// 25 | /// Manually set the port values instead of using the UseElectron extension method 26 | /// 27 | /// 28 | /// 29 | public static void InitializePorts(int socketPort, int webPort) 30 | { 31 | SocketPort = socketPort.ToString(); 32 | WebPort = webPort.ToString(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.API/DesktopCapturer.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using ElectronSharp.API.Entities; 3 | using Newtonsoft.Json; 4 | 5 | namespace ElectronSharp.API 6 | { 7 | public sealed class DesktopCapturer 8 | { 9 | private static readonly object _syncRoot = new(); 10 | private static DesktopCapturer _desktopCapturer; 11 | 12 | internal DesktopCapturer() { } 13 | 14 | internal static DesktopCapturer Instance 15 | { 16 | get 17 | { 18 | if (_desktopCapturer == null) 19 | { 20 | lock (_syncRoot) 21 | { 22 | if (_desktopCapturer == null) 23 | { 24 | _desktopCapturer = new DesktopCapturer(); 25 | } 26 | } 27 | } 28 | 29 | return _desktopCapturer; 30 | } 31 | } 32 | 33 | public async Task GetSourcesAsync(SourcesOption option) 34 | { 35 | return await BridgeConnector.OnResult("desktop-capturer-get-sources", "desktop-capturer-get-sources-result", option); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/AboutPanelOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// About panel options. 5 | /// 6 | public class AboutPanelOptions 7 | { 8 | /// 9 | /// The app's name. 10 | /// 11 | public string ApplicationName { get; set; } 12 | 13 | /// 14 | /// The app's version. 15 | /// 16 | public string ApplicationVersion { get; set; } 17 | 18 | /// 19 | /// Copyright information. 20 | /// 21 | public string Copyright { get; set; } 22 | 23 | /// 24 | /// The app's build version number. 25 | /// 26 | public string Version { get; set; } 27 | 28 | /// 29 | /// Credit information. 30 | /// 31 | public string Credits { get; set; } 32 | 33 | /// 34 | /// List of app authors. 35 | /// 36 | public string[] Authors { get; set; } 37 | 38 | /// 39 | /// The app's website. 40 | /// 41 | public string Website { get; set; } 42 | 43 | /// 44 | /// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. 45 | /// 46 | public string IconPath { get; set; } 47 | } 48 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/AddRepresentationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class AddRepresentationOptions 7 | { 8 | /// 9 | /// Gets or sets the width 10 | /// 11 | public int? Width { get; set; } 12 | 13 | /// 14 | /// Gets or sets the height 15 | /// 16 | public int? Height { get; set; } 17 | 18 | /// 19 | /// Gets or sets the scalefactor 20 | /// 21 | public float ScaleFactor { get; set; } = 1.0f; 22 | 23 | /// 24 | /// Gets or sets the buffer 25 | /// 26 | public byte[] Buffer { get; set; } 27 | 28 | /// 29 | /// Gets or sets the dataURL 30 | /// 31 | public string DataUrl { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/AppDetailsOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class AppDetailsOptions 7 | { 8 | /// 9 | /// Window’s App User Model ID. It has to be set, otherwise the other options will have no effect. 10 | /// 11 | public string AppId { get; set; } 12 | 13 | /// 14 | /// Window’s Relaunch Icon. 15 | /// 16 | public string AppIconPath { get; set; } 17 | 18 | /// 19 | /// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0. 20 | /// 21 | public int AppIconIndex { get; set; } 22 | 23 | /// 24 | /// Window’s Relaunch Command. 25 | /// 26 | public string RelaunchCommand { get; set; } 27 | 28 | /// 29 | /// Window’s Relaunch Display Name. 30 | /// 31 | public string RelaunchDisplayName { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/AutoResizeOptions.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// 7 | /// 8 | public class AutoResizeOptions 9 | { 10 | /// 11 | /// If `true`, the view's width will grow and shrink together with the window. 12 | /// `false` by default. 13 | /// 14 | [DefaultValue(false)] 15 | public bool Width { get; set; } = false; 16 | 17 | /// 18 | /// If `true`, the view's height will grow and shrink together with the window. 19 | /// `false` by default. 20 | /// 21 | [DefaultValue(false)] 22 | public bool Height { get; set; } = false; 23 | 24 | /// 25 | /// If `true`, the view's x position and width will grow and shrink proportionally 26 | /// with the window. `false` by default. 27 | /// 28 | [DefaultValue(false)] 29 | public bool Horizontal { get; set; } = false; 30 | 31 | /// 32 | /// If `true`, the view's y position and height will grow and shrink proportionally 33 | /// with the window. `false` by default. 34 | /// 35 | [DefaultValue(false)] 36 | public bool Vertical { get; set; } = false; 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/BackgroundMaterial.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details. 5 | /// This method is only supported on Windows 11 22H2 and up. 6 | /// 7 | public enum BackgroundMaterial 8 | { 9 | /// 10 | /// Let the Desktop Window Manager (DWM) automatically decide the system-drawn backdrop material for this window. This is the default. 11 | /// 12 | auto, 13 | /// 14 | /// Don't draw any system backdrop. 15 | /// 16 | none, 17 | /// 18 | /// Draw the backdrop material effect corresponding to a long-lived window. 19 | /// 20 | mica, 21 | /// 22 | /// Draw the backdrop material effect corresponding to a transient window. 23 | /// 24 | acrylic, 25 | /// 26 | /// Draw the backdrop material effect corresponding to a window with a tabbed title bar. 27 | /// 28 | tabbed, 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/BitmapOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class BitmapOptions 7 | { 8 | /// 9 | /// Gets or sets the scale factor 10 | /// 11 | public float ScaleFactor { get; set; } = 1.0f; 12 | } 13 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Blob.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Blob : IPostData 7 | { 8 | /// 9 | /// The object represents a Blob 10 | /// 11 | public string Type { get; } = "blob"; 12 | 13 | /// 14 | /// The UUID of the Blob being uploaded 15 | /// 16 | public string BlobUUID { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/BlockMapDataHolder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ElectronSharp.API.Entities 6 | { 7 | /// 8 | /// 9 | /// 10 | public class BlockMapDataHolder 11 | { 12 | /// 13 | /// The file size. Used to verify downloaded size (save one HTTP request to get length). 14 | /// Also used when block map data is embedded into the file(appimage, windows web installer package). 15 | /// 16 | public double Size { get; set; } 17 | 18 | /// 19 | /// The block map file size. Used when block map data is embedded into the file (appimage, windows web installer package). 20 | /// This information can be obtained from the file itself, but it requires additional HTTP request, 21 | /// so, to reduce request count, block map size is specified in the update metadata too. 22 | /// 23 | public double BlockMapSize { get; set; } 24 | 25 | /// 26 | /// The file checksum. 27 | /// 28 | public string Sha512 { get; set; } 29 | 30 | /// 31 | /// 32 | /// 33 | public bool IsAdminRightsRequired { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/BrowserViewConstructorOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class BrowserViewConstructorOptions 7 | { 8 | /// 9 | /// See BrowserWindow. 10 | /// 11 | public WebPreferences WebPreferences { get; set; } 12 | 13 | /// 14 | /// A proxy to set on creation in the format host:port. 15 | /// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function. 16 | /// 17 | public string Proxy { get; set; } 18 | 19 | /// 20 | /// The credentials of the Proxy in the format username:password. 21 | /// These will only be used if the Proxy field is also set. 22 | /// 23 | public string ProxyCredentials { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CPUUsage.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class CPUUsage 7 | { 8 | /// 9 | /// Percentage of CPU used since the last call to getCPUUsage. First call returns 0. 10 | /// 11 | public int PercentCPUUsage { get; set; } 12 | 13 | /// 14 | /// The number of average idle cpu wakeups per second since the last call to 15 | /// getCPUUsage.First call returns 0. 16 | /// 17 | public int IdleWakeupsPerSecond { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Certificate.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Certificate 7 | { 8 | /// 9 | /// PEM encoded data 10 | /// 11 | public string Data { get; set; } 12 | 13 | /// 14 | /// Fingerprint of the certificate 15 | /// 16 | public string Fingerprint { get; set; } 17 | 18 | /// 19 | /// Issuer principal 20 | /// 21 | public CertificatePrincipal Issuer { get; set; } 22 | 23 | /// 24 | /// Issuer certificate (if not self-signed) 25 | /// 26 | public Certificate IssuerCert { get; set; } 27 | 28 | /// 29 | /// Issuer's Common Name 30 | /// 31 | public string IssuerName { get; set; } 32 | 33 | /// 34 | /// Hex value represented string 35 | /// 36 | public string SerialNumber { get; set; } 37 | 38 | /// 39 | /// Subject principal 40 | /// 41 | public CertificatePrincipal Subject { get; set; } 42 | 43 | /// 44 | /// Subject's Common Name 45 | /// 46 | public string SubjectName { get; set; } 47 | 48 | /// 49 | /// End date of the certificate being valid in seconds 50 | /// 51 | public int ValidExpiry { get; set; } 52 | 53 | /// 54 | /// Start date of the certificate being valid in seconds 55 | /// 56 | public int ValidStart { get; set; } 57 | } 58 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CertificatePrincipal.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class CertificatePrincipal 7 | { 8 | /// 9 | /// Common Name 10 | /// 11 | public string CommonName { get; set; } 12 | 13 | /// 14 | /// Country or region 15 | /// 16 | public string Country { get; set; } 17 | 18 | /// 19 | /// Locality 20 | /// 21 | public string Locality { get; set; } 22 | 23 | /// 24 | /// Organization names 25 | /// 26 | public string[] Organizations { get; set; } 27 | 28 | /// 29 | /// Organization Unit names 30 | /// 31 | public string[] OrganizationUnits { get; set; } 32 | 33 | /// 34 | /// State or province 35 | /// 36 | public string State { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CertificateTrustDialogOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class CertificateTrustDialogOptions 7 | { 8 | /// 9 | /// The certificate to trust/import. 10 | /// 11 | public Certificate Certificate { get; set; } 12 | 13 | /// 14 | /// The message to display to the user. 15 | /// 16 | public string Message { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ChromeExtensionInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ElectronSharp.API.Entities 6 | { 7 | /// 8 | /// Provide metadata about the current loaded Chrome extension 9 | /// 10 | public class ChromeExtensionInfo 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The name of the Chrome extension. 16 | /// The version of the Chrome extension. 17 | public ChromeExtensionInfo(string name, string version) 18 | { 19 | Name = name; 20 | Version = version; 21 | } 22 | 23 | /// 24 | /// Name of the Chrome extension 25 | /// 26 | public string Name { get; set; } 27 | 28 | /// 29 | /// Version of the Chrome extension 30 | /// 31 | public string Version { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ClearStorageDataOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ClearStorageDataOptions 7 | { 8 | /// 9 | /// Should follow window.location.origin’s representation scheme://host:port. 10 | /// 11 | public string Origin { get; set; } 12 | 13 | /// 14 | /// The types of storages to clear, can contain: appcache, cookies, filesystem, 15 | /// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. 16 | /// 17 | public string[] Storages { get; set; } 18 | 19 | /// 20 | /// The types of quotas to clear, can contain: temporary, persistent, syncable. 21 | /// 22 | public string[] Quotas { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CookieChangedCause.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | 7 | /// 8 | /// The cause of the change 9 | /// 10 | [JsonConverter(typeof(StringEnumConverter))] 11 | public enum CookieChangedCause 12 | { 13 | /// 14 | ///The cookie was changed directly by a consumer's action. 15 | /// 16 | [JsonProperty("explicit")] 17 | @explicit, 18 | 19 | /// 20 | /// The cookie was automatically removed due to an insert operation that overwrote it. 21 | /// 22 | overwrite, 23 | 24 | /// 25 | /// The cookie was automatically removed as it expired. 26 | /// 27 | expired, 28 | 29 | /// 30 | /// The cookie was automatically evicted during garbage collection. 31 | /// 32 | evicted, 33 | 34 | /// 35 | /// The cookie was overwritten with an already-expired expiration date. 36 | /// 37 | [JsonProperty("expired_overwrite")] 38 | expiredOverwrite 39 | } 40 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CookieFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ElectronSharp.API.Entities 6 | { 7 | /// 8 | /// 9 | /// 10 | public class CookieFilter 11 | { 12 | /// 13 | /// (optional) - Retrieves cookies which are associated with url.Empty implies retrieving cookies of all URLs. 14 | /// 15 | public string Url { get; set; } 16 | 17 | /// 18 | /// (optional) - Filters cookies by name. 19 | /// 20 | public string Name { get; set; } 21 | 22 | /// 23 | /// (optional) - Retrieves cookies whose domains match or are subdomains of domains. 24 | /// 25 | public string Domain { get; set; } 26 | 27 | /// 28 | /// (optional) - Retrieves cookies whose path matches path. 29 | /// 30 | public string Path { get; set; } 31 | 32 | /// 33 | /// (optional) - Filters cookies by their Secure property. 34 | /// 35 | public bool Secure { get; set; } 36 | 37 | /// 38 | /// (optional) - Filters out session or persistent cookies. 39 | /// 40 | public bool Session { get; set; } 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CookieRemovedResponse.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public class CookieRemovedResponse 4 | { 5 | public Cookie cookie { get; set; } 6 | 7 | public CookieChangedCause cause { get; set; } 8 | public bool removed { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CreateFromBitmapOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class CreateFromBitmapOptions 7 | { 8 | /// 9 | /// Gets or sets the width 10 | /// 11 | public int? Width { get; set; } 12 | 13 | /// 14 | /// Gets or sets the height 15 | /// 16 | public int? Height { get; set; } 17 | 18 | /// 19 | /// Gets or sets the scalefactor 20 | /// 21 | public float ScaleFactor { get; set; } = 1.0f; 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/CreateFromBufferOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class CreateFromBufferOptions 7 | { 8 | /// 9 | /// Gets or sets the width 10 | /// 11 | public int? Width { get; set; } 12 | 13 | /// 14 | /// Gets or sets the height 15 | /// 16 | public int? Height { get; set; } 17 | 18 | /// 19 | /// Gets or sets the scalefactor 20 | /// 21 | public float ScaleFactor { get; set; } = 1.0f; 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Data.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Data 7 | { 8 | /// 9 | /// Gets or sets the text. 10 | /// 11 | /// 12 | /// The text. 13 | /// 14 | public string Text { get; set; } 15 | 16 | /// 17 | /// Gets or sets the HTML. 18 | /// 19 | /// 20 | /// The HTML. 21 | /// 22 | public string Html { get; set; } 23 | 24 | 25 | /// 26 | /// Gets or sets the RTF. 27 | /// 28 | /// 29 | /// The RTF. 30 | /// 31 | public string Rtf { get; set; } 32 | 33 | /// 34 | /// The title of the url at text. 35 | /// 36 | public string Bookmark { get; set; } 37 | 38 | public NativeImage? Image { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/DefaultFontFamily.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class DefaultFontFamily 7 | { 8 | /// 9 | /// Defaults to Times New Roman. 10 | /// 11 | public string Standard { get; set; } 12 | 13 | /// 14 | /// Defaults to Times New Roman. 15 | /// 16 | public string Serif { get; set; } 17 | 18 | /// 19 | /// Defaults to Arial. 20 | /// 21 | public string SansSerif { get; set; } 22 | 23 | /// 24 | /// Defaults to Courier New. 25 | /// 26 | public string Monospace { get; set; } 27 | 28 | /// 29 | /// Defaults to Script. 30 | /// 31 | public string Cursive { get; set; } 32 | 33 | /// 34 | /// Defaults to Impact. 35 | /// 36 | public string Fantasy { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/DesktopCapturerSource.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | public sealed class DesktopCapturerSource 6 | { 7 | public string Id { get; set; } 8 | public string Name { get; set; } 9 | public NativeImage Thumbnail { get; set; } 10 | 11 | [JsonProperty("display_id")] 12 | public string DisplayId { get; set; } 13 | public NativeImage AppIcon { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/DevToolsMode.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Opens the devtools with specified dock state, can be right, bottom, undocked, 5 | /// detach.Defaults to last used dock state.In undocked mode it's possible to dock 6 | /// back.In detach mode it's not. 7 | /// 8 | public enum DevToolsMode 9 | { 10 | /// 11 | /// The right 12 | /// 13 | right, 14 | 15 | /// 16 | /// The bottom 17 | /// 18 | bottom, 19 | 20 | /// 21 | /// The undocked 22 | /// 23 | undocked, 24 | 25 | /// 26 | /// The detach 27 | /// 28 | detach 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/DisplayBalloonOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | /// 4 | /// 5 | /// 6 | public class DisplayBalloonOptions 7 | { 8 | /// 9 | /// Gets or sets the icon. 10 | /// 11 | /// 12 | /// The icon. 13 | /// 14 | public string Icon { get; set; } 15 | 16 | /// 17 | /// Gets or sets the title. 18 | /// 19 | /// 20 | /// The title. 21 | /// 22 | public string Title { get; set; } 23 | 24 | /// 25 | /// Gets or sets the content. 26 | /// 27 | /// 28 | /// The content. 29 | /// 30 | public string Content { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/DockBounceType.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// Defines the DockBounceType enumeration. 7 | /// 8 | public enum DockBounceType 9 | { 10 | /// 11 | /// Dock icon will bounce until either the application becomes active or the request is canceled. 12 | /// 13 | [Description("critical")] 14 | Critical, 15 | 16 | /// 17 | /// The dock icon will bounce for one second. 18 | /// 19 | [Description("informational")] 20 | Informational 21 | } 22 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/EnableNetworkEmulationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class EnableNetworkEmulationOptions 7 | { 8 | /// 9 | /// Whether to emulate network outage. Defaults to false. 10 | /// 11 | public bool Offline { get; set; } = false; 12 | 13 | /// 14 | /// RTT in ms. Defaults to 0 which will disable latency throttling. 15 | /// 16 | public int Latency { get; set; } 17 | 18 | /// 19 | /// Download rate in Bps. Defaults to 0 which will disable download throttling. 20 | /// 21 | public int DownloadThroughput { get; set; } 22 | 23 | /// 24 | /// Upload rate in Bps. Defaults to 0 which will disable upload throttling. 25 | /// 26 | public int UploadThroughput { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Extension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ElectronSharp.API.Entities 8 | { 9 | /// 10 | /// Docs: https://electronjs.org/docs/api/structures/extension 11 | /// 12 | public class Extension 13 | { 14 | /// 15 | /// 16 | /// 17 | public string Id { get; set; } 18 | 19 | /// 20 | /// Copy of the extension's manifest data. 21 | /// 22 | public dynamic Manifest { get; set; } 23 | 24 | /// 25 | /// 26 | /// 27 | public string Name { get; set; } 28 | 29 | /// 30 | /// The extension's file path. 31 | /// 32 | public string Path { get; set; } 33 | 34 | /// 35 | /// The extension's `chrome-extension://` URL. 36 | /// 37 | public string Url { get; set; } 38 | 39 | /// 40 | /// 41 | /// 42 | public string Version { get; set; } 43 | } 44 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/FileFilter.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class FileFilter 7 | { 8 | /// 9 | /// Gets or sets the extensions. 10 | /// 11 | /// 12 | /// The extensions. 13 | /// 14 | public string[] Extensions { get; set; } 15 | 16 | /// 17 | /// Gets or sets the name. 18 | /// 19 | /// 20 | /// The name. 21 | /// 22 | public string Name { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/FileIconOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class FileIconOptions 7 | { 8 | /// 9 | /// Gets the size. 10 | /// 11 | /// 12 | /// The size. 13 | /// 14 | public string Size { get; private set; } 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// Size of the file icon. 20 | public FileIconOptions(FileIconSize fileIconSize) 21 | { 22 | Size = fileIconSize.ToString(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/FileIconSize.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum FileIconSize 7 | { 8 | /// 9 | /// The small 10 | /// 11 | small, 12 | 13 | /// 14 | /// The normal 15 | /// 16 | normal, 17 | 18 | /// 19 | /// The large 20 | /// 21 | large 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/FocusOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Controls the behavior of . 5 | /// 6 | public class FocusOptions 7 | { 8 | /// 9 | /// Make the receiver the active app even if another app is currently active. 10 | /// 11 | /// You should seek to use the option as sparingly as possible. 12 | /// 13 | public bool Steal { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/GpuInfoType.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public enum GpuInfoType 4 | { 5 | basic, 6 | complete 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/IPostData.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Interface to use Electrons PostData Object 5 | /// 6 | public interface IPostData 7 | { 8 | /// 9 | /// One of the following: 10 | /// rawData - The data is available as a Buffer, in the rawData field. 11 | /// file - The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file. 12 | /// blob - The object represents a Blob. The blobUUID field will be used to describe the Blob. 13 | /// 14 | public string Type { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ImportCertificateOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ImportCertificateOptions 7 | { 8 | /// 9 | /// Path for the pkcs12 file. 10 | /// 11 | public string Certificate { get; set; } 12 | 13 | /// 14 | /// Passphrase for the certificate. 15 | /// 16 | public string Password { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/JumpListCategory.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | /// 7 | /// 8 | /// 9 | public class JumpListCategory 10 | { 11 | /// 12 | /// Must be set if type is custom, otherwise it should be omitted. 13 | /// 14 | public string Name { get; set; } 15 | 16 | /// 17 | /// Array of objects if type is tasks or custom, otherwise it should be omitted. 18 | /// 19 | public JumpListItem[] Items { get; set; } 20 | 21 | /// 22 | /// One of the following: "tasks" | "frequent" | "recent" | "custom" 23 | /// 24 | [JsonConverter(typeof(StringEnumConverter))] 25 | public JumpListCategoryType Type { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/JumpListCategoryType.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum JumpListCategoryType 7 | { 8 | /// 9 | /// The tasks 10 | /// 11 | tasks, 12 | 13 | /// 14 | /// The frequent 15 | /// 16 | frequent, 17 | 18 | /// 19 | /// The recent 20 | /// 21 | recent, 22 | 23 | /// 24 | /// The custom 25 | /// 26 | custom 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/JumpListItemType.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum JumpListItemType 7 | { 8 | /// 9 | /// The task 10 | /// 11 | task, 12 | 13 | /// 14 | /// The separator 15 | /// 16 | separator, 17 | 18 | /// 19 | /// The file 20 | /// 21 | file 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/JumpListSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | public class JumpListSettings 6 | { 7 | /// 8 | /// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the 9 | /// MSDN docs). 10 | /// 11 | public int MinItems { get; set; } = 0; 12 | 13 | /// 14 | /// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories 15 | /// in the Jump List. These items must not be re-added to the Jump List in the next call to , Windows will 16 | /// not display any custom category that contains any of the removed items. 17 | /// 18 | public JumpListItem[] RemovedItems { get; set; } = Array.Empty(); 19 | } 20 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/LoadURLOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class LoadURLOptions 7 | { 8 | /// 9 | /// A HTTP Referrer url. 10 | /// 11 | public string HttpReferrer { get; set; } 12 | 13 | /// 14 | /// A user agent originating the request. 15 | /// 16 | public string UserAgent { get; set; } 17 | 18 | /// 19 | /// Base url (with trailing path separator) for files to be loaded by the data url. 20 | /// This is needed only if the specified url is a data url and needs to load other 21 | /// files. 22 | /// 23 | public string BaseURLForDataURL { get; set; } 24 | 25 | /// 26 | /// Extra headers for the request. 27 | /// 28 | public string ExtraHeaders { get; set; } 29 | 30 | /// 31 | /// PostData Object for the request. 32 | /// Can be , or 33 | /// 34 | public IPostData[] PostData { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/LoginItemSettingsOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class LoginItemSettingsOptions 7 | { 8 | /// 9 | /// The executable path to compare against. Defaults to process.execPath. 10 | /// 11 | public string Path { get; set; } 12 | 13 | /// 14 | /// The command-line arguments to compare against. Defaults to an empty array. 15 | /// 16 | public string[] Args { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/LoginSettings.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class LoginSettings 7 | { 8 | /// 9 | /// to open the app at login, to remove the app as a login item. 10 | /// Defaults to . 11 | /// 12 | public bool OpenAtLogin { get; set; } 13 | 14 | /// 15 | /// to open the app as hidden. Defaults to . The user can edit this 16 | /// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is 17 | /// opened to know the current value. This setting is not available on MAS builds. 18 | /// 19 | public bool OpenAsHidden { get; set; } 20 | 21 | /// 22 | /// The executable to launch at login. Defaults to process.execPath. 23 | /// 24 | public string Path { get; set; } 25 | 26 | /// 27 | /// The command-line arguments to pass to the executable. Defaults to an empty 28 | /// array.Take care to wrap paths in quotes. 29 | /// 30 | public string[] Args { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/MemoryInfo.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class MemoryInfo 7 | { 8 | /// 9 | /// The amount of memory currently pinned to actual physical RAM. 10 | /// 11 | public int WorkingSetSize { get; set; } 12 | 13 | /// 14 | /// The maximum amount of memory that has ever been pinned to actual physical RAM. 15 | /// 16 | public int PeakWorkingSetSize { get; set; } 17 | 18 | /// 19 | /// The amount of memory not shared by other processes, such as JS heap or HTML 20 | /// content. 21 | /// 22 | public int PrivateBytes { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/MenuType.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum MenuType 7 | { 8 | /// 9 | /// The normal 10 | /// 11 | normal, 12 | 13 | /// 14 | /// The separator 15 | /// 16 | separator, 17 | 18 | /// 19 | /// The submenu 20 | /// 21 | submenu, 22 | 23 | /// 24 | /// The checkbox 25 | /// 26 | checkbox, 27 | 28 | /// 29 | /// The radio 30 | /// 31 | radio 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/MessageBoxResult.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | internal class MessageBoxResponse 4 | { 5 | public int response { get; set; } 6 | public bool @checked { get; set; } 7 | } 8 | 9 | /// 10 | /// 11 | /// 12 | public class MessageBoxResult 13 | { 14 | /// 15 | /// Gets or sets the response. 16 | /// 17 | /// 18 | /// The response. 19 | /// 20 | public int Response { get; set; } 21 | 22 | /// 23 | /// Gets or sets a value indicating whether [checkbox checked]. 24 | /// 25 | /// 26 | /// true if [checkbox checked]; otherwise, false. 27 | /// 28 | public bool CheckboxChecked { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/MessageBoxType.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum MessageBoxType 7 | { 8 | /// 9 | /// The none 10 | /// 11 | none, 12 | 13 | /// 14 | /// The information 15 | /// 16 | info, 17 | 18 | /// 19 | /// The error 20 | /// 21 | error, 22 | 23 | /// 24 | /// The question 25 | /// 26 | question, 27 | 28 | /// 29 | /// The warning 30 | /// 31 | warning 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/NativeImageJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SixLabors.ImageSharp; 4 | using SixLabors.ImageSharp.Formats.Png; 5 | using SixLabors.ImageSharp.Processing; 6 | using System.IO; 7 | using System.Linq; 8 | using Newtonsoft.Json; 9 | 10 | namespace ElectronSharp.API.Entities 11 | { 12 | internal class NativeImageJsonConverter : JsonConverter 13 | { 14 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 15 | { 16 | if (value is NativeImage nativeImage) 17 | { 18 | var scaledImages = nativeImage.GetAllScaledImages(); 19 | serializer.Serialize(writer, scaledImages); 20 | } 21 | } 22 | 23 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 24 | { 25 | if (reader.TokenType == JsonToken.Null) return null; 26 | 27 | var dict = serializer.Deserialize>(reader); 28 | 29 | var newDictionary = new Dictionary(); 30 | 31 | foreach (var item in dict) 32 | { 33 | if (float.TryParse(item.Key, out var size) && !string.IsNullOrWhiteSpace(item.Value)) 34 | { 35 | var bytes = Convert.FromBase64String(item.Value); 36 | 37 | newDictionary.Add(size, Image.Load(new MemoryStream(bytes))); 38 | } 39 | } 40 | return newDictionary.Any() ? new NativeImage(newDictionary) : null; 41 | } 42 | 43 | public override bool CanConvert(Type objectType) => objectType == typeof(NativeImage); 44 | } 45 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/NotificationAction.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Versioning; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// 7 | /// 8 | [SupportedOSPlatform("macos")] 9 | public class NotificationAction 10 | { 11 | /// 12 | /// The label for the given action. 13 | /// 14 | public string Text { get; set; } 15 | 16 | /// 17 | /// The type of action, can be button. 18 | /// 19 | public string Type { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/OnTopLevel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// 7 | /// 8 | public enum OnTopLevel 9 | { 10 | /// 11 | /// The normal 12 | /// 13 | normal, 14 | 15 | /// 16 | /// The floating 17 | /// 18 | floating, 19 | 20 | /// 21 | /// The torn off menu 22 | /// 23 | [Description("torn-off-menu")] 24 | tornOffMenu, 25 | 26 | /// 27 | /// The modal panel 28 | /// 29 | [Description("modal-panel")] 30 | modalPanel, 31 | 32 | /// 33 | /// The main menu 34 | /// 35 | [Description("main-menu")] 36 | mainMenu, 37 | 38 | /// 39 | /// The status 40 | /// 41 | status, 42 | 43 | /// 44 | /// The pop up menu 45 | /// 46 | [Description("pop-up-menu")] 47 | popUpMenu, 48 | 49 | /// 50 | /// The screen saver 51 | /// 52 | [Description("screen-saver")] 53 | screenSaver 54 | } 55 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/OpenDevToolsOptions.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | /// 7 | /// 8 | /// 9 | public class OpenDevToolsOptions 10 | { 11 | /// 12 | /// Opens the devtools with specified dock state, can be right, bottom, undocked, 13 | /// detach.Defaults to last used dock state.In undocked mode it's possible to dock 14 | /// back.In detach mode it's not. 15 | /// 16 | [JsonConverter(typeof(StringEnumConverter))] 17 | public DevToolsMode Mode { get; set; } 18 | 19 | public string Title { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/OpenExternalOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.Versioning; 4 | 5 | namespace ElectronSharp.API.Entities 6 | { 7 | /// 8 | /// Controls the behavior of OpenExternal. 9 | /// 10 | public class OpenExternalOptions 11 | { 12 | /// 13 | /// to bring the opened application to the foreground. The default is . 14 | /// 15 | [DefaultValue(true)] 16 | [SupportedOSPlatform("macos")] 17 | public bool Activate { get; set; } = true; 18 | 19 | /// 20 | /// The working directory. 21 | /// 22 | [SupportedOSPlatform("windows")] 23 | public string WorkingDirectory { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Point.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Point 7 | { 8 | /// 9 | /// Gets or sets the x. 10 | /// 11 | /// 12 | /// The x. 13 | /// 14 | public int X { get; set; } 15 | 16 | /// 17 | /// Gets or sets the y. 18 | /// 19 | /// 20 | /// The y. 21 | /// 22 | public int Y { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/PrintToPDFOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class PrintToPDFOptions 7 | { 8 | /// 9 | /// Specifies the type of margins to use. Uses 0 for default margin, 1 for no 10 | /// margin, and 2 for minimum margin. 11 | /// 12 | public int MarginsType { get; set; } 13 | 14 | /// 15 | /// Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, 16 | /// Tabloid or an Object containing height and width in microns. 17 | /// 18 | public string PageSize { get; set; } 19 | 20 | /// 21 | /// Whether to print CSS backgrounds. 22 | /// 23 | public bool PrintBackground { get; set; } 24 | 25 | /// 26 | /// Whether to print selection only. 27 | /// 28 | public bool PrintSelectionOnly { get; set; } 29 | 30 | /// 31 | /// true for landscape, false for portrait. 32 | /// 33 | public bool Landscape { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/PrinterInfo.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Printer info 5 | /// 6 | public class PrinterInfo 7 | { 8 | /// 9 | /// Name 10 | /// 11 | public string Name { get; set; } 12 | 13 | /// 14 | /// Name 15 | /// 16 | public string Description { get; set; } 17 | 18 | /// 19 | /// Status 20 | /// 21 | public int Status { get; set; } 22 | 23 | /// 24 | /// Is default 25 | /// 26 | public bool IsDefault { get; set; } 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ProcessMetric.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ProcessMetric 7 | { 8 | /// 9 | /// Process id of the process. 10 | /// 11 | public int PId { get; set; } 12 | 13 | /// 14 | /// Process type (Browser or Tab or GPU etc). 15 | /// 16 | public string Type { get; set; } 17 | 18 | /// 19 | /// CPU usage of the process. 20 | /// 21 | public CPUUsage Cpu { get; set; } 22 | 23 | /// 24 | /// Creation time for this process. The time is represented as number of milliseconds since epoch. 25 | /// Since the can be reused after a process dies, it is useful to use both the 26 | /// and the to uniquely identify a process. 27 | /// 28 | public int CreationTime { get; set; } 29 | 30 | /// 31 | /// Memory information for the process. 32 | /// 33 | public MemoryInfo Memory { get; set; } 34 | 35 | /// 36 | /// Whether the process is sandboxed on OS level. 37 | /// 38 | public bool Sandboxed { get; set; } 39 | 40 | /// 41 | /// One of the following values: 42 | /// untrusted | low | medium | high | unknown 43 | /// 44 | public string IntegrityLevel { get; set; } 45 | } 46 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ProgressBarMode.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum ProgressBarMode 7 | { 8 | /// 9 | /// The none 10 | /// 11 | none, 12 | 13 | /// 14 | /// The normal 15 | /// 16 | normal, 17 | 18 | /// 19 | /// The indeterminate 20 | /// 21 | indeterminate, 22 | 23 | /// 24 | /// The error 25 | /// 26 | error, 27 | 28 | /// 29 | /// The paused 30 | /// 31 | paused 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ProgressBarOptions.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | /// 7 | /// 8 | /// 9 | public class ProgressBarOptions 10 | { 11 | /// 12 | /// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'. 13 | /// 14 | [JsonConverter(typeof(StringEnumConverter))] 15 | public ProgressBarMode Mode { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ProgressInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ElectronSharp.API.Entities 6 | { 7 | /// 8 | /// 9 | /// 10 | public class ProgressInfo 11 | { 12 | /// 13 | /// 14 | /// 15 | public string Progress { get; set; } 16 | 17 | /// 18 | /// 19 | /// 20 | public string BytesPerSecond { get; set; } 21 | 22 | /// 23 | /// 24 | /// 25 | public string Percent { get; set; } 26 | 27 | /// 28 | /// 29 | /// 30 | public string Total { get; set; } 31 | 32 | /// 33 | /// 34 | /// 35 | public string Transferred { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ProxyConfig.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ProxyConfig 7 | { 8 | /// 9 | /// The URL associated with the PAC file. 10 | /// 11 | public string PacScript { get; set; } 12 | 13 | /// 14 | /// Rules indicating which proxies to use. 15 | /// 16 | public string ProxyRules { get; set; } 17 | 18 | /// 19 | /// Rules indicating which URLs should bypass the proxy settings. 20 | /// 21 | public string ProxyBypassRules { get; set; } 22 | 23 | /// 24 | /// 25 | /// 26 | /// The URL associated with the PAC file. 27 | /// Rules indicating which proxies to use. 28 | /// Rules indicating which URLs should bypass the proxy settings. 29 | public ProxyConfig(string pacScript, string proxyRules, string proxyBypassRules) 30 | { 31 | PacScript = pacScript; 32 | ProxyRules = proxyRules; 33 | ProxyBypassRules = proxyBypassRules; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ReadBookmark.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ReadBookmark 7 | { 8 | /// 9 | /// Gets or sets the title. 10 | /// 11 | /// 12 | /// The title. 13 | /// 14 | public string Title { get; set; } 15 | 16 | /// 17 | /// Gets or sets the URL. 18 | /// 19 | /// 20 | /// The URL. 21 | /// 22 | public string Url { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Rectangle.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Rectangle 7 | { 8 | /// 9 | /// Gets or sets the x. 10 | /// 11 | /// 12 | /// The x. 13 | /// 14 | public int X { get; set; } 15 | 16 | /// 17 | /// Gets or sets the y. 18 | /// 19 | /// 20 | /// The y. 21 | /// 22 | public int Y { get; set; } 23 | 24 | /// 25 | /// Gets or sets the width. 26 | /// 27 | /// 28 | /// The width. 29 | /// 30 | public int Width { get; set; } 31 | 32 | /// 33 | /// Gets or sets the height. 34 | /// 35 | /// 36 | /// The height. 37 | /// 38 | public int Height { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/RelaunchOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Controls the behavior of . 5 | /// 6 | public class RelaunchOptions 7 | { 8 | /// 9 | /// Gets or sets the arguments. 10 | /// 11 | /// 12 | /// The arguments. 13 | /// 14 | public string[] Args { get; set; } 15 | 16 | /// 17 | /// Gets or sets the execute path. 18 | /// 19 | /// 20 | /// The execute path. 21 | /// 22 | public string ExecPath { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/RemovePassword.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Converters; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | /// 7 | /// 8 | /// 9 | public class RemovePassword 10 | { 11 | /// 12 | /// When provided, the authentication info related to the origin will only be 13 | /// removed otherwise the entire cache will be cleared. 14 | /// 15 | public string Origin { get; set; } 16 | 17 | /// 18 | /// Credentials of the authentication. Must be provided if removing by origin. 19 | /// 20 | public string Password { get; set; } 21 | 22 | /// 23 | /// Realm of the authentication. Must be provided if removing by origin. 24 | /// 25 | public string Realm { get; set; } 26 | 27 | /// 28 | /// Scheme of the authentication. Can be basic, digest, ntlm, negotiate. 29 | /// Must be provided if removing by origin. 30 | /// 31 | [JsonConverter(typeof(StringEnumConverter))] 32 | public Scheme Scheme { get; set; } 33 | 34 | /// 35 | /// password. 36 | /// 37 | public string Type { get; set; } 38 | 39 | /// 40 | /// Credentials of the authentication. Must be provided if removing by origin. 41 | /// 42 | public string Username { get; set; } 43 | 44 | /// 45 | /// 46 | /// 47 | /// password. 48 | public RemovePassword(string type) 49 | { 50 | Type = type; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ResizeOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class ResizeOptions 7 | { 8 | /// 9 | /// Gets or sets the width 10 | /// 11 | public int? Width { get; set; } 12 | 13 | /// 14 | /// Gets or sets the height 15 | /// 16 | public int? Height { get; set; } 17 | 18 | /// 19 | /// good, better, or best. Default is "best"; 20 | /// 21 | public string Quality { get; set; } = "best"; 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Scheme.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum Scheme 7 | { 8 | /// 9 | /// 10 | /// 11 | basic, 12 | 13 | /// 14 | /// 15 | /// 16 | digest, 17 | 18 | /// 19 | /// 20 | /// 21 | ntlm, 22 | 23 | /// 24 | /// 25 | /// 26 | negotiate 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/SecondInstanceResponse.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public class SecondInstanceResponse 4 | { 5 | public string[] args { get; set; } 6 | 7 | public string workingDirectory { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/SemVer.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class SemVer 7 | { 8 | /// 9 | /// 10 | /// 11 | public string Raw { get; set; } 12 | /// 13 | /// 14 | /// 15 | public bool Loose { get; set; } 16 | /// 17 | /// 18 | /// 19 | public SemVerOptions Options { get; set; } 20 | /// 21 | /// 22 | /// 23 | public int Major { get; set; } 24 | /// 25 | /// 26 | /// 27 | public int Minor { get; set; } 28 | /// 29 | /// 30 | /// 31 | public int Patch { get; set; } 32 | /// 33 | /// 34 | /// 35 | public string Version { get; set; } 36 | /// 37 | /// 38 | /// 39 | public string[] Build { get; set; } 40 | /// 41 | /// 42 | /// 43 | public string[] Prerelease { get; set; } 44 | } 45 | 46 | /// 47 | /// 48 | /// 49 | public class SemVerOptions 50 | { 51 | /// 52 | /// 53 | /// 54 | public bool? Loose { get; set; } 55 | /// 56 | /// 57 | /// 58 | public bool? IncludePrerelease { get; set; } 59 | } 60 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ShortcutDetails.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// Structure of a shortcut. 5 | /// 6 | public class ShortcutDetails 7 | { 8 | /// 9 | /// The Application User Model ID. Default is . 10 | /// 11 | public string AppUserModelId { get; set; } 12 | 13 | /// 14 | /// The arguments to be applied to when launching from this shortcut. Default is . 15 | /// 16 | public string Args { get; set; } 17 | 18 | /// 19 | /// The working directory. Default is . 20 | /// 21 | public string Cwd { get; set; } 22 | 23 | /// 24 | /// The description of the shortcut. Default is . 25 | /// 26 | public string Description { get; set; } 27 | 28 | /// 29 | /// The path to the icon, can be a DLL or EXE. and have to be set 30 | /// together. Default is , which uses the target's icon. 31 | /// 32 | public string Icon { get; set; } 33 | 34 | /// 35 | /// The resource ID of icon when is a DLL or EXE. Default is 0. 36 | /// 37 | public int IconIndex { get; set; } 38 | 39 | /// 40 | /// The target to launch from this shortcut. 41 | /// 42 | public string Target { get; set; } 43 | } 44 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ShortcutLinkOperation.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// Defines the ShortcutLinkOperation enumeration. 7 | /// 8 | public enum ShortcutLinkOperation 9 | { 10 | /// 11 | /// Creates a new shortcut, overwriting if necessary. 12 | /// 13 | [Description("create")] 14 | Create, 15 | 16 | /// 17 | /// Updates specified properties only on an existing shortcut. 18 | /// 19 | [Description("update")] 20 | Update, 21 | 22 | /// 23 | /// Overwrites an existing shortcut, fails if the shortcut doesn't exist. 24 | /// 25 | [Description("replace")] 26 | Replace 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/Size.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class Size 7 | { 8 | /// 9 | /// Gets or sets the width. 10 | /// 11 | /// 12 | /// The width. 13 | /// 14 | public int Width { get; set; } 15 | 16 | /// 17 | /// Gets or sets the height. 18 | /// 19 | /// 20 | /// The height. 21 | /// 22 | public int Height { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/SourcesOption.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public sealed class SourcesOption 4 | { 5 | public string[] Types { get; set; } 6 | public Size ThumbnailSize { get; set; } 7 | public bool FetchWindowIcons { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ThemeSourceMode.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// Defines the ThemeSourceMode enumeration. 7 | /// 8 | public enum ThemeSourceMode 9 | { 10 | /// 11 | /// Operating system default. 12 | /// 13 | [Description("system")] 14 | System, 15 | 16 | /// 17 | /// Light theme. 18 | /// 19 | [Description("light")] 20 | Light, 21 | 22 | /// 23 | /// Dark theme. 24 | /// 25 | [Description("dark")] 26 | Dark 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/ThumbarButtonFlag.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum ThumbarButtonFlag 7 | { 8 | /// 9 | /// The button is active and available to the user. 10 | /// 11 | enabled, 12 | 13 | /// 14 | /// The button is disabled.It is present, but has a visual state indicating it will not respond to user action. 15 | /// 16 | disabled, 17 | 18 | /// 19 | /// When the button is clicked, the thumbnail window closes immediately. 20 | /// 21 | dismissonclick, 22 | 23 | /// 24 | /// Do not draw a button border, use only the image. 25 | /// 26 | nobackground, 27 | 28 | /// 29 | /// The button is not shown to the user. 30 | /// 31 | hidden, 32 | 33 | /// 34 | /// The button is enabled but not interactive; no pressed button state is drawn.This value is intended for instances where the button is used in a notification. 35 | /// 36 | noninteractive 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/TitleBarStyle.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace ElectronSharp.API.Entities 4 | { 5 | /// 6 | /// 7 | /// 8 | public enum TitleBarStyle 9 | { 10 | /// 11 | /// The default style 12 | /// 13 | [JsonProperty("default")] 14 | defaultStyle, 15 | 16 | /// 17 | /// The hidden 18 | /// 19 | hidden, 20 | 21 | /// 22 | /// The hidden inset 23 | /// 24 | hiddenInset, 25 | 26 | /// 27 | /// The custom buttons on hover 28 | /// 29 | customButtonsOnHover 30 | } 31 | 32 | public class TitleBarOverlayConfig 33 | { 34 | public string color { get; set; } 35 | public string symbolColor { get; set; } 36 | public int height { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/TrayClickEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | 4 | /// 5 | /// 6 | /// 7 | public class TrayClickEventArgs 8 | { 9 | /// 10 | /// Gets or sets a value indicating whether [alt key]. 11 | /// 12 | /// 13 | /// true if [alt key]; otherwise, false. 14 | /// 15 | public bool AltKey { get; set; } 16 | 17 | /// 18 | /// Gets or sets a value indicating whether [shift key]. 19 | /// 20 | /// 21 | /// true if [shift key]; otherwise, false. 22 | /// 23 | public bool ShiftKey { get; set; } 24 | 25 | /// 26 | /// Gets or sets a value indicating whether [control key]. 27 | /// 28 | /// 29 | /// true if [control key]; otherwise, false. 30 | /// 31 | public bool CtrlKey { get; set; } 32 | 33 | /// 34 | /// Gets or sets a value indicating whether [meta key]. 35 | /// 36 | /// 37 | /// true if [meta key]; otherwise, false. 38 | /// 39 | public bool MetaKey { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/TrayClickEventResponse.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public class TrayClickEventResponse 4 | { 5 | public TrayClickEventArgs eventArgs { get; set; } 6 | public Rectangle bounds { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UpdateCancellationToken.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UpdateCancellationToken 7 | { 8 | /// 9 | /// 10 | /// 11 | public bool Cancelled { get; set; } 12 | 13 | /// 14 | /// 15 | /// 16 | public void Cancel() 17 | { 18 | 19 | } 20 | 21 | /// 22 | /// 23 | /// 24 | public void Dispose() 25 | { 26 | 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UpdateCheckResult.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UpdateCheckResult 7 | { 8 | /// 9 | /// 10 | /// 11 | public UpdateInfo UpdateInfo { get; set; } = new UpdateInfo(); 12 | 13 | /// 14 | /// 15 | /// 16 | public string[] Download { get; set; } 17 | 18 | /// 19 | /// 20 | /// 21 | public UpdateCancellationToken CancellationToken { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UpdateFileInfo.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UpdateFileInfo : BlockMapDataHolder 7 | { 8 | /// 9 | /// 10 | /// 11 | public string Url { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UpdateInfo.cs: -------------------------------------------------------------------------------- 1 | using ElectronSharp.API.Entities.Serialization; 2 | using System; 3 | 4 | namespace ElectronSharp.API.Entities 5 | { 6 | /// 7 | /// 8 | /// 9 | public class UpdateInfo 10 | { 11 | /// 12 | /// The version. 13 | /// 14 | public string Version { get; set; } 15 | 16 | /// 17 | /// 18 | /// 19 | public UpdateFileInfo[] Files { get; set; } = Array.Empty(); 20 | 21 | /// 22 | /// The release name. 23 | /// 24 | public string ReleaseName { get; set; } 25 | 26 | /// 27 | /// The release notes. 28 | /// 29 | [Newtonsoft.Json.JsonConverter(typeof(ReleaseNotesConverter))] 30 | public string ReleaseNotes { get; set; } 31 | 32 | /// 33 | /// 34 | /// 35 | public string ReleaseDate { get; set; } 36 | 37 | /// 38 | /// The staged rollout percentage, 0-100. 39 | /// 40 | public int StagingPercentage { get; set; } 41 | } 42 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UploadFile.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UploadFile : IPostData 7 | { 8 | /// 9 | /// The object represents a file. 10 | /// 11 | public string Type { get; } = "file"; 12 | 13 | /// 14 | /// The path of the file being uploaded. 15 | /// 16 | public string FilePath { get; set; } 17 | 18 | /// 19 | /// The offset from the beginning of the file being uploaded, in bytes. Defaults to 0. 20 | /// 21 | public long Offset { get; set; } = 0; 22 | 23 | /// 24 | /// The length of the file being uploaded, . Defaults to 0. 25 | /// If set to -1, the whole file will be uploaded. 26 | /// 27 | public long Length { get; set; } = 0; 28 | 29 | /// 30 | /// The modification time of the file represented by a double, which is the number of seconds since the UNIX Epoch (Jan 1, 1970) 31 | /// 32 | public double ModificationTime { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UploadRawData.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UploadRawData : IPostData 7 | { 8 | /// 9 | /// The data is available as a Buffer, in the rawData field. 10 | /// 11 | public string Type { get; } = "rawData"; 12 | 13 | /// 14 | /// The raw bytes of the post data in a Buffer. 15 | /// 16 | public byte[] Bytes { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/UserTask.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | /// 4 | /// 5 | /// 6 | public class UserTask 7 | { 8 | /// 9 | /// Gets or sets the arguments. 10 | /// 11 | /// 12 | /// The arguments. 13 | /// 14 | public string Arguments { get; set; } 15 | 16 | /// 17 | /// Gets or sets the description. 18 | /// 19 | /// 20 | /// The description. 21 | /// 22 | public string Description { get; set; } 23 | 24 | /// 25 | /// Gets or sets the index of the icon. 26 | /// 27 | /// 28 | /// The index of the icon. 29 | /// 30 | public int IconIndex { get; set; } 31 | 32 | /// 33 | /// Gets or sets the icon path. 34 | /// 35 | /// 36 | /// The icon path. 37 | /// 38 | public string IconPath { get; set; } 39 | 40 | /// 41 | /// Gets or sets the program. 42 | /// 43 | /// 44 | /// The program. 45 | /// 46 | public string Program { get; set; } 47 | 48 | /// 49 | /// Gets or sets the title. 50 | /// 51 | /// 52 | /// The title. 53 | /// 54 | public string Title { get; set; } 55 | 56 | /// 57 | /// The working directory. Default is . 58 | /// 59 | public string WorkingDirectory { get; set; } 60 | } 61 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/VisibleOnAllWorkspacesOptions.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public class VisibleOnAllWorkspacesOptions 4 | { 5 | /// 6 | /// visibleOnFullScreen boolean (optional) macOS - Sets whether the window should be visible above fullscreen windows. 7 | /// 8 | public bool VisibleOnFullScreen { get; set; } = false; 9 | 10 | /// 11 | /// skipTransformProcessType boolean (optional) macOS - Calling setVisibleOnAllWorkspaces will by default transform the process type 12 | /// between UIElementApplication and ForegroundApplication to ensure the correct behavior. However, this will hide the window and dock 13 | /// for a short time every time it is called. If your window is already of type UIElementApplication, you can bypass this transformation 14 | /// by passing true to skipTransformProcessType. 15 | /// 16 | public bool SkipTransformProcessType { get; set; } = false; 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Entities/WindowButtonPosition.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API.Entities 2 | { 3 | public class WindowButtonPosition 4 | { 5 | public int x { get; set; } 6 | public int y { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Reflection; 4 | 5 | namespace ElectronSharp.API.Extensions 6 | { 7 | internal static class EnumExtensions 8 | { 9 | public static string GetDescription(this T enumerationValue) where T : struct 10 | { 11 | Type type = enumerationValue.GetType(); 12 | 13 | if (!type.IsEnum) 14 | { 15 | throw new ArgumentException("EnumerationValue must be of Enum type", nameof(enumerationValue)); 16 | } 17 | 18 | //Tries to find a DescriptionAttribute for a potential friendly name 19 | //for the enum 20 | MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString()); 21 | 22 | if (memberInfo != null && memberInfo.Length > 0) 23 | { 24 | object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); 25 | 26 | if (attrs != null && attrs.Length > 0) 27 | { 28 | //Pull out the description value 29 | return ((DescriptionAttribute)attrs[0]).Description; 30 | } 31 | } 32 | //If we have no description attribute, just return the ToString of the enum 33 | return enumerationValue.ToString(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ElectronSharp.API/Extensions/ThumbarButtonExtensions.cs: -------------------------------------------------------------------------------- 1 | using ElectronSharp.API.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ElectronSharp.API.Extensions 6 | { 7 | internal static class ThumbarButtonExtensions 8 | { 9 | public static ThumbarButton[] AddThumbarButtonsId(this ThumbarButton[] thumbarButtons) 10 | { 11 | for (int index = 0; index < thumbarButtons.Length; index++) 12 | { 13 | var thumbarButton = thumbarButtons[index]; 14 | 15 | if (string.IsNullOrEmpty(thumbarButton.Id)) 16 | { 17 | thumbarButton.Id = Guid.NewGuid().ToString(); 18 | } 19 | } 20 | 21 | return thumbarButtons; 22 | } 23 | 24 | public static ThumbarButton GetThumbarButton(this List thumbarButtons, string id) 25 | { 26 | ThumbarButton result = new(""); 27 | 28 | foreach (var item in thumbarButtons) 29 | { 30 | if (item.Id == id) 31 | { 32 | result = item; 33 | } 34 | } 35 | 36 | return result; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /ElectronSharp.API/HybridSupport.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | /// 4 | /// 5 | /// 6 | public static class HybridSupport 7 | { 8 | /// 9 | /// Gets a value indicating whether this instance is electron active. 10 | /// 11 | /// 12 | /// true if this instance is electron active; otherwise, false. 13 | /// 14 | public static bool IsElectronActive 15 | { 16 | get 17 | { 18 | return !string.IsNullOrEmpty(BridgeSettings.SocketPort); 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /ElectronSharp.API/LifetimeServiceHost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.Extensions.Hosting; 5 | 6 | namespace ElectronSharp.API 7 | { 8 | /// 9 | /// Base class that reports if ASP.NET Core has fully started. 10 | /// 11 | internal class LifetimeServiceHost : IHostedService 12 | { 13 | public LifetimeServiceHost(IHostApplicationLifetime lifetime) 14 | { 15 | lifetime.ApplicationStarted.Register(() => 16 | { 17 | App.Instance.IsReady = true; 18 | 19 | BridgeConnector.Log("ASP.NET Core host has fully started."); 20 | }); 21 | } 22 | 23 | /// 24 | /// Triggered when the application host is ready to start the service. 25 | /// 26 | /// Indicates that the start process has been aborted. 27 | public Task StartAsync(CancellationToken cancellationToken) 28 | { 29 | return Task.CompletedTask; 30 | } 31 | 32 | /// 33 | /// Triggered when the application host is performing a graceful shutdown. 34 | /// 35 | /// Indicates that the shutdown process should no longer be graceful. 36 | public Task StopAsync(CancellationToken cancellationToken) 37 | { 38 | return Task.CompletedTask; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /ElectronSharp.API/MenuResponse.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | internal class MenuResponse 4 | { 5 | public string id { get; set; } 6 | public int windowId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/PackageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.API/PackageIcon.png -------------------------------------------------------------------------------- /ElectronSharp.API/ProcessHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Diagnostics; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace ElectronSharp.API 7 | { 8 | internal class ProcessHelper 9 | { 10 | public static void Execute(string command, string workingDirectoryPath) 11 | { 12 | using (Process cmd = new Process()) 13 | { 14 | bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); 15 | 16 | if (isWindows) 17 | { 18 | cmd.StartInfo = new ProcessStartInfo("cmd.exe", "/c " + command); 19 | } 20 | else 21 | { 22 | // works for OSX and Linux (at least on Ubuntu) 23 | var escapedArgs = command.Replace("\"", "\\\""); 24 | cmd.StartInfo = new ProcessStartInfo("bash", $"-c \"{escapedArgs}\""); 25 | } 26 | 27 | cmd.StartInfo.RedirectStandardInput = false; 28 | cmd.StartInfo.RedirectStandardOutput = false; 29 | cmd.StartInfo.RedirectStandardError = false; 30 | cmd.StartInfo.CreateNoWindow = true; 31 | cmd.StartInfo.UseShellExecute = false; 32 | cmd.StartInfo.WorkingDirectory = workingDirectoryPath; 33 | cmd.Start(); 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /ElectronSharp.API/QuitEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ElectronSharp.API 2 | { 3 | /// 4 | /// Event arguments for the / event. 5 | /// 6 | public sealed class QuitEventArgs 7 | { 8 | /// 9 | /// Will prevent the default behaviour, which is terminating the application. 10 | /// 11 | public void PreventDefault() 12 | { 13 | Electron.App.PreventQuit(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /ElectronSharp.API/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | namespace ElectronSharp.API 4 | { 5 | /// 6 | /// 7 | /// 8 | public static class ServiceCollectionExtensions 9 | { 10 | /// 11 | /// Adds the Members to the Service Collection 12 | /// 13 | public static IServiceCollection AddElectron(this IServiceCollection services) 14 | => services 15 | // adding in this manner to ensure late binding. 16 | .AddSingleton(provider => IpcMain.Instance) 17 | .AddSingleton(provider => App.Instance) 18 | .AddSingleton(provider => AutoUpdater.Instance) 19 | .AddSingleton(provider => WindowManager.Instance) 20 | .AddSingleton(provider => Menu.Instance) 21 | .AddSingleton(provider => Dialog.Instance) 22 | .AddSingleton(provider => Notification.Instance) 23 | .AddSingleton(provider => Tray.Instance) 24 | .AddSingleton(provider => GlobalShortcut.Instance) 25 | .AddSingleton(provider => Shell.Instance) 26 | .AddSingleton(provider => Screen.Instance) 27 | .AddSingleton(provider => Clipboard.Instance) 28 | .AddSingleton(provider => HostHook.Instance) 29 | .AddSingleton(provider => PowerMonitor.Instance) 30 | .AddSingleton(provider => NativeTheme.Instance) 31 | .AddSingleton(provider => Dock.Instance); 32 | } 33 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/DisconnectReason.cs: -------------------------------------------------------------------------------- 1 | namespace SocketIOClient 2 | { 3 | public class DisconnectReason 4 | { 5 | public static string IOServerDisconnect = "io server disconnect"; 6 | public static string IOClientDisconnect = "io client disconnect"; 7 | public static string PingTimeout = "ping timeout"; 8 | public static string TransportClose = "transport close"; 9 | public static string TransportError = "transport error"; 10 | } 11 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/EventHandlers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json; 4 | 5 | namespace SocketIOClient 6 | { 7 | public delegate void OnAnyHandler(string eventName, SocketIOResponse response); 8 | public delegate void OnOpenedHandler(string sid, int pingInterval, int pingTimeout); 9 | //public delegate void OnDisconnectedHandler(string sid, int pingInterval, int pingTimeout); 10 | public delegate void OnAck(int packetId, List array); 11 | public delegate void OnBinaryAck(int packetId, int totalCount, List array); 12 | public delegate void OnBinaryReceived(int packetId, int totalCount, string eventName, List array); 13 | public delegate void OnDisconnected(); 14 | public delegate void OnError(string error); 15 | public delegate void OnEventReceived(int packetId, string eventName, List array); 16 | public delegate void OnOpened(string sid, int pingInterval, int pingTimeout); 17 | public delegate void OnPing(); 18 | public delegate void OnPong(); 19 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Extensions/CancellationTokenSourceExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace SocketIOClient.Extensions 5 | { 6 | internal static class CancellationTokenSourceExtensions 7 | { 8 | public static void TryDispose(this CancellationTokenSource cts) 9 | { 10 | cts?.Dispose(); 11 | } 12 | 13 | public static void TryCancel(this CancellationTokenSource cts) 14 | { 15 | cts?.Cancel(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Extensions/DisposableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SocketIOClient.Extensions 4 | { 5 | internal static class DisposableExtensions 6 | { 7 | public static void TryDispose(this IDisposable disposable) 8 | { 9 | disposable?.Dispose(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Extensions/EventHandlerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SocketIOClient.Extensions 4 | { 5 | internal static class EventHandlerExtensions 6 | { 7 | public static void TryInvoke(this EventHandler handler, object sender, T args) 8 | { 9 | handler?.Invoke(sender, args); 10 | } 11 | 12 | public static void TryInvoke(this EventHandler handler, object sender, EventArgs args) 13 | { 14 | handler?.Invoke(sender, args); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Extensions/SocketIOEventExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SocketIOClient.Extensions 4 | { 5 | internal static class SocketIOEventExtensions 6 | { 7 | public static void TryInvoke(this OnAnyHandler handler, string eventName, SocketIOResponse response) 8 | { 9 | try 10 | { 11 | handler(eventName, response); 12 | } 13 | catch 14 | { 15 | // The exception is thrown by the user code, so it can be swallowed 16 | } 17 | } 18 | public static void TryInvoke(this Action handler, SocketIOResponse response) 19 | { 20 | try 21 | { 22 | handler(response); 23 | } 24 | catch 25 | { 26 | // The exception is thrown by the user code, so it can be swallowed 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/JsonSerializer/IJsonSerializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SocketIOClient.JsonSerializer 4 | { 5 | public interface IJsonSerializer 6 | { 7 | JsonSerializeResult Serialize(object[] data); 8 | T Deserialize(string json); 9 | T Deserialize(string json, IList incomingBytes); 10 | } 11 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/JsonSerializer/JsonSerializeResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SocketIOClient.JsonSerializer 4 | { 5 | public class JsonSerializeResult 6 | { 7 | public string Json { get; set; } 8 | public IList Bytes { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/LICENSE: -------------------------------------------------------------------------------- 1 | Code from https://github.com/doghappy/socket.io-client-csharp 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 HeroWong 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/DisconnectedMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System.Collections.Generic; 3 | 4 | namespace SocketIOClient.Messages 5 | { 6 | public class DisconnectedMessage : IMessage 7 | { 8 | public MessageType Type => MessageType.Disconnected; 9 | 10 | public string Namespace { get; set; } 11 | 12 | public List OutgoingBytes { get; set; } 13 | 14 | public List IncomingBytes { get; set; } 15 | 16 | public int BinaryCount { get; } 17 | 18 | public int Eio { get; set; } 19 | 20 | public TransportProtocol Protocol { get; set; } 21 | 22 | public void Read(string msg) 23 | { 24 | Namespace = msg.TrimEnd(','); 25 | } 26 | 27 | public string Write() 28 | { 29 | if (string.IsNullOrEmpty(Namespace)) 30 | { 31 | return "41"; 32 | } 33 | return "41" + Namespace + ","; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/ErrorMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text.Json; 5 | 6 | namespace SocketIOClient.Messages 7 | { 8 | public class ErrorMessage : IMessage 9 | { 10 | public MessageType Type => MessageType.ErrorMessage; 11 | 12 | public string Message { get; set; } 13 | 14 | public string Namespace { get; set; } 15 | 16 | public List OutgoingBytes { get; set; } 17 | 18 | public List IncomingBytes { get; set; } 19 | 20 | public int BinaryCount { get; } 21 | 22 | public int Eio { get; set; } 23 | 24 | public TransportProtocol Protocol { get; set; } 25 | 26 | public void Read(string msg) 27 | { 28 | if (Eio == 3) 29 | { 30 | Message = msg.Trim('"'); 31 | } 32 | else 33 | { 34 | int index = msg.IndexOf('{'); 35 | 36 | if (index > 0) 37 | { 38 | Namespace = msg.Substring(0, index - 1); 39 | msg = msg.Substring(index); 40 | } 41 | var doc = JsonDocument.Parse(msg); 42 | Message = doc.RootElement.GetProperty("message").GetString(); 43 | } 44 | } 45 | 46 | public string Write() 47 | { 48 | throw new NotImplementedException(); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/IMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System.Collections.Generic; 3 | 4 | namespace SocketIOClient.Messages 5 | { 6 | public interface IMessage 7 | { 8 | MessageType Type { get; } 9 | 10 | List OutgoingBytes { get; set; } 11 | 12 | List IncomingBytes { get; set; } 13 | 14 | int BinaryCount { get; } 15 | 16 | int Eio { get; set; } 17 | 18 | TransportProtocol Protocol { get; set; } 19 | 20 | void Read(string msg); 21 | 22 | //void Eio3WsRead(string msg); 23 | 24 | //void Eio3HttpRead(string msg); 25 | 26 | string Write(); 27 | 28 | //string Eio3WsWrite(); 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace SocketIOClient.Messages 2 | { 3 | public enum MessageType 4 | { 5 | Opened, 6 | Ping = 2, 7 | Pong, 8 | Connected = 40, 9 | Disconnected, 10 | EventMessage, 11 | AckMessage, 12 | ErrorMessage, 13 | BinaryMessage, 14 | BinaryAckMessage 15 | } 16 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/PingMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System.Collections.Generic; 3 | 4 | namespace SocketIOClient.Messages 5 | { 6 | public class PingMessage : IMessage 7 | { 8 | public MessageType Type => MessageType.Ping; 9 | 10 | public List OutgoingBytes { get; set; } 11 | 12 | public List IncomingBytes { get; set; } 13 | 14 | public int BinaryCount { get; } 15 | 16 | public int Eio { get; set; } 17 | 18 | public TransportProtocol Protocol { get; set; } 19 | 20 | public void Read(string msg) 21 | { 22 | } 23 | 24 | public string Write() => "2"; 25 | } 26 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/PongMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace SocketIOClient.Messages 6 | { 7 | public class PongMessage : IMessage 8 | { 9 | public MessageType Type => MessageType.Pong; 10 | 11 | public List OutgoingBytes { get; set; } 12 | 13 | public List IncomingBytes { get; set; } 14 | 15 | public int BinaryCount { get; } 16 | 17 | public int Eio { get; set; } 18 | 19 | public TransportProtocol Protocol { get; set; } 20 | 21 | public TimeSpan Duration { get; set; } 22 | 23 | public void Read(string msg) 24 | { 25 | } 26 | 27 | public string Write() => "3"; 28 | } 29 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/ServerAckMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SocketIOClient.Messages 6 | { 7 | /// 8 | /// The client calls the server's callback 9 | /// 10 | public class ServerAckMessage : IMessage 11 | { 12 | public MessageType Type => MessageType.AckMessage; 13 | 14 | public string Namespace { get; set; } 15 | 16 | public string Json { get; set; } 17 | 18 | public int Id { get; set; } 19 | 20 | public List OutgoingBytes { get; set; } 21 | 22 | public List IncomingBytes { get; set; } 23 | 24 | public int BinaryCount { get; } 25 | 26 | public int Eio { get; set; } 27 | 28 | public TransportProtocol Protocol { get; set; } 29 | 30 | public void Read(string msg) 31 | { 32 | } 33 | 34 | public string Write() 35 | { 36 | var builder = new StringBuilder(); 37 | builder.Append("43"); 38 | 39 | if (!string.IsNullOrEmpty(Namespace)) 40 | { 41 | builder.Append(Namespace).Append(','); 42 | } 43 | builder.Append(Id); 44 | 45 | if (string.IsNullOrEmpty(Json)) 46 | { 47 | builder.Append("[]"); 48 | } 49 | else 50 | { 51 | builder.Append(Json); 52 | } 53 | return builder.ToString(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Messages/ServerBinaryAckMessage.cs: -------------------------------------------------------------------------------- 1 | using SocketIOClient.Transport; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Text.Json; 5 | 6 | namespace SocketIOClient.Messages 7 | { 8 | /// 9 | /// The client calls the server's callback with binary 10 | /// 11 | public class ServerBinaryAckMessage : IMessage 12 | { 13 | public MessageType Type => MessageType.BinaryAckMessage; 14 | 15 | public string Namespace { get; set; } 16 | 17 | public List JsonElements { get; set; } 18 | 19 | public string Json { get; set; } 20 | 21 | public int Id { get; set; } 22 | 23 | public int BinaryCount { get; } 24 | 25 | public int Eio { get; set; } 26 | 27 | public TransportProtocol Protocol { get; set; } 28 | 29 | public List OutgoingBytes { get; set; } 30 | 31 | public List IncomingBytes { get; set; } 32 | 33 | public void Read(string msg) 34 | { 35 | } 36 | 37 | public string Write() 38 | { 39 | var builder = new StringBuilder(); 40 | 41 | builder 42 | .Append("46") 43 | .Append(OutgoingBytes.Count) 44 | .Append('-'); 45 | 46 | if (!string.IsNullOrEmpty(Namespace)) 47 | { 48 | builder.Append(Namespace).Append(','); 49 | } 50 | builder.Append(Id); 51 | 52 | if (string.IsNullOrEmpty(Json)) 53 | { 54 | builder.Append("[]"); 55 | } 56 | else 57 | { 58 | builder.Append(Json); 59 | } 60 | return builder.ToString(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/Eio4HttpPollingHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace SocketIOClient.Transport 9 | { 10 | public class Eio4HttpPollingHandler : HttpPollingHandler 11 | { 12 | public Eio4HttpPollingHandler(HttpClient httpClient) : base(httpClient) { } 13 | 14 | const char Separator = '\u001E'; //1E  15 | 16 | public override async Task PostAsync(string uri, IEnumerable bytes, CancellationToken cancellationToken) 17 | { 18 | var builder = new StringBuilder(); 19 | 20 | foreach (var item in bytes) 21 | { 22 | builder.Append('b').Append(Convert.ToBase64String(item)).Append(Separator); 23 | } 24 | 25 | if (builder.Length == 0) 26 | { 27 | return; 28 | } 29 | string text = builder.ToString().TrimEnd(Separator); 30 | await PostAsync(uri, text, cancellationToken); 31 | } 32 | 33 | protected override void ProduceText(string text) 34 | { 35 | string[] items = text.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries); 36 | 37 | foreach (var item in items) 38 | { 39 | if (item[0] == 'b') 40 | { 41 | byte[] bytes = Convert.FromBase64String(item.Substring(1)); 42 | BytesSubject.OnNext(bytes); 43 | } 44 | else 45 | { 46 | TextSubject.OnNext(item); 47 | } 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/IClientWebSocket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace SocketIOClient.Transport 6 | { 7 | public interface IClientWebSocket : IDisposable 8 | { 9 | IObservable TextObservable { get; } 10 | IObservable BytesObservable { get; } 11 | Task ConnectAsync(Uri uri, CancellationToken cancellationToken); 12 | Task DisconnectAsync(CancellationToken cancellationToken); 13 | Task SendAsync(byte[] bytes, TransportMessageType type, bool endOfMessage, CancellationToken cancellationToken); 14 | void AddHeader(string key, string val); 15 | } 16 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/IHttpPollingHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace SocketIOClient.Transport 8 | { 9 | public interface IHttpPollingHandler : IDisposable 10 | { 11 | IObservable TextObservable { get; } 12 | IObservable BytesObservable { get; } 13 | Task GetAsync(string uri, CancellationToken cancellationToken); 14 | Task SendAsync(HttpRequestMessage req, CancellationToken cancellationToken); 15 | Task PostAsync(string uri, string content, CancellationToken cancellationToken); 16 | Task PostAsync(string uri, IEnumerable bytes, CancellationToken cancellationToken); 17 | } 18 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/Payload.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SocketIOClient.Transport 4 | { 5 | public class Payload 6 | { 7 | public string Text { get; set; } 8 | public List Bytes { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/TransportMessageType.cs: -------------------------------------------------------------------------------- 1 | namespace SocketIOClient.Transport 2 | { 3 | public enum TransportMessageType 4 | { 5 | Text = 0, 6 | Binary = 1 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/Transport/TransportProtocol.cs: -------------------------------------------------------------------------------- 1 | namespace SocketIOClient.Transport 2 | { 3 | public enum TransportProtocol 4 | { 5 | Polling, 6 | WebSocket 7 | } 8 | } -------------------------------------------------------------------------------- /ElectronSharp.API/SocketIO/UriConverters/IUriConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SocketIOClient.UriConverters 5 | { 6 | public interface IUriConverter 7 | { 8 | Uri GetServerUri(bool ws, Uri serverUri, int eio, string path, IEnumerable> queryParams); 9 | } 10 | } -------------------------------------------------------------------------------- /ElectronSharp.CLI/Commands/ICommand.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace ElectronSharp.CLI.Commands 4 | { 5 | /// 6 | /// Interface for commands to implement. 7 | /// 8 | public interface ICommand 9 | { 10 | Task ExecuteAsync(); 11 | } 12 | } -------------------------------------------------------------------------------- /ElectronSharp.CLI/Commands/VersionCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Threading.Tasks; 5 | 6 | namespace ElectronSharp.CLI.Commands 7 | { 8 | public class VersionCommand : ICommand 9 | { 10 | public const string COMMAND_NAME = "version"; 11 | public const string COMMAND_DESCRIPTION = "Displays the ElectronSharp.CLI version"; 12 | public const string COMMAND_ARGUMENTS = ""; 13 | public static IList CommandOptions { get; set; } = new List(); 14 | 15 | public VersionCommand() 16 | { 17 | } 18 | 19 | public Task ExecuteAsync() 20 | { 21 | return Task.Run(() => 22 | { 23 | var runtimeVersion = typeof(VersionCommand) 24 | .GetTypeInfo() 25 | .Assembly 26 | .GetCustomAttribute(); 27 | 28 | Console.WriteLine($"ElectronSharp.CLI Version: " + runtimeVersion.Version); 29 | 30 | return true; 31 | }); 32 | } 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.CLI/PackageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.CLI/PackageIcon.png -------------------------------------------------------------------------------- /ElectronSharp.Host/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es2021": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended" 10 | ], 11 | "parser": "@typescript-eslint/parser", 12 | "parserOptions": { 13 | "ecmaVersion": "latest" 14 | }, 15 | "plugins": [ 16 | "@typescript-eslint" 17 | ], 18 | "rules": { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ElectronSharp.Host/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bin -------------------------------------------------------------------------------- /ElectronSharp.Host/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Electron App", 11 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", 12 | "program": "${workspaceFolder}/main.js", 13 | "sourceMaps": true, 14 | "args": [ 15 | "--test=true", 16 | "--blub=wuhuu" 17 | ] 18 | }, 19 | { 20 | "type": "node", 21 | "request": "launch", 22 | "name": "Launch build-helper", 23 | "program": "${workspaceFolder}/build-helper.js", 24 | "skipFiles": [ 25 | "/**" 26 | ], 27 | "args": [ 28 | "electron.manifest.json" 29 | ] 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /ElectronSharp.Host/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "typescript", 6 | "tsconfig": "tsconfig.json", 7 | "problemMatcher": [ 8 | "$tsc" 9 | ], 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | } 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node 3 | # Edit at https://www.gitignore.io/?templates=node 4 | 5 | ### Node ### 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # Diagnostic reports (https://nodejs.org/api/report.html) 15 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 16 | 17 | # Runtime data 18 | pids 19 | *.pid 20 | *.seed 21 | *.pid.lock 22 | 23 | # Directory for instrumented libs generated by jscoverage/JSCover 24 | lib-cov 25 | 26 | # Coverage directory used by tools like istanbul 27 | coverage 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | node_modules/ 46 | jspm_packages/ 47 | 48 | # TypeScript v1 declaration files 49 | typings/ 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional REPL history 58 | .node_repl_history 59 | 60 | # Output of 'npm pack' 61 | *.tgz 62 | 63 | # Yarn Integrity file 64 | .yarn-integrity 65 | 66 | # dotenv environment variables file 67 | .env 68 | .env.test 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless/ 84 | 85 | # FuseBox cache 86 | .fusebox/ 87 | 88 | # DynamoDB Local files 89 | .dynamodb/ 90 | 91 | # End of https://www.gitignore.io/api/node -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/connector.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Connector = void 0; 4 | class Connector { 5 | constructor(socket, 6 | // @ts-ignore 7 | app) { 8 | this.socket = socket; 9 | this.app = app; 10 | } 11 | on(key, javaScriptCode) { 12 | this.socket.on(key, (...args) => { 13 | const id = args.pop(); 14 | try { 15 | javaScriptCode(...args, (data) => { 16 | if (data) { 17 | this.socket.emit(`${key}Complete${id}`, data); 18 | } 19 | }); 20 | } 21 | catch (error) { 22 | this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error); 23 | } 24 | }); 25 | } 26 | } 27 | exports.Connector = Connector; 28 | //# sourceMappingURL=connector.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/connector.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/connector.ts: -------------------------------------------------------------------------------- 1 | export class Connector { 2 | constructor(private socket: SocketIO.Socket, 3 | // @ts-ignore 4 | public app: Electron.App) { } 5 | 6 | on(key: string, javaScriptCode: Function): void { 7 | this.socket.on(key, (...args: any[]) => { 8 | const id: string = args.pop(); 9 | 10 | try { 11 | javaScriptCode(...args, (data) => { 12 | if (data) { 13 | this.socket.emit(`${key}Complete${id}`, data); 14 | } 15 | }); 16 | } catch (error) { 17 | this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error); 18 | } 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.HookService = void 0; 4 | const connector_1 = require("./connector"); 5 | class HookService extends connector_1.Connector { 6 | constructor(socket, app) { 7 | super(socket, app); 8 | this.app = app; 9 | } 10 | onHostReady() { 11 | // execute your own JavaScript Host logic here 12 | } 13 | } 14 | exports.HookService = HookService; 15 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;IAClD,CAAC;CACJ;AARD,kCAQC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as Electron from "electron"; 3 | import { Connector } from "./connector"; 4 | 5 | export class HookService extends Connector { 6 | constructor(socket: SocketIO.Socket, public app: Electron.App) { 7 | super(socket, app); 8 | } 9 | 10 | onHostReady(): void { 11 | // execute your own JavaScript Host logic here 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-host-hook", 3 | "version": "1.0.0", 4 | "description": "Connector for ElectronSharp projects.", 5 | "repository": { 6 | "url": "https://github.com/theolivenbaum/electron-sharp" 7 | }, 8 | "main": "index.js", 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "keywords": [], 13 | "author": "Gregor Biswanger", 14 | "license": "MIT", 15 | "devDependencies": { 16 | "@types/socket.io": "^2.1.12", 17 | "typescript": "^4.3.5" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ElectronSharp.Host/ElectronHostHook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "sourceMap": true, 5 | "skipLibCheck": true, 6 | "target": "es2015" 7 | }, 8 | "exclude": [ 9 | "node_modules" 10 | ] 11 | } -------------------------------------------------------------------------------- /ElectronSharp.Host/api/commandLine.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | let electronSocket; 3 | module.exports = (socket, app) => { 4 | electronSocket = socket; 5 | socket.on('appCommandLineAppendSwitch', (the_switch, value) => { 6 | app.commandLine.appendSwitch(the_switch, value); 7 | }); 8 | socket.on('appCommandLineAppendArgument', (value) => { 9 | app.commandLine.appendArgument(value); 10 | }); 11 | socket.on('appCommandLineHasSwitch', (value) => { 12 | const hasSwitch = app.commandLine.hasSwitch(value); 13 | electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch); 14 | }); 15 | socket.on('appCommandLineGetSwitchValue', (the_switch) => { 16 | const value = app.commandLine.getSwitchValue(the_switch); 17 | electronSocket.emit('appCommandLineGetSwitchValueCompleted', value); 18 | }); 19 | }; 20 | //# sourceMappingURL=commandLine.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/api/commandLine.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"commandLine.js","sourceRoot":"","sources":["commandLine.ts"],"names":[],"mappings":";AAEA,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,GAAiB,EAAE,EAAE;IAC3C,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,UAAkB,EAAE,KAAa,EAAE,EAAE;QAC1E,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,KAAa,EAAE,EAAE;QACxD,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAa,EAAE,EAAE;QACnD,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,UAAkB,EAAE,EAAE;QAC7D,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzD,cAAc,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/commandLine.ts: -------------------------------------------------------------------------------- 1 | import {Socket} from 'net'; 2 | 3 | let electronSocket; 4 | 5 | export = (socket: Socket, app: Electron.App) => { 6 | electronSocket = socket; 7 | 8 | socket.on('appCommandLineAppendSwitch', (the_switch: string, value: string) => { 9 | app.commandLine.appendSwitch(the_switch, value); 10 | }); 11 | 12 | socket.on('appCommandLineAppendArgument', (value: string) => { 13 | app.commandLine.appendArgument(value); 14 | }); 15 | 16 | socket.on('appCommandLineHasSwitch', (value: string) => { 17 | const hasSwitch = app.commandLine.hasSwitch(value); 18 | electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch); 19 | }); 20 | 21 | socket.on('appCommandLineGetSwitchValue', (the_switch: string) => { 22 | const value = app.commandLine.getSwitchValue(the_switch); 23 | electronSocket.emit('appCommandLineGetSwitchValueCompleted', value); 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /ElectronSharp.Host/api/desktopCapturer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const electron_1 = require("electron"); 3 | let electronSocket; 4 | ; 5 | module.exports = (socket) => { 6 | electronSocket = socket; 7 | socket.on('desktop-capturer-get-sources', (options) => { 8 | electron_1.desktopCapturer.getSources(options).then(sources => { 9 | const result = sources.map(src => { 10 | return { 11 | appIcon: src.appIcon, 12 | name: src.name, 13 | id: src.id, 14 | display_id: src.display_id, 15 | thumbnail: { 1: src.thumbnail.toPNG().toString('base64') } 16 | }; 17 | }); 18 | electronSocket.emit('desktop-capturer-get-sources-result', result); 19 | }); 20 | }); 21 | }; 22 | //# sourceMappingURL=desktopCapturer.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/api/desktopCapturer.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"desktopCapturer.js","sourceRoot":"","sources":["desktopCapturer.ts"],"names":[],"mappings":";AACA,uCAA2C;AAE3C,IAAI,cAAc,CAAC;AAsBjB,CAAC;AApBH,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,OAAO,EAAE,EAAE;QAClD,0BAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAE/C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC7B,OAAO;oBACH,OAAO,EAAE,GAAG,CAAC,OAAO;oBACpB,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,EAAE,EAAE,GAAG,CAAC,EAAE;oBACV,UAAU,EAAE,GAAG,CAAC,UAAU;oBAC1B,SAAS,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;iBAC7D,CAAC;YACN,CAAC,CAAC,CAAC;YAEH,cAAc,CAAC,IAAI,CAAC,qCAAqC,EAAE,MAAM,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAGP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/desktopCapturer.ts: -------------------------------------------------------------------------------- 1 | import { Socket } from 'net'; 2 | import { desktopCapturer } from 'electron'; 3 | 4 | let electronSocket; 5 | 6 | export = (socket: Socket) => { 7 | electronSocket = socket; 8 | socket.on('desktop-capturer-get-sources', (options) => { 9 | desktopCapturer.getSources(options).then(sources => { 10 | 11 | const result = sources.map(src => { 12 | return { 13 | appIcon: src.appIcon, 14 | name: src.name, 15 | id: src.id, 16 | display_id: src.display_id, 17 | thumbnail: { 1: src.thumbnail.toPNG().toString('base64') } 18 | }; 19 | }); 20 | 21 | electronSocket.emit('desktop-capturer-get-sources-result', result); 22 | }); 23 | }); 24 | 25 | 26 | };; 27 | -------------------------------------------------------------------------------- /ElectronSharp.Host/api/globalShortcut.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const electron_1 = require("electron"); 3 | let electronSocket; 4 | module.exports = (socket) => { 5 | electronSocket = socket; 6 | socket.on('globalShortcut-register', (accelerator) => { 7 | electron_1.globalShortcut.register(accelerator, () => { 8 | electronSocket.emit('globalShortcut-pressed', accelerator); 9 | }); 10 | }); 11 | socket.on('globalShortcut-isRegistered', (accelerator) => { 12 | const isRegistered = electron_1.globalShortcut.isRegistered(accelerator); 13 | electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered); 14 | }); 15 | socket.on('globalShortcut-unregister', (accelerator) => { 16 | electron_1.globalShortcut.unregister(accelerator); 17 | }); 18 | socket.on('globalShortcut-unregisterAll', () => { 19 | try { 20 | electron_1.globalShortcut.unregisterAll(); 21 | } 22 | catch (error) { 23 | } 24 | }); 25 | }; 26 | //# sourceMappingURL=globalShortcut.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/api/globalShortcut.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"globalShortcut.js","sourceRoot":"","sources":["globalShortcut.ts"],"names":[],"mappings":";AAAA,uCAAwC;AAGxC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,yBAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;YACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,CAAC,WAAW,EAAE,EAAE;QACrD,MAAM,YAAY,GAAG,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE9D,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,WAAW,EAAE,EAAE;QACnD,yBAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC3C,IAAI;YACA,yBAAc,CAAC,aAAa,EAAE,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE;SACf;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/globalShortcut.ts: -------------------------------------------------------------------------------- 1 | import {globalShortcut} from 'electron'; 2 | import {Socket} from 'net'; 3 | 4 | let electronSocket; 5 | 6 | export = (socket: Socket) => { 7 | electronSocket = socket; 8 | socket.on('globalShortcut-register', (accelerator) => { 9 | globalShortcut.register(accelerator, () => { 10 | electronSocket.emit('globalShortcut-pressed', accelerator); 11 | }); 12 | }); 13 | 14 | socket.on('globalShortcut-isRegistered', (accelerator) => { 15 | const isRegistered = globalShortcut.isRegistered(accelerator); 16 | 17 | electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered); 18 | }); 19 | 20 | socket.on('globalShortcut-unregister', (accelerator) => { 21 | globalShortcut.unregister(accelerator); 22 | }); 23 | 24 | socket.on('globalShortcut-unregisterAll', () => { 25 | try { 26 | globalShortcut.unregisterAll(); 27 | } catch (error) { 28 | } 29 | }); 30 | }; 31 | -------------------------------------------------------------------------------- /ElectronSharp.Host/api/nativeTheme.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const electron_1 = require("electron"); 3 | let electronSocket; 4 | module.exports = (socket) => { 5 | electronSocket = socket; 6 | socket.on('nativeTheme-shouldUseDarkColors', () => { 7 | const shouldUseDarkColors = electron_1.nativeTheme.shouldUseDarkColors; 8 | electronSocket.emit('nativeTheme-shouldUseDarkColors-completed', shouldUseDarkColors); 9 | }); 10 | socket.on('nativeTheme-shouldUseHighContrastColors', () => { 11 | const shouldUseHighContrastColors = electron_1.nativeTheme.shouldUseHighContrastColors; 12 | electronSocket.emit('nativeTheme-shouldUseHighContrastColors-completed', shouldUseHighContrastColors); 13 | }); 14 | socket.on('nativeTheme-shouldUseInvertedColorScheme', () => { 15 | const shouldUseInvertedColorScheme = electron_1.nativeTheme.shouldUseInvertedColorScheme; 16 | electronSocket.emit('nativeTheme-shouldUseInvertedColorScheme-completed', shouldUseInvertedColorScheme); 17 | }); 18 | socket.on('nativeTheme-themeSource-get', () => { 19 | const themeSource = electron_1.nativeTheme.themeSource; 20 | electronSocket.emit('nativeTheme-themeSource-getCompleted', themeSource); 21 | }); 22 | socket.on('nativeTheme-themeSource', (themeSource) => { 23 | electron_1.nativeTheme.themeSource = themeSource; 24 | }); 25 | socket.on('register-nativeTheme-updated-event', (id) => { 26 | electron_1.nativeTheme.on('updated', () => { 27 | electronSocket.emit('nativeTheme-updated' + id); 28 | }); 29 | }); 30 | }; 31 | //# sourceMappingURL=nativeTheme.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/api/nativeTheme.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"nativeTheme.js","sourceRoot":"","sources":["nativeTheme.ts"],"names":[],"mappings":";AACA,uCAAqC;AAErC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC9C,MAAM,mBAAmB,GAAG,sBAAW,CAAC,mBAAmB,CAAC;QAE5D,cAAc,CAAC,IAAI,CAAC,2CAA2C,EAAE,mBAAmB,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACtD,MAAM,2BAA2B,GAAG,sBAAW,CAAC,2BAA2B,CAAC;QAE5E,cAAc,CAAC,IAAI,CAAC,mDAAmD,EAAE,2BAA2B,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACvD,MAAM,4BAA4B,GAAG,sBAAW,CAAC,4BAA4B,CAAC;QAE9E,cAAc,CAAC,IAAI,CAAC,oDAAoD,EAAE,4BAA4B,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,sBAAW,CAAC,WAAW,CAAC;QAE5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,WAAW,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,sBAAW,CAAC,WAAW,GAAG,WAAW,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,CAAC,EAAE,EAAE,EAAE;QACnD,sBAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/nativeTheme.ts: -------------------------------------------------------------------------------- 1 | import {Socket} from 'net'; 2 | import {nativeTheme} from 'electron'; 3 | 4 | let electronSocket; 5 | 6 | export = (socket: Socket) => { 7 | electronSocket = socket; 8 | 9 | socket.on('nativeTheme-shouldUseDarkColors', () => { 10 | const shouldUseDarkColors = nativeTheme.shouldUseDarkColors; 11 | 12 | electronSocket.emit('nativeTheme-shouldUseDarkColors-completed', shouldUseDarkColors); 13 | }); 14 | 15 | socket.on('nativeTheme-shouldUseHighContrastColors', () => { 16 | const shouldUseHighContrastColors = nativeTheme.shouldUseHighContrastColors; 17 | 18 | electronSocket.emit('nativeTheme-shouldUseHighContrastColors-completed', shouldUseHighContrastColors); 19 | }); 20 | 21 | socket.on('nativeTheme-shouldUseInvertedColorScheme', () => { 22 | const shouldUseInvertedColorScheme = nativeTheme.shouldUseInvertedColorScheme; 23 | 24 | electronSocket.emit('nativeTheme-shouldUseInvertedColorScheme-completed', shouldUseInvertedColorScheme); 25 | }); 26 | 27 | socket.on('nativeTheme-themeSource-get', () => { 28 | const themeSource = nativeTheme.themeSource; 29 | 30 | electronSocket.emit('nativeTheme-themeSource-getCompleted', themeSource); 31 | }); 32 | 33 | socket.on('nativeTheme-themeSource', (themeSource) => { 34 | nativeTheme.themeSource = themeSource; 35 | }); 36 | 37 | socket.on('register-nativeTheme-updated-event', (id) => { 38 | nativeTheme.on('updated', () => { 39 | electronSocket.emit('nativeTheme-updated' + id); 40 | }); 41 | }); 42 | }; 43 | -------------------------------------------------------------------------------- /ElectronSharp.Host/api/notification.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"notification.js","sourceRoot":"","sources":["notification.ts"],"names":[],"mappings":";AACA,uCAAsC;AAEtC,MAAM,aAAa,GAA4B,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,CAA4B,CAAC;AACpI,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE;QACxC,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,IAAI,OAAO,CAAC,MAAM,EAAE;YAChB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;gBACzB,cAAc,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvC,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACpC;QAED,YAAY,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAY,CAAC,WAAW,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/powerMonitor.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const electron_1 = require("electron"); 3 | let electronSocket; 4 | module.exports = (socket) => { 5 | electronSocket = socket; 6 | socket.on('register-pm-lock-screen', () => { 7 | electron_1.powerMonitor.on('lock-screen', () => { 8 | electronSocket.emit('pm-lock-screen'); 9 | }); 10 | }); 11 | socket.on('register-pm-unlock-screen', () => { 12 | electron_1.powerMonitor.on('unlock-screen', () => { 13 | electronSocket.emit('pm-unlock-screen'); 14 | }); 15 | }); 16 | socket.on('register-pm-suspend', () => { 17 | electron_1.powerMonitor.on('suspend', () => { 18 | electronSocket.emit('pm-suspend'); 19 | }); 20 | }); 21 | socket.on('register-pm-resume', () => { 22 | electron_1.powerMonitor.on('resume', () => { 23 | electronSocket.emit('pm-resume'); 24 | }); 25 | }); 26 | socket.on('register-pm-on-ac', () => { 27 | electron_1.powerMonitor.on('on-ac', () => { 28 | electronSocket.emit('pm-on-ac'); 29 | }); 30 | }); 31 | socket.on('register-pm-on-battery', () => { 32 | electron_1.powerMonitor.on('on-battery', () => { 33 | electronSocket.emit('pm-on-battery'); 34 | }); 35 | }); 36 | socket.on('register-pm-shutdown', () => { 37 | electron_1.powerMonitor.on('shutdown', () => { 38 | electronSocket.emit('pm-shutdown'); 39 | }); 40 | }); 41 | }; 42 | //# sourceMappingURL=powerMonitor.js.map -------------------------------------------------------------------------------- /ElectronSharp.Host/api/powerMonitor.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"powerMonitor.js","sourceRoot":"","sources":["powerMonitor.ts"],"names":[],"mappings":";AACA,uCAAsC;AAEtC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,uBAAY,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YAChC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACxC,uBAAY,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;YAClC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAClC,uBAAY,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC5B,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QACjC,uBAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAChC,uBAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC1B,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,uBAAY,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC/B,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACnC,uBAAY,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;YAC7B,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/api/powerMonitor.ts: -------------------------------------------------------------------------------- 1 | import {Socket} from 'net'; 2 | import {powerMonitor} from 'electron'; 3 | 4 | let electronSocket; 5 | 6 | export = (socket: Socket) => { 7 | electronSocket = socket; 8 | socket.on('register-pm-lock-screen', () => { 9 | powerMonitor.on('lock-screen', () => { 10 | electronSocket.emit('pm-lock-screen'); 11 | }); 12 | }); 13 | socket.on('register-pm-unlock-screen', () => { 14 | powerMonitor.on('unlock-screen', () => { 15 | electronSocket.emit('pm-unlock-screen'); 16 | }); 17 | }); 18 | socket.on('register-pm-suspend', () => { 19 | powerMonitor.on('suspend', () => { 20 | electronSocket.emit('pm-suspend'); 21 | }); 22 | }); 23 | socket.on('register-pm-resume', () => { 24 | powerMonitor.on('resume', () => { 25 | electronSocket.emit('pm-resume'); 26 | }); 27 | }); 28 | socket.on('register-pm-on-ac', () => { 29 | powerMonitor.on('on-ac', () => { 30 | electronSocket.emit('pm-on-ac'); 31 | }); 32 | }); 33 | socket.on('register-pm-on-battery', () => { 34 | powerMonitor.on('on-battery', () => { 35 | electronSocket.emit('pm-on-battery'); 36 | }); 37 | }); 38 | socket.on('register-pm-shutdown', () => { 39 | powerMonitor.on('shutdown', () => { 40 | electronSocket.emit('pm-shutdown'); 41 | }); 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /ElectronSharp.Host/api/shell.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";AACA,uCAA+B;AAE/B,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC7C,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjC,cAAc,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,YAAY,GAAG,MAAM,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhD,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnD,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,OAAO,EAAE;YACT,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBAC7C,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,CAAC;SACN;aAAM;YACH,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,CAAC;SACN;QAED,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE;QAC1D,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,IAAI;YACA,MAAM,gBAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,GAAG,IAAI,CAAC;SAClB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,GAAG,KAAK,CAAC;SACnB;QAED,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACzB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,YAAY,EAAE,EAAE;QACjD,MAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} -------------------------------------------------------------------------------- /ElectronSharp.Host/electron.manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "executable": "{{executable}}", 3 | "splashscreen": { 4 | "imageFile": "" 5 | }, 6 | "name": "{{executable}}", 7 | "author": "", 8 | "singleInstance": false, 9 | "environment": "Production", 10 | "build": { 11 | "appId": "com.{{executable}}.app", 12 | "productName": "{{executable}}", 13 | "copyright": "Copyright © 2020", 14 | "buildVersion": "1.0.0", 15 | "compression": "maximum", 16 | "directories": { 17 | "output": "../../../bin/Desktop" 18 | }, 19 | "extraResources": [ 20 | { 21 | "from": "./bin", 22 | "to": "bin", 23 | "filter": [ "**/*" ] 24 | } 25 | ], 26 | "files": [ 27 | { 28 | "from": "./ElectronHostHook/node_modules", 29 | "to": "ElectronHostHook/node_modules", 30 | "filter": [ "**/*" ] 31 | }, 32 | "**/*" 33 | ] 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.Host/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron.net.host", 3 | "version": "1.0.0", 4 | "description": "Electron-Host for ElectronSharp.", 5 | "repository": { 6 | "url": "https://github.com/theolivenbaum/electron-sharp" 7 | }, 8 | "main": "main.js", 9 | "author": "Gregor Biswanger", 10 | "license": "MIT", 11 | "scripts": { 12 | "start": "tsc -p ." 13 | }, 14 | "dependencies": { 15 | "dasherize": "^2.0.0", 16 | "electron-updater": "^6.3.0-alpha.4", 17 | "image-size": "^1.1.1", 18 | "portscanner": "^2.2.0", 19 | "socket.io": "^4.7.5" 20 | }, 21 | "devDependencies": { 22 | "@electron/notarize": "^2.3.0", 23 | "@types/node": "^20.12.10", 24 | "@typescript-eslint/eslint-plugin": "^7.8.0", 25 | "@typescript-eslint/parser": "^7.8.0", 26 | "dotenv": "^16.4.5", 27 | "electron": "36.2.0", 28 | "eslint": "^8.57.0", 29 | "typescript": "^5.4.5" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ElectronSharp.Host/splashscreen/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Loading App 8 | 9 | 10 | 11 | splashscreen 12 | 19 | 20 | -------------------------------------------------------------------------------- /ElectronSharp.Host/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "sourceMap": true, 6 | "skipLibCheck": true 7 | }, 8 | "exclude": [ 9 | "node_modules", 10 | "ElectronHostHook" 11 | ] 12 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Assets/electron.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/Assets/electron.ico -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Assets/electron_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/Assets/electron_32x32.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/AboutController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace ElectronSharp.SampleApp.Controllers 4 | { 5 | public class AboutController : Controller 6 | { 7 | public IActionResult Index() 8 | { 9 | return View(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/AppSysInformationController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Mvc; 3 | using ElectronSharp.API; 4 | using ElectronSharp.API.Entities; 5 | 6 | namespace ElectronSharp.SampleApp.Controllers 7 | { 8 | public class AppSysInformationController : Controller 9 | { 10 | public IActionResult Index() 11 | { 12 | if (HybridSupport.IsElectronActive) 13 | { 14 | Electron.IpcMain.OnWithId("app-info", async (info) => 15 | { 16 | string appPath = await Electron.App.GetAppPathAsync(); 17 | 18 | if (Electron.WindowManager.TryGetBrowserWindows(info.browserId, out var window)) 19 | { 20 | Electron.IpcMain.Send(window, "got-app-path", appPath); 21 | } 22 | }); 23 | 24 | Electron.IpcMain.OnWithId("sys-info", async (info) => 25 | { 26 | string homePath = await Electron.App.GetPathAsync(PathName.Home); 27 | 28 | if (Electron.WindowManager.TryGetBrowserWindows(info.browserId, out var window)) 29 | { 30 | Electron.IpcMain.Send(window, "got-sys-info", homePath); 31 | } 32 | }); 33 | 34 | Electron.IpcMain.OnWithId("screen-info", async (info) => 35 | { 36 | var display = await Electron.Screen.GetPrimaryDisplayAsync(); 37 | 38 | if (Electron.WindowManager.TryGetBrowserWindows(info.browserId, out var window)) 39 | { 40 | Electron.IpcMain.Send(window, "got-screen-info", display.Size); 41 | } 42 | }); 43 | } 44 | 45 | return View(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/DesktopCapturerController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace ElectronSharp.SampleApp.Controllers 4 | { 5 | public class DesktopCapturerController : Controller 6 | { 7 | public IActionResult Index() 8 | { 9 | return View(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using ElectronSharp.API; 3 | using System; 4 | 5 | namespace ElectronSharp.SampleApp.Controllers 6 | { 7 | public class HomeController : Controller 8 | { 9 | public IActionResult Index() 10 | { 11 | if (HybridSupport.IsElectronActive) 12 | { 13 | Electron.PowerMonitor.OnLockScreen += () => 14 | { 15 | Console.WriteLine("Screen Locked detected from C#"); 16 | }; 17 | 18 | Electron.PowerMonitor.OnUnLockScreen += () => 19 | { 20 | Console.WriteLine("Screen unlocked detected from C# "); 21 | }; 22 | 23 | Electron.PowerMonitor.OnSuspend += () => 24 | { 25 | Console.WriteLine("The system is going to sleep"); 26 | }; 27 | 28 | Electron.PowerMonitor.OnResume += () => 29 | { 30 | Console.WriteLine("The system is resuming"); 31 | }; 32 | 33 | Electron.PowerMonitor.OnAC += () => 34 | { 35 | Console.WriteLine("The system changes to AC power"); 36 | }; 37 | 38 | Electron.PowerMonitor.OnBattery += () => 39 | { 40 | Console.WriteLine("The system is about to change to battery power"); 41 | }; 42 | 43 | } 44 | 45 | return View(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/HostHookController.cs: -------------------------------------------------------------------------------- 1 | using ElectronSharp.API; 2 | using ElectronSharp.API.Entities; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System.Linq; 5 | 6 | namespace ElectronSharp.SampleApp.Controllers 7 | { 8 | public class HostHookController : Controller 9 | { 10 | public IActionResult Index() 11 | { 12 | if (HybridSupport.IsElectronActive) 13 | { 14 | Electron.IpcMain.On("start-hoosthook", async (args) => 15 | { 16 | var mainWindow = Electron.WindowManager.BrowserWindows.First(); 17 | 18 | var options = new OpenDialogOptions 19 | { 20 | Properties = new OpenDialogProperty[] 21 | { 22 | OpenDialogProperty.openDirectory 23 | } 24 | }; 25 | var folderPath = await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options); 26 | 27 | var resultFromTypeScript = await Electron.HostHook.CallAsync("create-excel-file", folderPath); 28 | Electron.IpcMain.Send(mainWindow, "excel-file-created", resultFromTypeScript); 29 | }); 30 | } 31 | 32 | return View(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/IpcController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using ElectronSharp.API; 3 | using System.Linq; 4 | 5 | namespace ElectronSharp.SampleApp.Controllers 6 | { 7 | public class IpcController : Controller 8 | { 9 | public IActionResult Index() 10 | { 11 | if (HybridSupport.IsElectronActive) 12 | { 13 | Electron.IpcMain.On("async-msg", (args) => 14 | { 15 | var mainWindow = Electron.WindowManager.BrowserWindows.First(); 16 | Electron.IpcMain.Send(mainWindow, "asynchronous-reply", "pong"); 17 | }); 18 | 19 | Electron.IpcMain.OnSync("sync-msg", (args) => 20 | { 21 | return "pong"; 22 | }); 23 | } 24 | 25 | return View(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/NotificationsController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using ElectronSharp.API; 3 | using ElectronSharp.API.Entities; 4 | 5 | namespace ElectronSharp.SampleApp.Controllers 6 | { 7 | public class NotificationsController : Controller 8 | { 9 | public IActionResult Index() 10 | { 11 | if (HybridSupport.IsElectronActive) 12 | { 13 | Electron.IpcMain.On("basic-noti", (args) => 14 | { 15 | 16 | var options = new NotificationOptions("Basic Notification", "Short message part") 17 | { 18 | OnClick = async () => await Electron.Dialog.ShowMessageBoxAsync("Notification clicked") 19 | }; 20 | 21 | Electron.Notification.Show(options); 22 | 23 | }); 24 | 25 | Electron.IpcMain.On("advanced-noti", (args) => 26 | { 27 | 28 | var options = new NotificationOptions("Notification with image", "Short message plus a custom image") 29 | { 30 | OnClick = async () => await Electron.Dialog.ShowMessageBoxAsync("Notification clicked"), 31 | Icon = "/assets/img/programming.png" 32 | }; 33 | 34 | Electron.Notification.Show(options); 35 | }); 36 | } 37 | 38 | return View(); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/PdfController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Mvc; 3 | using ElectronSharp.API; 4 | using ElectronSharp.API.Entities; 5 | 6 | namespace ElectronSharp.SampleApp.Controllers 7 | { 8 | public class PdfController : Controller 9 | { 10 | public IActionResult Index() 11 | { 12 | if (HybridSupport.IsElectronActive) 13 | { 14 | Electron.IpcMain.On("print-pdf", async (args) => 15 | { 16 | BrowserWindow mainWindow = Electron.WindowManager.BrowserWindows.First(); 17 | 18 | var saveOptions = new SaveDialogOptions 19 | { 20 | Title = "Save an PDF-File", 21 | DefaultPath = await Electron.App.GetPathAsync(PathName.Documents), 22 | Filters = new FileFilter[] 23 | { 24 | new FileFilter { Name = "PDF", Extensions = new string[] { "pdf" } } 25 | } 26 | }; 27 | var path = await Electron.Dialog.ShowSaveDialogAsync(mainWindow, saveOptions); 28 | 29 | if (await mainWindow.WebContents.PrintToPDFAsync(path)) 30 | { 31 | await Electron.Shell.OpenExternalAsync("file://" + path); 32 | } 33 | else 34 | { 35 | Electron.Dialog.ShowErrorBox("Error", "Failed to create pdf file."); 36 | } 37 | }); 38 | } 39 | 40 | return View(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/ShellController.cs: -------------------------------------------------------------------------------- 1 | using ElectronSharp.API; 2 | using ElectronSharp.API.Entities; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace ElectronSharp.SampleApp.Controllers 6 | { 7 | public class ShellController : Controller 8 | { 9 | public IActionResult Index() 10 | { 11 | if (HybridSupport.IsElectronActive) 12 | { 13 | Electron.IpcMain.On("open-file-manager", async (args) => 14 | { 15 | string path = await Electron.App.GetPathAsync(PathName.Home); 16 | await Electron.Shell.ShowItemInFolderAsync(path); 17 | 18 | }); 19 | 20 | Electron.IpcMain.On("open-ex-links", async (args) => 21 | { 22 | await Electron.Shell.OpenExternalAsync("https://github.com/ElectronSharp"); 23 | }); 24 | } 25 | 26 | return View(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/ShortcutsController.cs: -------------------------------------------------------------------------------- 1 | using ElectronSharp.API; 2 | using ElectronSharp.API.Entities; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System.Threading.Tasks; 5 | 6 | namespace ElectronSharp.SampleApp.Controllers 7 | { 8 | public class ShortcutsController : Controller 9 | { 10 | public IActionResult Index() 11 | { 12 | if (HybridSupport.IsElectronActive) 13 | { 14 | Electron.GlobalShortcut.Register("CommandOrControl+Alt+K", async () => 15 | { 16 | var options = new MessageBoxOptions("You pressed the registered global shortcut keybinding.") 17 | { 18 | Type = MessageBoxType.info, 19 | Title = "Success!" 20 | }; 21 | 22 | await Electron.Dialog.ShowMessageBoxAsync(options); 23 | }); 24 | Electron.App.WillQuit += arg => Task.Run(() => Electron.GlobalShortcut.UnregisterAll()); 25 | } 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Controllers/TrayController.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.AspNetCore.Mvc; 3 | using ElectronSharp.API; 4 | using ElectronSharp.API.Entities; 5 | using Microsoft.AspNetCore.Hosting; 6 | 7 | namespace ElectronSharp.SampleApp.Controllers 8 | { 9 | public class TrayController : Controller 10 | { 11 | private readonly IWebHostEnvironment _env; 12 | 13 | public TrayController(IWebHostEnvironment env) 14 | { 15 | _env = env; 16 | } 17 | 18 | 19 | public IActionResult Index() 20 | { 21 | if (HybridSupport.IsElectronActive) 22 | { 23 | Electron.IpcMain.On("put-in-tray", (args) => 24 | { 25 | 26 | if (Electron.Tray.MenuItems.Count == 0) 27 | { 28 | var menu = new MenuItem 29 | { 30 | Label = "Remove", 31 | Click = () => Electron.Tray.Destroy() 32 | }; 33 | 34 | Electron.Tray.Show(Path.Combine(_env.ContentRootPath, "Assets/electron_32x32.png"), menu); 35 | Electron.Tray.SetToolTip("Electron Demo in the tray."); 36 | } 37 | else 38 | { 39 | Electron.Tray.Destroy(); 40 | } 41 | 42 | }); 43 | } 44 | 45 | return View(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node 3 | # Edit at https://www.gitignore.io/?templates=node 4 | 5 | ### Node ### 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # Diagnostic reports (https://nodejs.org/api/report.html) 15 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 16 | 17 | # Runtime data 18 | pids 19 | *.pid 20 | *.seed 21 | *.pid.lock 22 | 23 | # Directory for instrumented libs generated by jscoverage/JSCover 24 | lib-cov 25 | 26 | # Coverage directory used by tools like istanbul 27 | coverage 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | node_modules/ 46 | jspm_packages/ 47 | 48 | # TypeScript v1 declaration files 49 | typings/ 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional REPL history 58 | .node_repl_history 59 | 60 | # Output of 'npm pack' 61 | *.tgz 62 | 63 | # Yarn Integrity file 64 | .yarn-integrity 65 | 66 | # dotenv environment variables file 67 | .env 68 | .env.test 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless/ 84 | 85 | # FuseBox cache 86 | .fusebox/ 87 | 88 | # DynamoDB Local files 89 | .dynamodb/ 90 | 91 | # End of https://www.gitignore.io/api/node -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/connector.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Connector = void 0; 4 | class Connector { 5 | constructor(socket, 6 | // @ts-ignore 7 | app) { 8 | this.socket = socket; 9 | this.app = app; 10 | } 11 | on(key, javaScriptCode) { 12 | this.socket.on(key, (...args) => { 13 | const id = args.pop(); 14 | try { 15 | javaScriptCode(...args, (data) => { 16 | if (data) { 17 | this.socket.emit(`${key}Complete${id}`, data); 18 | } 19 | }); 20 | } 21 | catch (error) { 22 | this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error); 23 | } 24 | }); 25 | } 26 | } 27 | exports.Connector = Connector; 28 | //# sourceMappingURL=connector.js.map -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/connector.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"} -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/connector.ts: -------------------------------------------------------------------------------- 1 | export class Connector { 2 | constructor(private socket: SocketIO.Socket, 3 | // @ts-ignore 4 | public app: Electron.App) { } 5 | 6 | on(key: string, javaScriptCode: Function): void { 7 | this.socket.on(key, (...args: any[]) => { 8 | const id: string = args.pop(); 9 | 10 | try { 11 | javaScriptCode(...args, (data) => { 12 | if (data) { 13 | this.socket.emit(`${key}Complete${id}`, data); 14 | } 15 | }); 16 | } catch (error) { 17 | this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error); 18 | } 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/excelCreator.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.ExcelCreator = void 0; 13 | const Excel = require("exceljs"); 14 | class ExcelCreator { 15 | create(path) { 16 | return __awaiter(this, void 0, void 0, function* () { 17 | const workbook = new Excel.Workbook(); 18 | const worksheet = workbook.addWorksheet("My Sheet"); 19 | worksheet.columns = [ 20 | { header: "Id", key: "id", width: 10 }, 21 | { header: "Name", key: "name", width: 32 }, 22 | { header: "Birthday", key: "birthday", width: 10, outlineLevel: 1 } 23 | ]; 24 | worksheet.addRow({ id: 1, name: "John Doe", birthday: new Date(1970, 1, 1) }); 25 | worksheet.addRow({ id: 2, name: "Jane Doe", birthday: new Date(1965, 1, 7) }); 26 | yield workbook.xlsx.writeFile(path + "\\sample.xlsx"); 27 | return "Excel file created!"; 28 | }); 29 | } 30 | } 31 | exports.ExcelCreator = ExcelCreator; 32 | //# sourceMappingURL=excelCreator.js.map -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/excelCreator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"excelCreator.js","sourceRoot":"","sources":["excelCreator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAGjC,MAAa,YAAY;IACf,MAAM,CAAC,IAAY;;YACrB,MAAM,QAAQ,GAAa,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,SAAS,GAAc,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAC/D,SAAS,CAAC,OAAO,GAAG;gBAChB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;gBACtC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;gBAC1C,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE;aACtE,CAAC;YACF,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC9E,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAE9E,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe,CAAC,CAAC;YAEtD,OAAO,qBAAqB,CAAC;QACjC,CAAC;KAAA;CACJ;AAhBD,oCAgBC"} -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/excelCreator.ts: -------------------------------------------------------------------------------- 1 | import * as Excel from "exceljs"; 2 | import { Workbook, Worksheet } from "exceljs"; 3 | 4 | export class ExcelCreator { 5 | async create(path: string): Promise { 6 | const workbook: Workbook = new Excel.Workbook(); 7 | const worksheet: Worksheet = workbook.addWorksheet("My Sheet"); 8 | worksheet.columns = [ 9 | { header: "Id", key: "id", width: 10 }, 10 | { header: "Name", key: "name", width: 32 }, 11 | { header: "Birthday", key: "birthday", width: 10, outlineLevel: 1 } 12 | ]; 13 | worksheet.addRow({ id: 1, name: "John Doe", birthday: new Date(1970, 1, 1) }); 14 | worksheet.addRow({ id: 2, name: "Jane Doe", birthday: new Date(1965, 1, 7) }); 15 | 16 | await workbook.xlsx.writeFile(path + "\\sample.xlsx"); 17 | 18 | return "Excel file created!"; 19 | } 20 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.HookService = void 0; 13 | const connector_1 = require("./connector"); 14 | const excelCreator_1 = require("./excelCreator"); 15 | class HookService extends connector_1.Connector { 16 | constructor(socket, app) { 17 | super(socket, app); 18 | this.app = app; 19 | } 20 | onHostReady() { 21 | // execute your own JavaScript Host logic here 22 | this.on("create-excel-file", (path, done) => __awaiter(this, void 0, void 0, function* () { 23 | const excelCreator = new excelCreator_1.ExcelCreator(); 24 | const result = yield excelCreator.create(path); 25 | done(result); 26 | })); 27 | } 28 | } 29 | exports.HookService = HookService; 30 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,2CAAwC;AACxC,iDAA8C;AAE9C,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;QAC9C,IAAI,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAO,IAAI,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,YAAY,GAAiB,IAAI,2BAAY,EAAE,CAAC;YACtD,MAAM,MAAM,GAAW,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEvD,IAAI,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAdD,kCAcC"} -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as Electron from "electron"; 3 | import { Connector } from "./connector"; 4 | import { ExcelCreator } from "./excelCreator"; 5 | 6 | export class HookService extends Connector { 7 | constructor(socket: SocketIO.Socket, public app: Electron.App) { 8 | super(socket, app); 9 | } 10 | 11 | onHostReady(): void { 12 | // execute your own JavaScript Host logic here 13 | this.on("create-excel-file", async (path, done) => { 14 | const excelCreator: ExcelCreator = new ExcelCreator(); 15 | const result: string = await excelCreator.create(path); 16 | 17 | done(result); 18 | }); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-host-hook", 3 | "version": "1.0.0", 4 | "description": "Connector for ElectronSharp projects.", 5 | "repository": { 6 | "url": "https://github.com/theolivenbaum/electron-sharp" 7 | }, 8 | "main": "index.js", 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "keywords": [], 13 | "author": "Gregor Biswanger", 14 | "license": "MIT", 15 | "devDependencies": { 16 | "@types/socket.io": "^2.1.2", 17 | "typescript": "^3.4.5" 18 | }, 19 | "dependencies": { 20 | "exceljs": "^1.10.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronHostHook/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "sourceMap": true, 5 | "skipLibCheck": true, 6 | "target": "es2015" 7 | }, 8 | "exclude": [ 9 | "node_modules" 10 | ] 11 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/ElectronSharp.SampleApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net9.0 4 | win-x64 5 | 4.2 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | PreserveNewest 27 | 28 | 29 | PreserveNewest 30 | 31 | 32 | 33 | 34 | Never 35 | 36 | 37 | 38 | 39 | PreserveNewest 40 | 41 | 42 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "WSL": { 4 | "commandName": "WSL2", 5 | "launchUrl": "http://localhost:50395/", 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | "ASPNETCORE_URLS": "http://localhost:50395/" 9 | }, 10 | "distributionName": "" 11 | }, 12 | "run with electronize": { 13 | "commandName": "Executable", 14 | "executablePath": "$(SolutionDir)ElectronSharp.CLI\\bin\\Debug\\net7.0\\dotnet-electron-sharp.exe", 15 | "commandLineArgs": "start /from-build-output $(SolutionDir)ElectronSharp.SampleApp\\bin\\$(Configuration)\\net9.0", 16 | "workingDirectory": "$(SolutionDir)ElectronSharp.SampleApp" 17 | }, 18 | "run from csharp": { 19 | "commandName": "Project", 20 | "workingDirectory": ".", 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "hotReloadEnabled": false 25 | } 26 | }, 27 | "iisSettings": { 28 | "windowsAuthentication": false, 29 | "anonymousAuthentication": true, 30 | "iisExpress": { 31 | "applicationUrl": "http://localhost:50394/", 32 | "sslPort": 0 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Views/CrashHang/ProcessCrash.cshtml: -------------------------------------------------------------------------------- 1 |  22 | 23 |

Click the text below to crash and then reload this process.

24 | Crash this process -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Views/CrashHang/ProcessHang.cshtml: -------------------------------------------------------------------------------- 1 |  25 | 26 |

Click the text below to hang and then reload this process.

27 | (This will take up to 30 seconds.) 28 | 29 | Hang this process -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Views/Windows/DemoWindow.cshtml: -------------------------------------------------------------------------------- 1 |  30 | 31 |

Hello World!

32 | Close this Window -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/Views/Windows/HandleErrorCrashes.cshtml: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | }, 8 | "DemoTitleInSettings": "ElectronSharp API Demos" 9 | } 10 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/mac/app.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/mac/app.icns -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/1024.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/128.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/16.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/24.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/256.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/32.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/48.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/512.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/png/64.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/app-icon/win/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/app-icon/win/app.ico -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/code-blocks.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function () { 2 | setTimeout(() => { 3 | const codeBlocks = document.querySelectorAll('pre code'); 4 | Array.prototype.forEach.call(codeBlocks, function (code) { 5 | hljs.highlightBlock(code) 6 | }); 7 | }, 1000); 8 | }) 9 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Black.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-BlackIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-BlackIt.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Bold.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-BoldIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-BoldIt.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-ExtraLight.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-ExtraLight.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-ExtraLightIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-ExtraLightIt.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-It.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-It.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Light.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-LightIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-LightIt.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Regular.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Semibold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-Semibold.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-SemiboldIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/css/fonts/SourceSansPro-SemiboldIt.otf -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | color: #333; 12 | background: #f8f8f8; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-quote { 17 | color: #998; 18 | font-style: italic; 19 | } 20 | 21 | .hljs-keyword, 22 | .hljs-selector-tag, 23 | .hljs-subst { 24 | color: #333; 25 | font-weight: bold; 26 | } 27 | 28 | .hljs-number, 29 | .hljs-literal, 30 | .hljs-variable, 31 | .hljs-template-variable, 32 | .hljs-tag .hljs-attr { 33 | color: #008080; 34 | } 35 | 36 | .hljs-string, 37 | .hljs-doctag { 38 | color: #d14; 39 | } 40 | 41 | .hljs-title, 42 | .hljs-section, 43 | .hljs-selector-id { 44 | color: #900; 45 | font-weight: bold; 46 | } 47 | 48 | .hljs-subst { 49 | font-weight: normal; 50 | } 51 | 52 | .hljs-type, 53 | .hljs-class .hljs-title { 54 | color: #458; 55 | font-weight: bold; 56 | } 57 | 58 | .hljs-tag, 59 | .hljs-name, 60 | .hljs-attribute { 61 | color: #000080; 62 | font-weight: normal; 63 | } 64 | 65 | .hljs-regexp, 66 | .hljs-link { 67 | color: #009926; 68 | } 69 | 70 | .hljs-symbol, 71 | .hljs-bullet { 72 | color: #990073; 73 | } 74 | 75 | .hljs-built_in, 76 | .hljs-builtin-name { 77 | color: #0086b3; 78 | } 79 | 80 | .hljs-meta { 81 | color: #999; 82 | font-weight: bold; 83 | } 84 | 85 | .hljs-deletion { 86 | background: #fdd; 87 | } 88 | 89 | .hljs-addition { 90 | background: #dfd; 91 | } 92 | 93 | .hljs-emphasis { 94 | font-style: italic; 95 | } 96 | 97 | .hljs-strong { 98 | font-weight: bold; 99 | } 100 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/highlight.min.css: -------------------------------------------------------------------------------- 1 | .hljs{display:block;overflow-x:auto;padding:0.5em;background:#F0F0F0}.hljs,.hljs-subst{color:#444}.hljs-comment{color:#888888}.hljs-keyword,.hljs-attribute,.hljs-selector-tag,.hljs-meta-keyword,.hljs-doctag,.hljs-name{font-weight:bold}.hljs-type,.hljs-string,.hljs-number,.hljs-selector-id,.hljs-selector-class,.hljs-quote,.hljs-template-tag,.hljs-deletion{color:#880000}.hljs-title,.hljs-section{color:#880000;font-weight:bold}.hljs-regexp,.hljs-symbol,.hljs-variable,.hljs-template-variable,.hljs-link,.hljs-selector-attr,.hljs-selector-pseudo{color:#BC6060}.hljs-literal{color:#78A960}.hljs-built_in,.hljs-bullet,.hljs-code,.hljs-addition{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta-string{color:#4d99bf}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold} -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/nativize.css: -------------------------------------------------------------------------------- 1 | /* 2 | ** nativize.css 3 | ** Makes the UI feel more native 4 | */ 5 | 6 | html { 7 | font-family: sans-serif; 8 | -webkit-user-select: none; /* disable selection */ 9 | -webkit-user-drag: none; /* disable dragging */ 10 | cursor: default; /* use default cursor */ 11 | } 12 | 13 | body { 14 | margin: 0; /* remove default margin */ 15 | } 16 | 17 | 18 | /* enable text selection */ 19 | 20 | /*.is-selectable,*/ 21 | 22 | pre, 23 | code { 24 | -webkit-user-select: auto; 25 | user-select: text; 26 | cursor: auto; 27 | } 28 | 29 | 30 | /* Buttons and links */ 31 | 32 | button{ 33 | cursor: default; 34 | } 35 | 36 | /* Internal links */ 37 | a { 38 | cursor: pointer; 39 | text-decoration: none; 40 | border-bottom: 1px dashed; 41 | outline: none; 42 | } 43 | 44 | /* New window (target) + external links */ 45 | a[target], 46 | a[href^="https://"], 47 | a[href^="http://"] { 48 | border-bottom: 1px solid; 49 | } 50 | 51 | a:hover, 52 | a:focus { 53 | border-bottom: none; 54 | } 55 | 56 | 57 | /* Images */ 58 | 59 | img { 60 | -webkit-user-drag: none; /* disable dragging */ 61 | } 62 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/print.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | body { 3 | background: none; 4 | color: black !important; 5 | font-size: 70%; 6 | margin: 0; padding: 0; 7 | } 8 | 9 | h1 { 10 | font-size: 22px; 11 | } 12 | 13 | .nav, button, .demo-box:before, 14 | #pdf-path, header p { 15 | display: none; 16 | } 17 | 18 | .demo-box, h2, 19 | pre, code { 20 | padding: 0 !important; 21 | margin: 0 !important; 22 | } 23 | 24 | header { 25 | padding: 0 0 10px 0; 26 | } 27 | 28 | code, .support { 29 | font-size: 10px; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/section.css: -------------------------------------------------------------------------------- 1 | /* Section ------------------ */ 2 | 3 | .section { 4 | position: absolute; 5 | top: 0; 6 | left: 0; 7 | right: 0; 8 | bottom: 0; 9 | overflow-x: hidden; 10 | overflow-y: auto; 11 | color: var(--color-accent); 12 | 13 | /* Hide */ 14 | pointer-events: none; 15 | visibility: hidden; 16 | opacity: 0; 17 | transform: translateX(-20px); 18 | transition: visibility 0s .12s linear , opacity .12s ease-in, transform .12s ease-in; 19 | } 20 | .section.is-shown { 21 | pointer-events: auto; 22 | visibility: visible; 23 | opacity: 1; 24 | transform: translateX(0); 25 | transition: visibility 0s 0s linear , opacity .36s ease-out, transform .36s ease-out; 26 | } 27 | 28 | .section h3, 29 | .section p { 30 | color: var(--color); 31 | } 32 | 33 | .section-wrapper { 34 | position: relative; 35 | max-width: 740px; 36 | margin: 0 auto; 37 | padding: 2rem 2rem 1rem 2rem; 38 | border-bottom: 1px solid var(--color-border); 39 | } 40 | @media (min-width: 940px) { 41 | .section-wrapper { 42 | padding-top: 4rem; 43 | } 44 | } 45 | 46 | .section-icon { 47 | width: 32px; 48 | height: 32px; 49 | vertical-align: middle; 50 | margin-right: .5em; 51 | } 52 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/css/variables.css: -------------------------------------------------------------------------------- 1 | 2 | /* Custom Properties */ 3 | 4 | :root { 5 | --color: hsl(0,0%,22%); 6 | --color-subtle: hsl(0,0%,44%); 7 | --color-strong: hsl(0,0%,11%); 8 | --color-link: hsl(0,0%,22%); 9 | 10 | --color-border: hsl(0,0%,88%); 11 | --color-bg: hsl(0,0%,96%); 12 | 13 | --color-accent: black; /* Fallback */ 14 | } 15 | 16 | 17 | /* Category Colors */ 18 | 19 | .u-category-windows { --color-accent: hsl(116, 30%, 36%); } 20 | .u-category-menu { --color-accent: hsl(194, 60%, 36%); } 21 | .u-category-native-ui { --color-accent: hsl(222, 53%, 50%); } 22 | .u-category-communication { --color-accent: hsl(285, 47%, 46%); } 23 | .u-category-system { --color-accent: hsl(330, 65%, 48%); } 24 | .u-category-update { --color-accent: hsl(0, 92%, 43%); } 25 | .u-category-media { --color-accent: hsl( 36, 77%, 34%); } 26 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/demo-btns.js: -------------------------------------------------------------------------------- 1 | setTimeout(() => { 2 | const demoBtns = document.querySelectorAll('.js-container-target'); 3 | 4 | // Listen for demo button clicks 5 | Array.prototype.forEach.call(demoBtns, function (btn) { 6 | btn.addEventListener('click', function (event) { 7 | const parent = event.target.parentElement; 8 | 9 | // Toggles the "is-open" class on the demo's parent element. 10 | parent.classList.toggle('is-open'); 11 | }) 12 | }) 13 | }, 1000); 14 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/ex-links.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | const shell = require('electron').shell 3 | const links = document.querySelectorAll('a[href]') 4 | 5 | Array.prototype.forEach.call(links, function (link) { 6 | const url = link.getAttribute('href') 7 | if (url.indexOf('http') === 0) { 8 | link.addEventListener('click', function (e) { 9 | e.preventDefault() 10 | shell.openExternal(url) 11 | }) 12 | } 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/about.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/about@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/about@2x.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/diagram.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/heart.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/heart.jpg -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/loading.gif -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/programming.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/programming.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/img/ui-terminology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/img/ui-terminology.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/imports.js: -------------------------------------------------------------------------------- 1 | const links = ["windows", "crashhang", "menus", "shortcuts", "shell", "notifications", "dialogs", "tray", "ipc", "hosthook", "appsysinformation", "clipboard", "pdf", "desktopcapturer", "update"]; 2 | 3 | fetch('about').then((aboutPage) => { 4 | aboutPage.text().then(pageContent => { 5 | const template = document.createRange().createContextualFragment(pageContent); 6 | document.querySelector('body').appendChild(template.firstElementChild.content); 7 | }); 8 | }); 9 | 10 | links.forEach(async pageName => { 11 | const page = await fetch(pageName); 12 | const pageContent = await page.text(); 13 | const template = document.createRange().createContextualFragment(pageContent); 14 | document.querySelector('.content').appendChild(template.firstElementChild.content); 15 | }); -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/mac/child.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.inherit 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/mac/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleURLTypes 6 | 7 | 8 | CFBundleURLSchemes 9 | 10 | electron-api-demos 11 | 12 | CFBundleURLName 13 | Electron API Demos Protocol 14 | 15 | 16 | ElectronTeamID 17 | VEKTX9H2N7 18 | 19 | 20 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/mac/parent.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.application-groups 8 | VEKTX9H2N7.com.github.electron-api-demos 9 | com.apple.security.files.user-selected.read-write 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.150x150.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.310x150.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.44x44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.44x44.png -------------------------------------------------------------------------------- /ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/ElectronSharp.SampleApp/wwwroot/assets/tiles/SampleAppx.50x50.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Gregor Biswanger, Robert Mühsig 4 | Copyright (c) 2022 Rafael Oliveira 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /Releaser/Releaser.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net9.0 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /assets/electron-sharp-logo.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theolivenbaum/electron-sharp/8a94e88715be7e07ae79669ecb48ff191bd528b3/assets/electron-sharp-logo.afdesign --------------------------------------------------------------------------------