From 67611192414ec0dea616f9a4bae4bc1d0eb48a4a Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 22 Nov 2025 02:16:10 +0100 Subject: [PATCH 1/4] Update all model classes to Electron API 39.2 --- .../API/Entities/AboutPanelOptions.cs | 22 ++- .../API/Entities/AddRepresentationOptions.cs | 13 +- .../API/Entities/AppDetailsOptions.cs | 16 ++- .../API/Entities/AutoResizeOptions.cs | 1 + .../API/Entities/BitmapOptions.cs | 3 +- src/ElectronNET.API/API/Entities/Blob.cs | 1 + .../Entities/BrowserViewConstructorOptions.cs | 9 +- .../API/Entities/BrowserWindowOptions.cs | 83 ++++++++++-- src/ElectronNET.API/API/Entities/CPUUsage.cs | 12 +- .../API/Entities/Certificate.cs | 1 + .../API/Entities/CertificatePrincipal.cs | 1 + .../Entities/CertificateTrustDialogOptions.cs | 1 + .../API/Entities/ChromeExtensionInfo.cs | 1 + .../API/Entities/ClearStorageDataOptions.cs | 10 +- src/ElectronNET.API/API/Entities/Cookie.cs | 28 ++-- .../API/Entities/CookieChangedCause.cs | 15 +- .../API/Entities/CookieDetails.cs | 25 ++-- .../API/Entities/CookieFilter.cs | 8 +- .../API/Entities/CreateFromBitmapOptions.cs | 7 +- .../API/Entities/CreateFromBufferOptions.cs | 7 +- .../CreateInterruptedDownloadOptions.cs | 8 +- src/ElectronNET.API/API/Entities/Data.cs | 6 + .../API/Entities/DefaultFontFamily.cs | 5 + .../API/Entities/DevToolsMode.cs | 13 +- src/ElectronNET.API/API/Entities/Display.cs | 46 +++++-- .../API/Entities/DisplayBalloonOptions.cs | 39 +++++- .../API/Entities/DockBounceType.cs | 3 + .../Entities/EnableNetworkEmulationOptions.cs | 10 +- src/ElectronNET.API/API/Entities/Extension.cs | 1 + .../API/Entities/FileFilter.cs | 1 + .../API/Entities/FileIconOptions.cs | 7 +- .../API/Entities/FileIconSize.cs | 13 +- .../API/Entities/FocusOptions.cs | 9 +- .../API/Entities/GPUFeatureStatus.cs | 41 ++++-- src/ElectronNET.API/API/Entities/IPostData.cs | 10 +- .../API/Entities/ImportCertificateOptions.cs | 8 +- .../API/Entities/InputEvent.cs | 90 +++++++++++- .../API/Entities/InputEventType.cs | 5 + .../API/Entities/JumpListCategory.cs | 12 +- .../API/Entities/JumpListCategoryType.cs | 8 +- .../API/Entities/JumpListItem.cs | 31 +++-- .../API/Entities/JumpListItemType.cs | 8 +- .../API/Entities/JumpListSettings.cs | 16 ++- .../API/Entities/LoadURLOptions.cs | 16 +-- .../API/Entities/LoginItemLaunchItem.cs | 37 +++++ .../API/Entities/LoginItemSettings.cs | 36 ++++- .../API/Entities/LoginItemSettingsOptions.cs | 18 ++- .../API/Entities/LoginSettings.cs | 36 ++++- src/ElectronNET.API/API/Entities/Margins.cs | 29 ++-- .../API/Entities/MemoryInfo.cs | 16 ++- src/ElectronNET.API/API/Entities/MenuItem.cs | 71 ++++++++-- src/ElectronNET.API/API/Entities/MenuRole.cs | 128 ++++++++++++++++-- src/ElectronNET.API/API/Entities/MenuType.cs | 31 +++-- .../API/Entities/MessageBoxOptions.cs | 56 ++++---- .../API/Entities/MessageBoxResult.cs | 13 +- .../API/Entities/MessageBoxType.cs | 3 +- .../API/Entities/ModifierType.cs | 3 +- .../API/Entities/NativeImage.cs | 7 + .../API/Entities/NativeImageJsonConverter.cs | 1 + .../API/Entities/NotificationAction.cs | 10 +- .../API/Entities/NotificationOptions.cs | 70 ++++++---- .../API/Entities/OnDidFailLoadInfo.cs | 20 +++ .../API/Entities/OnDidNavigateInfo.cs | 12 +- .../API/Entities/OnTopLevel.cs | 6 +- .../API/Entities/OpenDevToolsOptions.cs | 15 +- .../API/Entities/OpenDialogOptions.cs | 16 ++- .../API/Entities/OpenDialogProperty.cs | 14 +- .../API/Entities/OpenExternalOptions.cs | 15 +- src/ElectronNET.API/API/Entities/PageSize.cs | 18 +++ src/ElectronNET.API/API/Entities/PathName.cs | 63 +++++---- src/ElectronNET.API/API/Entities/Point.cs | 1 + .../API/Entities/PrintOptions.cs | 61 ++++++--- .../API/Entities/PrintToPDFOptions.cs | 31 +++-- .../API/Entities/PrinterInfo.cs | 25 +++- .../API/Entities/ProcessMetric.cs | 28 ++-- .../API/Entities/ProcessVersions.cs | 1 + .../API/Entities/ProgressBarMode.cs | 8 +- .../API/Entities/ProgressBarOptions.cs | 9 +- .../API/Entities/ProgressInfo.cs | 21 ++- .../API/Entities/ProxyConfig.cs | 8 +- .../API/Entities/ReadBookmark.cs | 9 +- src/ElectronNET.API/API/Entities/Rectangle.cs | 1 + .../API/Entities/RelaunchOptions.cs | 13 +- .../API/Entities/ReleaseNoteInfo.cs | 5 +- .../API/Entities/RemovePassword.cs | 1 + .../API/Entities/ResizeOptions.cs | 5 +- .../API/Entities/SaveDialogOptions.cs | 30 +++- .../API/Entities/SaveDialogProperty.cs | 40 ++++++ src/ElectronNET.API/API/Entities/Scheme.cs | 3 +- src/ElectronNET.API/API/Entities/SemVer.cs | 2 + .../API/Entities/SharingItem.cs | 27 ++++ .../API/Entities/ShortcutDetails.cs | 12 +- .../API/Entities/ShortcutLinkOperation.cs | 6 +- src/ElectronNET.API/API/Entities/Size.cs | 1 + .../API/Entities/ThemeSourceMode.cs | 4 +- .../API/Entities/ThumbarButton.cs | 5 +- .../API/Entities/ThumbarButtonFlag.cs | 8 +- .../API/Entities/TitleBarOverlay.cs | 33 ++++- .../API/Entities/TitleBarStyle.cs | 3 + .../API/Entities/ToBitmapOptions.cs | 5 +- .../API/Entities/ToDataUrlOptions.cs | 3 +- .../API/Entities/ToPNGOptions.cs | 3 +- .../API/Entities/TrayClickEventArgs.cs | 14 +- .../API/Entities/UpdateCancellationToken.cs | 7 +- .../API/Entities/UpdateCheckResult.cs | 7 +- .../API/Entities/UpdateFileInfo.cs | 3 +- .../API/Entities/UpdateInfo.cs | 15 +- .../API/Entities/UploadFile.cs | 14 +- .../API/Entities/UploadRawData.cs | 5 +- src/ElectronNET.API/API/Entities/UserTask.cs | 8 +- src/ElectronNET.API/API/Entities/Vibrancy.cs | 73 +++++++--- .../API/Entities/WebPreferences.cs | 50 +++++-- .../Converter/ModifierTypeListConverter.cs | 2 +- .../Tests/BrowserWindowTests.cs | 2 +- 114 files changed, 1527 insertions(+), 499 deletions(-) create mode 100644 src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs create mode 100644 src/ElectronNET.API/API/Entities/SaveDialogProperty.cs create mode 100644 src/ElectronNET.API/API/Entities/SharingItem.cs diff --git a/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs b/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs index 90aeb869..03bef1b6 100644 --- a/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs +++ b/src/ElectronNET.API/API/Entities/AboutPanelOptions.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// About panel options. /// + /// Up-to-date with Electron API 39.2 public class AboutPanelOptions { /// @@ -21,28 +24,35 @@ public class AboutPanelOptions public string Copyright { get; set; } /// - /// The app's build version number. + /// The app's build version number (macOS). /// + [SupportedOSPlatform("macos")] public string Version { get; set; } /// - /// Credit information. + /// Credit information (macOS, Windows). /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public string Credits { get; set; } /// - /// List of app authors. + /// List of app authors (Linux). /// + [SupportedOSPlatform("linux")] public string[] Authors { get; set; } /// - /// The app's website. + /// The app's website (Linux). /// + [SupportedOSPlatform("linux")] public string Website { get; set; } /// - /// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. + /// Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality. /// + [SupportedOSPlatform("linux")] + [SupportedOSPlatform("windows")] public string IconPath { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs b/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs index 96da0cb9..40338f0c 100644 --- a/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs +++ b/src/ElectronNET.API/API/Entities/AddRepresentationOptions.cs @@ -1,32 +1,35 @@ +using System.Text.Json.Serialization; + namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class AddRepresentationOptions { /// - /// Gets or sets the width + /// Gets or sets the width in pixels. Defaults to 0. Required if a bitmap buffer is specified as . /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height in pixels. Defaults to 0. Required if a bitmap buffer is specified as . /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; /// - /// Gets or sets the buffer + /// Gets or sets the buffer containing the raw image data. /// public byte[] Buffer { get; set; } /// - /// Gets or sets the dataURL + /// Gets or sets the data URL containing a base 64 encoded PNG or JPEG image. /// public string DataUrl { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs b/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs index 55a92e91..bf2f12c6 100644 --- a/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs +++ b/src/ElectronNET.API/API/Entities/AppDetailsOptions.cs @@ -1,32 +1,36 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class AppDetailsOptions { /// - /// Window’s App User Model ID. It has to be set, otherwise the other options will have no effect. + /// Window's App User Model ID. It has to be set, otherwise the other options will have no effect. /// public string AppId { get; set; } /// - /// Window’s Relaunch Icon. + /// Window's relaunch icon resource path. /// public string AppIconPath { get; set; } /// - /// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0. + /// Index of the icon in . Ignored when is not set. Default is 0. /// public int AppIconIndex { get; set; } /// - /// Window’s Relaunch Command. + /// Window's relaunch command. /// public string RelaunchCommand { get; set; } /// - /// Window’s Relaunch Display Name. + /// Window's relaunch display name. /// public string RelaunchDisplayName { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs b/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs index e4b350d2..2244a7d4 100644 --- a/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs +++ b/src/ElectronNET.API/API/Entities/AutoResizeOptions.cs @@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class AutoResizeOptions { /// diff --git a/src/ElectronNET.API/API/Entities/BitmapOptions.cs b/src/ElectronNET.API/API/Entities/BitmapOptions.cs index 6c7a463b..07d0c0ba 100644 --- a/src/ElectronNET.API/API/Entities/BitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/BitmapOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class BitmapOptions { /// - /// Gets or sets the scale factor + /// The image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/Blob.cs b/src/ElectronNET.API/API/Entities/Blob.cs index e1a81b0d..3c7e3e81 100644 --- a/src/ElectronNET.API/API/Entities/Blob.cs +++ b/src/ElectronNET.API/API/Entities/Blob.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Blob : IPostData { /// diff --git a/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs b/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs index f9eb8ef3..346de4b6 100644 --- a/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs +++ b/src/ElectronNET.API/API/Entities/BrowserViewConstructorOptions.cs @@ -3,23 +3,26 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class BrowserViewConstructorOptions { /// - /// See BrowserWindow. + /// Gets or sets the web preferences for the view (see WebPreferences). /// public WebPreferences WebPreferences { get; set; } /// - /// A proxy to set on creation in the format host:port. + /// Gets or sets a proxy to use on creation in the format host:port. /// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function. /// + /// This is custom shortcut. Not part of the Electron API. public string Proxy { get; set; } /// - /// The credentials of the Proxy in the format username:password. + /// Gets or sets the credentials of the proxy in the format username:password. /// These will only be used if the Proxy field is also set. /// + /// This is custom shortcut. Not part of the Electron API. public string ProxyCredentials { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs b/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs index 592cea08..dec474e0 100644 --- a/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs +++ b/src/ElectronNET.API/API/Entities/BrowserWindowOptions.cs @@ -1,6 +1,7 @@ using ElectronNET.Converter; using System.ComponentModel; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -72,24 +73,32 @@ public class BrowserWindowOptions /// /// Whether window is movable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Movable { get; set; } = true; /// /// Whether window is minimizable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Minimizable { get; set; } = true; /// /// Whether window is maximizable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Maximizable { get; set; } = true; /// /// Whether window is closable. This is not implemented on Linux. Default is true. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool Closable { get; set; } = true; @@ -124,6 +133,8 @@ public class BrowserWindowOptions /// /// Whether to show the window in taskbar. Default is false. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public bool SkipTaskbar { get; set; } /// @@ -142,8 +153,7 @@ public class BrowserWindowOptions public string Title { get; set; } = "Electron.NET"; /// - /// The window icon. On Windows it is recommended to use ICO icons to get best - /// visual effects, you can also leave it undefined so the executable's icon will be used. + /// The window icon. Can be a NativeImage or a string path. On Windows it is recommended to use ICO icons; when undefined, the executable's icon will be used. /// public string Icon { get; set; } @@ -154,7 +164,7 @@ public class BrowserWindowOptions public bool Show { get; set; } = true; /// - /// Specify false to create a . Default is true. + /// Specify false to create a frameless window. Default is true. /// [DefaultValue(true)] public bool Frame { get; set; } = true; @@ -169,6 +179,7 @@ public class BrowserWindowOptions /// Whether the web view accepts a single mouse-down event that simultaneously /// activates the window.Default is false. /// + [SupportedOSPlatform("macos")] public bool AcceptFirstMouse { get; set; } /// @@ -179,28 +190,35 @@ public class BrowserWindowOptions /// /// Auto hide the menu bar unless the Alt key is pressed. Default is false. /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public bool AutoHideMenuBar { get; set; } /// /// Enable the window to be resized larger than screen. Default is false. /// + [SupportedOSPlatform("macos")] public bool EnableLargerThanScreen { get; set; } /// - /// Window's background color as Hexadecimal value, like #66CD00 or #FFF or - /// #80FFFFFF (alpha is supported). Default is #FFF (white). + /// The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported if transparent is set to true. Default is #FFF (white). /// public string BackgroundColor { get; set; } /// - /// Whether window should have a shadow. This is only implemented on macOS. Default - /// is true. + /// Initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). Only implemented on Windows and macOS. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("macos")] + public double? Opacity { get; set; } + + /// + /// Whether window should have a shadow. Default is true. /// public bool HasShadow { get; set; } /// - /// Forces using dark theme for the window, only works on some GTK+3 desktop - /// environments.Default is false. + /// Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default is false. /// public bool DarkTheme { get; set; } @@ -220,6 +238,12 @@ public class BrowserWindowOptions /// public TitleBarStyle TitleBarStyle { get; set; } + /// + /// Set a custom position for the traffic light buttons in frameless windows (macOS). + /// + [SupportedOSPlatform("macos")] + public Point TrafficLightPosition { get; set; } + /// /// Configures the window's title bar overlay when using a frameless window. /// Can be either: @@ -233,9 +257,9 @@ public class BrowserWindowOptions public TitleBarOverlay TitleBarOverlay { get; set; } /// - /// Shows the title in the tile bar in full screen mode on macOS for all - /// titleBarStyle options.Default is false. + /// Shows the title in the title bar in full screen mode on macOS for all titleBarStyle options. Default is false. /// + /// Not documented by MCP base-window-options / browser-window-options. public bool FullscreenWindowTitle { get; set; } /// @@ -243,6 +267,7 @@ public class BrowserWindowOptions /// window frame.Setting it to false will remove window shadow and window /// animations. Default is true. /// + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool ThickFrame { get; set; } = true; @@ -252,14 +277,17 @@ public class BrowserWindowOptions /// Windows versions older than Windows 11 Build 22000 this property has no effect, and /// frameless windows will not have rounded corners. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] [DefaultValue(true)] public bool RoundedCorners { get; set; } = true; /// /// Add a type of vibrancy effect to the window, only on macOS. Can be - /// appearance-based, light, dark, titlebar, selection, menu, popover, sidebar, - /// medium-light or ultra-dark. + /// appearance-based, titlebar, selection, menu, popover, sidebar, header, sheet, + /// window, hud, fullscreen-ui, tooltip, content, under-window, or under-page. /// + [SupportedOSPlatform("macos")] public Vibrancy Vibrancy { get; set; } /// @@ -269,6 +297,7 @@ public class BrowserWindowOptions /// it to zoom to the width of the screen.This will also affect the behavior when /// calling maximize() directly.Default is false. /// + [SupportedOSPlatform("macos")] public bool ZoomToPageWidth { get; set; } /// @@ -277,6 +306,7 @@ public class BrowserWindowOptions /// adds a native new tab button to your window's tab bar and allows your app and /// window to receive the new-window-for-tab event. /// + [SupportedOSPlatform("macos")] public string TabbingIdentifier { get; set; } /// @@ -288,12 +318,39 @@ public class BrowserWindowOptions /// A proxy to set on creation in the format host:port. /// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function. /// + /// Not documented by MCP base-window-options / browser-window-options. public string Proxy { get; set; } /// /// The credentials of the Proxy in the format username:password. /// These will only be used if the Proxy field is also set. /// + /// Not documented by MCP base-window-options / browser-window-options. public string ProxyCredentials { get; set; } + + /// + /// Gets or sets whether to use pre-Lion fullscreen on macOS. Default is false. + /// + [SupportedOSPlatform("macos")] + public bool SimpleFullscreen { get; set; } + + /// + /// Gets or sets whether the window should be hidden when the user toggles into mission control (macOS). + /// + [SupportedOSPlatform("macos")] + public bool HiddenInMissionControl { get; set; } + + /// + /// Gets or sets how the material appearance should reflect window activity state on macOS. Must be used with the vibrancy property. + /// Possible values: 'followWindow' (default), 'active', 'inactive'. + /// + [SupportedOSPlatform("macos")] + public string VisualEffectState { get; set; } + + /// + /// Gets or sets the system-drawn background material on Windows. Can be 'auto', 'none', 'mica', 'acrylic' or 'tabbed'. + /// + [SupportedOSPlatform("windows")] + public string BackgroundMaterial { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CPUUsage.cs b/src/ElectronNET.API/API/Entities/CPUUsage.cs index acd4746f..c21d133e 100644 --- a/src/ElectronNET.API/API/Entities/CPUUsage.cs +++ b/src/ElectronNET.API/API/Entities/CPUUsage.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CPUUsage { /// @@ -11,9 +12,14 @@ public class CPUUsage public double PercentCPUUsage { get; set; } /// - /// The number of average idle cpu wakeups per second since the last call to - /// getCPUUsage.First call returns 0. + /// Total seconds of CPU time used since process startup, if available. /// - public int IdleWakeupsPerSecond { get; set; } + public double? CumulativeCPUUsage { get; set; } + + /// + /// The number of average idle CPU wakeups per second since the last call to + /// getCPUUsage. First call returns 0. Will always return 0 on Windows. + /// + public double IdleWakeupsPerSecond { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Certificate.cs b/src/ElectronNET.API/API/Entities/Certificate.cs index 646c126f..937b4153 100644 --- a/src/ElectronNET.API/API/Entities/Certificate.cs +++ b/src/ElectronNET.API/API/Entities/Certificate.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Certificate { /// diff --git a/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs b/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs index 0b1245af..8b1b6b27 100644 --- a/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs +++ b/src/ElectronNET.API/API/Entities/CertificatePrincipal.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CertificatePrincipal { /// diff --git a/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs b/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs index 9a3bfda9..04b0eab2 100644 --- a/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/CertificateTrustDialogOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CertificateTrustDialogOptions { /// diff --git a/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs b/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs index 36115a9f..b3d5e0a6 100644 --- a/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs +++ b/src/ElectronNET.API/API/Entities/ChromeExtensionInfo.cs @@ -3,6 +3,7 @@ /// /// Provide metadata about the current loaded Chrome extension /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class ChromeExtensionInfo { /// diff --git a/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs b/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs index d3940e7f..cf455e14 100644 --- a/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs +++ b/src/ElectronNET.API/API/Entities/ClearStorageDataOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ClearStorageDataOptions { /// @@ -11,13 +12,16 @@ public class ClearStorageDataOptions public string Origin { get; set; } /// - /// The types of storages to clear, can contain: appcache, cookies, filesystem, - /// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. + /// The types of storages to clear. Can contain: cookies, filesystem, indexdb, + /// localstorage, shadercache, websql, serviceworkers, cachestorage. + /// If not specified, all storage types are cleared. /// public string[] Storages { get; set; } /// - /// The types of quotas to clear, can contain: temporary, persistent, syncable. + /// The types of quotas to clear. Can contain: temporary. If not specified, + /// all quotas are cleared. The quotas option is deprecated; + /// "temporary" is the only remaining supported quota type. /// public string[] Quotas { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/Cookie.cs b/src/ElectronNET.API/API/Entities/Cookie.cs index d9b9b278..815c2865 100644 --- a/src/ElectronNET.API/API/Entities/Cookie.cs +++ b/src/ElectronNET.API/API/Entities/Cookie.cs @@ -1,53 +1,59 @@ namespace ElectronNET.API.Entities { /// - /// + /// Cookie structure as used by Electron session.cookies APIs. /// + /// Up-to-date with Electron API 39.2 public class Cookie { /// - /// The name of the cookie. + /// Gets or sets the name of the cookie. /// public string Name { get; set; } /// - /// The value of the cookie. + /// Gets or sets the value of the cookie. /// public string Value { get; set; } /// - /// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. + /// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. /// public string Domain { get; set; } /// - /// (optional) - Whether the cookie is a host-only cookie; this will only be true if no domain was passed. + /// Gets or sets a value indicating whether the cookie is a host-only cookie; this will only be true if no domain was passed. /// public bool HostOnly { get; set; } /// - /// (optional) - The path of the cookie. + /// Gets or sets the path of the cookie. /// public string Path { get; set; } /// - /// (optional) - Whether the cookie is marked as secure. + /// Gets or sets a value indicating whether the cookie is marked as secure. /// public bool Secure { get; set; } /// - /// (optional) - Whether the cookie is marked as HTTP only. + /// Gets or sets a value indicating whether the cookie is marked as HTTP only. /// public bool HttpOnly { get; set; } /// - /// (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date. + /// Gets or sets a value indicating whether the cookie is a session cookie or a persistent cookie with an expiration date. /// public bool Session { get; set; } /// - /// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. + /// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. /// - public long ExpirationDate { get; set; } + public double ExpirationDate { get; set; } + + /// + /// Gets or sets the SameSite policy applied to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict". + /// + public string SameSite { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CookieChangedCause.cs b/src/ElectronNET.API/API/Entities/CookieChangedCause.cs index ae1a42db..fd65bfd4 100644 --- a/src/ElectronNET.API/API/Entities/CookieChangedCause.cs +++ b/src/ElectronNET.API/API/Entities/CookieChangedCause.cs @@ -1,16 +1,15 @@ -using System.Text.Json.Serialization; - namespace ElectronNET.API.Entities { + using System.Text.Json.Serialization; + /// - /// The cause of the change + /// The cause of the cookie change (per Electron Cookies 'changed' event). /// public enum CookieChangedCause { /// - ///The cookie was changed directly by a consumer's action. + /// The cookie was changed directly by a consumer's action. /// - [JsonPropertyName("explicit")] @explicit, /// @@ -19,17 +18,17 @@ public enum CookieChangedCause overwrite, /// - /// The cookie was automatically removed as it expired. + /// The cookie was automatically removed as it expired. /// expired, /// - /// The cookie was automatically evicted during garbage collection. + /// The cookie was automatically evicted during garbage collection. /// evicted, /// - /// The cookie was overwritten with an already-expired expiration date. + /// The cookie was overwritten with an already-expired expiration date. /// [JsonPropertyName("expired_overwrite")] expiredOverwrite diff --git a/src/ElectronNET.API/API/Entities/CookieDetails.cs b/src/ElectronNET.API/API/Entities/CookieDetails.cs index 389e8ce5..260edb98 100644 --- a/src/ElectronNET.API/API/Entities/CookieDetails.cs +++ b/src/ElectronNET.API/API/Entities/CookieDetails.cs @@ -5,54 +5,59 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class CookieDetails { /// - /// The URL to associate the cookie with. The callback will be rejected if the URL is invalid. + /// Gets or sets the URL to associate the cookie with. The operation will be rejected if the URL is invalid. /// public string Url { get; set; } /// - /// (optional) - The name of the cookie. Empty by default if omitted. + /// Gets or sets the name of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Name { get; set; } /// - /// (optional) - The value of the cookie. Empty by default if omitted. + /// Gets or sets the value of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Value { get; set; } /// - /// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted. + /// Gets or sets the domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted. /// [DefaultValue("")] public string Domain { get; set; } /// - /// (optional) - The path of the cookie. Empty by default if omitted. + /// Gets or sets the path of the cookie. Empty by default if omitted. /// [DefaultValue("")] public string Path { get; set; } /// - /// (optional) - Whether the cookie is marked as secure. Defaults to false. + /// Gets or sets a value indicating whether the cookie should be marked as secure. Defaults to false unless the SameSite policy is set to no_restriction (SameSite=None). /// [DefaultValue(false)] public bool Secure { get; set; } /// - /// (optional) - Whether the cookie is marked as HTTP only. Defaults to false. + /// Gets or sets a value indicating whether the cookie should be marked as HTTP only. Defaults to false. /// [DefaultValue(false)] public bool HttpOnly { get; set; } /// - /// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. - /// If omitted then the cookie becomes a session cookie and will not be retained between sessions. + /// Gets or sets the expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie and will not be retained between sessions. /// [DefaultValue(0)] - public long ExpirationDate { get; set; } + public double ExpirationDate { get; set; } + + /// + /// Gets or sets the SameSite policy to apply to this cookie. Can be "unspecified", "no_restriction", "lax" or "strict". Default is "lax". + /// + public string SameSite { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CookieFilter.cs b/src/ElectronNET.API/API/Entities/CookieFilter.cs index ee5a51e4..7914fe80 100644 --- a/src/ElectronNET.API/API/Entities/CookieFilter.cs +++ b/src/ElectronNET.API/API/Entities/CookieFilter.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CookieFilter { /// - /// (optional) - Retrieves cookies which are associated with url.Empty implies retrieving cookies of all URLs. + /// (optional) - Retrieves cookies which are associated with url. Empty implies retrieving cookies of all URLs. /// public string Url { get; set; } @@ -34,5 +35,10 @@ public class CookieFilter /// (optional) - Filters out session or persistent cookies. /// public bool Session { get; set; } + + /// + /// (optional) - Filters cookies by httpOnly. + /// + public bool HttpOnly { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs b/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs index b2239983..48ec8036 100644 --- a/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateFromBitmapOptions.cs @@ -3,20 +3,21 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateFromBitmapOptions { /// - /// Gets or sets the width + /// Gets or sets the width in pixels. Required for nativeImage.createFromBitmap(buffer, options). /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height in pixels. Required for nativeImage.createFromBitmap(buffer, options). /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Optional, defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs b/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs index 206f5acd..0eef0f91 100644 --- a/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateFromBufferOptions.cs @@ -3,20 +3,21 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateFromBufferOptions { /// - /// Gets or sets the width + /// Gets or sets the width. Required for bitmap buffers passed to nativeImage.createFromBuffer. /// public int? Width { get; set; } /// - /// Gets or sets the height + /// Gets or sets the height. Required for bitmap buffers passed to nativeImage.createFromBuffer. /// public int? Height { get; set; } /// - /// Gets or sets the scalefactor + /// The image scale factor. Optional, defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs b/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs index b28f6166..5221376e 100644 --- a/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs +++ b/src/ElectronNET.API/API/Entities/CreateInterruptedDownloadOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class CreateInterruptedDownloadOptions { /// @@ -16,7 +17,7 @@ public class CreateInterruptedDownloadOptions public string[] UrlChain { get; set; } /// - /// + /// (optional) - MIME type of the download. /// public string MimeType { get; set; } @@ -41,9 +42,10 @@ public class CreateInterruptedDownloadOptions public string ETag { get; set; } /// - /// Time when download was started in number of seconds since UNIX epoch. + /// (optional) - Time when download was started in number of seconds since UNIX epoch. + /// Electron documents this as a Number (Double). /// - public int StartTime { get; set; } + public double? StartTime { get; set; } /// /// diff --git a/src/ElectronNET.API/API/Entities/Data.cs b/src/ElectronNET.API/API/Entities/Data.cs index 2dcca894..9dddf66d 100644 --- a/src/ElectronNET.API/API/Entities/Data.cs +++ b/src/ElectronNET.API/API/Entities/Data.cs @@ -21,6 +21,12 @@ public class Data /// public string Html { get; set; } + /// + /// Gets or sets the image. + /// Maps to clipboard.write({ image: NativeImage }). + /// + public NativeImage Image { get; set; } + /// /// Gets or sets the RTF. diff --git a/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs b/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs index 105d2053..95e081a3 100644 --- a/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs +++ b/src/ElectronNET.API/API/Entities/DefaultFontFamily.cs @@ -34,5 +34,10 @@ public class DefaultFontFamily /// Defaults to Impact. /// public string Fantasy { get; set; } + + /// + /// Defaults to Latin Modern Math. + /// + public string Math { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/DevToolsMode.cs b/src/ElectronNET.API/API/Entities/DevToolsMode.cs index 7290d8ca..6d786a39 100644 --- a/src/ElectronNET.API/API/Entities/DevToolsMode.cs +++ b/src/ElectronNET.API/API/Entities/DevToolsMode.cs @@ -1,9 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// Opens the devtools with specified dock state, can be right, bottom, undocked, - /// detach.Defaults to last used dock state.In undocked mode it's possible to dock - /// back.In detach mode it's not. + /// Opens the devtools with specified dock state, can be left, right, bottom, undocked, + /// detach. Defaults to last used dock state. In undocked mode it's possible to dock + /// back. In detach mode it's not. /// public enum DevToolsMode { @@ -25,6 +25,11 @@ public enum DevToolsMode /// /// The detach /// - detach + detach, + + /// + /// The left + /// + left, } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Display.cs b/src/ElectronNET.API/API/Entities/Display.cs index ba2d8a79..258b6b84 100644 --- a/src/ElectronNET.API/API/Entities/Display.cs +++ b/src/ElectronNET.API/API/Entities/Display.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Display { /// - /// Can be available, unavailable, unknown. + /// Gets or sets the accelerometer support status; can be 'available', 'unavailable', or 'unknown'. /// public string AccelerometerSupport { get; set; } @@ -19,57 +20,72 @@ public class Display public Rectangle Bounds { get; set; } /// - /// The number of bits per pixel. + /// Gets or sets the number of bits per pixel. /// public int ColorDepth { get; set; } /// - /// Represent a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions. + /// Gets or sets the color space description used for color conversions. /// public string ColorSpace { get; set; } /// - /// The number of bits per color component. + /// Gets or sets the number of bits per color component. /// public int DepthPerComponent { get; set; } /// - /// The display refresh rate. + /// Gets or sets a value indicating whether the display is detected by the system. /// - public int DisplayFrequency { get; set; } + public bool Detected { get; set; } /// - /// Unique identifier associated with the display. + /// Gets or sets the display refresh rate. + /// + public double DisplayFrequency { get; set; } + + /// + /// Gets or sets the unique identifier associated with the display. A value of -1 means the display is invalid or the correct id is not yet known, and a value of -10 means the display is a virtual display assigned to a unified desktop. /// public long Id { get; set; } /// - /// true for an internal display and false for an external display. + /// Gets or sets a value indicating whether the display is internal (true) or external (false). /// public bool Internal { get; set; } /// - /// User-friendly label, determined by the platform. + /// Gets or sets the user-friendly label, determined by the platform. /// public string Label { get; set; } /// - /// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. + /// Gets or sets the maximum cursor size in native pixels. + /// + public Size MaximumCursorSize { get; set; } + + /// + /// Gets or sets the display's origin in pixel coordinates. Only available on windowing systems that position displays in pixel coordinates (e.g., X11). + /// + public Point NativeOrigin { get; set; } + + /// + /// Gets or sets the screen rotation in clock-wise degrees. Can be 0, 90, 180, or 270. /// public int Rotation { get; set; } /// - /// Output device's pixel scale factor. + /// Gets or sets the output device's pixel scale factor. /// public double ScaleFactor { get; set; } /// - /// Can be available, unavailable, unknown. + /// Gets or sets the touch support status; can be 'available', 'unavailable', or 'unknown'. /// public string TouchSupport { get; set; } /// - /// Whether or not the display is a monochrome display. + /// Gets or sets a value indicating whether the display is monochrome. /// public bool Monochrome { get; set; } @@ -82,10 +98,10 @@ public class Display public Size Size { get; set; } /// - /// Gets or sets the work area. + /// Gets or sets the work area of the display in DIP points. /// /// - /// The work area. + /// The work area of the display in DIP points. /// public Rectangle WorkArea { get; set; } diff --git a/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs b/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs index c2235111..66758b7d 100644 --- a/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs +++ b/src/ElectronNET.API/API/Entities/DisplayBalloonOptions.cs @@ -1,8 +1,21 @@ -namespace ElectronNET.API +using System.Runtime.Versioning; + +namespace ElectronNET.API { /// /// /// + public enum DisplayBalloonIconType + { + none, + info, + warning, + error, + custom + } + + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public class DisplayBalloonOptions { /// @@ -28,5 +41,29 @@ public class DisplayBalloonOptions /// The content. /// public string Content { get; set; } + + /// + /// (optional) - Icon type for the balloon: none, info, warning, error or custom. + /// Default is custom. + /// + public DisplayBalloonIconType IconType { get; set; } = DisplayBalloonIconType.custom; + + /// + /// (optional) - Use the large version of the icon. Default is true. + /// Maps to Windows NIIF_LARGE_ICON. + /// + public bool LargeIcon { get; set; } = true; + + /// + /// (optional) - Do not play the associated sound. Default is false. + /// Maps to Windows NIIF_NOSOUND. + /// + public bool NoSound { get; set; } + + /// + /// (optional) - Do not display the balloon if the current user is in "quiet time". + /// Default is false. Maps to Windows NIIF_RESPECT_QUIET_TIME. + /// + public bool RespectQuietTime { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/DockBounceType.cs b/src/ElectronNET.API/API/Entities/DockBounceType.cs index eedcaac3..611982b0 100644 --- a/src/ElectronNET.API/API/Entities/DockBounceType.cs +++ b/src/ElectronNET.API/API/Entities/DockBounceType.cs @@ -1,10 +1,13 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Defines the DockBounceType enumeration. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] public enum DockBounceType { /// diff --git a/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs b/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs index 64fed7a1..d5a3e3d1 100644 --- a/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs +++ b/src/ElectronNET.API/API/Entities/EnableNetworkEmulationOptions.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class EnableNetworkEmulationOptions { /// @@ -12,17 +13,20 @@ public class EnableNetworkEmulationOptions /// /// RTT in ms. Defaults to 0 which will disable latency throttling. + /// Electron documents this as a Number (Double). /// - public int Latency { get; set; } + public double Latency { get; set; } /// /// Download rate in Bps. Defaults to 0 which will disable download throttling. + /// Electron documents this as a Number (Double). /// - public int DownloadThroughput { get; set; } + public double DownloadThroughput { get; set; } /// /// Upload rate in Bps. Defaults to 0 which will disable upload throttling. + /// Electron documents this as a Number (Double). /// - public int UploadThroughput { get; set; } + public double UploadThroughput { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Extension.cs b/src/ElectronNET.API/API/Entities/Extension.cs index d4edd975..af4da662 100644 --- a/src/ElectronNET.API/API/Entities/Extension.cs +++ b/src/ElectronNET.API/API/Entities/Extension.cs @@ -3,6 +3,7 @@ /// /// Docs: https://electronjs.org/docs/api/structures/extension /// + /// Up-to-date with Electron API 39.2 public class Extension { /// diff --git a/src/ElectronNET.API/API/Entities/FileFilter.cs b/src/ElectronNET.API/API/Entities/FileFilter.cs index 3f573ed3..4cae053a 100644 --- a/src/ElectronNET.API/API/Entities/FileFilter.cs +++ b/src/ElectronNET.API/API/Entities/FileFilter.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class FileFilter { /// diff --git a/src/ElectronNET.API/API/Entities/FileIconOptions.cs b/src/ElectronNET.API/API/Entities/FileIconOptions.cs index f2e1d250..820d2140 100644 --- a/src/ElectronNET.API/API/Entities/FileIconOptions.cs +++ b/src/ElectronNET.API/API/Entities/FileIconOptions.cs @@ -3,14 +3,13 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class FileIconOptions { /// - /// Gets the size. + /// The requested icon size string passed to app.getFileIcon: + /// "small" (16x16), "normal" (32x32), or "large" (48x48 on Linux, 32x32 on Windows; unsupported on macOS). /// - /// - /// The size. - /// public string Size { get; private set; } /// diff --git a/src/ElectronNET.API/API/Entities/FileIconSize.cs b/src/ElectronNET.API/API/Entities/FileIconSize.cs index 75430d60..bb642b92 100644 --- a/src/ElectronNET.API/API/Entities/FileIconSize.cs +++ b/src/ElectronNET.API/API/Entities/FileIconSize.cs @@ -1,23 +1,28 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public enum FileIconSize { /// - /// The small + /// small - 16x16 (per app.getFileIcon size mapping). /// small, /// - /// The normal + /// normal - 32x32 (per app.getFileIcon size mapping). /// normal, /// - /// The large + /// large - 48x48 on Linux, 32x32 on Windows, unsupported on macOS (per app.getFileIcon size mapping). /// + [SupportedOSPlatform("Linux")] + [SupportedOSPlatform("Windows")] large } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/FocusOptions.cs b/src/ElectronNET.API/API/Entities/FocusOptions.cs index 2520499f..56053a57 100644 --- a/src/ElectronNET.API/API/Entities/FocusOptions.cs +++ b/src/ElectronNET.API/API/Entities/FocusOptions.cs @@ -1,15 +1,18 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Controls the behavior of . /// + /// Up-to-date with Electron API 39.2 public class FocusOptions { /// /// Make the receiver the active app even if another app is currently active. - /// - /// You should seek to use the option as sparingly as possible. + /// You should seek to use the steal option as sparingly as possible. /// + [SupportedOSPlatform("macOS")] public bool Steal { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs b/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs index 1904958c..01448e0f 100644 --- a/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs +++ b/src/ElectronNET.API/API/Entities/GPUFeatureStatus.cs @@ -3,82 +3,97 @@ namespace ElectronNET.API.Entities { /// + /// Graphics Feature Status from chrome://gpu/ as returned by app.getGPUFeatureStatus(). + /// Each field reflects the status of a GPU capability reported by Chromium. /// + /// Possible values for all fields: + /// - disabled_software: Software only. Hardware acceleration disabled (yellow) + /// - disabled_off: Disabled (red) + /// - disabled_off_ok: Disabled (yellow) + /// - unavailable_software: Software only, hardware acceleration unavailable (yellow) + /// - unavailable_off: Unavailable (red) + /// - unavailable_off_ok: Unavailable (yellow) + /// - enabled_readback: Hardware accelerated but at reduced performance (yellow) + /// - enabled_force: Hardware accelerated on all pages (green) + /// - enabled: Hardware accelerated (green) + /// - enabled_on: Enabled (green) + /// - enabled_force_on: Force enabled (green) /// + /// Up-to-date with Electron API 39.2 public class GPUFeatureStatus { /// - /// Canvas. + /// Gets or sets the status for Canvas. /// [JsonPropertyName("2d_canvas")] public string Canvas { get; set; } /// - /// Flash. + /// Gets or sets the status for Flash. /// [JsonPropertyName("flash_3d")] public string Flash3D { get; set; } /// - /// Flash Stage3D. + /// Gets or sets the status for Flash Stage3D. /// [JsonPropertyName("flash_stage3d")] public string FlashStage3D { get; set; } /// - /// Flash Stage3D Baseline profile. + /// Gets or sets the status for Flash Stage3D Baseline profile. /// [JsonPropertyName("flash_stage3d_baseline")] public string FlashStage3dBaseline { get; set; } /// - /// Compositing. + /// Gets or sets the status for Compositing. /// [JsonPropertyName("gpu_compositing")] public string GpuCompositing { get; set; } /// - /// Multiple Raster Threads. + /// Gets or sets the status for Multiple Raster Threads. /// [JsonPropertyName("multiple_raster_threads")] public string MultipleRasterThreads { get; set; } /// - /// Native GpuMemoryBuffers. + /// Gets or sets the status for Native GpuMemoryBuffers. /// [JsonPropertyName("native_gpu_memory_buffers")] public string NativeGpuMemoryBuffers { get; set; } /// - /// Rasterization. + /// Gets or sets the status for Rasterization. /// public string Rasterization { get; set; } /// - /// Video Decode. + /// Gets or sets the status for Video Decode. /// [JsonPropertyName("video_decode")] public string VideoDecode { get; set; } /// - /// Video Encode. + /// Gets or sets the status for Video Encode. /// [JsonPropertyName("video_encode")] public string VideoEncode { get; set; } /// - /// VPx Video Decode. + /// Gets or sets the status for VPx Video Decode. /// [JsonPropertyName("vpx_decode")] public string VpxDecode { get; set; } /// - /// WebGL. + /// Gets or sets the status for WebGL. /// public string Webgl { get; set; } /// - /// WebGL2. + /// Gets or sets the status for WebGL2. /// public string Webgl2 { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/IPostData.cs b/src/ElectronNET.API/API/Entities/IPostData.cs index a8c9612e..8c5d2c9d 100644 --- a/src/ElectronNET.API/API/Entities/IPostData.cs +++ b/src/ElectronNET.API/API/Entities/IPostData.cs @@ -1,15 +1,17 @@ namespace ElectronNET.API.Entities { /// - /// Interface to use Electrons PostData Object + /// Represents a postData item for loadURL/webContents.loadURL options. + /// Valid types per Electron docs: 'rawData' and 'file'. /// + /// Up-to-date with Electron API 39.2 public interface IPostData { /// /// One of the following: - /// rawData - The data is available as a Buffer, in the rawData field. - /// file - The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file. - /// blob - The object represents a Blob. The blobUUID field will be used to describe the Blob. + /// rawData - . + /// file - . + /// Based on Electron postData definitions. /// public string Type { get; } } diff --git a/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs b/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs index 3a93dc68..cabb91e0 100644 --- a/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs +++ b/src/ElectronNET.API/API/Entities/ImportCertificateOptions.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Options for app.importCertificate(options) on Linux. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("linux")] public class ImportCertificateOptions { /// diff --git a/src/ElectronNET.API/API/Entities/InputEvent.cs b/src/ElectronNET.API/API/Entities/InputEvent.cs index 98370e5e..a39a50a3 100644 --- a/src/ElectronNET.API/API/Entities/InputEvent.cs +++ b/src/ElectronNET.API/API/Entities/InputEvent.cs @@ -6,8 +6,10 @@ namespace ElectronNET.API.Entities using System.Text.Json.Serialization; /// - /// + /// Input event payload as used by webContents 'input-event' and 'before-input-event'. + /// Fields map to KeyboardEvent properties where noted, and type/modifiers follow Electron's InputEvent structure. /// + /// Up-to-date with Electron API 39.2 public class InputEvent { /// @@ -57,15 +59,95 @@ public class InputEvent /// /// An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`, - /// `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`, - /// `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right` + /// `meta`, `command`, `cmd`, `iskeypad`, `isautorepeat`, `leftbuttondown`, + /// `middlebuttondown`, `rightbuttondown`, `capslock`, `numlock`, `left`, `right`. /// [JsonConverter(typeof(ModifierTypeListConverter))] public List Modifiers { get; set; } + /// + /// For MouseInputEvent: The x-coordinate of the event (Integer). + /// + public int? X { get; set; } + + /// + /// For MouseInputEvent: The y-coordinate of the event (Integer). + /// + public int? Y { get; set; } + + /// + /// For MouseInputEvent: The button pressed, can be 'left', 'middle', or 'right' (optional). + /// + public string Button { get; set; } + + /// + /// For MouseInputEvent: Global x in screen coordinates (Integer, optional). + /// + public int? GlobalX { get; set; } + + /// + /// For MouseInputEvent: Global y in screen coordinates (Integer, optional). + /// + public int? GlobalY { get; set; } + + /// + /// For MouseInputEvent: Movement delta on x-axis since last event (Integer, optional). + /// + public int? MovementX { get; set; } + + /// + /// For MouseInputEvent: Movement delta on y-axis since last event (Integer, optional). + /// + public int? MovementY { get; set; } + + /// + /// For MouseInputEvent: Click count (Integer, optional). + /// + public int? ClickCount { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal scroll delta (Integer, optional). + /// + public int? DeltaX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical scroll delta (Integer, optional). + /// + public int? DeltaY { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal wheel ticks (Integer, optional). + /// + public int? WheelTicksX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical wheel ticks (Integer, optional). + /// + public int? WheelTicksY { get; set; } + + /// + /// For MouseWheelInputEvent: Horizontal acceleration ratio (Integer, optional). + /// + public int? AccelerationRatioX { get; set; } + + /// + /// For MouseWheelInputEvent: Vertical acceleration ratio (Integer, optional). + /// + public int? AccelerationRatioY { get; set; } + + /// + /// For MouseWheelInputEvent: True if wheel deltas are precise (optional). + /// + public bool? HasPreciseScrollingDeltas { get; set; } + + /// + /// For MouseWheelInputEvent: True if the target can scroll (optional). + /// + public bool? CanScroll { get; set; } + /// /// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`, - /// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, + /// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, `char`, /// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`, /// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`, /// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`, diff --git a/src/ElectronNET.API/API/Entities/InputEventType.cs b/src/ElectronNET.API/API/Entities/InputEventType.cs index a64f11d6..6df172b9 100644 --- a/src/ElectronNET.API/API/Entities/InputEventType.cs +++ b/src/ElectronNET.API/API/Entities/InputEventType.cs @@ -60,6 +60,11 @@ public enum InputEventType /// keyUp, + /// + /// + /// + @char, + /// /// /// diff --git a/src/ElectronNET.API/API/Entities/JumpListCategory.cs b/src/ElectronNET.API/API/Entities/JumpListCategory.cs index 660a7825..df01ee99 100644 --- a/src/ElectronNET.API/API/Entities/JumpListCategory.cs +++ b/src/ElectronNET.API/API/Entities/JumpListCategory.cs @@ -1,24 +1,28 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Jump List category definition used with app.setJumpList(categories). + /// Matches Electron's JumpListCategory structure. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListCategory { /// - /// Must be set if type is custom, otherwise it should be omitted. + /// Gets or sets the name; must be set if type is custom, otherwise it should be omitted. /// public string Name { get; set; } /// - /// Array of objects if type is tasks or custom, otherwise it should be omitted. + /// Gets or sets the array of objects if type is tasks or custom; otherwise it should be omitted. /// public JumpListItem[] Items { get; set; } /// - /// One of the following: "tasks" | "frequent" | "recent" | "custom" + /// Gets or sets the category type. One of: tasks | frequent | recent | custom. /// public JumpListCategoryType Type { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs b/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs index 56a18ddf..4211e4ec 100644 --- a/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs +++ b/src/ElectronNET.API/API/Entities/JumpListCategoryType.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Jump list category kinds for app.setJumpList (Windows). /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum JumpListCategoryType { /// diff --git a/src/ElectronNET.API/API/Entities/JumpListItem.cs b/src/ElectronNET.API/API/Entities/JumpListItem.cs index 9c57ba82..6ff55c7e 100644 --- a/src/ElectronNET.API/API/Entities/JumpListItem.cs +++ b/src/ElectronNET.API/API/Entities/JumpListItem.cs @@ -1,56 +1,65 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Jump List item used in app.setJumpList(categories) on Windows. + /// Matches Electron's JumpListItem structure. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListItem { /// - /// The command line arguments when program is executed. Should only be set if type is task. + /// Gets or sets the command line arguments when program is executed. Should only be set if type is task. /// public string Args { get; set; } /// - /// Description of the task (displayed in a tooltip). Should only be set if type is task. + /// Gets or sets the description of the task (displayed in a tooltip). Should only be set if type is task. Maximum length 260 characters. /// public string Description { get; set; } /// - /// The index of the icon in the resource file. If a resource file contains multiple + /// Gets or sets the index of the icon in the resource file. If a resource file contains multiple /// icons this value can be used to specify the zero-based index of the icon that - /// should be displayed for this task.If a resource file contains only one icon, + /// should be displayed for this task. If a resource file contains only one icon, /// this property should be set to zero. /// public int IconIndex { get; set; } /// - /// The absolute path to an icon to be displayed in a Jump List, which can be an + /// Gets or sets the absolute path to an icon to be displayed in a Jump List, which can be an /// arbitrary resource file that contains an icon(e.g. .ico, .exe, .dll). You can /// usually specify process.execPath to show the program icon. /// public string IconPath { get; set; } /// - /// Path of the file to open, should only be set if type is file. + /// Gets or sets the path of the file to open; should only be set if type is file. /// public string Path { get; set; } /// - /// Path of the program to execute, usually you should specify process.execPath - /// which opens the current program.Should only be set if type is task. + /// Gets or sets the path of the program to execute, usually specify process.execPath + /// which opens the current program. Should only be set if type is task. /// public string Program { get; set; } /// - /// The text to be displayed for the item in the Jump List. Should only be set if type is task. + /// Gets or sets the text to be displayed for the item in the Jump List. Should only be set if type is task. /// public string Title { get; set; } /// - /// One of the following: "task" | "separator" | "file" + /// Gets or sets the item type. One of: task | separator | file. /// public JumpListItemType Type { get; set; } + + /// + /// Gets or sets the working directory. Default is empty. + /// + public string WorkingDirectory { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/JumpListItemType.cs b/src/ElectronNET.API/API/Entities/JumpListItemType.cs index 6bc23828..0b055c0a 100644 --- a/src/ElectronNET.API/API/Entities/JumpListItemType.cs +++ b/src/ElectronNET.API/API/Entities/JumpListItemType.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Jump list item kinds for app.setJumpList (Windows). /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum JumpListItemType { /// diff --git a/src/ElectronNET.API/API/Entities/JumpListSettings.cs b/src/ElectronNET.API/API/Entities/JumpListSettings.cs index 82184ed1..e340be24 100644 --- a/src/ElectronNET.API/API/Entities/JumpListSettings.cs +++ b/src/ElectronNET.API/API/Entities/JumpListSettings.cs @@ -1,20 +1,24 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Settings returned by app.getJumpListSettings() on Windows. + /// Matches Electron's JumpListSettings object. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class JumpListSettings { /// - /// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the - /// MSDN docs). + /// The minimum number of items that will be shown in the Jump List. /// public int MinItems { get; set; } = 0; /// /// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories - /// in the Jump List. These items must not be re-added to the Jump List in the next call to , Windows will - /// not display any custom category that contains any of the removed items. + /// in the Jump List. These items must not be re-added to the Jump List in the next call to app.setJumpList(categories); + /// Windows will not display any custom category that contains any of the removed items. /// public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0]; } diff --git a/src/ElectronNET.API/API/Entities/LoadURLOptions.cs b/src/ElectronNET.API/API/Entities/LoadURLOptions.cs index f4e14781..e03c6ccb 100644 --- a/src/ElectronNET.API/API/Entities/LoadURLOptions.cs +++ b/src/ElectronNET.API/API/Entities/LoadURLOptions.cs @@ -1,12 +1,14 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for BrowserWindow.loadURL(url, options) / webContents.loadURL(url, options). + /// Matches Electron's loadURL options. /// + /// Up-to-date with Electron API 39.2 public class LoadURLOptions { /// - /// A HTTP Referrer url. + /// An HTTP Referrer URL. In Electron this may be a string or a Referrer object. /// public string HttpReferrer { get; set; } @@ -16,20 +18,18 @@ public class LoadURLOptions public string UserAgent { get; set; } /// - /// Base url (with trailing path separator) for files to be loaded by the data url. - /// This is needed only if the specified url is a data url and needs to load other - /// files. + /// Base URL (with trailing path separator) for files to be loaded by the data URL. + /// Needed only if the specified URL is a data URL and needs to load other files. /// public string BaseURLForDataURL { get; set; } /// - /// Extra headers for the request. + /// Extra headers separated by "\n". /// public string ExtraHeaders { get; set; } /// - /// PostData Object for the request. - /// Can be , or + /// Post data for the request. Matches Electron's postData: (UploadRawData | UploadFile)[] /// public IPostData[] PostData { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs b/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs new file mode 100644 index 00000000..1ad9660e --- /dev/null +++ b/src/ElectronNET.API/API/Entities/LoginItemLaunchItem.cs @@ -0,0 +1,37 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// Windows launch entry as returned by app.getLoginItemSettings().launchItems. + /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] + public class LoginItemLaunchItem + { + /// + /// Name value of a registry entry. + /// + public string Name { get; set; } + + /// + /// The executable to an app that corresponds to a registry entry. + /// + public string Path { get; set; } + + /// + /// The command-line arguments to pass to the executable. + /// + public string[] Args { get; set; } + + /// + /// One of user or machine. Indicates whether the registry entry is under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. + /// + public string Scope { get; set; } + + /// + /// True if the app registry key is startup approved and therefore shows as enabled in Task Manager and Windows settings. + /// + public bool Enabled { get; set; } + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginItemSettings.cs b/src/ElectronNET.API/API/Entities/LoginItemSettings.cs index a744a624..037d3d72 100644 --- a/src/ElectronNET.API/API/Entities/LoginItemSettings.cs +++ b/src/ElectronNET.API/API/Entities/LoginItemSettings.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Return object for app.getLoginItemSettings() on macOS and Windows. /// + /// Up-to-date with Electron API 39.2 public class LoginItemSettings { /// @@ -11,29 +14,52 @@ public class LoginItemSettings public bool OpenAtLogin { get; set; } /// - /// if the app is set to open as hidden at login. This setting is not available + /// if the app is set to open as hidden at login. Deprecated on macOS 13 and up; not available /// on MAS builds. /// + [SupportedOSPlatform("macos")] public bool OpenAsHidden { get; set; } /// /// if the app was opened at login automatically. This setting is not available /// on MAS builds. /// + [SupportedOSPlatform("macos")] public bool WasOpenedAtLogin { get; set; } /// /// if the app was opened as a hidden login item. This indicates that the app should not - /// open any windows at startup. This setting is not available on + /// open any windows at startup. Deprecated on macOS 13 and up; not available on /// MAS builds. /// + [SupportedOSPlatform("macos")] public bool WasOpenedAsHidden { get; set; } /// /// if the app was opened as a login item that should restore the state from the previous /// session. This indicates that the app should restore the windows that were open the last time the app was closed. - /// This setting is not available on MAS builds. + /// Deprecated on macOS 13 and up; not available on MAS builds. /// + [SupportedOSPlatform("macos")] public bool RestoreState { get; set; } + + /// + /// macOS status: one of not-registered, enabled, requires-approval, or not-found. + /// + [SupportedOSPlatform("macos")] + public string Status { get; set; } + + /// + /// Windows: true if app is set to open at login and its run key is not deactivated. + /// Differs from OpenAtLogin as it ignores the args option; this is true if the given executable would be launched at login with any arguments. + /// + [SupportedOSPlatform("windows")] + public bool ExecutableWillLaunchAtLogin { get; set; } + + /// + /// Windows launch entries found in registry. + /// + [SupportedOSPlatform("windows")] + public LoginItemLaunchItem[] LaunchItems { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs b/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs index bd23d453..85e408f2 100644 --- a/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs +++ b/src/ElectronNET.API/API/Entities/LoginItemSettingsOptions.cs @@ -1,4 +1,6 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// @@ -8,11 +10,25 @@ public class LoginItemSettingsOptions /// /// The executable path to compare against. Defaults to process.execPath. /// + [SupportedOSPlatform("windows")] public string Path { get; set; } /// /// The command-line arguments to compare against. Defaults to an empty array. /// + [SupportedOSPlatform("windows")] public string[] Args { get; set; } + + /// + /// The type of service to query on macOS 13+. Defaults to 'mainAppService'. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string Type { get; set; } + + /// + /// The name of the service. Required if type is non-default. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string ServiceName { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/LoginSettings.cs b/src/ElectronNET.API/API/Entities/LoginSettings.cs index 994a9941..05ba0209 100644 --- a/src/ElectronNET.API/API/Entities/LoginSettings.cs +++ b/src/ElectronNET.API/API/Entities/LoginSettings.cs @@ -1,8 +1,11 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Settings object for app.setLoginItemSettings() on macOS and Windows. /// + /// Up-to-date with Electron API 39.2 public class LoginSettings { /// @@ -14,19 +17,46 @@ public class LoginSettings /// /// to open the app as hidden. Defaults to . The user can edit this /// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is - /// opened to know the current value. This setting is not available on MAS builds. + /// opened to know the current value. This setting is not available on MAS builds and does not work on macOS 13 and up. /// + [SupportedOSPlatform("macos")] public bool OpenAsHidden { get; set; } /// /// The executable to launch at login. Defaults to process.execPath. /// + [SupportedOSPlatform("windows")] public string Path { get; set; } /// /// The command-line arguments to pass to the executable. Defaults to an empty /// array.Take care to wrap paths in quotes. /// + [SupportedOSPlatform("windows")] public string[] Args { get; set; } + + /// + /// The type of service to add as a login item. Defaults to 'mainAppService'. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string Type { get; set; } + + /// + /// The name of the service. Required if Type is non-default. Only available on macOS 13 and up. + /// + [SupportedOSPlatform("macos")] + public string ServiceName { get; set; } + + /// + /// Change the startup approved registry key and enable/disable the app in Task Manager and Windows Settings. Defaults to true. + /// + [SupportedOSPlatform("windows")] + public bool Enabled { get; set; } = true; + + /// + /// Value name to write into registry. Defaults to the app's AppUserModelId(). + /// + [SupportedOSPlatform("windows")] + public string Name { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Margins.cs b/src/ElectronNET.API/API/Entities/Margins.cs index b99bb681..e6da4efb 100644 --- a/src/ElectronNET.API/API/Entities/Margins.cs +++ b/src/ElectronNET.API/API/Entities/Margins.cs @@ -1,33 +1,42 @@ namespace ElectronNET.API.Entities; /// -/// +/// Margins object used by webContents.print options and webContents.printToPDF. /// +/// Up-to-date with Electron API 39.2 public class Margins { /// - /// Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, + /// Gets or sets the margin type. Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen, /// you will also need to specify `top`, `bottom`, `left`, and `right`. /// public string MarginType { get; set; } /// - /// The top margin of the printed web page, in pixels. + /// Gets or sets the top margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Top { get; set; } + public double Top { get; set; } /// - /// The bottom margin of the printed web page, in pixels. + /// Gets or sets the bottom margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Bottom { get; set; } + public double Bottom { get; set; } /// - /// The left margin of the printed web page, in pixels. + /// Gets or sets the left margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Left { get; set; } + public double Left { get; set; } /// - /// The right margin of the printed web page, in pixels. + /// Gets or sets the right margin of the printed web page. Units depend on API: + /// - webContents.print: pixels + /// - webContents.printToPDF: inches /// - public int Right { get; set; } + public double Right { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MemoryInfo.cs b/src/ElectronNET.API/API/Entities/MemoryInfo.cs index a7eb0949..d8b11eb3 100644 --- a/src/ElectronNET.API/API/Entities/MemoryInfo.cs +++ b/src/ElectronNET.API/API/Entities/MemoryInfo.cs @@ -1,24 +1,28 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Process memory info as returned by process.getProcessMemoryInfo(). + /// Values are reported in Kilobytes. /// + /// Up-to-date with Electron API 39.2 public class MemoryInfo { /// - /// The amount of memory currently pinned to actual physical RAM. + /// Gets or sets the amount of memory currently pinned to actual physical RAM. /// public int WorkingSetSize { get; set; } /// - /// The maximum amount of memory that has ever been pinned to actual physical RAM. + /// Gets or sets the maximum amount of memory that has ever been pinned to actual physical RAM. /// public int PeakWorkingSetSize { get; set; } /// - /// The amount of memory not shared by other processes, such as JS heap or HTML - /// content. + /// Gets or sets the amount of memory not shared by other processes, such as JS heap or HTML content. Windows only. /// + [SupportedOSPlatform("windows")] public int PrivateBytes { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuItem.cs b/src/ElectronNET.API/API/Entities/MenuItem.cs index b50b9658..13a6e195 100644 --- a/src/ElectronNET.API/API/Entities/MenuItem.cs +++ b/src/ElectronNET.API/API/Entities/MenuItem.cs @@ -1,11 +1,13 @@ using System; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class MenuItem { /// @@ -16,13 +18,12 @@ public class MenuItem public Action Click { get; set; } /// - /// Define the action of the menu item, when specified the click property will be - /// ignored. + /// Gets or sets the action (role) of the menu item. When specified, the click property will be ignored. /// public MenuRole Role { get; set; } /// - /// Can be normal, separator, submenu, checkbox or radio. + /// Gets or sets the menu item type. Can be normal, separator, submenu, checkbox, radio, header (macOS 14+), or palette (macOS 14+). /// public MenuType Type { get; set; } @@ -42,8 +43,15 @@ public class MenuItem /// /// The sublabel. /// + [SupportedOSPlatform("macos")] public string Sublabel { get; set; } + /// + /// Hover text for this menu item (macOS). + /// + [SupportedOSPlatform("macos")] + public string ToolTip { get; set; } + /// /// Gets or sets the accelerator. @@ -63,17 +71,31 @@ public class MenuItem public string Icon { get; set; } /// - /// If false, the menu item will be greyed out and unclickable. + /// Gets or sets a value indicating whether the item is enabled. If false, the menu item will be greyed out and unclickable. /// public bool Enabled { get; set; } = true; /// - /// If false, the menu item will be entirely hidden. + /// Gets or sets a value indicating whether the item is visible. If false, the menu item will be entirely hidden. /// public bool Visible { get; set; } = true; /// - /// Should only be specified for checkbox or radio type menu items. + /// Gets or sets a value indicating whether the accelerator should work when the item is hidden. Default is true (macOS). + /// When false, prevents the accelerator from triggering the item if the item is not visible. + /// + [SupportedOSPlatform("macos")] + public bool? AcceleratorWorksWhenHidden { get; set; } + + /// + /// Gets or sets a value indicating whether the accelerator should be registered with the system or only displayed (Linux/Windows). Defaults to true. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] + public bool? RegisterAccelerator { get; set; } + + /// + /// Gets or sets a value indicating whether the item is checked. Should only be specified for checkbox or radio items. /// public bool Checked { get; set; } @@ -85,15 +107,44 @@ public class MenuItem public MenuItem[] Submenu { get; set; } /// - /// Unique within a single menu. If defined then it can be used as a reference to - /// this item by the position attribute. + /// The item to share when the role is shareMenu (macOS). + /// + [SupportedOSPlatform("macos")] + public SharingItem SharingItem { get; set; } + + /// + /// Gets or sets a unique id within a single menu. If defined then it can be used as a reference for placement. /// public string Id { get; internal set; } /// - /// This field allows fine-grained definition of the specific location within a - /// given menu. + /// This field allows fine-grained definition of the specific location within a given menu. /// public string Position { get; set; } + + /// + /// Gets or sets a list of item ids. Inserts this item before the item(s) with the specified id(s). + /// If the referenced item doesn't exist the item will be inserted at the end of the menu. + /// Also implies that this item should be placed in the same group as the referenced item(s). + /// + public string[] Before { get; set; } + + /// + /// Gets or sets a list of item ids. Inserts this item after the item(s) with the specified id(s). + /// If the referenced item doesn't exist the item will be inserted at the end of the menu. + /// + public string[] After { get; set; } + + /// + /// Gets or sets a list of item ids. Places this item's containing group before the containing group + /// of the item(s) with the specified id(s). + /// + public string[] BeforeGroupContaining { get; set; } + + /// + /// Gets or sets a list of item ids. Places this item's containing group after the containing group + /// of the item(s) with the specified id(s). + /// + public string[] AfterGroupContaining { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuRole.cs b/src/ElectronNET.API/API/Entities/MenuRole.cs index 37f10090..e2eed341 100644 --- a/src/ElectronNET.API/API/Entities/MenuRole.cs +++ b/src/ElectronNET.API/API/Entities/MenuRole.cs @@ -31,14 +31,14 @@ public enum MenuRole paste, /// - /// The pasteandmatchstyle + /// The pasteAndMatchStyle /// - pasteandmatchstyle, + pasteAndMatchStyle, /// - /// The selectall + /// The selectAll /// - selectall, + selectAll, /// /// The delete @@ -68,12 +68,12 @@ public enum MenuRole /// /// Reload the current window ignoring the cache. /// - forcereload, + forceReload, /// /// Toggle developer tools in the current window /// - toggledevtools, + toggleDevTools, /// /// Toggle full screen mode on the current window @@ -83,17 +83,17 @@ public enum MenuRole /// /// Reset the focused page’s zoom level to the original size /// - resetzoom, + resetZoom, /// /// Zoom in the focused page by 10% /// - zoomin, + zoomIn, /// /// Zoom out the focused page by 10% /// - zoomout, + zoomOut, /// /// Whole default “Edit” menu (Undo, Copy, etc.) @@ -118,7 +118,7 @@ public enum MenuRole /// /// Only macOS: Map to the hideOtherApplications action /// - hideothers, + hideOthers, /// /// Only macOS: Map to the unhideAllApplications action @@ -128,12 +128,12 @@ public enum MenuRole /// /// Only macOS: Map to the startSpeaking action /// - startspeaking, + startSpeaking, /// /// Only macOS: Map to the stopSpeaking action /// - stopspeaking, + stopSpeaking, /// /// Only macOS: Map to the arrangeInFront action @@ -158,6 +158,108 @@ public enum MenuRole /// /// Only macOS: The submenu is a “Services” menu /// - services + services, + + /// + /// Toggle built-in spellchecker. + /// + toggleSpellChecker, + + /// + /// The submenu is a "File" menu. + /// + fileMenu, + + /// + /// The submenu is a "View" menu. + /// + viewMenu, + + /// + /// The application menu. + /// + appMenu, + + /// + /// The submenu is a "Share" menu. + /// + shareMenu, + + /// + /// Displays a list of files recently opened by the app. + /// + recentDocuments, + + /// + /// Clear the recent documents list. + /// + clearRecentDocuments, + + /// + /// Toggle the tab bar (macOS). + /// + toggleTabBar, + + /// + /// Select the next tab (macOS). + /// + selectNextTab, + + /// + /// Select the previous tab (macOS). + /// + selectPreviousTab, + + /// + /// Show all tabs (macOS). + /// + showAllTabs, + + /// + /// Merge all windows (macOS). + /// + mergeAllWindows, + + /// + /// Move the current tab to a new window (macOS). + /// + moveTabToNewWindow, + + /// + /// Show substitutions panel (macOS). + /// + showSubstitutions, + + /// + /// Toggle smart quotes (macOS). + /// + toggleSmartQuotes, + + /// + /// Toggle smart dashes (macOS). + /// + toggleSmartDashes, + + /// + /// Toggle text replacement (macOS). + /// + toggleTextReplacement, + + // Backwards-compatibility aliases (old identifiers) to avoid breaking existing code. + // These map to the same enum values as their official values. + pasteandmatchstyle = pasteAndMatchStyle, + selectall = selectAll, + forcereload = forceReload, + toggledevtools = toggleDevTools, + resetzoom = resetZoom, + zoomin = zoomIn, + zoomout = zoomOut, + hideothers = hideOthers, + startspeaking = startSpeaking, + stopspeaking = stopSpeaking, + togglespellchecker = toggleSpellChecker, + togglesmartquotes = toggleSmartQuotes, + togglesmartdashes = toggleSmartDashes, + toggletextreplacement = toggleTextReplacement } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MenuType.cs b/src/ElectronNET.API/API/Entities/MenuType.cs index 9da110cd..86682818 100644 --- a/src/ElectronNET.API/API/Entities/MenuType.cs +++ b/src/ElectronNET.API/API/Entities/MenuType.cs @@ -1,33 +1,48 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Menu item types matching Electron's MenuItem.type values. /// + /// Up-to-date with Electron API 39.2 public enum MenuType { /// - /// The normal + /// Normal menu item. /// normal, /// - /// The separator + /// Separator between items. /// separator, /// - /// The submenu + /// Submenu container. /// submenu, /// - /// The checkbox + /// Checkbox item. /// checkbox, /// - /// The radio + /// Radio item. + /// + radio, + + /// + /// Header item (macOS 14+). + /// + [SupportedOSPlatform("macos")] + header, + + /// + /// Palette item (macOS 14+). /// - radio + [SupportedOSPlatform("macos")] + palette } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs b/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs index b4f7e09d..09ce56a7 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxOptions.cs @@ -1,88 +1,82 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Options for dialog.showMessageBox / dialog.showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public class MessageBoxOptions { /// - /// Can be "none", "info", "error", "question" or "warning". On Windows, "question" - /// displays the same icon as "info", unless you set an icon using the "icon" - /// option. On macOS, both "warning" and "error" display the same warning icon. + /// Gets or sets the type. Can be "none", "info", "error", "question" or "warning". On Windows, "question" displays the same icon as "info", unless you set an icon using the "icon" option. On macOS, both "warning" and "error" display the same warning icon. /// public MessageBoxType Type { get; set; } /// - /// Array of texts for buttons. On Windows, an empty array will result in one button - /// labeled "OK". + /// Gets or sets the array of texts for buttons. On Windows, an empty array will result in one button labeled "OK". /// public string[] Buttons { get; set; } /// - /// Index of the button in the buttons array which will be selected by default when - /// the message box opens. + /// Gets or sets the index of the button in the buttons array which will be selected by default when the message box opens. /// public int DefaultId { get; set; } /// - /// Title of the message box, some platforms will not show it. + /// Gets or sets the title of the message box; some platforms will not show it. /// public string Title { get; set; } /// - /// Content of the message box. + /// Gets or sets the content of the message box. /// public string Message { get; set; } /// - /// Extra information of the message. + /// Gets or sets the extra information of the message. /// public string Detail { get; set; } /// - /// If provided, the message box will include a checkbox with the given label. The - /// checkbox state can be inspected only when using callback. + /// Gets or sets the checkbox label. If provided, the message box will include a checkbox with the given label. /// public string CheckboxLabel { get; set; } /// - /// Initial checked state of the checkbox. false by default. + /// Gets or sets the initial checked state of the checkbox. Defaults to false. /// public bool CheckboxChecked { get; set; } /// - /// Gets or sets the icon. + /// Gets or sets the icon for the message box. /// - /// - /// The icon. - /// public string Icon { get; set; } /// - /// The index of the button to be used to cancel the dialog, via the Esc key. By - /// default this is assigned to the first button with "cancel" or "no" as the label. - /// If no such labeled buttons exist and this option is not set, 0 will be used as - /// the return value or callback response. This option is ignored on Windows. + /// Gets or sets the custom width of the text in the message box. + /// + [SupportedOSPlatform("macos")] + public int? TextWidth { get; set; } + + /// + /// Gets or sets the index of the button to be used to cancel the dialog via the Esc key. By default this is assigned to the first button with "cancel" or "no" as the label. If no such labeled buttons exist and this option is not set, 0 will be used. /// public int CancelId { get; set; } /// - /// On Windows Electron will try to figure out which one of the buttons are common - /// buttons(like "Cancel" or "Yes"), and show the others as command links in the - /// dialog.This can make the dialog appear in the style of modern Windows apps. If - /// you don't like this behavior, you can set noLink to true. + /// Gets or sets a value indicating whether to disable Windows command-links behavior (noLink). + /// On Windows Electron will try to figure out which one of the buttons are common buttons (like "Cancel" or "Yes"), and show the others as command links in the dialog. Set to true to disable this behavior. /// + [SupportedOSPlatform("windows")] public bool NoLink { get; set; } /// - /// Normalize the keyboard access keys across platforms. Default is false. Enabling - /// this assumes AND character is used in the button labels for the placement of the keyboard + /// Gets or sets a value indicating whether to normalize the keyboard access keys across platforms. Default is false. Enabling this assumes '&' is used in the button labels for the placement of the keyboard /// shortcut access key and labels will be converted so they work correctly on each - /// platform, AND characters are removed on macOS, converted to _ on Linux, and left - /// untouched on Windows.For example, a button label of VieANDw will be converted to - /// Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and + /// platform, '&' characters are removed on macOS, converted to '_' on Linux, and left + /// untouched on Windows. For example, a button label of "View" will be converted to "Vie_w" on Linux and "View" on macOS and can be selected via Alt-W on Windows and /// Linux. /// public bool NormalizeAccessKeys { get; set; } diff --git a/src/ElectronNET.API/API/Entities/MessageBoxResult.cs b/src/ElectronNET.API/API/Entities/MessageBoxResult.cs index 1894c09c..dd44c24a 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxResult.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxResult.cs @@ -1,24 +1,19 @@ namespace ElectronNET.API.Entities { /// - /// + /// Result returned by dialog.showMessageBox / dialog.showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public class MessageBoxResult { /// - /// Gets or sets the response. + /// The index of the clicked button. /// - /// - /// The response. - /// public int Response { get; set; } /// - /// Gets or sets a value indicating whether [checkbox checked]. + /// The checked state of the checkbox if CheckboxLabel was set; otherwise false. /// - /// - /// true if [checkbox checked]; otherwise, false. - /// public bool CheckboxChecked { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/MessageBoxType.cs b/src/ElectronNET.API/API/Entities/MessageBoxType.cs index 09fb3b0b..3490bad9 100644 --- a/src/ElectronNET.API/API/Entities/MessageBoxType.cs +++ b/src/ElectronNET.API/API/Entities/MessageBoxType.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Message box type for dialog.showMessageBox/showMessageBoxSync. /// + /// Up-to-date with Electron API 39.2 public enum MessageBoxType { /// diff --git a/src/ElectronNET.API/API/Entities/ModifierType.cs b/src/ElectronNET.API/API/Entities/ModifierType.cs index d7b37458..664d40f5 100644 --- a/src/ElectronNET.API/API/Entities/ModifierType.cs +++ b/src/ElectronNET.API/API/Entities/ModifierType.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities; /// -/// Specifies the possible modifier keys for a keyboard input. +/// Specifies the possible modifier keys for a keyboard input (maps to InputEvent.modifiers). /// +/// Up-to-date with Electron API 39.2 public enum ModifierType { /// diff --git a/src/ElectronNET.API/API/Entities/NativeImage.cs b/src/ElectronNET.API/API/Entities/NativeImage.cs index bf087919..e974d41a 100644 --- a/src/ElectronNET.API/API/Entities/NativeImage.cs +++ b/src/ElectronNET.API/API/Entities/NativeImage.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text.Json.Serialization; using System.Text.RegularExpressions; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -268,6 +269,12 @@ public bool IsEmpty() /// public bool IsTemplateImage => _isTemplateImage; + /// + /// Whether the image is considered a macOS template image. + /// + [SupportedOSPlatform("macos")] + public bool IsMacTemplateImage => _isTemplateImage; + /// /// Deprecated. Marks the image as a template image. /// diff --git a/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs b/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs index dddcbccc..140e6d1c 100644 --- a/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs +++ b/src/ElectronNET.API/API/Entities/NativeImageJsonConverter.cs @@ -8,6 +8,7 @@ namespace ElectronNET.API.Entities { + /// Project-specific: JSON converter for NativeImage; no MCP structure equivalent. internal class NativeImageJsonConverter : JsonConverter { public override void Write(Utf8JsonWriter writer, NativeImage value, JsonSerializerOptions options) diff --git a/src/ElectronNET.API/API/Entities/NotificationAction.cs b/src/ElectronNET.API/API/Entities/NotificationAction.cs index c7194cd0..71e681cf 100644 --- a/src/ElectronNET.API/API/Entities/NotificationAction.cs +++ b/src/ElectronNET.API/API/Entities/NotificationAction.cs @@ -1,17 +1,21 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] public class NotificationAction { /// - /// The label for the given action. + /// Gets or sets the label for the action. /// public string Text { get; set; } /// - /// The type of action, can be button. + /// Gets or sets the type of action; can be 'button'. /// public string Type { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/NotificationOptions.cs b/src/ElectronNET.API/API/Entities/NotificationOptions.cs index 4093f523..cd17dfac 100644 --- a/src/ElectronNET.API/API/Entities/NotificationOptions.cs +++ b/src/ElectronNET.API/API/Entities/NotificationOptions.cs @@ -7,75 +7,85 @@ namespace ElectronNET.API.Entities /// /// /// + /// Up-to-date with Electron API 39.2 public class NotificationOptions { /// - /// A title for the notification, which will be shown at the top of the notification - /// window when it is shown. + /// Gets or sets the title for the notification, which will be shown at the top of the notification window when it is shown. /// public string Title { get; set; } /// - /// A subtitle for the notification, which will be displayed below the title. + /// Gets or sets the subtitle for the notification, which will be displayed below the title. /// - public string SubTitle { get; set; } + [SupportedOSPlatform("macos")] + [JsonPropertyName("subtitle")] + public string Subtitle { get; set; } /// - /// The body text of the notification, which will be displayed below the title or - /// subtitle. + /// Gets or sets the body text of the notification, which will be displayed below the title or subtitle. /// public string Body { get; set; } /// - /// Whether or not to emit an OS notification noise when showing the notification. + /// Gets or sets a value indicating whether to suppress the OS notification noise when showing the notification. /// public bool Silent { get; set; } /// - /// An icon to use in the notification. + /// Gets or sets an icon to use in the notification. Can be a string path or a NativeImage. If a string is passed, it must be a valid path to a local icon file. /// public string Icon { get; set; } /// - /// Whether or not to add an inline reply option to the notification. + /// Gets or sets a value indicating whether to add an inline reply option to the notification. /// + [SupportedOSPlatform("macos")] public bool HasReply { get; set; } /// - /// The timeout duration of the notification. Can be 'default' or 'never'. + /// Gets or sets the timeout duration of the notification. Can be 'default' or 'never'. /// - [SupportedOSPlatform("Linux")] - [SupportedOSPlatform("Windows")] + [SupportedOSPlatform("linux")] + [SupportedOSPlatform("windows")] public string TimeoutType { get; set; } /// - /// The placeholder to write in the inline reply input field. + /// Gets or sets the placeholder to write in the inline reply input field. /// + [SupportedOSPlatform("macos")] public string ReplyPlaceholder { get; set; } /// - /// The name of the sound file to play when the notification is shown. + /// Gets or sets the name of the sound file to play when the notification is shown. /// + [SupportedOSPlatform("macos")] public string Sound { get; set; } /// - /// The urgency level of the notification. Can be 'normal', 'critical', or 'low'. + /// Gets or sets the urgency level of the notification. Can be 'normal', 'critical', or 'low'. /// - [SupportedOSPlatform("Linux")] + [SupportedOSPlatform("linux")] public string Urgency { get; set; } /// - /// Actions to add to the notification. Please read the available actions and - /// limitations in the NotificationAction documentation. + /// Gets or sets the actions to add to the notification. Please read the available actions and limitations in the NotificationAction documentation. /// - public NotificationAction Actions { get; set; } + [SupportedOSPlatform("macos")] + public NotificationAction[] Actions { get; set; } /// - /// A custom title for the close button of an alert. An empty string will cause the - /// default localized text to be used. + /// Gets or sets a custom title for the close button of an alert. An empty string will cause the default localized text to be used. /// + [SupportedOSPlatform("macos")] public string CloseButtonText { get; set; } + /// + /// Gets or sets a custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification. + /// + [SupportedOSPlatform("windows")] + public string ToastXml { get; set; } + /// /// Emitted when the notification is shown to the user, note this could be fired /// multiple times as a notification can be shown multiple times through the Show() @@ -131,7 +141,7 @@ public class NotificationOptions /// The string the user entered into the inline reply field /// [JsonIgnore] - [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("macos")] public Action OnReply { get; set; } /// @@ -144,11 +154,11 @@ public class NotificationOptions internal string ReplyID { get; set; } /// - /// macOS only - The index of the action that was activated + /// macOS only - The index of the action that was activated. /// [JsonIgnore] - [SupportedOSPlatform("macOS")] - public Action OnAction { get; set; } + [SupportedOSPlatform("macos")] + public Action OnAction { get; set; } /// /// Gets or sets the action identifier. @@ -159,6 +169,14 @@ public class NotificationOptions [JsonInclude] internal string ActionID { get; set; } + /// + /// Windows only: Emitted when an error is encountered while creating and showing the native notification. + /// Corresponds to the 'failed' event on Notification. + /// + [JsonIgnore] + [SupportedOSPlatform("windows")] + public Action OnFailed { get; set; } + /// /// Initializes a new instance of the class. /// @@ -170,4 +188,4 @@ public NotificationOptions(string title, string body) Body = body; } } -} +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs b/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs index 2a57182f..d6fdcc3f 100644 --- a/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs +++ b/src/ElectronNET.API/API/Entities/OnDidFailLoadInfo.cs @@ -15,4 +15,24 @@ public class OnDidFailLoadInfo /// Validated URL. /// public string ValidatedUrl { get; set; } + + /// + /// Error description string. + /// + public string ErrorDescription { get; set; } + + /// + /// True if the event pertains to the main frame. + /// + public bool IsMainFrame { get; set; } + + /// + /// The process id for the frame. + /// + public int FrameProcessId { get; set; } + + /// + /// The routing id for the frame. + /// + public int FrameRoutingId { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs b/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs index 52c2b149..6094ca51 100644 --- a/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs +++ b/src/ElectronNET.API/API/Entities/OnDidNavigateInfo.cs @@ -1,17 +1,23 @@ namespace ElectronNET.API.Entities; /// -/// 'OnDidNavigate' event details. +/// 'did-navigate' event details for main frame navigation. /// +/// Up-to-date with Electron API 39.2 public class OnDidNavigateInfo { /// - /// Navigated URL. + /// The URL navigated to. /// public string Url { get; set; } /// - /// HTTP response code. + /// HTTP response code (-1 for non-HTTP navigations). /// public int HttpResponseCode { get; set; } + + /// + /// HTTP status text (empty for non-HTTP navigations). + /// + public string HttpStatusText { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OnTopLevel.cs b/src/ElectronNET.API/API/Entities/OnTopLevel.cs index f2a125c3..0165f53b 100644 --- a/src/ElectronNET.API/API/Entities/OnTopLevel.cs +++ b/src/ElectronNET.API/API/Entities/OnTopLevel.cs @@ -1,10 +1,14 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// String values for the 'level' parameter of BrowserWindow.setAlwaysOnTop. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("Windows")] public enum OnTopLevel { /// diff --git a/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs b/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs index b94da91f..6bea1d80 100644 --- a/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenDevToolsOptions.cs @@ -8,10 +8,19 @@ namespace ElectronNET.API.Entities public class OpenDevToolsOptions { /// - /// Opens the devtools with specified dock state, can be right, bottom, undocked, - /// detach.Defaults to last used dock state.In undocked mode it's possible to dock - /// back.In detach mode it's not. + /// Opens the DevTools with specified dock state. Can be left, right, bottom, undocked, or detach. + /// Defaults to the last used dock state. In undocked mode it's possible to dock back; in detach mode it's not. /// public DevToolsMode Mode { get; set; } + + /// + /// Whether to bring the opened DevTools window to the foreground. Default is true. + /// + public bool Activate { get; set; } = true; + + /// + /// A title for the DevTools window (only visible in undocked or detach mode). + /// + public string Title { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs b/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs index 26cd6ecc..1e6899ce 100644 --- a/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenDialogOptions.cs @@ -2,9 +2,12 @@ namespace ElectronNET.API.Entities { + using System.Runtime.Versioning; + /// /// /// + /// Up-to-date with Electron API 39.2 public class OpenDialogOptions { /// @@ -29,18 +32,19 @@ public class OpenDialogOptions public string ButtonLabel { get; set; } /// - /// Contains which features the dialog should use. The following values are supported: + /// Gets or sets which features the dialog should use. The following values are supported: /// 'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' /// public OpenDialogProperty[] Properties { get; set; } /// - /// Message to display above input boxes. + /// Gets or sets the message to display above input boxes. /// + [SupportedOSPlatform("macos")] public string Message { get; set; } /// - /// The filters specifies an array of file types that can be displayed or + /// Gets or sets the filters specifying an array of file types that can be displayed or /// selected when you want to limit the user to a specific type. For example: /// /// @@ -55,5 +59,11 @@ public class OpenDialogOptions /// /// public FileFilter[] Filters { get; set; } + + /// + /// Create security scoped bookmarks when packaged for the Mac App Store. + /// + [SupportedOSPlatform("macos")] + public bool SecurityScopedBookmarks { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs b/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs index 44a16b15..42ecd037 100644 --- a/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs +++ b/src/ElectronNET.API/API/Entities/OpenDialogProperty.cs @@ -1,5 +1,7 @@ namespace ElectronNET.API.Entities { + using System.Runtime.Versioning; + /// /// /// @@ -28,21 +30,31 @@ public enum OpenDialogProperty /// /// The create directory /// + [SupportedOSPlatform("macos")] createDirectory, /// /// The prompt to create /// + [SupportedOSPlatform("windows")] promptToCreate, /// /// The no resolve aliases /// + [SupportedOSPlatform("macos")] noResolveAliases, /// /// The treat package as directory /// - treatPackageAsDirectory + [SupportedOSPlatform("macos")] + treatPackageAsDirectory, + + /// + /// Do not add the item being opened to the recent documents list (Windows). + /// + [SupportedOSPlatform("windows")] + dontAddToRecent } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs b/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs index f648cd19..1d3f3f5b 100644 --- a/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs +++ b/src/ElectronNET.API/API/Entities/OpenExternalOptions.cs @@ -1,21 +1,32 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Controls the behavior of OpenExternal. /// + /// Up-to-date with Electron API 39.2 public class OpenExternalOptions { /// - /// to bring the opened application to the foreground. The default is . + /// Gets or sets whether to bring the opened application to the foreground. The default is . /// + [SupportedOSPlatform("macos")] [DefaultValue(true)] public bool Activate { get; set; } = true; /// - /// The working directory. + /// Gets or sets the working directory. /// + [SupportedOSPlatform("windows")] public string WorkingDirectory { get; set; } + + /// + /// Gets or sets a value indicating a user-initiated launch that enables tracking of frequently used programs and other behaviors. The default is . + /// + [SupportedOSPlatform("windows")] + [DefaultValue(false)] + public bool LogUsage { get; set; } = false; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PageSize.cs b/src/ElectronNET.API/API/Entities/PageSize.cs index 42562256..4b83e15e 100644 --- a/src/ElectronNET.API/API/Entities/PageSize.cs +++ b/src/ElectronNET.API/API/Entities/PageSize.cs @@ -4,17 +4,35 @@ public class PageSize { private readonly string _value; + /// + /// Represents the page size for printing/PDF. + /// Matches Electron semantics: either a named size (e.g. 'A4', 'Letter', 'Legal', 'Tabloid', 'Ledger', etc.) + /// or a custom size specified by Height and Width in inches. + /// + /// Up-to-date with Electron API 39.2 public PageSize() { } private PageSize(string value) : this() => _value = value; + /// + /// Gets or sets the custom page height in inches (when using object form instead of a named size). + /// public double Height { get; set; } + /// + /// Gets or sets the custom page width in inches (when using object form instead of a named size). + /// public double Width { get; set; } + /// + /// Implicit conversion to string to represent named page sizes (e.g. 'A4', 'Letter'). + /// public static implicit operator string(PageSize pageSize) => pageSize?._value; + /// + /// Implicit conversion from string to represent named page sizes (e.g. 'A4', 'Letter'). + /// public static implicit operator PageSize(string value) => new(value); } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PathName.cs b/src/ElectronNET.API/API/Entities/PathName.cs index e83ba8b0..6fe8ab89 100644 --- a/src/ElectronNET.API/API/Entities/PathName.cs +++ b/src/ElectronNET.API/API/Entities/PathName.cs @@ -1,95 +1,102 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// Defines the PathName enumeration. + /// Names for app.getPath(name). Aligned with Electron docs. /// + /// Up-to-date with Electron API 39.2 public enum PathName { /// - /// User’s home directory. + /// User's home directory. /// - [Description("home")] Home, /// /// Per-user application data directory. /// - [Description("appData")] AppData, /// - /// The directory for storing your app’s configuration files, - /// which by default it is the appData directory appended with your app’s name. + /// The directory for storing your app's configuration files, which by default is the appData directory appended with your app's name. /// - [Description("userData")] UserData, + /// + /// The directory for storing data generated by Session, such as localStorage, cookies, disk cache, downloaded dictionaries, network state, devtools files. + /// By default this points to userData. + /// + SessionData, + /// /// Temporary directory. /// - [Description("temp")] Temp, /// /// The current executable file. /// - [Description("exe")] Exe, /// - /// The libchromiumcontent library. + /// The location of the Chromium module. By default this is synonymous with exe. /// - [Description("Module")] Module, /// - /// The current user’s Desktop directory. + /// The current user's Desktop directory. /// - [Description("desktop")] Desktop, /// - /// Directory for a user’s “My Documents”. + /// Directory for a user's "My Documents". /// - [Description("documents")] Documents, /// - /// Directory for a user’s downloads. + /// Directory for a user's downloads. /// - [Description("downloads")] Downloads, /// - /// Directory for a user’s music. + /// Directory for a user's music. /// - [Description("music")] Music, /// - /// Directory for a user’s pictures. + /// Directory for a user's pictures. /// - [Description("pictures")] Pictures, /// - /// Directory for a user’s videos. + /// Directory for a user's videos. /// - [Description("videos")] Videos, /// - /// The logs. + /// Directory for the user's recent files. Windows only. + /// + [SupportedOSPlatform("windows")] + Recent, + + /// + /// Directory for your app's log folder. /// - [Description("logs")] Logs, /// - /// Full path to the system version of the Pepper Flash plugin. + /// Directory where crash dumps are stored. + /// + CrashDumps, + + /// + /// The directory where app assets such as resources.pak are stored. + /// Available on Windows and Linux only. /// - [Description("PepperFlashSystemPlugin")] - PepperFlashSystemPlugin + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] + Assets } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Point.cs b/src/ElectronNET.API/API/Entities/Point.cs index 9b3bed8a..c88f6db4 100644 --- a/src/ElectronNET.API/API/Entities/Point.cs +++ b/src/ElectronNET.API/API/Entities/Point.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Point { /// diff --git a/src/ElectronNET.API/API/Entities/PrintOptions.cs b/src/ElectronNET.API/API/Entities/PrintOptions.cs index bb3f6188..d0070ffb 100644 --- a/src/ElectronNET.API/API/Entities/PrintOptions.cs +++ b/src/ElectronNET.API/API/Entities/PrintOptions.cs @@ -3,15 +3,16 @@ namespace ElectronNET.API.Entities /// /// Print dpi /// + /// Up-to-date with Electron API 39.2 public class PrintDpi { /// - /// The horizontal dpi + /// Gets or sets the horizontal DPI. /// public float Horizontal { get; set; } /// - /// The vertical dpi + /// Gets or sets the vertical DPI. /// public float Vertical { get; set; } } @@ -19,15 +20,16 @@ public class PrintDpi /// /// The page range to print /// + /// Up-to-date with Electron API 39.2 public class PrintPageRange { /// - /// From + /// Gets or sets the starting page index (0-based). /// public int From { get; set; } /// - /// To + /// Gets or sets the ending page index (inclusive, 0-based). /// public int To { get; set; } } @@ -35,72 +37,89 @@ public class PrintPageRange /// /// Print options /// + /// Up-to-date with Electron API 39.2 public class PrintOptions { /// - /// Don't ask user for print settings + /// Gets or sets a value indicating whether to suppress print settings prompts. /// public bool Silent { get; set; } /// - /// Prints the background color and image of the web page + /// Gets or sets a value indicating whether to print background graphics. /// public bool PrintBackground { get; set; } /// - /// Set the printer device name to use + /// Gets or sets the printer device name to use. /// public string DeviceName { get; set; } /// - /// Set whether the printed web page will be in color or grayscale + /// Gets or sets a value indicating whether the page will be printed in color. /// public bool Color { get; set; } /// - /// Specifies the type of margins to use. Uses 0 for default margin, 1 for no - /// margin, and 2 for minimum margin. + /// Gets or sets the margins for the print job. Use MarginType plus top/bottom/left/right for custom. + /// Units for margins with webContents.print are pixels (per MCP); for webContents.printToPDF, inches. /// - public int MarginsType { get; set; } + public Margins Margins { get; set; } /// - /// true for landscape, false for portrait. + /// Gets or sets a value indicating whether to print in landscape orientation. /// public bool Landscape { get; set; } /// - /// The scale factor of the web page + /// Gets or sets the scale factor of the web page. /// public float ScaleFactor { get; set; } /// - /// The number of pages to print per page sheet + /// Gets or sets the number of pages to print per sheet. /// public int PagesPerSheet { get; set; } /// - /// The number of copies of the web page to print + /// Gets or sets the number of copies to print. /// - public bool Copies { get; set; } + public int Copies { get; set; } /// - /// Whether the web page should be collated + /// Gets or sets a value indicating whether pages should be collated. /// public bool Collate { get; set; } /// - /// The page range to print + /// Gets or sets the page range(s) to print. On macOS, only one range is honored. /// - public PrintPageRange PageRanges { get; set; } + public PrintPageRange[] PageRanges { get; set; } /// - /// Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge. + /// Gets or sets the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge. /// public string DuplexMode { get; set; } /// - /// Dpi + /// Gets or sets the DPI settings for the print job. /// public PrintDpi Dpi { get; set; } + + /// + /// Gets or sets the string to be printed as page header. + /// + public string Header { get; set; } + + /// + /// Gets or sets the string to be printed as page footer. + /// + public string Footer { get; set; } + + /// + /// Gets or sets the page size of the printed document. Can be A0–A6, Legal, Letter, Tabloid, + /// or an object. For webContents.print, custom sizes use microns (Chromium validates width_microns/height_microns). + /// + public PageSize PageSize { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs b/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs index 714bca0b..1200274b 100644 --- a/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs +++ b/src/ElectronNET.API/API/Entities/PrintToPDFOptions.cs @@ -6,30 +6,31 @@ namespace ElectronNET.API.Entities; /// /// /// +/// Up-to-date with Electron API 39.2 public class PrintToPDFOptions { /// - /// Paper orientation. `true` for landscape, `false` for portrait. Defaults to false. + /// Gets or sets the paper orientation. `true` for landscape, `false` for portrait. Defaults to false. /// public bool Landscape { get; set; } = false; /// - /// Whether to display header and footer. Defaults to false. + /// Gets or sets whether to display header and footer. Defaults to false. /// public bool DisplayHeaderFooter { get; set; } = false; /// - /// Whether to print background graphics. Defaults to false. + /// Gets or sets whether to print background graphics. Defaults to false. /// public bool PrintBackground { get; set; } = false; /// - /// Scale of the webpage rendering. Defaults to 1. + /// Gets or sets the scale of the webpage rendering. Defaults to 1. /// public double Scale { get; set; } = 1; /// - /// Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`, + /// Gets or sets the page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`, /// `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing /// `height` and `width` in inches. Defaults to `Letter`. /// @@ -37,13 +38,13 @@ public class PrintToPDFOptions public PageSize PageSize { get; set; } = "Letter"; /// - /// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, + /// Gets or sets the paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, /// which means print all pages. /// public string PageRanges { get; set; } = ""; /// - /// HTML template for the print header. Should be valid HTML markup with following + /// Gets or sets the HTML template for the print header. Should be valid HTML markup with following /// classes used to inject printing values into them: `date` (formatted print date), /// `title` (document title), `url` (document location), `pageNumber` (current page /// number) and `totalPages` (total pages in the document). For example, `` @@ -52,16 +53,28 @@ public class PrintToPDFOptions public string HeaderTemplate { get; set; } /// - /// HTML template for the print footer. Should use the same format as the + /// Gets or sets the HTML template for the print footer. Should use the same format as the /// `headerTemplate`. /// public string FooterTemplate { get; set; } /// - /// Whether or not to prefer page size as defined by css. Defaults to false, in + /// Gets or sets whether to prefer page size as defined by css. Defaults to false, in /// which case the content will be scaled to fit the paper size. /// public bool PreferCSSPageSize { get; set; } = false; + /// + /// Gets or sets whether to generate a tagged (accessible) PDF. Defaults to false. + /// Experimental per Electron docs; the generated PDF may not adhere fully to PDF/UA and WCAG standards. + /// + public bool GenerateTaggedPDF { get; set; } = false; + + /// + /// Gets or sets whether to generate a PDF document outline from content headers. Defaults to false. + /// Experimental per Electron docs. + /// + public bool GenerateDocumentOutline { get; set; } = false; + public Margins Margins { get; set; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/PrinterInfo.cs b/src/ElectronNET.API/API/Entities/PrinterInfo.cs index 88b2f44a..f612eeb0 100644 --- a/src/ElectronNET.API/API/Entities/PrinterInfo.cs +++ b/src/ElectronNET.API/API/Entities/PrinterInfo.cs @@ -1,28 +1,43 @@ +using System.Collections.Generic; + namespace ElectronNET.API.Entities { /// - /// Printer info + /// PrinterInfo structure as returned by webContents.getPrintersAsync(). Fields backed by MCP: name, displayName, description, options. /// + /// Up-to-date with Electron API 39.2 public class PrinterInfo { /// - /// Name + /// Gets or sets the name of the printer as understood by the OS. /// public string Name { get; set; } /// - /// Name + /// Gets or sets the name of the printer as shown in Print Preview. + /// + public string DisplayName { get; set; } + + /// + /// Gets or sets a longer description of the printer's type. /// public string Description { get; set; } /// - /// Status + /// Gets or sets the status code reported by the OS. Semantics are platform-specific. + /// Not MCP-backed: this field is not listed in Electron's PrinterInfo structure. /// public int Status { get; set; } /// - /// Is default + /// Gets or sets a value indicating whether this printer is the system default. + /// Not MCP-backed: this field is not listed in Electron's PrinterInfo structure. /// public bool IsDefault { get; set; } + + /// + /// Gets or sets the platform-specific printer information as an object (keys/values vary by OS). + /// + public Dictionary Options { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProcessMetric.cs b/src/ElectronNET.API/API/Entities/ProcessMetric.cs index 30ef1c34..0bbde730 100644 --- a/src/ElectronNET.API/API/Entities/ProcessMetric.cs +++ b/src/ElectronNET.API/API/Entities/ProcessMetric.cs @@ -1,54 +1,58 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Process metrics information. /// + /// Up-to-date with Electron API 39.2 public class ProcessMetric { /// - /// Process id of the process. + /// Gets or sets the process id of the process. /// public int PId { get; set; } /// - /// Process type (Browser or Tab or GPU etc). + /// Gets or sets the process type. One of: Browser | Tab | Utility | Zygote | Sandbox helper | GPU | Pepper Plugin | Pepper Plugin Broker | Unknown. /// public string Type { get; set; } /// - /// CPU usage of the process. + /// Gets or sets the CPU usage of the process. /// public CPUUsage Cpu { get; set; } /// - /// Creation time for this process in milliseconds since Unix epoch. Can exceed Int32 range and may contain fractional milliseconds. + /// Gets or sets the creation time for this process, represented as the number of milliseconds since the UNIX epoch. Since the pid can be reused after a process dies, use both pid and creationTime to uniquely identify a process. /// public double CreationTime { get; set; } /// - /// Memory information for the process. + /// Gets or sets the memory information for the process. /// public MemoryInfo Memory { get; set; } /// - /// Whether the process is sandboxed on OS level. + /// Gets or sets a value indicating whether the process is sandboxed on OS level. /// + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("windows")] public bool Sandboxed { get; set; } /// - /// One of the following values: - /// untrusted | low | medium | high | unknown + /// Gets or sets the integrity level. One of: untrusted | low | medium | high | unknown. /// + [SupportedOSPlatform("windows")] public string IntegrityLevel { get; set; } /// - /// The name of the process. - /// Examples for utility: Audio Service, Content Decryption Module Service, Network Service, Video Capture, etc. + /// Gets or sets the name of the process. Examples for utility: Audio Service, Content Decryption Module Service, Network Service, Video Capture, etc. /// public string Name { get; set; } /// - /// The non-localized name of the process. + /// Gets or sets the non-localized name of the process. /// public string ServiceName { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/ProcessVersions.cs b/src/ElectronNET.API/API/Entities/ProcessVersions.cs index d7d3c012..11c76e64 100644 --- a/src/ElectronNET.API/API/Entities/ProcessVersions.cs +++ b/src/ElectronNET.API/API/Entities/ProcessVersions.cs @@ -3,6 +3,7 @@ namespace ElectronNET.API.Entities /// /// An object listing the version strings specific to Electron /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). /// Value representing Chrome's version string /// Value representing Electron's version string /// diff --git a/src/ElectronNET.API/API/Entities/ProgressBarMode.cs b/src/ElectronNET.API/API/Entities/ProgressBarMode.cs index b9fed428..260355d8 100644 --- a/src/ElectronNET.API/API/Entities/ProgressBarMode.cs +++ b/src/ElectronNET.API/API/Entities/ProgressBarMode.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Mode for BrowserWindow/BaseWindow setProgressBar on Windows. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum ProgressBarMode { /// diff --git a/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs b/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs index ee01720a..6967f45d 100644 --- a/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs +++ b/src/ElectronNET.API/API/Entities/ProgressBarOptions.cs @@ -1,15 +1,18 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Options for BrowserWindow.setProgressBar(progress, options). /// + /// Up-to-date with Electron API 39.2 public class ProgressBarOptions { /// - /// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'. + /// Mode for the progress bar on Windows. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'. /// - public ProgressBarMode Mode { get; set; } + [SupportedOSPlatform("windows")] + public ProgressBarMode Mode { get; set; } = ProgressBarMode.normal; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProgressInfo.cs b/src/ElectronNET.API/API/Entities/ProgressInfo.cs index 1427cf8c..3055ed0e 100644 --- a/src/ElectronNET.API/API/Entities/ProgressInfo.cs +++ b/src/ElectronNET.API/API/Entities/ProgressInfo.cs @@ -3,31 +3,30 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class ProgressInfo { - /// - /// - /// + /// Gets or sets the progress. public string Progress { get; set; } /// - /// + /// Gets or sets bytes processed per second. /// - public string BytesPerSecond { get; set; } + public long BytesPerSecond { get; set; } /// - /// + /// Gets or sets the percentage completed (0–100). /// - public string Percent { get; set; } + public double Percent { get; set; } /// - /// + /// Gets or sets the total number of bytes to download. /// - public string Total { get; set; } + public long Total { get; set; } /// - /// + /// Gets or sets the number of bytes transferred so far. /// - public string Transferred { get; set; } + public long Transferred { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ProxyConfig.cs b/src/ElectronNET.API/API/Entities/ProxyConfig.cs index c9df6475..529b7449 100644 --- a/src/ElectronNET.API/API/Entities/ProxyConfig.cs +++ b/src/ElectronNET.API/API/Entities/ProxyConfig.cs @@ -1,10 +1,16 @@ namespace ElectronNET.API.Entities { /// - /// + /// Proxy configuration for app.setProxy / session.setProxy. Matches Electron's ProxyConfig structure. /// public class ProxyConfig { + /// + /// The proxy mode. One of: 'direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system'. + /// Defaults to 'pac_script' if 'PacScript' is specified, otherwise defaults to 'fixed_servers'. + /// + public string Mode { get; set; } + /// /// The URL associated with the PAC file. /// diff --git a/src/ElectronNET.API/API/Entities/ReadBookmark.cs b/src/ElectronNET.API/API/Entities/ReadBookmark.cs index fd5b665c..29443e23 100644 --- a/src/ElectronNET.API/API/Entities/ReadBookmark.cs +++ b/src/ElectronNET.API/API/Entities/ReadBookmark.cs @@ -1,8 +1,13 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Result of clipboard.readBookmark(): title and url. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macOS")] + [SupportedOSPlatform("Windows")] public class ReadBookmark { /// diff --git a/src/ElectronNET.API/API/Entities/Rectangle.cs b/src/ElectronNET.API/API/Entities/Rectangle.cs index b0622725..738ba863 100644 --- a/src/ElectronNET.API/API/Entities/Rectangle.cs +++ b/src/ElectronNET.API/API/Entities/Rectangle.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Rectangle { /// diff --git a/src/ElectronNET.API/API/Entities/RelaunchOptions.cs b/src/ElectronNET.API/API/Entities/RelaunchOptions.cs index 5fc8517a..15854788 100644 --- a/src/ElectronNET.API/API/Entities/RelaunchOptions.cs +++ b/src/ElectronNET.API/API/Entities/RelaunchOptions.cs @@ -1,24 +1,19 @@ namespace ElectronNET.API.Entities { /// - /// Controls the behavior of . + /// Options for app.relaunch: optional args array and execPath. /// + /// Up-to-date with Electron API 39.2 public class RelaunchOptions { /// - /// Gets or sets the arguments. + /// Command-line arguments for the relaunched instance. /// - /// - /// The arguments. - /// public string[] Args { get; set; } /// - /// Gets or sets the execute path. + /// Executable path to relaunch instead of the current app. /// - /// - /// The execute path. - /// public string ExecPath { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs b/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs index 6b0c9777..b2a3d19e 100644 --- a/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs +++ b/src/ElectronNET.API/API/Entities/ReleaseNoteInfo.cs @@ -3,15 +3,16 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class ReleaseNoteInfo { /// - /// The version. + /// Gets or sets the version. /// public string Version { get; set; } /// - /// The note. + /// Gets or sets the note text. /// public string Note { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/RemovePassword.cs b/src/ElectronNET.API/API/Entities/RemovePassword.cs index b2afb415..92690e9d 100644 --- a/src/ElectronNET.API/API/Entities/RemovePassword.cs +++ b/src/ElectronNET.API/API/Entities/RemovePassword.cs @@ -5,6 +5,7 @@ namespace ElectronNET.API.Entities /// /// /// + /// Undecidable from MCP: no typed structure for session.clearAuthCache parameters. public class RemovePassword { /// diff --git a/src/ElectronNET.API/API/Entities/ResizeOptions.cs b/src/ElectronNET.API/API/Entities/ResizeOptions.cs index e506cb82..02976541 100644 --- a/src/ElectronNET.API/API/Entities/ResizeOptions.cs +++ b/src/ElectronNET.API/API/Entities/ResizeOptions.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for NativeImage.resize: optional width/height and quality. /// + /// Up-to-date with Electron API 39.2 public class ResizeOptions { /// @@ -16,7 +17,7 @@ public class ResizeOptions public int? Height { get; set; } /// - /// good, better, or best. Default is "best"; + /// 'good', 'better', or 'best'. Default is 'best'. /// public string Quality { get; set; } = "best"; } diff --git a/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs b/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs index 9c549a7f..1772c144 100644 --- a/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs +++ b/src/ElectronNET.API/API/Entities/SaveDialogOptions.cs @@ -1,10 +1,12 @@ using ElectronNET.API.Entities; +using System.Runtime.Versioning; namespace ElectronNET.API { /// - /// + /// Options for dialog.showSaveDialog / dialog.showSaveDialogSync. /// + /// Up-to-date with Electron API 39.2 public class SaveDialogOptions { /// @@ -21,13 +23,18 @@ public class SaveDialogOptions public string DefaultPath { get; set; } /// - /// Custom label for the confirmation button, when left empty the default label will - /// be used. + /// Gets or sets the custom label for the confirmation button; when left empty the default label will be used. /// public string ButtonLabel { get; set; } /// - /// The filters specifies an array of file types that can be displayed or + /// Properties for the save dialog. Supported values: + /// showHiddenFiles | createDirectory (macOS) | treatPackageAsDirectory (macOS) | showOverwriteConfirmation (Linux) | dontAddToRecent (Windows) + /// + public SaveDialogProperty[] Properties { get; set; } + + /// + /// Gets or sets the filters specifying an array of file types that can be displayed or /// selected when you want to limit the user to a specific type. For example: /// /// @@ -44,18 +51,27 @@ public class SaveDialogOptions public FileFilter[] Filters { get; set; } /// - /// Message to display above text fields. + /// Gets or sets the message to display above text fields. /// + [SupportedOSPlatform("macos")] public string Message { get; set; } /// - /// Custom label for the text displayed in front of the filename text field. + /// Gets or sets the custom label for the text displayed in front of the filename text field. /// + [SupportedOSPlatform("macos")] public string NameFieldLabel { get; set; } /// - /// Show the tags input box, defaults to true. + /// Gets or sets a value indicating whether to show the tags input box. Defaults to true. /// + [SupportedOSPlatform("macos")] public bool ShowsTagField { get; set; } + + /// + /// Gets or sets a value indicating whether to create a security scoped bookmark when packaged for the Mac App Store. If enabled and the file doesn't already exist a blank file will be created at the chosen path. + /// + [SupportedOSPlatform("macos")] + public bool SecurityScopedBookmarks { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs b/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs new file mode 100644 index 00000000..633e65e8 --- /dev/null +++ b/src/ElectronNET.API/API/Entities/SaveDialogProperty.cs @@ -0,0 +1,40 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// Properties supported by dialog.showSaveDialog / showSaveDialogSync. + /// + /// Up-to-date with Electron API 39.2 + public enum SaveDialogProperty + { + /// + /// Show hidden files in dialog. + /// + showHiddenFiles, + + /// + /// Allow creating new directories from dialog (macOS). + /// + [SupportedOSPlatform("macos")] + createDirectory, + + /// + /// Treat packages, such as .app folders, as a directory instead of a file (macOS). + /// + [SupportedOSPlatform("macos")] + treatPackageAsDirectory, + + /// + /// Sets whether the user will be presented a confirmation dialog if the user types a file name that already exists (Linux). + /// + [SupportedOSPlatform("linux")] + showOverwriteConfirmation, + + /// + /// Do not add the item being saved to the recent documents list (Windows). + /// + [SupportedOSPlatform("windows")] + dontAddToRecent + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Scheme.cs b/src/ElectronNET.API/API/Entities/Scheme.cs index a1daf100..4eb0b468 100644 --- a/src/ElectronNET.API/API/Entities/Scheme.cs +++ b/src/ElectronNET.API/API/Entities/Scheme.cs @@ -1,8 +1,9 @@ namespace ElectronNET.API.Entities { /// - /// + /// Authentication scheme names used by webContents 'login' authInfo.scheme. /// + /// Undecidable from MCP: no typed enum is defined in docs; kept as project enum to reflect commonly observed values. public enum Scheme { /// diff --git a/src/ElectronNET.API/API/Entities/SemVer.cs b/src/ElectronNET.API/API/Entities/SemVer.cs index abac145a..4e3f8c84 100644 --- a/src/ElectronNET.API/API/Entities/SemVer.cs +++ b/src/ElectronNET.API/API/Entities/SemVer.cs @@ -3,6 +3,7 @@ /// /// /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class SemVer { /// @@ -54,6 +55,7 @@ public class SemVer /// /// /// + /// Project-specific: no matching Electron structure found in MCP docs (electronjs). public class SemVerOptions { /// diff --git a/src/ElectronNET.API/API/Entities/SharingItem.cs b/src/ElectronNET.API/API/Entities/SharingItem.cs new file mode 100644 index 00000000..38bfb107 --- /dev/null +++ b/src/ElectronNET.API/API/Entities/SharingItem.cs @@ -0,0 +1,27 @@ +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities +{ + /// + /// SharingItem for MenuItem role 'shareMenu' (macOS). + /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] + public class SharingItem + { + /// + /// An array of text to share. + /// + public string[] Texts { get; set; } + + /// + /// An array of files to share. + /// + public string[] FilePaths { get; set; } + + /// + /// An array of URLs to share. + /// + public string[] Urls { get; set; } + } +} \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ShortcutDetails.cs b/src/ElectronNET.API/API/Entities/ShortcutDetails.cs index 90235661..01db6715 100644 --- a/src/ElectronNET.API/API/Entities/ShortcutDetails.cs +++ b/src/ElectronNET.API/API/Entities/ShortcutDetails.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// /// Structure of a shortcut. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class ShortcutDetails { /// @@ -36,6 +40,12 @@ public class ShortcutDetails /// public int IconIndex { get; set; } + /// + /// The Application Toast Activator CLSID. Needed for participating in Action Center. + /// + [SupportedOSPlatform("windows")] + public string ToastActivatorClsid { get; set; } + /// /// The target to launch from this shortcut. /// diff --git a/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs b/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs index c2b6d3f9..69ed7751 100644 --- a/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs +++ b/src/ElectronNET.API/API/Entities/ShortcutLinkOperation.cs @@ -1,28 +1,28 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// Defines the ShortcutLinkOperation enumeration. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public enum ShortcutLinkOperation { /// /// Creates a new shortcut, overwriting if necessary. /// - [Description("create")] Create, /// /// Updates specified properties only on an existing shortcut. /// - [Description("update")] Update, /// /// Overwrites an existing shortcut, fails if the shortcut doesn't exist. /// - [Description("replace")] Replace } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/Size.cs b/src/ElectronNET.API/API/Entities/Size.cs index 61bbd122..7dbd771e 100644 --- a/src/ElectronNET.API/API/Entities/Size.cs +++ b/src/ElectronNET.API/API/Entities/Size.cs @@ -3,6 +3,7 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class Size { /// diff --git a/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs b/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs index 53fa23ed..b1f1fda8 100644 --- a/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs +++ b/src/ElectronNET.API/API/Entities/ThemeSourceMode.cs @@ -5,24 +5,22 @@ namespace ElectronNET.API.Entities /// /// Defines the ThemeSourceMode enumeration. /// + /// Up-to-date with Electron API 39.2 public enum ThemeSourceMode { /// /// Operating system default. /// - [Description("system")] System, /// /// Light theme. /// - [Description("light")] Light, /// /// Dark theme. /// - [Description("dark")] Dark } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ThumbarButton.cs b/src/ElectronNET.API/API/Entities/ThumbarButton.cs index af9bcce7..dbfd03b5 100644 --- a/src/ElectronNET.API/API/Entities/ThumbarButton.cs +++ b/src/ElectronNET.API/API/Entities/ThumbarButton.cs @@ -1,11 +1,14 @@ using System; using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Thumbnail toolbar button for Windows taskbar. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public class ThumbarButton { /// diff --git a/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs b/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs index e68ca860..0c4c9c3a 100644 --- a/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs +++ b/src/ElectronNET.API/API/Entities/ThumbarButtonFlag.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Flags for Windows taskbar thumbnail toolbar buttons. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("windows")] public enum ThumbarButtonFlag { /// diff --git a/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs b/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs index 34c8ab87..ae0bb2e0 100644 --- a/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs +++ b/src/ElectronNET.API/API/Entities/TitleBarOverlay.cs @@ -1,5 +1,11 @@ -namespace ElectronNET.API.Entities; +using System.Runtime.Versioning; +namespace ElectronNET.API.Entities; + +/// +/// Configures the window's title bar overlay when using a frameless window. +/// +/// Up-to-date with Electron API 39.2 public class TitleBarOverlay { private readonly bool? _value; @@ -10,13 +16,34 @@ public TitleBarOverlay() private TitleBarOverlay(bool value) : this() => _value = value; + /// + /// Gets or sets the CSS color of the Window Controls Overlay when enabled. + /// OS-specific per MCP: available on Windows and Linux. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public string Color { get; set; } - public double Height { get; set; } - + /// + /// Gets or sets the height of the title bar and Window Controls Overlay in pixels. Default is system height. + /// + public int Height { get; set; } + + /// + /// Gets or sets the CSS color of the symbols on the Window Controls Overlay when enabled. + /// OS-specific per MCP: available on Windows and Linux. + /// + [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public string SymbolColor { get; set; } + /// + /// Allows using a bare boolean for titleBarOverlay in options (true/false). + /// public static implicit operator bool?(TitleBarOverlay titleBarOverlay) => titleBarOverlay?._value; + /// + /// Allows constructing from a bare boolean (true/false) for titleBarOverlay. + /// public static implicit operator TitleBarOverlay(bool value) => new(value); } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/TitleBarStyle.cs b/src/ElectronNET.API/API/Entities/TitleBarStyle.cs index 7d117f30..7bd5f167 100644 --- a/src/ElectronNET.API/API/Entities/TitleBarStyle.cs +++ b/src/ElectronNET.API/API/Entities/TitleBarStyle.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { @@ -21,11 +22,13 @@ public enum TitleBarStyle /// /// The hidden inset /// + [SupportedOSPlatform("macos")] hiddenInset, /// /// The custom buttons on hover /// + [SupportedOSPlatform("macos")] customButtonsOnHover } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs b/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs index 98593fa7..f280f300 100644 --- a/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToBitmapOptions.cs @@ -1,12 +1,13 @@ namespace ElectronNET.API.Entities { /// - /// + /// Options for nativeImage.toBitmap; supports optional scaleFactor (defaults to 1.0) per MCP. /// + /// Up-to-date with Electron API 39.2 public class ToBitmapOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs b/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs index 748b206a..ccdb437d 100644 --- a/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToDataUrlOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ToDataUrlOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/ToPNGOptions.cs b/src/ElectronNET.API/API/Entities/ToPNGOptions.cs index 47a2cd0b..8d0e6831 100644 --- a/src/ElectronNET.API/API/Entities/ToPNGOptions.cs +++ b/src/ElectronNET.API/API/Entities/ToPNGOptions.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class ToPNGOptions { /// - /// Gets or sets the scalefactor + /// Gets or sets the image scale factor. Defaults to 1.0. /// public float ScaleFactor { get; set; } = 1.0f; } diff --git a/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs b/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs index 516e192a..6ac9da16 100644 --- a/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs +++ b/src/ElectronNET.API/API/Entities/TrayClickEventArgs.cs @@ -1,4 +1,6 @@ -namespace ElectronNET.API +using ElectronNET.API.Entities; + +namespace ElectronNET.API { /// /// @@ -36,5 +38,15 @@ public class TrayClickEventArgs /// true if [meta key]; otherwise, false. /// public bool MetaKey { get; set; } + + /// + /// The bounds of tray icon. + /// + public Rectangle Bounds { get; set; } + + /// + /// The position of the event. + /// + public Point Position { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs index 84b9c3c7..7345d2d6 100644 --- a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs +++ b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs @@ -3,22 +3,23 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateCancellationToken { /// - /// + /// Gets or sets a value indicating whether cancellation has been requested. /// public bool Cancelled { get; set; } /// - /// + /// Requests cancellation of the update process. /// public void Cancel() { } /// - /// + /// Disposes the underlying cancellation token (if applicable). /// public void Dispose() { diff --git a/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs b/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs index ed3b4097..3a902c77 100644 --- a/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs +++ b/src/ElectronNET.API/API/Entities/UpdateCheckResult.cs @@ -3,20 +3,21 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateCheckResult { /// - /// + /// Gets or sets the update information discovered by the check. /// public UpdateInfo UpdateInfo { get; set; } = new UpdateInfo(); /// - /// + /// Gets or sets the download artifacts (if provided by the updater). /// public string[] Download { get; set; } /// - /// + /// Gets or sets the cancellation token for the update process. /// public UpdateCancellationToken CancellationToken { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs b/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs index 4163ac1f..dc1708cc 100644 --- a/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs +++ b/src/ElectronNET.API/API/Entities/UpdateFileInfo.cs @@ -3,10 +3,11 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateFileInfo : BlockMapDataHolder { /// - /// + /// Gets or sets the URL of the update file. /// public string Url { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UpdateInfo.cs b/src/ElectronNET.API/API/Entities/UpdateInfo.cs index 5b33bf0b..c3b6a457 100644 --- a/src/ElectronNET.API/API/Entities/UpdateInfo.cs +++ b/src/ElectronNET.API/API/Entities/UpdateInfo.cs @@ -3,36 +3,37 @@ /// /// /// + /// Up-to-date with electron-updater 6.7.2 public class UpdateInfo { /// - /// The version. + /// Gets or sets the version. /// public string Version { get; set; } /// - /// + /// Gets or sets the files included in this update. /// public UpdateFileInfo[] Files { get; set; } = new UpdateFileInfo[0]; /// - /// The release name. + /// Gets or sets the release name. /// public string ReleaseName { get; set; } /// - /// The release notes. + /// Gets or sets the release notes. /// public ReleaseNoteInfo[] ReleaseNotes { get; set; } = new ReleaseNoteInfo[0]; /// - /// + /// Gets or sets the release date. /// public string ReleaseDate { get; set; } /// - /// The staged rollout percentage, 0-100. + /// Gets or sets the staged rollout percentage, 0-100. /// - public int StagingPercentage { get; set; } + public double StagingPercentage { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UploadFile.cs b/src/ElectronNET.API/API/Entities/UploadFile.cs index adff7df8..d542c355 100644 --- a/src/ElectronNET.API/API/Entities/UploadFile.cs +++ b/src/ElectronNET.API/API/Entities/UploadFile.cs @@ -3,32 +3,32 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class UploadFile : IPostData { /// - /// The object represents a file. + /// Gets the type discriminator; constant 'file'. /// public string Type { get; } = "file"; /// - /// The path of the file being uploaded. + /// Gets or sets the path of the file to be uploaded. /// public string FilePath { get; set; } /// - /// The offset from the beginning of the file being uploaded, in bytes. Defaults to 0. + /// Gets or sets the offset from the beginning of the file being uploaded, in bytes. Defaults to 0. /// public long Offset { get; set; } = 0; /// - /// The length of the file being uploaded, . Defaults to 0. - /// If set to -1, the whole file will be uploaded. + /// Gets or sets the number of bytes to read from offset. Defaults to 0. /// public long Length { get; set; } = 0; /// - /// The modification time of the file represented by a double, which is the number of seconds since the UNIX Epoch (Jan 1, 1970) + /// Gets or sets the last modification time in number of seconds since the UNIX epoch. Defaults to 0. /// - public double ModificationTime { get; set; } + public double ModificationTime { get; set; } = 0; } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/UploadRawData.cs b/src/ElectronNET.API/API/Entities/UploadRawData.cs index c1577978..96a91ac9 100644 --- a/src/ElectronNET.API/API/Entities/UploadRawData.cs +++ b/src/ElectronNET.API/API/Entities/UploadRawData.cs @@ -3,15 +3,16 @@ /// /// /// + /// Up-to-date with Electron API 39.2 public class UploadRawData : IPostData { /// - /// The data is available as a Buffer, in the rawData field. + /// Gets the type discriminator; constant 'rawData'. /// public string Type { get; } = "rawData"; /// - /// The raw bytes of the post data in a Buffer. + /// Gets or sets the data to be uploaded as raw bytes (Electron Buffer). /// public byte[] Bytes { get; set; } } diff --git a/src/ElectronNET.API/API/Entities/UserTask.cs b/src/ElectronNET.API/API/Entities/UserTask.cs index 020910dc..65443b14 100644 --- a/src/ElectronNET.API/API/Entities/UserTask.cs +++ b/src/ElectronNET.API/API/Entities/UserTask.cs @@ -1,8 +1,12 @@ -namespace ElectronNET.API.Entities +using System.Runtime.Versioning; + +namespace ElectronNET.API.Entities { /// - /// + /// Windows Task item used by app.setUserTasks. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("Windows")] public class UserTask { /// diff --git a/src/ElectronNET.API/API/Entities/Vibrancy.cs b/src/ElectronNET.API/API/Entities/Vibrancy.cs index 2e8bec85..8e35607e 100644 --- a/src/ElectronNET.API/API/Entities/Vibrancy.cs +++ b/src/ElectronNET.API/API/Entities/Vibrancy.cs @@ -1,63 +1,92 @@ using System.Runtime.Serialization; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// - /// + /// Vibrancy types for BrowserWindow on macOS. /// + /// Up-to-date with Electron API 39.2 + [SupportedOSPlatform("macos")] public enum Vibrancy { /// - /// The appearance based + /// Appearance-based vibrancy. /// [EnumMember(Value = "appearance-based")] appearanceBased, /// - /// The light + /// Title bar area. /// - light, + titlebar, /// - /// The dark + /// Selection highlight. /// - dark, + selection, /// - /// The titlebar + /// Menu background. /// - titlebar, + menu, /// - /// The selection + /// Popover background. /// - selection, + popover, /// - /// The menu + /// Sidebar background. /// - menu, + sidebar, /// - /// The popover + /// Header background. /// - popover, + header, /// - /// The sidebar + /// Sheet background. /// - sidebar, + sheet, + + /// + /// Window background. + /// + window, + + /// + /// Heads-up display. + /// + hud, + + /// + /// Fullscreen UI background. + /// + [EnumMember(Value = "fullscreen-ui")] + fullscreenUi, + + /// + /// Tooltip background. + /// + tooltip, + + /// + /// Content background. + /// + content, /// - /// The medium light + /// Under-window background. /// - [EnumMember(Value = "medium-light")] - mediumLight, + [EnumMember(Value = "under-window")] + underWindow, /// - /// The ultra dark + /// Under-page background. /// - [EnumMember(Value = "ultra-dark")] - ultraDark + [EnumMember(Value = "under-page")] + underPage } } \ No newline at end of file diff --git a/src/ElectronNET.API/API/Entities/WebPreferences.cs b/src/ElectronNET.API/API/Entities/WebPreferences.cs index 07f51001..385d3474 100644 --- a/src/ElectronNET.API/API/Entities/WebPreferences.cs +++ b/src/ElectronNET.API/API/Entities/WebPreferences.cs @@ -1,10 +1,12 @@ using System.ComponentModel; +using System.Runtime.Versioning; namespace ElectronNET.API.Entities { /// /// /// + /// Up-to-date with Electron API 39.2 public class WebPreferences { /// @@ -25,6 +27,11 @@ public class WebPreferences /// public bool NodeIntegrationInWorker { get; set; } + /// + /// Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. + /// + public bool NodeIntegrationInSubFrames { get; set; } + /// /// Specifies a script that will be loaded before other scripts run in the page. /// This script will always have access to node APIs no matter whether node @@ -35,11 +42,7 @@ public class WebPreferences public string Preload { get; set; } /// - /// If set, this will sandbox the renderer associated with the window, making it - /// compatible with the Chromium OS-level sandbox and disabling the Node.js engine. - /// This is not the same as the nodeIntegration option and the APIs available to the - /// preload script are more limited. Read more about the option.This option is - /// currently experimental and may change or be removed in future Electron releases. + /// If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as the nodeIntegration option and the APIs available to the preload script are more limited. Default is true since Electron 20. The sandbox will automatically be disabled when nodeIntegration is set to true. /// public bool Sandbox { get; set; } @@ -56,7 +59,8 @@ public class WebPreferences /// /// The default zoom factor of the page, 3.0 represents 300%. Default is 1.0. /// - public double ZoomFactor { get; set; } + [DefaultValue(1.0)] + public double ZoomFactor { get; set; } = 1.0; /// /// Enables JavaScript support. Default is true. @@ -84,6 +88,11 @@ public class WebPreferences [DefaultValue(true)] public bool Images { get; set; } = true; + /// + /// Specifies how to run image animations (e.g. GIFs). Can be 'animate', 'animateOnce' or 'noAnimation'. Default is 'animate'. + /// + public string ImageAnimationPolicy { get; set; } + /// /// Make TextArea elements resizable. Default is true. /// @@ -115,11 +124,13 @@ public class WebPreferences /// /// Enables Chromium's experimental canvas features. Default is false. /// + /// Not documented by MCP electronjs web-preferences. public bool ExperimentalCanvasFeatures { get; set; } /// /// Enables scroll bounce (rubber banding) effect on macOS. Default is false. /// + [SupportedOSPlatform("macos")] public bool ScrollBounce { get; set; } /// @@ -147,16 +158,19 @@ public class WebPreferences /// /// Defaults to 13. /// - public int DefaultMonospaceFontSize { get; set; } + [DefaultValue(13)] + public int DefaultMonospaceFontSize { get; set; } = 13; /// /// Defaults to 0. /// - public int MinimumFontSize { get; set; } + [DefaultValue(0)] + public int MinimumFontSize { get; set; } = 0; /// /// Defaults to ISO-8859-1. /// + /// Not documented by MCP electronjs web-preferences. public string DefaultEncoding { get; set; } /// @@ -212,5 +226,25 @@ public class WebPreferences /// [DefaultValue(false)] public bool EnableRemoteModule { get; set; } = false; + + /// + /// Gets or sets a value indicating whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause the 'preferred-size-changed' event to be emitted on the WebContents when the preferred size changes. Default is false. + /// + [DefaultValue(false)] + public bool EnablePreferredSizeMode { get; set; } + + /// + /// Gets or sets a value indicating whether to enable background transparency for the guest page. Default is true. + /// Note: The guest page's text and background colors are derived from the color scheme of its root element. When transparency is enabled, the text color will still change accordingly but the background will remain transparent. + /// + [DefaultValue(true)] + public bool Transparent { get; set; } = true; + + /// + /// Gets or sets a value indicating whether to enable the 'paste' execCommand. Deprecated. Default is false. + /// + [DefaultValue(false)] + [System.Obsolete("enableDeprecatedPaste is deprecated in Electron; avoid using.")] + public bool EnableDeprecatedPaste { get; set; } } } \ No newline at end of file diff --git a/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs b/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs index c9f77848..371f71a3 100644 --- a/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs +++ b/src/ElectronNET.API/Converter/ModifierTypeListConverter.cs @@ -40,7 +40,7 @@ public override void Write(Utf8JsonWriter writer, List value, Json writer.WriteStartArray(); foreach (var modifier in value) { - writer.WriteStringValue(modifier.ToString()); + writer.WriteStringValue(modifier.ToString().ToLowerInvariant()); } writer.WriteEndArray(); diff --git a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs index 6c0bd7e2..0d86d232 100644 --- a/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs +++ b/src/ElectronNET.IntegrationTests/Tests/BrowserWindowTests.cs @@ -177,7 +177,7 @@ public async Task Progress_bar_and_always_on_top_toggle() var win = this.fx.MainWindow; win.SetProgressBar(0.5); await Task.Delay(50); - win.SetProgressBar(0.8, new ProgressBarOptions { Mode = ProgressBarMode.normal }); + win.SetProgressBar(0.8, new ProgressBarOptions()); await Task.Delay(50); win.SetAlwaysOnTop(true); await Task.Delay(500); From 77834d0f2e2c028de6224dc39482f25cbfc45b82 Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 22 Nov 2025 00:03:18 +0100 Subject: [PATCH 2/4] Drop workaround via DescriptinoAttribute: No longer needed --- src/ElectronNET.API/API/App.cs | 4 +-- src/ElectronNET.API/API/BrowserWindow.cs | 6 ++-- src/ElectronNET.API/API/Dock.cs | 2 +- .../API/Extensions/EnumExtensions.cs | 35 ------------------- src/ElectronNET.API/API/NativeTheme.cs | 2 +- src/ElectronNET.API/API/Shell.cs | 2 +- 6 files changed, 8 insertions(+), 43 deletions(-) delete mode 100644 src/ElectronNET.API/API/Extensions/EnumExtensions.cs diff --git a/src/ElectronNET.API/API/App.cs b/src/ElectronNET.API/API/App.cs index c486f90a..a1843031 100644 --- a/src/ElectronNET.API/API/App.cs +++ b/src/ElectronNET.API/API/App.cs @@ -539,7 +539,7 @@ public async Task GetPathAsync(PathName pathName, CancellationToken canc using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { BridgeConnector.Socket.Once("appGetPathCompleted", taskCompletionSource.SetResult); - BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription()); + BridgeConnector.Socket.Emit("appGetPath", pathName); return await taskCompletionSource.Task .ConfigureAwait(false); @@ -560,7 +560,7 @@ public async Task GetPathAsync(PathName pathName, CancellationToken canc /// public void SetPath(PathName name, string path) { - this.CallMethod2(name.GetDescription(), path); + this.CallMethod2(name, path); } /// diff --git a/src/ElectronNET.API/API/BrowserWindow.cs b/src/ElectronNET.API/API/BrowserWindow.cs index bd60b77d..bc863988 100644 --- a/src/ElectronNET.API/API/BrowserWindow.cs +++ b/src/ElectronNET.API/API/BrowserWindow.cs @@ -681,7 +681,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) => /// Values include normal, floating, torn-off-menu, modal-panel, main-menu, /// status, pop-up-menu and screen-saver. The default is floating. /// See the macOS docs - public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription()); + public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level); /// /// Sets whether the window should show always on top of other windows. @@ -694,7 +694,7 @@ public void SetAspectRatio(int aspectRatio, Size extraSize) => /// See the macOS docs /// The number of layers higher to set this window relative to the given level. /// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver. - public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel); + public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level, relativeLevel); /// /// Whether the window is always on top of other windows. @@ -1190,7 +1190,7 @@ public async Task> GetChildWindowsAsync() /// menu, popover, sidebar, medium-light or ultra-dark. /// See the macOS documentation for more details. [SupportedOSPlatform("macOS")] - public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription()); + public void SetVibrancy(Vibrancy type) => this.CallMethod1(type); /// /// Render and control web pages. diff --git a/src/ElectronNET.API/API/Dock.cs b/src/ElectronNET.API/API/Dock.cs index 1186d37a..e2577595 100644 --- a/src/ElectronNET.API/API/Dock.cs +++ b/src/ElectronNET.API/API/Dock.cs @@ -57,7 +57,7 @@ public async Task BounceAsync(DockBounceType type, CancellationToken cancel using (cancellationToken.Register(() => tcs.TrySetCanceled())) { BridgeConnector.Socket.Once("dock-bounce-completed", tcs.SetResult); - BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription()); + BridgeConnector.Socket.Emit("dock-bounce", type); return await tcs.Task .ConfigureAwait(false); diff --git a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs b/src/ElectronNET.API/API/Extensions/EnumExtensions.cs deleted file mode 100644 index 42604586..00000000 --- a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.ComponentModel; -using System.Reflection; - -namespace ElectronNET.API.Extensions -{ - internal static class EnumExtensions - { - public static string GetDescription(this T enumerationValue) where T : struct - { - Type type = enumerationValue.GetType(); - if (!type.IsEnum) - { - throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue"); - } - - //Tries to find a DescriptionAttribute for a potential friendly name - //for the enum - MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString()); - if (memberInfo != null && memberInfo.Length > 0) - { - object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); - - if (attrs != null && attrs.Length > 0) - { - //Pull out the description value - return ((DescriptionAttribute)attrs[0]).Description; - } - } - - //If we have no description attribute, just return the ToString of the enum - return enumerationValue.ToString(); - } - } -} \ No newline at end of file diff --git a/src/ElectronNET.API/API/NativeTheme.cs b/src/ElectronNET.API/API/NativeTheme.cs index 71b35cf5..620e0861 100644 --- a/src/ElectronNET.API/API/NativeTheme.cs +++ b/src/ElectronNET.API/API/NativeTheme.cs @@ -99,7 +99,7 @@ internal static NativeTheme Instance /// The new ThemeSource. public void SetThemeSource(ThemeSourceMode themeSourceMode) { - var themeSource = themeSourceMode.GetDescription(); + var themeSource = themeSourceMode; BridgeConnector.Socket.Emit("nativeTheme-themeSource", themeSource); } diff --git a/src/ElectronNET.API/API/Shell.cs b/src/ElectronNET.API/API/Shell.cs index 4c99de84..888b3097 100644 --- a/src/ElectronNET.API/API/Shell.cs +++ b/src/ElectronNET.API/API/Shell.cs @@ -134,7 +134,7 @@ public Task WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperat var tcs = new TaskCompletionSource(); BridgeConnector.Socket.Once("shell-writeShortcutLinkCompleted", tcs.SetResult); - BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.GetDescription(), options); + BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation, options); return tcs.Task; } From 59887cce5f9597fe5d663239c6b4aa92733bd313 Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 22 Nov 2025 00:04:53 +0100 Subject: [PATCH 3/4] Guard deserialization error --- src/ElectronNET.API/API/Notification.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ElectronNET.API/API/Notification.cs b/src/ElectronNET.API/API/Notification.cs index a5f03f94..e0e9f80b 100644 --- a/src/ElectronNET.API/API/Notification.cs +++ b/src/ElectronNET.API/API/Notification.cs @@ -97,7 +97,14 @@ private static void GenerateIDsForDefinedActions(NotificationOptions notificatio isActionDefined = true; BridgeConnector.Socket.Off("NotificationEventAction"); - BridgeConnector.Socket.On("NotificationEventAction", (args) => { _notificationOptions.Single(x => x.ActionID == args[0]).OnAction(args[1]); }); + BridgeConnector.Socket.On("NotificationEventAction", (args) => + { + var opt = _notificationOptions.Single(x => x.ActionID == args[0]); + if (int.TryParse(args[1], out var index)) + { + opt.OnAction(index); + } + }); } if (isActionDefined) From 3821ca60eaf9ea92579a58fc8c5cf9e1f3d732cf Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 22 Nov 2025 02:26:55 +0100 Subject: [PATCH 4/4] getPrinters: Increase timeout --- src/ElectronNET.API/API/ApiBase.cs | 9 +++++++-- src/ElectronNET.API/API/WebContents.cs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ElectronNET.API/API/ApiBase.cs b/src/ElectronNET.API/API/ApiBase.cs index 95231fe1..b8af9af4 100644 --- a/src/ElectronNET.API/API/ApiBase.cs +++ b/src/ElectronNET.API/API/ApiBase.cs @@ -116,6 +116,11 @@ protected void CallMethod3(object val1, object val2, object val3, [CallerMemberN } protected Task InvokeAsync(object arg = null, [CallerMemberName] string callerName = null) + { + return this.InvokeAsyncWithTimeout(InvocationTimeout, arg, callerName); + } + + protected Task InvokeAsyncWithTimeout(int invocationTimeout, object arg = null, [CallerMemberName] string callerName = null) { Debug.Assert(callerName != null, nameof(callerName) + " != null"); @@ -123,7 +128,7 @@ protected Task InvokeAsync(object arg = null, [CallerMemberName] string ca { return this.invocators.GetOrAdd(callerName, _ => { - var getter = new Invocator(this, callerName, InvocationTimeout, arg); + var getter = new Invocator(this, callerName, invocationTimeout, arg); getter.Task().ContinueWith(_ => { @@ -301,7 +306,7 @@ public Invocator(ApiBase apiBase, string callerName, int timeoutMs, object arg = _ = apiBase.Id >= 0 ? BridgeConnector.Socket.Emit(messageName, apiBase.Id) : BridgeConnector.Socket.Emit(messageName); } - System.Threading.Tasks.Task.Delay(InvocationTimeout).ContinueWith(_ => + System.Threading.Tasks.Task.Delay(timeoutMs).ContinueWith(_ => { if (this.tcs != null) { diff --git a/src/ElectronNET.API/API/WebContents.cs b/src/ElectronNET.API/API/WebContents.cs index fb95876d..5d1037c5 100644 --- a/src/ElectronNET.API/API/WebContents.cs +++ b/src/ElectronNET.API/API/WebContents.cs @@ -139,7 +139,7 @@ public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions) /// Get system printers. /// /// printers - public Task GetPrintersAsync() => this.InvokeAsync(); + public Task GetPrintersAsync() => this.InvokeAsyncWithTimeout(5_000); /// /// Prints window's web page.