Implement all functions from the Electron App-API

This commit is contained in:
Gregor Biswanger
2017-10-14 00:06:58 +02:00
parent 5f0be6543b
commit aa526c4bcb
24 changed files with 1448 additions and 17 deletions

View File

@@ -0,0 +1,30 @@
namespace ElectronNET.API.Entities
{
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>
/// Credit information.
/// </summary>
public string Credits { get; set; }
/// <summary>
/// The app's build version number.
/// </summary>
public string Version { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
namespace ElectronNET.API.Entities
{
public class CPUUsage
{
/// <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; }
/// <summary>
/// Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
/// </summary>
public int PercentCPUUsage { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace ElectronNET.API
{
public enum DockBounceType
{
critical,
informational
}
}

View File

@@ -0,0 +1,12 @@
namespace ElectronNET.API.Entities
{
public class FileIconOptions
{
public string Size { get; private set; }
public FileIconOptions(FileIconSize fileIconSize)
{
Size = fileIconSize.ToString();
}
}
}

View File

@@ -0,0 +1,9 @@
namespace ElectronNET.API.Entities
{
public enum FileIconSize
{
small,
normal,
large
}
}

View File

@@ -0,0 +1,82 @@
using Newtonsoft.Json;
namespace ElectronNET.API.Entities
{
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,15 @@
namespace ElectronNET.API.Entities
{
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,11 @@
using ElectronNET.API.Entities;
namespace ElectronNET.API
{
public class JumpListCategory
{
public string Name { get; set; } = string.Empty;
public JumpListItem[] Items { get; set; } = new JumpListItem[0];
public string Type { get; set; } = "tasks";
}
}

View File

@@ -0,0 +1,14 @@
namespace ElectronNET.API.Entities
{
public class JumpListItem
{
public string Args { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public int IconIndex { get; set; } = 0;
public string IconPath { get; set; } = string.Empty;
public string Path { get; set; } = string.Empty;
public string Program { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Type {get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace ElectronNET.API.Entities
{
public class JumpListSettings
{
public int MinItems { get; set; } = 0;
public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0];
}
}

View File

@@ -0,0 +1,36 @@
namespace ElectronNET.API.Entities
{
public class LoginItemSettings
{
/// <summary>
/// true if the app is set to open at login.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// true if the app is set to open as hidden at login. This setting is only
/// supported on macOS.
/// </summary>
public bool OpenAsHidden { get; set; }
/// <summary>
/// true if the app was opened at login automatically. This setting is only
/// supported on macOS.
/// </summary>
public bool WasOpenedAtLogin { get; set; }
/// <summary>
/// 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 only supported on macOS.
/// </summary>
public bool WasOpenedAsHidden { get; set; }
/// <summary>
/// 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 only supported
/// on macOS.
/// </summary>
public bool RestoreState { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace ElectronNET.API.Entities
{
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,30 @@
namespace ElectronNET.API.Entities
{
public class LoginSettings
{
/// <summary>
/// true to open the app at login, false to remove the app as a login item. Defaults
/// to false.
/// </summary>
public bool OpenAtLogin { get; set; }
/// <summary>
/// true to open the app as hidden. Defaults to false. The user can edit this
/// setting from the System Preferences so
/// app.getLoginItemStatus().wasOpenedAsHidden should be checked when the app is
/// opened to know the current value.This setting is only supported on macOS.
/// </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
{
public class MemoryInfo
{
/// <summary>
/// The maximum amount of memory that has ever been pinned to actual physical RAM.
/// On macOS its value will always be 0.
/// </summary>
public int PeakWorkingSetSize { get; set; }
/// <summary>
/// Process id of the process.
/// </summary>
public int Pid { 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; }
/// <summary>
/// The amount of memory shared between processes, typically memory consumed by the
/// Electron code itself
/// </summary>
public int SharedBytes { get; set; }
/// <summary>
/// The amount of memory currently pinned to actual physical RAM.
/// </summary>
public int WorkingSetSize {get; set; }
}
}

View File

@@ -0,0 +1,106 @@
namespace ElectronNET.API.Entities
{
// TODO: Fertig coden
public class NativeImage
{
// public static NativeImage CreateEmpty()
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromBuffer(byte[] buffer)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromBuffer(byte[] buffer, CreateFromBufferOptions options)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromDataURL(string dataURL)
// {
// throw new NotImplementedException();
// }
// public static NativeImage CreateFromPath(string path)
// {
// throw new NotImplementedException();
// }
// public void AddRepresentation(AddRepresentationOptions options)
// {
// throw new NotImplementedException();
// }
// public NativeImage Crop(Rectangle rect)
// {
// throw new NotImplementedException();
// }
// public int GetAspectRatio()
// {
// throw new NotImplementedException();
// }
// public byte[] GetBitmap()
// {
// throw new NotImplementedException();
// }
// public byte[] GetBitmap(BitmapOptions options)
// {
// throw new NotImplementedException();
// }
// public byte[] GetNativeHandle()
// {
// throw new NotImplementedException();
// }
// public Size GetSize()
// {
// throw new NotImplementedException();
// }
// public bool IsEmpty()
// {
// throw new NotImplementedException();
// }
// public bool IsTemplateImage()
// {
// throw new NotImplementedException();
// }
// public NativeImage Resize(ResizeOptions options)
// {
// throw new NotImplementedException();
// }
// public void SetTemplateImage(bool option)
// {
// throw new NotImplementedException();
// }
// public byte[] ToBitmap(ToBitmapOptions options)
// {
// throw new NotImplementedException();
// }
// public string ToDataURL(ToDataURLOptions options)
// {
// throw new NotImplementedException();
// }
// public byte[] ToJPEG(int quality)
// {
// throw new NotImplementedException();
// }
// public byte[] ToPNG(ToPNGOptions options)
// {
// throw new NotImplementedException();
// }
}
}

View File

@@ -0,0 +1,25 @@
namespace ElectronNET.API.Entities
{
public class ProcessMetric
{
/// <summary>
/// CPU usage of the process.
/// </summary>
public CPUUsage Cpu { get; set; }
/// <summary>
/// Memory information for the process.
/// </summary>
public MemoryInfo Memory {get; set;}
/// <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; }
}
}

View File

@@ -0,0 +1,12 @@
namespace ElectronNET.API.Entities
{
public class UserTask
{
public string Arguments { get; set; }
public string Description { get; set; }
public int IconIndex { get; set; }
public string IconPath { get; set; }
public string Program { get; set; }
public string Title { get; set; }
}
}