Moved into src folder

This commit is contained in:
Florian Rappl
2023-04-01 23:44:25 +02:00
parent 3470a70572
commit 2367035acd
357 changed files with 5 additions and 16 deletions

View File

@@ -0,0 +1,48 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// About panel options.
/// </summary>
public class AboutPanelOptions
{
/// <summary>
/// The app's name.
/// </summary>
public string ApplicationName { get; set; }
/// <summary>
/// The app's version.
/// </summary>
public string ApplicationVersion { get; set; }
/// <summary>
/// Copyright information.
/// </summary>
public string Copyright { get; set; }
/// <summary>
/// The app's build version number.
/// </summary>
public string Version { get; set; }
/// <summary>
/// Credit information.
/// </summary>
public string Credits { get; set; }
/// <summary>
/// List of app authors.
/// </summary>
public string[] Authors { get; set; }
/// <summary>
/// The app's website.
/// </summary>
public string Website { get; set; }
/// <summary>
/// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
/// </summary>
public string IconPath { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class AddRepresentationOptions
{
/// <summary>
/// Gets or sets the width
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height
/// </summary>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
/// <summary>
/// Gets or sets the buffer
/// </summary>
public byte[] Buffer { get; set; }
/// <summary>
/// Gets or sets the dataURL
/// </summary>
public string DataUrl { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class AppDetailsOptions
{
/// <summary>
/// Windows App User Model ID. It has to be set, otherwise the other options will have no effect.
/// </summary>
public string AppId { get; set; }
/// <summary>
/// Windows Relaunch Icon.
/// </summary>
public string AppIconPath { get; set; }
/// <summary>
/// Index of the icon in appIconPath. Ignored when appIconPath is not set. Default is 0.
/// </summary>
public int AppIconIndex { get; set; }
/// <summary>
/// Windows Relaunch Command.
/// </summary>
public string RelaunchCommand { get; set; }
/// <summary>
/// Windows Relaunch Display Name.
/// </summary>
public string RelaunchDisplayName { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class AutoResizeOptions
{
/// <summary>
/// If `true`, the view's width will grow and shrink together with the window.
/// `false` by default.
/// </summary>
[DefaultValue(false)]
public bool Width { get; set; } = false;
/// <summary>
/// If `true`, the view's height will grow and shrink together with the window.
/// `false` by default.
/// </summary>
[DefaultValue(false)]
public bool Height { get; set; } = false;
/// <summary>
/// If `true`, the view's x position and width will grow and shrink proportionally
/// with the window. `false` by default.
/// </summary>
[DefaultValue(false)]
public bool Horizontal { get; set; } = false;
/// <summary>
/// If `true`, the view's y position and height will grow and shrink proportionally
/// with the window. `false` by default.
/// </summary>
[DefaultValue(false)]
public bool Vertical { get; set; } = false;
}
}

View File

@@ -0,0 +1,13 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class BitmapOptions
{
/// <summary>
/// Gets or sets the scale factor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Blob : IPostData
{
/// <summary>
/// The object represents a Blob
/// </summary>
public string Type { get; } = "blob";
/// <summary>
/// The UUID of the Blob being uploaded
/// </summary>
public string BlobUUID { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class BlockMapDataHolder
{
/// <summary>
/// The file size. Used to verify downloaded size (save one HTTP request to get length).
/// Also used when block map data is embedded into the file(appimage, windows web installer package).
/// </summary>
public double Size { get; set; }
/// <summary>
/// The block map file size. Used when block map data is embedded into the file (appimage, windows web installer package).
/// This information can be obtained from the file itself, but it requires additional HTTP request,
/// so, to reduce request count, block map size is specified in the update metadata too.
/// </summary>
public double BlockMapSize { get; set; }
/// <summary>
/// The file checksum.
/// </summary>
public string Sha512 { get; set; }
/// <summary>
///
/// </summary>
public bool IsAdminRightsRequired { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class BrowserViewConstructorOptions
{
/// <summary>
/// See BrowserWindow.
/// </summary>
public WebPreferences WebPreferences { get; set; }
/// <summary>
/// A proxy to set on creation in the format host:port.
/// The proxy can be alternatively set using the BrowserView.WebContents.SetProxyAsync function.
/// </summary>
public string Proxy { get; set; }
/// <summary>
/// The credentials of the Proxy in the format username:password.
/// These will only be used if the Proxy field is also set.
/// </summary>
public string ProxyCredentials { get; set; }
}
}

View File

@@ -0,0 +1,274 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class BrowserWindowOptions
{
/// <summary>
/// Window's width in pixels. Default is 800.
/// </summary>
public int Width { get; set; } = 800;
/// <summary>
/// Window's height in pixels. Default is 600.
/// </summary>
public int Height { get; set; } = 600;
/// <summary>
/// ( if y is used) Window's left offset from screen. Default is to center the
/// window.
/// </summary>
public int X { get; set; } = -1;
/// <summary>
/// ( if x is used) Window's top offset from screen. Default is to center the
/// window.
/// </summary>
public int Y { get; set; } = -1;
/// <summary>
/// The width and height would be used as web page's size, which means the actual
/// window's size will include window frame's size and be slightly larger. Default
/// is false.
/// </summary>
public bool UseContentSize { get; set; }
/// <summary>
/// Show window in the center of the screen.
/// </summary>
public bool Center { get; set; }
/// <summary>
/// Window's minimum width. Default is 0.
/// </summary>
public int MinWidth { get; set; }
/// <summary>
/// Window's minimum height. Default is 0.
/// </summary>
public int MinHeight { get; set; }
/// <summary>
/// Window's maximum width. Default is no limit.
/// </summary>
public int MaxWidth { get; set; }
/// <summary>
/// Window's maximum height. Default is no limit.
/// </summary>
public int MaxHeight { get; set; }
/// <summary>
/// Whether window is resizable. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Resizable { get; set; } = true;
/// <summary>
/// Whether window is movable. This is not implemented on Linux. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Movable { get; set; } = true;
/// <summary>
/// Whether window is minimizable. This is not implemented on Linux. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Minimizable { get; set; } = true;
/// <summary>
/// Whether window is maximizable. This is not implemented on Linux. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Maximizable { get; set; } = true;
/// <summary>
/// Whether window is closable. This is not implemented on Linux. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Closable { get; set; } = true;
/// <summary>
/// Whether the window can be focused. Default is true. On Windows setting
/// focusable: false also implies setting skipTaskbar: true. On Linux setting
/// focusable: false makes the window stop interacting with wm, so the window will
/// always stay on top in all workspaces.
/// </summary>
[DefaultValue(true)]
public bool Focusable { get; set; } = true;
/// <summary>
/// Whether the window should always stay on top of other windows. Default is false.
/// </summary>
public bool AlwaysOnTop { get; set; }
/// <summary>
/// Whether the window should show in fullscreen. When explicitly set to false the
/// fullscreen button will be hidden or disabled on macOS.Default is false.
/// </summary>
public bool Fullscreen { get; set; }
/// <summary>
/// Whether the window can be put into fullscreen mode. On macOS, also whether the
/// maximize/zoom button should toggle full screen mode or maximize window.Default
/// is true.
/// </summary>
public bool Fullscreenable { get; set; }
/// <summary>
/// Whether to show the window in taskbar. Default is false.
/// </summary>
public bool SkipTaskbar { get; set; }
/// <summary>
/// The kiosk mode. Default is false.
/// </summary>
public bool Kiosk { get; set; }
/// <summary>
/// Default window title. Default is "Electron.NET".
/// </summary>
public string Title { get; set; } = "Electron.NET";
/// <summary>
/// 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.
/// </summary>
public string Icon { get; set; }
/// <summary>
/// Whether window should be shown when created. Default is true.
/// </summary>
[DefaultValue(true)]
public bool Show { get; set; } = true;
/// <summary>
/// Specify false to create a . Default is true.
/// </summary>
[DefaultValue(true)]
public bool Frame { get; set; } = true;
/// <summary>
/// Whether this is a modal window. This only works when the window is a child
/// window.Default is false.
/// </summary>
public bool Modal { get; set; }
/// <summary>
/// Whether the web view accepts a single mouse-down event that simultaneously
/// activates the window.Default is false.
/// </summary>
public bool AcceptFirstMouse { get; set; }
/// <summary>
/// Whether to hide cursor when typing. Default is false.
/// </summary>
public bool DisableAutoHideCursor { get; set; }
/// <summary>
/// Auto hide the menu bar unless the Alt key is pressed. Default is false.
/// </summary>
public bool AutoHideMenuBar { get; set; }
/// <summary>
/// Enable the window to be resized larger than screen. Default is false.
/// </summary>
public bool EnableLargerThanScreen { get; set; }
/// <summary>
/// Window's background color as Hexadecimal value, like #66CD00 or #FFF or
/// #80FFFFFF (alpha is supported). Default is #FFF (white).
/// </summary>
public string BackgroundColor { get; set; }
/// <summary>
/// Whether window should have a shadow. This is only implemented on macOS. Default
/// is true.
/// </summary>
public bool HasShadow { get; set; }
/// <summary>
/// Forces using dark theme for the window, only works on some GTK+3 desktop
/// environments.Default is false.
/// </summary>
public bool DarkTheme { get; set; }
/// <summary>
/// Makes the window . Default is false.
/// </summary>
public bool Transparent { get; set; }
/// <summary>
/// The type of window, default is normal window.
/// </summary>
public string Type { get; set; }
/// <summary>
/// The style of window title bar. Default is default. Possible values are:
/// 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover'
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public TitleBarStyle TitleBarStyle { get; set; }
/// <summary>
/// Shows the title in the tile bar in full screen mode on macOS for all
/// titleBarStyle options.Default is false.
/// </summary>
public bool FullscreenWindowTitle { get; set; }
/// <summary>
/// Use WS_THICKFRAME style for frameless windows on Windows, which adds standard
/// window frame.Setting it to false will remove window shadow and window
/// animations. Default is true.
/// </summary>
[DefaultValue(true)]
public bool ThickFrame { get; set; } = true;
/// <summary>
/// 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.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public Vibrancy Vibrancy { get; set; }
/// <summary>
/// Controls the behavior on macOS when option-clicking the green stoplight button
/// on the toolbar or by clicking the Window > Zoom menu item.If true, the window
/// will grow to the preferred width of the web page when zoomed, false will cause
/// it to zoom to the width of the screen.This will also affect the behavior when
/// calling maximize() directly.Default is false.
/// </summary>
public bool ZoomToPageWidth { get; set; }
/// <summary>
/// Tab group name, allows opening the window as a native tab on macOS 10.12+.
/// Windows with the same tabbing identifier will be grouped together.This also
/// 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.
/// </summary>
public string TabbingIdentifier { get; set; }
/// <summary>
/// Settings of web page's features.
/// </summary>
public WebPreferences WebPreferences { get; set; }
/// <summary>
/// A proxy to set on creation in the format host:port.
/// The proxy can be alternatively set using the BrowserWindow.WebContents.SetProxyAsync function.
/// </summary>
public string Proxy { get; set; }
/// <summary>
/// The credentials of the Proxy in the format username:password.
/// These will only be used if the Proxy field is also set.
/// </summary>
public string ProxyCredentials { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CPUUsage
{
/// <summary>
/// Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
/// </summary>
public int PercentCPUUsage { get; set; }
/// <summary>
/// The number of average idle cpu wakeups per second since the last call to
/// getCPUUsage.First call returns 0.
/// </summary>
public int IdleWakeupsPerSecond { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Certificate
{
/// <summary>
/// PEM encoded data
/// </summary>
public string Data { get; set; }
/// <summary>
/// Fingerprint of the certificate
/// </summary>
public string Fingerprint { get; set; }
/// <summary>
/// Issuer principal
/// </summary>
public CertificatePrincipal Issuer { get; set; }
/// <summary>
/// Issuer certificate (if not self-signed)
/// </summary>
public Certificate IssuerCert { get; set; }
/// <summary>
/// Issuer's Common Name
/// </summary>
public string IssuerName { get; set; }
/// <summary>
/// Hex value represented string
/// </summary>
public string SerialNumber { get; set; }
/// <summary>
/// Subject principal
/// </summary>
public CertificatePrincipal Subject { get; set; }
/// <summary>
/// Subject's Common Name
/// </summary>
public string SubjectName { get; set; }
/// <summary>
/// End date of the certificate being valid in seconds
/// </summary>
public int ValidExpiry { get; set; }
/// <summary>
/// Start date of the certificate being valid in seconds
/// </summary>
public int ValidStart { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CertificatePrincipal
{
/// <summary>
/// Common Name
/// </summary>
public string CommonName { get; set; }
/// <summary>
/// Country or region
/// </summary>
public string Country { get; set; }
/// <summary>
/// Locality
/// </summary>
public string Locality { get; set; }
/// <summary>
/// Organization names
/// </summary>
public string[] Organizations { get; set; }
/// <summary>
/// Organization Unit names
/// </summary>
public string[] OrganizationUnits { get; set; }
/// <summary>
/// State or province
/// </summary>
public string State { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CertificateTrustDialogOptions
{
/// <summary>
/// The certificate to trust/import.
/// </summary>
public Certificate Certificate { get; set; }
/// <summary>
/// The message to display to the user.
/// </summary>
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Provide metadata about the current loaded Chrome extension
/// </summary>
public class ChromeExtensionInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="ChromeExtensionInfo"/> class.
/// </summary>
/// <param name="name">The name of the Chrome extension.</param>
/// <param name="version">The version of the Chrome extension.</param>
public ChromeExtensionInfo(string name, string version)
{
Name = name;
Version = version;
}
/// <summary>
/// Name of the Chrome extension
/// </summary>
public string Name { get; set; }
/// <summary>
/// Version of the Chrome extension
/// </summary>
public string Version { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ClearStorageDataOptions
{
/// <summary>
/// Should follow window.location.origins representation scheme://host:port.
/// </summary>
public string Origin { get; set; }
/// <summary>
/// The types of storages to clear, can contain: appcache, cookies, filesystem,
/// indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage.
/// </summary>
public string[] Storages { get; set; }
/// <summary>
/// The types of quotas to clear, can contain: temporary, persistent, syncable.
/// </summary>
public string[] Quotas { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
namespace ElectronNET.API.Entities {
/// <summary>
///
/// </summary>
public class Cookie {
/// <summary>
/// The name of the cookie.
/// </summary>
public string Name { get; set;}
/// <summary>
/// The value of the cookie.
/// </summary>
public string Value { get; set; }
/// <summary>
/// (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains.
/// </summary>
public string Domain { get; set; }
/// <summary>
/// (optional) - Whether the cookie is a host-only cookie; this will only be true if no domain was passed.
/// </summary>
public bool HostOnly { get; set; }
/// <summary>
/// (optional) - The path of the cookie.
/// </summary>
public string Path { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as secure.
/// </summary>
public bool Secure { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as HTTP only.
/// </summary>
public bool HttpOnly { get; set; }
/// <summary>
/// (optional) - Whether the cookie is a session cookie or a persistent cookie with an expiration date.
/// </summary>
public bool Session { get; set; }
/// <summary>
/// (optional) - The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
/// </summary>
public long ExpirationDate { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities {
/// <summary>
/// The cause of the change
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum CookieChangedCause
{
/// <summary>
///The cookie was changed directly by a consumer's action.
/// </summary>
[JsonProperty("explicit")]
@explicit,
/// <summary>
/// The cookie was automatically removed due to an insert operation that overwrote it.
/// </summary>
overwrite,
/// <summary>
/// The cookie was automatically removed as it expired.
/// </summary>
expired,
/// <summary>
/// The cookie was automatically evicted during garbage collection.
/// </summary>
evicted,
/// <summary>
/// The cookie was overwritten with an already-expired expiration date.
/// </summary>
[JsonProperty("expired_overwrite")]
expiredOverwrite
}
}

View File

@@ -0,0 +1,56 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities {
/// <summary>
///
/// </summary>
public class CookieDetails {
/// <summary>
/// The URL to associate the cookie with. The callback will be rejected if the URL is invalid.
/// </summary>
public string Url { get; set; }
/// <summary>
/// (optional) - The name of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Name { get; set; }
/// <summary>
/// (optional) - The value of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Value { get; set; }
/// <summary>
/// (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.
/// </summary>
[DefaultValue("")]
public string Domain { get; set; }
/// <summary>
/// (optional) - The path of the cookie. Empty by default if omitted.
/// </summary>
[DefaultValue("")]
public string Path { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as secure. Defaults to false.
/// </summary>
[DefaultValue(false)]
public bool Secure { get; set; }
/// <summary>
/// (optional) - Whether the cookie is marked as HTTP only. Defaults to false.
/// </summary>
[DefaultValue(false)]
public bool HttpOnly { get; set; }
/// <summary>
/// (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.
/// </summary>
[DefaultValue(0)]
public long ExpirationDate { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CookieFilter
{
/// <summary>
/// (optional) - Retrieves cookies which are associated with url.Empty implies retrieving cookies of all URLs.
/// </summary>
public string Url { get; set; }
/// <summary>
/// (optional) - Filters cookies by name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// (optional) - Retrieves cookies whose domains match or are subdomains of domains.
/// </summary>
public string Domain { get; set; }
/// <summary>
/// (optional) - Retrieves cookies whose path matches path.
/// </summary>
public string Path { get; set; }
/// <summary>
/// (optional) - Filters cookies by their Secure property.
/// </summary>
public bool Secure { get; set; }
/// <summary>
/// (optional) - Filters out session or persistent cookies.
/// </summary>
public bool Session { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CreateFromBitmapOptions
{
/// <summary>
/// Gets or sets the width
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height
/// </summary>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CreateFromBufferOptions
{
/// <summary>
/// Gets or sets the width
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height
/// </summary>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,67 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class CreateInterruptedDownloadOptions
{
/// <summary>
/// Absolute path of the download.
/// </summary>
public string Path { get; set; }
/// <summary>
/// Complete URL chain for the download.
/// </summary>
public string[] UrlChain { get; set; }
/// <summary>
///
/// </summary>
public string MimeType { get; set; }
/// <summary>
/// Start range for the download.
/// </summary>
public int Offset { get; set; }
/// <summary>
/// Total length of the download.
/// </summary>
public int Length { get; set; }
/// <summary>
/// Last-Modified header value.
/// </summary>
public string LastModified { get; set; }
/// <summary>
/// ETag header value.
/// </summary>
public string ETag { get; set; }
/// <summary>
/// Time when download was started in number of seconds since UNIX epoch.
/// </summary>
public int StartTime { get; set; }
/// <summary>
///
/// </summary>
/// <param name="path">Absolute path of the download.</param>
/// <param name="urlChain">Complete URL chain for the download.</param>
/// <param name="offset">Start range for the download.</param>
/// <param name="length">Total length of the download.</param>
/// <param name="lastModified">Last-Modified header value.</param>
/// <param name="eTag">ETag header value.</param>
public CreateInterruptedDownloadOptions(string path, string[] urlChain, int offset, int length, string lastModified, string eTag)
{
Path = path;
UrlChain = urlChain;
Offset = offset;
Length = length;
LastModified = lastModified;
ETag = eTag;
}
}
}

View File

@@ -0,0 +1,38 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Data
{
/// <summary>
/// Gets or sets the text.
/// </summary>
/// <value>
/// The text.
/// </value>
public string Text { get; set; }
/// <summary>
/// Gets or sets the HTML.
/// </summary>
/// <value>
/// The HTML.
/// </value>
public string Html { get; set; }
/// <summary>
/// Gets or sets the RTF.
/// </summary>
/// <value>
/// The RTF.
/// </value>
public string Rtf { get; set; }
/// <summary>
/// The title of the url at text.
/// </summary>
public string Bookmark { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class DefaultFontFamily
{
/// <summary>
/// Defaults to Times New Roman.
/// </summary>
public string Standard { get; set; }
/// <summary>
/// Defaults to Times New Roman.
/// </summary>
public string Serif { get; set; }
/// <summary>
/// Defaults to Arial.
/// </summary>
public string SansSerif { get; set; }
/// <summary>
/// Defaults to Courier New.
/// </summary>
public string Monospace { get; set; }
/// <summary>
/// Defaults to Script.
/// </summary>
public string Cursive { get; set; }
/// <summary>
/// Defaults to Impact.
/// </summary>
public string Fantasy { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// 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.
/// </summary>
public enum DevToolsMode
{
/// <summary>
/// The right
/// </summary>
right,
/// <summary>
/// The bottom
/// </summary>
bottom,
/// <summary>
/// The undocked
/// </summary>
undocked,
/// <summary>
/// The detach
/// </summary>
detach
}
}

View File

@@ -0,0 +1,60 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Display
{
/// <summary>
/// Gets or sets the bounds.
/// </summary>
/// <value>
/// The bounds.
/// </value>
public Rectangle Bounds { get; set; }
/// <summary>
/// Unique identifier associated with the display.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
/// </summary>
public int Rotation { get; set; }
/// <summary>
/// Output device's pixel scale factor.
/// </summary>
public int ScaleFactor { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>
/// The size.
/// </value>
public Size Size { get; set; }
/// <summary>
/// Can be available, unavailable, unknown.
/// </summary>
public string TouchSupport { get; set; }
/// <summary>
/// Gets or sets the work area.
/// </summary>
/// <value>
/// The work area.
/// </value>
public Rectangle WorkArea { get; set; }
/// <summary>
/// Gets or sets the size of the work area.
/// </summary>
/// <value>
/// The size of the work area.
/// </value>
public Size WorkAreaSize { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public class DisplayBalloonOptions
{
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the content.
/// </summary>
/// <value>
/// The content.
/// </value>
public string Content { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the DockBounceType enumeration.
/// </summary>
public enum DockBounceType
{
/// <summary>
/// Dock icon will bounce until either the application becomes active or the request is canceled.
/// </summary>
[Description("critical")]
Critical,
/// <summary>
/// The dock icon will bounce for one second.
/// </summary>
[Description("informational")]
Informational
}
}

View File

@@ -0,0 +1,28 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class EnableNetworkEmulationOptions
{
/// <summary>
/// Whether to emulate network outage. Defaults to false.
/// </summary>
public bool Offline { get; set; } = false;
/// <summary>
/// RTT in ms. Defaults to 0 which will disable latency throttling.
/// </summary>
public int Latency { get; set; }
/// <summary>
/// Download rate in Bps. Defaults to 0 which will disable download throttling.
/// </summary>
public int DownloadThroughput { get; set; }
/// <summary>
/// Upload rate in Bps. Defaults to 0 which will disable upload throttling.
/// </summary>
public int UploadThroughput { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Docs: https://electronjs.org/docs/api/structures/extension
/// </summary>
public class Extension
{
/// <summary>
///
/// </summary>
public string Id { get; set; }
/// <summary>
/// Copy of the extension's manifest data.
/// </summary>
public dynamic Manifest { get; set; }
/// <summary>
///
/// </summary>
public string Name { get; set; }
/// <summary>
/// The extension's file path.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The extension's `chrome-extension://` URL.
/// </summary>
public string Url { get; set; }
/// <summary>
///
/// </summary>
public string Version { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class FileFilter
{
/// <summary>
/// Gets or sets the extensions.
/// </summary>
/// <value>
/// The extensions.
/// </value>
public string[] Extensions { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class FileIconOptions
{
/// <summary>
/// Gets the size.
/// </summary>
/// <value>
/// The size.
/// </value>
public string Size { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="FileIconOptions"/> class.
/// </summary>
/// <param name="fileIconSize">Size of the file icon.</param>
public FileIconOptions(FileIconSize fileIconSize)
{
Size = fileIconSize.ToString();
}
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum FileIconSize
{
/// <summary>
/// The small
/// </summary>
small,
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The large
/// </summary>
large
}
}

View File

@@ -0,0 +1,15 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Controls the behavior of <see cref="App.Focus(FocusOptions)"/>.
/// </summary>
public class FocusOptions
{
/// <summary>
/// Make the receiver the active app even if another app is currently active.
/// <para/>
/// You should seek to use the <see cref="Steal"/> option as sparingly as possible.
/// </summary>
public bool Steal { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class GPUFeatureStatus
{
/// <summary>
/// Canvas.
/// </summary>
[JsonProperty("2d_canvas")]
public string Canvas { get; set; }
/// <summary>
/// Flash.
/// </summary>
[JsonProperty("flash_3d")]
public string Flash3D { get; set; }
/// <summary>
/// Flash Stage3D.
/// </summary>
[JsonProperty("flash_stage3d")]
public string FlashStage3D { get; set; }
/// <summary>
/// Flash Stage3D Baseline profile.
/// </summary>
[JsonProperty("flash_stage3d_baseline")]
public string FlashStage3dBaseline { get; set; }
/// <summary>
/// Compositing.
/// </summary>
[JsonProperty("gpu_compositing")]
public string GpuCompositing { get; set; }
/// <summary>
/// Multiple Raster Threads.
/// </summary>
[JsonProperty("multiple_raster_threads")]
public string MultipleRasterThreads { get; set; }
/// <summary>
/// Native GpuMemoryBuffers.
/// </summary>
[JsonProperty("native_gpu_memory_buffers")]
public string NativeGpuMemoryBuffers { get; set; }
/// <summary>
/// Rasterization.
/// </summary>
public string Rasterization { get; set; }
/// <summary>
/// Video Decode.
/// </summary>
[JsonProperty("video_decode")]
public string VideoDecode { get; set; }
/// <summary>
/// Video Encode.
/// </summary>
[JsonProperty("video_encode")]
public string VideoEncode { get; set; }
/// <summary>
/// VPx Video Decode.
/// </summary>
[JsonProperty("vpx_decode")]
public string VpxDecode { get; set; }
/// <summary>
/// WebGL.
/// </summary>
public string Webgl { get; set; }
/// <summary>
/// WebGL2.
/// </summary>
public string Webgl2 { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Interface to use Electrons PostData Object
/// </summary>
public interface IPostData
{
/// <summary>
/// One of the following:
/// rawData - <see cref="UploadRawData"/> The data is available as a Buffer, in the rawData field.
/// file - <see cref="UploadFile"/> The object represents a file. The filePath, offset, length and modificationTime fields will be used to describe the file.
/// blob - <see cref="Blob"/> The object represents a Blob. The blobUUID field will be used to describe the Blob.
/// </summary>
public string Type { get; }
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ImportCertificateOptions
{
/// <summary>
/// Path for the pkcs12 file.
/// </summary>
public string Certificate { get; set; }
/// <summary>
/// Passphrase for the certificate.
/// </summary>
public string Password {get; set; }
}
}

View File

@@ -0,0 +1,81 @@
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using ElectronNET.API.Converter;
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class InputEvent
{
/// <summary>
/// Equivalent to KeyboardEvent.key.
/// </summary>
public string Key { get; set; } = "";
/// <summary>
/// Equivalent to KeyboardEvent.code.
/// </summary>
public string Code { get; set; } = "";
/// <summary>
/// Equivalent to KeyboardEvent.repeat.
/// </summary>
public bool IsAutoRepeat { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.isComposing.
/// </summary>
public bool IsComposing { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.shiftKey.
/// </summary>
public bool Shift { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.controlKey.
/// </summary>
public bool Control { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.altKey.
/// </summary>
public bool Alt { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.metaKey.
/// </summary>
public bool Meta { get; set; } = false;
/// <summary>
/// Equivalent to KeyboardEvent.location.
/// </summary>
public int Location { get; set; } = 0;
/// <summary>
/// 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`
/// </summary>
[JsonConverter(typeof(ModifierTypeListConverter))]
public List<ModifierType> Modifiers { get; set; }
/// <summary>
/// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
/// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
/// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
/// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
/// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
/// `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
/// `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
/// `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
/// `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
/// `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public InputEventType Type { get; set; }
}
}

View File

@@ -0,0 +1,201 @@
namespace ElectronNET.API.Entities;
/// <summary>
///
/// </summary>
public enum InputEventType
{
/// <summary>
///
/// </summary>
undefined,
/// <summary>
///
/// </summary>
mouseDown,
/// <summary>
///
/// </summary>
mouseUp,
/// <summary>
///
/// </summary>
mouseMove,
/// <summary>
///
/// </summary>
mouseEnter,
/// <summary>
///
/// </summary>
mouseLeave,
/// <summary>
///
/// </summary>
contextMenu,
/// <summary>
///
/// </summary>
mouseWheel,
/// <summary>
///
/// </summary>
rawKeyDown,
/// <summary>
///
/// </summary>
keyDown,
/// <summary>
///
/// </summary>
keyUp,
/// <summary>
///
/// </summary>
gestureScrollBegin,
/// <summary>
///
/// </summary>
gestureScrollEnd,
/// <summary>
///
/// </summary>
gestureScrollUpdate,
/// <summary>
///
/// </summary>
gestureFlingStart,
/// <summary>
///
/// </summary>
gestureFlingCancel,
/// <summary>
///
/// </summary>
gesturePinchBegin,
/// <summary>
///
/// </summary>
gesturePinchEnd,
/// <summary>
///
/// </summary>
gesturePinchUpdate,
/// <summary>
///
/// </summary>
gestureTapDown,
/// <summary>
///
/// </summary>
gestureShowPress,
/// <summary>
///
/// </summary>
gestureTap,
/// <summary>
///
/// </summary>
gestureTapCancel,
/// <summary>
///
/// </summary>
gestureShortPress,
/// <summary>
///
/// </summary>
gestureLongPress,
/// <summary>
///
/// </summary>
gestureLongTap,
/// <summary>
///
/// </summary>
gestureTwoFingerTap,
/// <summary>
///
/// </summary>
gestureTapUnconfirmed,
/// <summary>
///
/// </summary>
gestureDoubleTap,
/// <summary>
///
/// </summary>
touchStart,
/// <summary>
///
/// </summary>
touchMove,
/// <summary>
///
/// </summary>
touchEnd,
/// <summary>
///
/// </summary>
touchCancel,
/// <summary>
///
/// </summary>
touchScrollStarted,
/// <summary>
///
/// </summary>
pointerDown,
/// <summary>
///
/// </summary>
pointerUp,
/// <summary>
///
/// </summary>
pointerMove,
/// <summary>
///
/// </summary>
pointerRawUpdate,
/// <summary>
///
/// </summary>
pointerCancel,
/// <summary>
///
/// </summary>
pointerCausedUaAction
}

View File

@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class JumpListCategory
{
/// <summary>
/// Must be set if type is custom, otherwise it should be omitted.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Array of objects if type is tasks or custom, otherwise it should be omitted.
/// </summary>
public JumpListItem[] Items { get; set; }
/// <summary>
/// One of the following: "tasks" | "frequent" | "recent" | "custom"
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public JumpListCategoryType Type { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum JumpListCategoryType
{
/// <summary>
/// The tasks
/// </summary>
tasks,
/// <summary>
/// The frequent
/// </summary>
frequent,
/// <summary>
/// The recent
/// </summary>
recent,
/// <summary>
/// The custom
/// </summary>
custom
}
}

View File

@@ -0,0 +1,58 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class JumpListItem
{
/// <summary>
/// The command line arguments when program is executed. Should only be set if type is task.
/// </summary>
public string Args { get; set; }
/// <summary>
/// Description of the task (displayed in a tooltip). Should only be set if type is task.
/// </summary>
public string Description { get; set; }
/// <summary>
/// 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,
/// this property should be set to zero.
/// </summary>
public int IconIndex { get; set; }
/// <summary>
/// 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.
/// </summary>
public string IconPath { get; set; }
/// <summary>
/// Path of the file to open, should only be set if type is file.
/// </summary>
public string Path { get; set; }
/// <summary>
/// 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.
/// </summary>
public string Program { get; set; }
/// <summary>
/// The text to be displayed for the item in the Jump List. Should only be set if type is task.
/// </summary>
public string Title { get; set; }
/// <summary>
/// One of the following: "task" | "separator" | "file"
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public JumpListItemType Type { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum JumpListItemType
{
/// <summary>
/// The task
/// </summary>
task,
/// <summary>
/// The separator
/// </summary>
separator,
/// <summary>
/// The file
/// </summary>
file
}
}

View File

@@ -0,0 +1,21 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class JumpListSettings
{
/// <summary>
/// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the
/// <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx">MSDN</see> docs).
/// </summary>
public int MinItems { get; set; } = 0;
/// <summary>
/// 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 <see cref="App.SetJumpList"/>, Windows will
/// not display any custom category that contains any of the removed items.
/// </summary>
public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0];
}
}

View File

@@ -0,0 +1,36 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoadURLOptions
{
/// <summary>
/// A HTTP Referrer url.
/// </summary>
public string HttpReferrer { get; set; }
/// <summary>
/// A user agent originating the request.
/// </summary>
public string UserAgent { get; set; }
/// <summary>
/// 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.
/// </summary>
public string BaseURLForDataURL { get; set; }
/// <summary>
/// Extra headers for the request.
/// </summary>
public string ExtraHeaders { get; set; }
/// <summary>
/// PostData Object for the request.
/// Can be <see cref="UploadRawData"/>, <see cref="UploadFile"/> or <see cref="Blob"/>
/// </summary>
public IPostData[] PostData { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginItemSettings
{
/// <summary>
/// <see langword="true"/> if the app is set to open at login.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> if the app is set to open as hidden at login. This setting is not available
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// <see langword="true"/> if the app was opened at login automatically. This setting is not available
/// on <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool WasOpenedAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> 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
/// <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool WasOpenedAsHidden { get; set; }
/// <summary>
/// <see langword="true"/> 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 <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool RestoreState { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginItemSettingsOptions
{
/// <summary>
/// The executable path to compare against. Defaults to process.execPath.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The command-line arguments to compare against. Defaults to an empty array.
/// </summary>
public string[] Args { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class LoginSettings
{
/// <summary>
/// <see langword="true"/> to open the app at login, <see langword="false"/> to remove the app as a login item.
/// Defaults to <see langword="false"/>.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// <see langword="true"/> to open the app as hidden. Defaults to <see langword="false"/>. 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 <see href="https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide">MAS builds</see>.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// The executable to launch at login. Defaults to process.execPath.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The command-line arguments to pass to the executable. Defaults to an empty
/// array.Take care to wrap paths in quotes.
/// </summary>
public string[] Args { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities;
/// <summary>
///
/// </summary>
public class Margins
{
/// <summary>
/// Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
/// you will also need to specify `top`, `bottom`, `left`, and `right`.
/// </summary>
public string MarginType { get; set; }
/// <summary>
/// The top margin of the printed web page, in pixels.
/// </summary>
public int Top { get; set; }
/// <summary>
/// The bottom margin of the printed web page, in pixels.
/// </summary>
public int Bottom { get; set; }
/// <summary>
/// The left margin of the printed web page, in pixels.
/// </summary>
public int Left { get; set; }
/// <summary>
/// The right margin of the printed web page, in pixels.
/// </summary>
public int Right { get; set; }
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MemoryInfo
{
/// <summary>
/// The amount of memory currently pinned to actual physical RAM.
/// </summary>
public int WorkingSetSize { get; set; }
/// <summary>
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
/// </summary>
public int PeakWorkingSetSize { get; set; }
/// <summary>
/// The amount of memory not shared by other processes, such as JS heap or HTML
/// content.
/// </summary>
public int PrivateBytes { get; set; }
}
}

View File

@@ -0,0 +1,103 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MenuItem
{
/// <summary>
/// Will be called with click(menuItem, browserWindow, event) when the menu item is
/// clicked.
/// </summary>
[JsonIgnore]
public Action Click { get; set; }
/// <summary>
/// Define the action of the menu item, when specified the click property will be
/// ignored.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MenuRole Role { get; set; }
/// <summary>
/// Can be normal, separator, submenu, checkbox or radio.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MenuType Type { get; set; }
/// <summary>
/// Gets or sets the label.
/// </summary>
/// <value>
/// The label.
/// </value>
public string Label { get; set; }
/// <summary>
/// Gets or sets the sublabel.
/// </summary>
/// <value>
/// The sublabel.
/// </value>
public string Sublabel { get; set; }
/// <summary>
/// Gets or sets the accelerator.
/// </summary>
/// <value>
/// The accelerator.
/// </value>
public string Accelerator { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// If false, the menu item will be greyed out and unclickable.
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// If false, the menu item will be entirely hidden.
/// </summary>
public bool Visible { get; set; } = true;
/// <summary>
/// Should only be specified for checkbox or radio type menu items.
/// </summary>
public bool Checked { get; set; }
/// <summary>
/// Should be specified for submenu type menu items. If submenu is specified, the
/// type: 'submenu' can be omitted.If the value is not a Menu then it will be
/// automatically converted to one using Menu.buildFromTemplate.
/// </summary>
public MenuItem[] Submenu { get; set; }
/// <summary>
/// Unique within a single menu. If defined then it can be used as a reference to
/// this item by the position attribute.
/// </summary>
public string Id { get; internal set; }
/// <summary>
/// This field allows fine-grained definition of the specific location within a
/// given menu.
/// </summary>
public string Position { get; set; }
}
}

View File

@@ -0,0 +1,163 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum MenuRole
{
/// <summary>
/// The undo
/// </summary>
undo = 1,
/// <summary>
/// The redo
/// </summary>
redo,
/// <summary>
/// The cut
/// </summary>
cut,
/// <summary>
/// The copy
/// </summary>
copy,
/// <summary>
/// The paste
/// </summary>
paste,
/// <summary>
/// The pasteandmatchstyle
/// </summary>
pasteandmatchstyle,
/// <summary>
/// The selectall
/// </summary>
selectall,
/// <summary>
/// The delete
/// </summary>
delete,
/// <summary>
/// Minimize current window
/// </summary>
minimize,
/// <summary>
/// Close current window
/// </summary>
close,
/// <summary>
/// Quit the application
/// </summary>
quit,
/// <summary>
/// Reload the current window
/// </summary>
reload,
/// <summary>
/// Reload the current window ignoring the cache.
/// </summary>
forcereload,
/// <summary>
/// Toggle developer tools in the current window
/// </summary>
toggledevtools,
/// <summary>
/// Toggle full screen mode on the current window
/// </summary>
togglefullscreen,
/// <summary>
/// Reset the focused pages zoom level to the original size
/// </summary>
resetzoom,
/// <summary>
/// Zoom in the focused page by 10%
/// </summary>
zoomin,
/// <summary>
/// Zoom out the focused page by 10%
/// </summary>
zoomout,
/// <summary>
/// Whole default “Edit” menu (Undo, Copy, etc.)
/// </summary>
editMenu,
/// <summary>
/// Whole default “Window” menu (Minimize, Close, etc.)
/// </summary>
windowMenu,
/// <summary>
/// Only macOS: Map to the orderFrontStandardAboutPanel action
/// </summary>
about,
/// <summary>
/// Only macOS: Map to the hide action
/// </summary>
hide,
/// <summary>
/// Only macOS: Map to the hideOtherApplications action
/// </summary>
hideothers,
/// <summary>
/// Only macOS: Map to the unhideAllApplications action
/// </summary>
unhide,
/// <summary>
/// Only macOS: Map to the startSpeaking action
/// </summary>
startspeaking,
/// <summary>
/// Only macOS: Map to the stopSpeaking action
/// </summary>
stopspeaking,
/// <summary>
/// Only macOS: Map to the arrangeInFront action
/// </summary>
front,
/// <summary>
/// Only macOS: Map to the performZoom action
/// </summary>
zoom,
/// <summary>
/// Only macOS: The submenu is a “Window” menu
/// </summary>
window,
/// <summary>
/// Only macOS: The submenu is a “Help” menu
/// </summary>
help,
/// <summary>
/// Only macOS: The submenu is a “Services” menu
/// </summary>
services
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum MenuType
{
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The separator
/// </summary>
separator,
/// <summary>
/// The submenu
/// </summary>
submenu,
/// <summary>
/// The checkbox
/// </summary>
checkbox,
/// <summary>
/// The radio
/// </summary>
radio
}
}

View File

@@ -0,0 +1,101 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MessageBoxOptions
{
/// <summary>
/// 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.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public MessageBoxType Type { get; set; }
/// <summary>
/// Array of texts for buttons. On Windows, an empty array will result in one button
/// labeled "OK".
/// </summary>
public string[] Buttons { get; set; }
/// <summary>
/// Index of the button in the buttons array which will be selected by default when
/// the message box opens.
/// </summary>
public int DefaultId { get; set; }
/// <summary>
/// Title of the message box, some platforms will not show it.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Content of the message box.
/// </summary>
public string Message { get; set; }
/// <summary>
/// Extra information of the message.
/// </summary>
public string Detail { get; set; }
/// <summary>
/// If provided, the message box will include a checkbox with the given label. The
/// checkbox state can be inspected only when using callback.
/// </summary>
public string CheckboxLabel { get; set; }
/// <summary>
/// Initial checked state of the checkbox. false by default.
/// </summary>
public bool CheckboxChecked { get; set; }
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>
/// The icon.
/// </value>
public string Icon { get; set; }
/// <summary>
/// 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.
/// </summary>
public int CancelId { get; set; }
/// <summary>
/// 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.
/// </summary>
public bool NoLink { get; set; }
/// <summary>
/// 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
/// 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
/// Linux.
/// </summary>
public bool NormalizeAccessKeys { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="MessageBoxOptions"/> class.
/// </summary>
/// <param name="message">The message.</param>
public MessageBoxOptions(string message)
{
Message = message;
}
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class MessageBoxResult
{
/// <summary>
/// Gets or sets the response.
/// </summary>
/// <value>
/// The response.
/// </value>
public int Response { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [checkbox checked].
/// </summary>
/// <value>
/// <c>true</c> if [checkbox checked]; otherwise, <c>false</c>.
/// </value>
public bool CheckboxChecked { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum MessageBoxType
{
/// <summary>
/// The none
/// </summary>
none,
/// <summary>
/// The information
/// </summary>
info,
/// <summary>
/// The error
/// </summary>
error,
/// <summary>
/// The question
/// </summary>
question,
/// <summary>
/// The warning
/// </summary>
warning
}
}

View File

@@ -0,0 +1,87 @@
namespace ElectronNET.API.Entities;
/// <summary>
/// Specifies the possible modifier keys for a keyboard input.
/// </summary>
public enum ModifierType
{
/// <summary>
/// The Shift key.
/// </summary>
shift,
/// <summary>
/// The Control key.
/// </summary>
control,
/// <summary>
/// The Control key (alias for control).
/// </summary>
ctrl,
/// <summary>
/// The Alt key.
/// </summary>
alt,
/// <summary>
/// The Meta key.
/// </summary>
meta,
/// <summary>
/// The Command key.
/// </summary>
command,
/// <summary>
/// The Command key (alias for command).
/// </summary>
cmd,
/// <summary>
/// Indicates whether the keypad modifier key is pressed.
/// </summary>
isKeypad,
/// <summary>
/// Indicates whether the key is an auto-repeated key.
/// </summary>
isAutoRepeat,
/// <summary>
/// Indicates whether the left mouse button is pressed.
/// </summary>
leftButtonDown,
/// <summary>
/// Indicates whether the middle mouse button is pressed.
/// </summary>
middleButtonDown,
/// <summary>
/// Indicates whether the right mouse button is pressed.
/// </summary>
rightButtonDown,
/// <summary>
/// The Caps Lock key.
/// </summary>
capsLock,
/// <summary>
/// The Num Lock key.
/// </summary>
numlock,
/// <summary>
/// The Left key.
/// </summary>
left,
/// <summary>
/// The Right key.
/// </summary>
right
}

View File

@@ -0,0 +1,453 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Native Image handler for Electron.NET
/// </summary>
[JsonConverter(typeof(NativeImageJsonConverter))]
public class NativeImage
{
private readonly Dictionary<float, Image> _images = new Dictionary<float, Image>();
private bool _isTemplateImage;
private static readonly Dictionary<string, float> ScaleFactorPairs = new Dictionary<string, float>
{
{"@2x", 2.0f}, {"@3x", 3.0f}, {"@1x", 1.0f}, {"@4x", 4.0f},
{"@5x", 5.0f}, {"@1.25x", 1.25f}, {"@1.33x", 1.33f}, {"@1.4x", 1.4f},
{"@1.5x", 1.5f}, {"@1.8x", 1.8f}, {"@2.5x", 2.5f}
};
private static float? ExtractDpiFromFilePath(string filePath)
{
var withoutExtension = Path.GetFileNameWithoutExtension(filePath);
return ScaleFactorPairs
.Where(p => withoutExtension.EndsWith(p.Key))
.Select(p => p.Value)
.FirstOrDefault();
}
private static Image BytesToImage(byte[] bytes)
{
var ms = new MemoryStream(bytes);
return Image.FromStream(ms);
}
/// <summary>
/// Creates an empty NativeImage
/// </summary>
public static NativeImage CreateEmpty()
{
return new NativeImage();
}
/// <summary>
///
/// </summary>
public static NativeImage CreateFromBitmap(Bitmap bitmap, CreateFromBitmapOptions options = null)
{
if (options is null)
{
options = new CreateFromBitmapOptions();
}
return new NativeImage(bitmap, options.ScaleFactor);
}
/// <summary>
/// Creates a NativeImage from a byte array.
/// </summary>
public static NativeImage CreateFromBuffer(byte[] buffer, CreateFromBufferOptions options = null)
{
if (options is null)
{
options = new CreateFromBufferOptions();
}
var ms = new MemoryStream(buffer);
var image = Image.FromStream(ms);
return new NativeImage(image, options.ScaleFactor);
}
/// <summary>
/// Creates a NativeImage from a base64 encoded data URL.
/// </summary>
/// <param name="dataUrl">A data URL with a base64 encoded image.</param>
public static NativeImage CreateFromDataURL(string dataUrl)
{
var images = new Dictionary<float,Image>();
var parsedDataUrl = Regex.Match(dataUrl, @"data:image/(?<type>.+?),(?<data>.+)");
var actualData = parsedDataUrl.Groups["data"].Value;
var binData = Convert.FromBase64String(actualData);
var image = BytesToImage(binData);
images.Add(1.0f, image);
return new NativeImage(images);
}
/// <summary>
/// Creates a NativeImage from an image on the disk.
/// </summary>
/// <param name="path">The path of the image</param>
public static NativeImage CreateFromPath(string path)
{
var images = new Dictionary<float,Image>();
if (Regex.IsMatch(path, "(@.+?x)"))
{
var dpi = ExtractDpiFromFilePath(path);
if (dpi == null)
{
throw new Exception($"Invalid scaling factor for '{path}'.");
}
images[dpi.Value] = Image.FromFile(path);
}
else
{
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
var extension = Path.GetExtension(path);
// Load as 1x dpi
images[1.0f] = Image.FromFile(path);
foreach (var scale in ScaleFactorPairs)
{
var fileName = $"{fileNameWithoutExtension}{scale}.{extension}";
if (File.Exists(fileName))
{
var dpi = ExtractDpiFromFilePath(fileName);
if (dpi != null)
{
images[dpi.Value] = Image.FromFile(fileName);
}
}
}
}
return new NativeImage(images);
}
/// <summary>
/// Creates an empty NativeImage
/// </summary>
public NativeImage()
{
}
/// <summary>
/// Creates a NativeImage from a bitmap and scale factor
/// </summary>
public NativeImage(Image bitmap, float scaleFactor = 1.0f)
{
_images.Add(scaleFactor, bitmap);
}
/// <summary>
/// Creates a NativeImage from a dictionary of scales and images.
/// </summary>
public NativeImage(Dictionary<float, Image> imageDictionary)
{
_images = imageDictionary;
}
/// <summary>
/// Crops the image specified by the input rectangle and computes scale factor
/// </summary>
public NativeImage Crop(Rectangle rect)
{
var images = new Dictionary<float,Image>();
foreach (var image in _images)
{
images.Add(image.Key, Crop(rect.X, rect.Y, rect.Width, rect.Height, image.Key));
}
return new NativeImage(images);
}
/// <summary>
/// Resizes the image and computes scale factor
/// </summary>
public NativeImage Resize(ResizeOptions options)
{
var images = new Dictionary<float, Image>();
foreach (var image in _images)
{
images.Add(image.Key, Resize(options.Width, options.Height, image.Key));
}
return new NativeImage(images);
}
/// <summary>
/// Add an image representation for a specific scale factor.
/// </summary>
/// <param name="options"></param>
public void AddRepresentation(AddRepresentationOptions options)
{
if (options.Buffer.Length > 0)
{
_images[options.ScaleFactor] =
CreateFromBuffer(options.Buffer, new CreateFromBufferOptions {ScaleFactor = options.ScaleFactor})
.GetScale(options.ScaleFactor);
}
else if (!string.IsNullOrEmpty(options.DataUrl))
{
_images[options.ScaleFactor] = CreateFromDataURL(options.DataUrl).GetScale(options.ScaleFactor);
}
}
/// <summary>
/// Gets the aspect ratio for the image based on scale factor
/// </summary>
/// <param name="scaleFactor">Optional</param>
public float GetAspectRatio(float scaleFactor = 1.0f)
{
var image = GetScale(scaleFactor);
if (image != null)
{
return image.Width / image.Height;
}
return 0f;
}
/// <summary>
/// Returns a byte array that contains the image's raw bitmap pixel data.
/// </summary>
public byte[] GetBitmap(BitmapOptions options)
{
return ToBitmap(new ToBitmapOptions{ ScaleFactor = options.ScaleFactor });
}
/// <summary>
/// Returns a byte array that contains the image's raw bitmap pixel data.
/// </summary>
public byte[] GetNativeHandle()
{
return ToBitmap(new ToBitmapOptions());
}
/// <summary>
/// Gets the size of the specified image based on scale factor
/// </summary>
public Size GetSize(float scaleFactor = 1.0f)
{
if (_images.ContainsKey(scaleFactor))
{
var image = _images[scaleFactor];
return new Size
{
Width = image.Width,
Height = image.Height
};
}
return null;
}
/// <summary>
/// Checks to see if the NativeImage instance is empty.
/// </summary>
public bool IsEmpty()
{
return _images.Count <= 0;
}
/// <summary>
/// Deprecated. Whether the image is a template image.
/// </summary>
public bool IsTemplateImage => _isTemplateImage;
/// <summary>
/// Deprecated. Marks the image as a template image.
/// </summary>
public void SetTemplateImage(bool option)
{
_isTemplateImage = option;
}
/// <summary>
/// Outputs a bitmap based on the scale factor
/// </summary>
public byte[] ToBitmap(ToBitmapOptions options)
{
return ImageToBytes(ImageFormat.Bmp, options.ScaleFactor);
}
/// <summary>
/// Outputs a data URL based on the scale factor
/// </summary>
public string ToDataURL(ToDataUrlOptions options)
{
if (!_images.ContainsKey(options.ScaleFactor))
{
return null;
}
var image = _images[options.ScaleFactor];
var mimeType = ImageCodecInfo.GetImageEncoders().FirstOrDefault(x => x.FormatID == image.RawFormat.Guid)?.MimeType;
if (mimeType is null)
{
mimeType = "image/png";
}
var bytes = ImageToBytes(image.RawFormat, options.ScaleFactor);
var base64 = Convert.ToBase64String(bytes);
return $"data:{mimeType};base64,{base64}";
}
/// <summary>
/// Outputs a JPEG for the default scale factor
/// </summary>
public byte[] ToJPEG(int quality)
{
return ImageToBytes(ImageFormat.Jpeg, 1.0f, quality);
}
/// <summary>
/// Outputs a PNG for the specified scale factor
/// </summary>
public byte[] ToPNG(ToPNGOptions options)
{
return ImageToBytes(ImageFormat.Png, options.ScaleFactor);
}
private byte[] ImageToBytes(ImageFormat imageFormat = null, float scaleFactor = 1.0f, int quality = 100)
{
using var ms = new MemoryStream();
if (_images.ContainsKey(scaleFactor))
{
var image = _images[scaleFactor];
var encoderCodecInfo = GetEncoder(imageFormat ?? image.RawFormat);
var encoder = Encoder.Quality;
var encoderParameters = new EncoderParameters(1)
{
Param = new[]
{
new EncoderParameter(encoder, quality)
}
};
image.Save(ms, encoderCodecInfo, encoderParameters);
return ms.ToArray();
}
return null;
}
private Image Resize(int? width, int? height, float scaleFactor = 1.0f)
{
if (!_images.ContainsKey(scaleFactor) || (width is null && height is null))
{
return null;
}
var image = _images[scaleFactor];
using (var g = Graphics.FromImage(image))
{
g.CompositingQuality = CompositingQuality.HighQuality;
var aspect = GetAspectRatio(scaleFactor);
width ??= Convert.ToInt32(image.Width * aspect);
height ??= Convert.ToInt32(image.Height * aspect);
width = Convert.ToInt32(width * scaleFactor);
height = Convert.ToInt32(height * scaleFactor);
var bmp = new Bitmap(width.Value, height.Value);
g.DrawImage(bmp,
new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height),
GraphicsUnit.Pixel);
return bmp;
}
}
private Image Crop(int? x, int? y, int? width, int? height, float scaleFactor = 1.0f)
{
if (!_images.ContainsKey(scaleFactor))
{
return null;
}
var image = _images[scaleFactor];
using (var g = Graphics.FromImage(image))
{
g.CompositingQuality = CompositingQuality.HighQuality;
x ??= 0;
y ??= 0;
x = Convert.ToInt32(x * scaleFactor);
y = Convert.ToInt32(y * scaleFactor);
width ??= image.Width;
height ??= image.Height;
width = Convert.ToInt32(width * scaleFactor);
height = Convert.ToInt32(height * scaleFactor);
var bmp = new Bitmap(width.Value, height.Value);
g.DrawImage(bmp, new System.Drawing.Rectangle(0, 0, image.Width, image.Height), new System.Drawing.Rectangle(x.Value, y.Value, width.Value, height.Value), GraphicsUnit.Pixel);
return bmp;
}
}
private ImageCodecInfo GetEncoder(ImageFormat format)
{
var codecs = ImageCodecInfo.GetImageDecoders();
foreach (ImageCodecInfo codec in codecs)
{
if (codec.FormatID == format.Guid)
{
return codec;
}
}
return null;
}
internal Dictionary<float,string> GetAllScaledImages()
{
var dict = new Dictionary<float,string>();
try
{
foreach (var (scale, image) in _images)
{
dict.Add(scale, Convert.ToBase64String(ImageToBytes(null, scale)));
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
return dict;
}
internal Image GetScale(float scaleFactor)
{
if (_images.ContainsKey(scaleFactor))
{
return _images[scaleFactor];
}
return null;
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
internal class NativeImageJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value is NativeImage nativeImage)
{
var scaledImages = nativeImage.GetAllScaledImages();
serializer.Serialize(writer, scaledImages);
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var dict = serializer.Deserialize<Dictionary<float, string>>(reader);
var newDictionary = new Dictionary<float, Image>();
foreach (var item in dict)
{
var bytes = Convert.FromBase64String(item.Value);
newDictionary.Add(item.Key, Image.FromStream(new MemoryStream(bytes)));
}
return new NativeImage(newDictionary);
}
public override bool CanConvert(Type objectType) => objectType == typeof(NativeImage);
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class NotificationAction
{
/// <summary>
/// The label for the given action.
/// </summary>
public string Text { get; set; }
/// <summary>
/// The type of action, can be button.
/// </summary>
public string Type { get; set; }
}
}

View File

@@ -0,0 +1,167 @@
using Newtonsoft.Json;
using System;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class NotificationOptions
{
/// <summary>
/// A title for the notification, which will be shown at the top of the notification
/// window when it is shown.
/// </summary>
public string Title { get; set; }
/// <summary>
/// A subtitle for the notification, which will be displayed below the title.
/// </summary>
public string SubTitle { get; set; }
/// <summary>
/// The body text of the notification, which will be displayed below the title or
/// subtitle.
/// </summary>
public string Body { get; set; }
/// <summary>
/// Whether or not to emit an OS notification noise when showing the notification.
/// </summary>
public bool Silent { get; set; }
/// <summary>
/// An icon to use in the notification.
/// </summary>
public string Icon { get; set; }
/// <summary>
/// Whether or not to add an inline reply option to the notification.
/// </summary>
public bool HasReply { get; set; }
/// <summary>
/// The timeout duration of the notification. Can be 'default' or 'never'.
/// </summary>
public string TimeoutType { get; set; }
/// <summary>
/// The placeholder to write in the inline reply input field.
/// </summary>
public string ReplyPlaceholder { get; set; }
/// <summary>
/// The name of the sound file to play when the notification is shown.
/// </summary>
public string Sound { get; set; }
/// <summary>
/// The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
/// </summary>
public string Urgency { get; set; }
/// <summary>
/// Actions to add to the notification. Please read the available actions and
/// limitations in the NotificationAction documentation.
/// </summary>
public NotificationAction Actions { get; set; }
/// <summary>
/// A custom title for the close button of an alert. An empty string will cause the
/// default localized text to be used.
/// </summary>
public string CloseButtonText { get; set; }
/// <summary>
/// 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()
/// method.
/// </summary>
[JsonIgnore]
public Action OnShow { get; set; }
/// <summary>
/// Gets or sets the show identifier.
/// </summary>
/// <value>
/// The show identifier.
/// </value>
[JsonProperty]
internal string ShowID { get; set; }
/// <summary>
/// Emitted when the notification is clicked by the user.
/// </summary>
[JsonIgnore]
public Action OnClick { get; set; }
/// <summary>
/// Gets or sets the click identifier.
/// </summary>
/// <value>
/// The click identifier.
/// </value>
[JsonProperty]
internal string ClickID { get; set; }
/// <summary>
/// Emitted when the notification is closed by manual intervention from the user.
///
/// This event is not guarunteed to be emitted in all cases where the notification is closed.
/// </summary>
[JsonIgnore]
public Action OnClose { get; set; }
/// <summary>
/// Gets or sets the close identifier.
/// </summary>
/// <value>
/// The close identifier.
/// </value>
[JsonProperty]
internal string CloseID { get; set; }
/// <summary>
/// macOS only: Emitted when the user clicks the “Reply” button on a notification with hasReply: true.
///
/// The string the user entered into the inline reply field
/// </summary>
[JsonIgnore]
public Action<string> OnReply { get; set; }
/// <summary>
/// Gets or sets the reply identifier.
/// </summary>
/// <value>
/// The reply identifier.
/// </value>
[JsonProperty]
internal string ReplyID { get; set; }
/// <summary>
/// macOS only - The index of the action that was activated
/// </summary>
[JsonIgnore]
public Action<string> OnAction { get; set; }
/// <summary>
/// Gets or sets the action identifier.
/// </summary>
/// <value>
/// The action identifier.
/// </value>
[JsonProperty]
internal string ActionID { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="NotificationOptions"/> class.
/// </summary>
/// <param name="title">The title.</param>
/// <param name="body">The body.</param>
public NotificationOptions(string title, string body)
{
Title = title;
Body = body;
}
}
}

View File

@@ -0,0 +1,55 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum OnTopLevel
{
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The floating
/// </summary>
floating,
/// <summary>
/// The torn off menu
/// </summary>
[Description("torn-off-menu")]
tornOffMenu,
/// <summary>
/// The modal panel
/// </summary>
[Description("modal-panel")]
modalPanel,
/// <summary>
/// The main menu
/// </summary>
[Description("main-menu")]
mainMenu,
/// <summary>
/// The status
/// </summary>
status,
/// <summary>
/// The pop up menu
/// </summary>
[Description("pop-up-menu")]
popUpMenu,
/// <summary>
/// The screen saver
/// </summary>
[Description("screen-saver")]
screenSaver
}
}

View File

@@ -0,0 +1,19 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class OpenDevToolsOptions
{
/// <summary>
/// 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.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public DevToolsMode Mode { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class OpenDialogOptions
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the default path.
/// </summary>
/// <value>
/// The default path.
/// </value>
public string DefaultPath { get; set; }
/// <summary>
/// Custom label for the confirmation button, when left empty the default label will be used.
/// </summary>
public string ButtonLabel { get; set; }
/// <summary>
/// Contains which features the dialog should use. The following values are supported:
/// 'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'
/// </summary>
[JsonProperty("properties", ItemConverterType = typeof(StringEnumConverter))]
public OpenDialogProperty[] Properties { get; set; }
/// <summary>
/// Message to display above input boxes.
/// </summary>
public string Message { get; set; }
/// <summary>
/// The filters specifies an array of file types that can be displayed or
/// selected when you want to limit the user to a specific type. For example:
/// </summary>
/// <example>
/// <code>
/// new FileFilter[]
/// {
/// new FileFiler { Name = "Images", Extensions = new string[] { "jpg", "png", "gif" } },
/// new FileFiler { Name = "Movies", Extensions = new string[] { "mkv", "avi", "mp4" } },
/// new FileFiler { Name = "Custom File Type", Extensions= new string[] {"as" } },
/// new FileFiler { Name = "All Files", Extensions= new string[] { "*" } }
/// }
/// </code>
/// </example>
public FileFilter[] Filters { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum OpenDialogProperty
{
/// <summary>
/// The open file
/// </summary>
openFile,
/// <summary>
/// The open directory
/// </summary>
openDirectory,
/// <summary>
/// The multi selections
/// </summary>
multiSelections,
/// <summary>
/// The show hidden files
/// </summary>
showHiddenFiles,
/// <summary>
/// The create directory
/// </summary>
createDirectory,
/// <summary>
/// The prompt to create
/// </summary>
promptToCreate,
/// <summary>
/// The no resolve aliases
/// </summary>
noResolveAliases,
/// <summary>
/// The treat package as directory
/// </summary>
treatPackageAsDirectory
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Controls the behavior of OpenExternal.
/// </summary>
public class OpenExternalOptions
{
/// <summary>
/// <see langword="true"/> to bring the opened application to the foreground. The default is <see langword="true"/>.
/// </summary>
[DefaultValue(true)]
public bool Activate { get; set; } = true;
/// <summary>
/// The working directory.
/// </summary>
public string WorkingDirectory { get; set; }
}
}

View File

@@ -0,0 +1,95 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the PathName enumeration.
/// </summary>
public enum PathName
{
/// <summary>
/// Users home directory.
/// </summary>
[Description("home")]
Home,
/// <summary>
/// Per-user application data directory.
/// </summary>
[Description("appData")]
AppData,
/// <summary>
/// The directory for storing your apps configuration files,
/// which by default it is the appData directory appended with your apps name.
/// </summary>
[Description("userData")]
UserData,
/// <summary>
/// Temporary directory.
/// </summary>
[Description("temp")]
Temp,
/// <summary>
/// The current executable file.
/// </summary>
[Description("exe")]
Exe,
/// <summary>
/// The libchromiumcontent library.
/// </summary>
[Description("Module")]
Module,
/// <summary>
/// The current users Desktop directory.
/// </summary>
[Description("desktop")]
Desktop,
/// <summary>
/// Directory for a users “My Documents”.
/// </summary>
[Description("documents")]
Documents,
/// <summary>
/// Directory for a users downloads.
/// </summary>
[Description("downloads")]
Downloads,
/// <summary>
/// Directory for a users music.
/// </summary>
[Description("music")]
Music,
/// <summary>
/// Directory for a users pictures.
/// </summary>
[Description("pictures")]
Pictures,
/// <summary>
/// Directory for a users videos.
/// </summary>
[Description("videos")]
Videos,
/// <summary>
/// The logs.
/// </summary>
[Description("logs")]
Logs,
/// <summary>
/// Full path to the system version of the Pepper Flash plugin.
/// </summary>
[Description("PepperFlashSystemPlugin")]
PepperFlashSystemPlugin
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Point
{
/// <summary>
/// Gets or sets the x.
/// </summary>
/// <value>
/// The x.
/// </value>
public int X { get; set; }
/// <summary>
/// Gets or sets the y.
/// </summary>
/// <value>
/// The y.
/// </value>
public int Y { get; set; }
}
}

View File

@@ -0,0 +1,107 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Print dpi
/// </summary>
public class PrintDpi
{
/// <summary>
/// The horizontal dpi
/// </summary>
public float Horizontal { get; set; }
/// <summary>
/// The vertical dpi
/// </summary>
public float Vertical { get; set; }
}
/// <summary>
/// The page range to print
/// </summary>
public class PrintPageRange
{
/// <summary>
/// From
/// </summary>
public int From { get; set; }
/// <summary>
/// To
/// </summary>
public int To { get; set; }
}
/// <summary>
/// Print options
/// </summary>
public class PrintOptions
{
/// <summary>
/// Don't ask user for print settings
/// </summary>
public bool Silent { get; set; }
/// <summary>
/// Prints the background color and image of the web page
/// </summary>
public bool PrintBackground { get; set; }
/// <summary>
/// Set the printer device name to use
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// Set whether the printed web page will be in color or grayscale
/// </summary>
public bool Color { get; set; }
/// <summary>
/// Specifies the type of margins to use. Uses 0 for default margin, 1 for no
/// margin, and 2 for minimum margin.
/// </summary>
public int MarginsType { get; set; }
/// <summary>
/// true for landscape, false for portrait.
/// </summary>
public bool Landscape { get; set; }
/// <summary>
/// The scale factor of the web page
/// </summary>
public float ScaleFactor { get; set; }
/// <summary>
/// The number of pages to print per page sheet
/// </summary>
public int PagesPerSheet { get; set; }
/// <summary>
/// The number of copies of the web page to print
/// </summary>
public bool Copies { get; set; }
/// <summary>
/// Whether the web page should be collated
/// </summary>
public bool Collate { get; set; }
/// <summary>
/// The page range to print
/// </summary>
public PrintPageRange PageRanges { get; set; }
/// <summary>
/// Set the duplex mode of the printed web page. Can be simplex, shortEdge, or longEdge.
/// </summary>
public string DuplexMode { get; set; }
/// <summary>
/// Dpi
/// </summary>
public PrintDpi Dpi { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
namespace ElectronNET.API.Entities;
/// <summary>
///
/// </summary>
public class PrintToPDFOptions
{
/// <summary>
/// Paper orientation. `true` for landscape, `false` for portrait. Defaults to false.
/// </summary>
public bool Landscape { get; set; } = false;
/// <summary>
/// Whether to display header and footer. Defaults to false.
/// </summary>
public bool DisplayHeaderFooter { get; set; } = false;
/// <summary>
/// Whether to print background graphics. Defaults to false.
/// </summary>
public bool PrintBackground { get; set; } = false;
/// <summary>
/// Scale of the webpage rendering. Defaults to 1.
/// </summary>
public double Scale { get; set; } = 1;
/// <summary>
/// Specify 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`.
/// </summary>
public string PageSize { get; set; } = "Letter";
/// <summary>
/// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string,
/// which means print all pages.
/// </summary>
public string PageRanges { get; set; } = "";
/// <summary>
/// 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, `<span class="title"></span>`
/// would generate span containing the title.
/// </summary>
public string HeaderTemplate { get; set; }
/// <summary>
/// HTML template for the print footer. Should use the same format as the
/// `headerTemplate`.
/// </summary>
public string FooterTemplate { get; set; }
/// <summary>
/// Whether or not to prefer page size as defined by css. Defaults to false, in
/// which case the content will be scaled to fit the paper size.
/// </summary>
public bool PreferCSSPageSize { get; set; } = false;
public Margins Margins { get; set; }
}

View File

@@ -0,0 +1,29 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Printer info
/// </summary>
public class PrinterInfo
{
/// <summary>
/// Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Name
/// </summary>
public string Description { get; set; }
/// <summary>
/// Status
/// </summary>
public int Status { get; set; }
/// <summary>
/// Is default
/// </summary>
public bool IsDefault { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProcessMetric
{
/// <summary>
/// Process id of the process.
/// </summary>
public int PId { get; set; }
/// <summary>
/// Process type (Browser or Tab or GPU etc).
/// </summary>
public string Type { get; set; }
/// <summary>
/// CPU usage of the process.
/// </summary>
public CPUUsage Cpu { get; set; }
/// <summary>
/// Creation time for this process. The time is represented as number of milliseconds since epoch.
/// Since the <see cref="PId"/> can be reused after a process dies, it is useful to use both the <see cref="PId"/>
/// and the <see cref="CreationTime"/> to uniquely identify a process.
/// </summary>
public int CreationTime { get; set; }
/// <summary>
/// Memory information for the process.
/// </summary>
public MemoryInfo Memory { get; set; }
/// <summary>
/// Whether the process is sandboxed on OS level.
/// </summary>
public bool Sandboxed { get; set; }
/// <summary>
/// One of the following values:
/// untrusted | low | medium | high | unknown
/// </summary>
public string IntegrityLevel { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum ProgressBarMode
{
/// <summary>
/// The none
/// </summary>
none,
/// <summary>
/// The normal
/// </summary>
normal,
/// <summary>
/// The indeterminate
/// </summary>
indeterminate,
/// <summary>
/// The error
/// </summary>
error,
/// <summary>
/// The paused
/// </summary>
paused
}
}

View File

@@ -0,0 +1,17 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProgressBarOptions
{
/// <summary>
/// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public ProgressBarMode Mode { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProgressInfo
{
/// <summary>
///
/// </summary>
public string Progress { get; set; }
/// <summary>
///
/// </summary>
public string BytesPerSecond { get; set; }
/// <summary>
///
/// </summary>
public string Percent { get; set; }
/// <summary>
///
/// </summary>
public string Total { get; set; }
/// <summary>
///
/// </summary>
public string Transferred { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ProxyConfig
{
/// <summary>
/// The URL associated with the PAC file.
/// </summary>
public string PacScript { get; set; }
/// <summary>
/// Rules indicating which proxies to use.
/// </summary>
public string ProxyRules { get; set; }
/// <summary>
/// Rules indicating which URLs should bypass the proxy settings.
/// </summary>
public string ProxyBypassRules { get; set; }
/// <summary>
///
/// </summary>
/// <param name="pacScript">The URL associated with the PAC file.</param>
/// <param name="proxyRules">Rules indicating which proxies to use.</param>
/// <param name="proxyBypassRules">Rules indicating which URLs should bypass the proxy settings.</param>
public ProxyConfig(string pacScript, string proxyRules, string proxyBypassRules)
{
PacScript = pacScript;
ProxyRules = proxyRules;
ProxyBypassRules = proxyBypassRules;
}
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ReadBookmark
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>
/// The URL.
/// </value>
public string Url { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Rectangle
{
/// <summary>
/// Gets or sets the x.
/// </summary>
/// <value>
/// The x.
/// </value>
public int X { get; set; }
/// <summary>
/// Gets or sets the y.
/// </summary>
/// <value>
/// The y.
/// </value>
public int Y { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
public int Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>
/// The height.
/// </value>
public int Height { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Controls the behavior of <see cref="App.Relaunch(RelaunchOptions)"/>.
/// </summary>
public class RelaunchOptions
{
/// <summary>
/// Gets or sets the arguments.
/// </summary>
/// <value>
/// The arguments.
/// </value>
public string[] Args { get; set; }
/// <summary>
/// Gets or sets the execute path.
/// </summary>
/// <value>
/// The execute path.
/// </value>
public string ExecPath { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ReleaseNoteInfo
{
/// <summary>
/// The version.
/// </summary>
public string Version { get; set; }
/// <summary>
/// The note.
/// </summary>
public string Note { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class RemovePassword
{
/// <summary>
/// When provided, the authentication info related to the origin will only be
/// removed otherwise the entire cache will be cleared.
/// </summary>
public string Origin { get; set; }
/// <summary>
/// Credentials of the authentication. Must be provided if removing by origin.
/// </summary>
public string Password { get; set; }
/// <summary>
/// Realm of the authentication. Must be provided if removing by origin.
/// </summary>
public string Realm { get; set; }
/// <summary>
/// Scheme of the authentication. Can be basic, digest, ntlm, negotiate.
/// Must be provided if removing by origin.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public Scheme Scheme { get; set; }
/// <summary>
/// password.
/// </summary>
public string Type { get; set; }
/// <summary>
/// Credentials of the authentication. Must be provided if removing by origin.
/// </summary>
public string Username { get; set; }
/// <summary>
///
/// </summary>
/// <param name="type">password.</param>
public RemovePassword(string type)
{
Type = type;
}
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ResizeOptions
{
/// <summary>
/// Gets or sets the width
/// </summary>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height
/// </summary>
public int? Height { get; set; }
/// <summary>
/// good, better, or best. Default is "best";
/// </summary>
public string Quality { get; set; } = "best";
}
}

View File

@@ -0,0 +1,61 @@
using ElectronNET.API.Entities;
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public class SaveDialogOptions
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Absolute directory path, absolute file path, or file name to use by default.
/// </summary>
public string DefaultPath { get; set; }
/// <summary>
/// Custom label for the confirmation button, when left empty the default label will
/// be used.
/// </summary>
public string ButtonLabel { get; set; }
/// <summary>
/// The filters specifies an array of file types that can be displayed or
/// selected when you want to limit the user to a specific type. For example:
/// </summary>
/// <example>
/// <code>
/// new FileFilter[]
/// {
/// new FileFiler { Name = "Images", Extensions = new string[] { "jpg", "png", "gif" } },
/// new FileFiler { Name = "Movies", Extensions = new string[] { "mkv", "avi", "mp4" } },
/// new FileFiler { Name = "Custom File Type", Extensions= new string[] {"as" } },
/// new FileFiler { Name = "All Files", Extensions= new string[] { "*" } }
/// }
/// </code>
/// </example>
public FileFilter[] Filters { get; set; }
/// <summary>
/// Message to display above text fields.
/// </summary>
public string Message { get; set; }
/// <summary>
/// Custom label for the text displayed in front of the filename text field.
/// </summary>
public string NameFieldLabel { get; set; }
/// <summary>
/// Show the tags input box, defaults to true.
/// </summary>
public bool ShowsTagField { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum Scheme
{
/// <summary>
///
/// </summary>
basic,
/// <summary>
///
/// </summary>
digest,
/// <summary>
///
/// </summary>
ntlm,
/// <summary>
///
/// </summary>
negotiate
}
}

View File

@@ -0,0 +1,59 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class SemVer
{
/// <summary>
///
/// </summary>
public string Raw { get; set; }
/// <summary>
///
/// </summary>
public bool Loose { get; set; }
/// <summary>
///
/// </summary>
public SemVerOptions Options { get; set; }
/// <summary>
///
/// </summary>
public int Major { get; set; }
/// <summary>
///
/// </summary>
public int Minor { get; set; }
/// <summary>
///
/// </summary>
public int Patch { get; set; }
/// <summary>
///
/// </summary>
public string Version { get; set; }
/// <summary>
///
/// </summary>
public string[] Build { get; set; }
/// <summary>
///
/// </summary>
public string[] Prerelease { get; set; }
}
/// <summary>
///
/// </summary>
public class SemVerOptions {
/// <summary>
///
/// </summary>
public bool? Loose { get; set; }
/// <summary>
///
/// </summary>
public bool? IncludePrerelease { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
namespace ElectronNET.API.Entities
{
/// <summary>
/// Structure of a shortcut.
/// </summary>
public class ShortcutDetails
{
/// <summary>
/// The Application User Model ID. Default is <see cref="string.Empty"/>.
/// </summary>
public string AppUserModelId { get; set; }
/// <summary>
/// The arguments to be applied to <see cref="Target"/> when launching from this shortcut. Default is <see cref="string.Empty"/>.
/// </summary>
public string Args { get; set; }
/// <summary>
/// The working directory. Default is <see cref="string.Empty"/>.
/// </summary>
public string Cwd { get; set; }
/// <summary>
/// The description of the shortcut. Default is <see cref="string.Empty"/>.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The path to the icon, can be a DLL or EXE. <see cref="Icon"/> and <see cref="IconIndex"/> have to be set
/// together. Default is <see cref="string.Empty"/>, which uses the target's icon.
/// </summary>
public string Icon { get; set; }
/// <summary>
/// The resource ID of icon when <see cref="Icon"/> is a DLL or EXE. Default is 0.
/// </summary>
public int IconIndex { get; set; }
/// <summary>
/// The target to launch from this shortcut.
/// </summary>
public string Target { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the ShortcutLinkOperation enumeration.
/// </summary>
public enum ShortcutLinkOperation
{
/// <summary>
/// Creates a new shortcut, overwriting if necessary.
/// </summary>
[Description("create")]
Create,
/// <summary>
/// Updates specified properties only on an existing shortcut.
/// </summary>
[Description("update")]
Update,
/// <summary>
/// Overwrites an existing shortcut, fails if the shortcut doesn't exist.
/// </summary>
[Description("replace")]
Replace
}
}

View File

@@ -0,0 +1,24 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class Size
{
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
public int Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>
/// The height.
/// </value>
public int Height { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel;
namespace ElectronNET.API.Entities
{
/// <summary>
/// Defines the ThemeSourceMode enumeration.
/// </summary>
public enum ThemeSourceMode
{
/// <summary>
/// Operating system default.
/// </summary>
[Description("system")]
System,
/// <summary>
/// Light theme.
/// </summary>
[Description("light")]
Light,
/// <summary>
/// Dark theme.
/// </summary>
[Description("dark")]
Dark
}
}

View File

@@ -0,0 +1,61 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ThumbarButton
{
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
public string Id { get; internal set; }
/// <summary>
/// Gets or sets the click.
/// </summary>
/// <value>
/// The click.
/// </value>
[JsonIgnore]
public Action Click { get; set; }
/// <summary>
/// Control specific states and behaviors of the button. By default, it is ["enabled"].
///
/// enabled - The button is active and available to the user.
/// disabled - The button is disabled.It is present, but has a visual state indicating it will not respond to user action.
/// dismissonclick - When the button is clicked, the thumbnail window closes immediately.
/// nobackground - Do not draw a button border, use only the image.
/// hidden - The button is not shown to the user.
/// noninteractive - The button is enabled but not interactive; no pressed button state is drawn.This value is intended for instances where the button is used in a notification.
/// </summary>
[JsonProperty("flags", ItemConverterType = typeof(StringEnumConverter))]
public ThumbarButtonFlag[] Flags { get; set; }
/// <summary>
/// The icon showing in thumbnail toolbar.
/// </summary>
public string Icon { get; set; }
/// <summary>
/// The text of the button's tooltip.
/// </summary>
public string Tooltip { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ThumbarButton"/> class.
/// </summary>
/// <param name="icon">The icon.</param>
public ThumbarButton(string icon)
{
Icon = icon;
}
}
}

View File

@@ -0,0 +1,38 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum ThumbarButtonFlag
{
/// <summary>
/// The button is active and available to the user.
/// </summary>
enabled,
/// <summary>
/// The button is disabled.It is present, but has a visual state indicating it will not respond to user action.
/// </summary>
disabled,
/// <summary>
/// When the button is clicked, the thumbnail window closes immediately.
/// </summary>
dismissonclick,
/// <summary>
/// Do not draw a button border, use only the image.
/// </summary>
nobackground,
/// <summary>
/// The button is not shown to the user.
/// </summary>
hidden,
/// <summary>
/// The button is enabled but not interactive; no pressed button state is drawn.This value is intended for instances where the button is used in a notification.
/// </summary>
noninteractive
}
}

View File

@@ -0,0 +1,31 @@
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public enum TitleBarStyle
{
/// <summary>
/// The default style
/// </summary>
[JsonProperty("default")]
defaultStyle,
/// <summary>
/// The hidden
/// </summary>
hidden,
/// <summary>
/// The hidden inset
/// </summary>
hiddenInset,
/// <summary>
/// The custom buttons on hover
/// </summary>
customButtonsOnHover
}
}

View File

@@ -0,0 +1,13 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ToBitmapOptions
{
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,13 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ToDataUrlOptions
{
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,13 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class ToPNGOptions
{
/// <summary>
/// Gets or sets the scalefactor
/// </summary>
public float ScaleFactor { get; set; } = 1.0f;
}
}

View File

@@ -0,0 +1,40 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public class TrayClickEventArgs
{
/// <summary>
/// Gets or sets a value indicating whether [alt key].
/// </summary>
/// <value>
/// <c>true</c> if [alt key]; otherwise, <c>false</c>.
/// </value>
public bool AltKey { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [shift key].
/// </summary>
/// <value>
/// <c>true</c> if [shift key]; otherwise, <c>false</c>.
/// </value>
public bool ShiftKey { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [control key].
/// </summary>
/// <value>
/// <c>true</c> if [control key]; otherwise, <c>false</c>.
/// </value>
public bool CtrlKey { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [meta key].
/// </summary>
/// <value>
/// <c>true</c> if [meta key]; otherwise, <c>false</c>.
/// </value>
public bool MetaKey { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class UpdateCancellationToken
{
/// <summary>
///
/// </summary>
public bool Cancelled { get; set; }
/// <summary>
///
/// </summary>
public void Cancel()
{
}
/// <summary>
///
/// </summary>
public void Dispose()
{
}
}
}

View File

@@ -0,0 +1,23 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class UpdateCheckResult
{
/// <summary>
///
/// </summary>
public UpdateInfo UpdateInfo { get; set; } = new UpdateInfo();
/// <summary>
///
/// </summary>
public string[] Download { get; set; }
/// <summary>
///
/// </summary>
public UpdateCancellationToken CancellationToken { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class UpdateFileInfo : BlockMapDataHolder
{
/// <summary>
///
/// </summary>
public string Url { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
namespace ElectronNET.API.Entities
{
/// <summary>
///
/// </summary>
public class UpdateInfo
{
/// <summary>
/// The version.
/// </summary>
public string Version { get; set; }
/// <summary>
///
/// </summary>
public UpdateFileInfo[] Files { get; set; } = new UpdateFileInfo[0];
/// <summary>
/// The release name.
/// </summary>
public string ReleaseName { get; set; }
/// <summary>
/// The release notes.
/// </summary>
public ReleaseNoteInfo[] ReleaseNotes { get; set; } = new ReleaseNoteInfo[0];
/// <summary>
///
/// </summary>
public string ReleaseDate { get; set; }
/// <summary>
/// The staged rollout percentage, 0-100.
/// </summary>
public int StagingPercentage { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More