mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-15 13:16:03 +00:00
Implement all functions from the Electron App-API
This commit is contained in:
@@ -86,6 +86,7 @@ namespace ElectronNET.API
|
||||
|
||||
_socket.On("appGetAppPathCompleted", (path) =>
|
||||
{
|
||||
_socket.Off("appGetAppPathCompleted");
|
||||
taskCompletionSource.SetResult(path.ToString());
|
||||
});
|
||||
|
||||
@@ -100,6 +101,8 @@ namespace ElectronNET.API
|
||||
|
||||
_socket.On("appGetPathCompleted", (path) =>
|
||||
{
|
||||
_socket.Off("appGetPathCompleted");
|
||||
|
||||
taskCompletionSource.SetResult(path.ToString());
|
||||
});
|
||||
|
||||
@@ -108,6 +111,593 @@ namespace ElectronNET.API
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void Blub2() { }
|
||||
// TODO: Fertig coden
|
||||
//public async static Task<NativeImage> GetFileIconAsync(string filePath)
|
||||
//{
|
||||
// var taskCompletionSource = new TaskCompletionSource<NativeImage>();
|
||||
|
||||
// _socket.On("appGetFileIconCompleted", (results) =>
|
||||
// {
|
||||
// _socket.Off("appGetFileIconCompleted");
|
||||
|
||||
// byte[] test = ((JArray)results).Last.ToObject<byte[]>();
|
||||
|
||||
|
||||
// //object[] result = results as object[];
|
||||
// //NativeImage nativeImage = (NativeImage)result[1];
|
||||
// //taskCompletionSource.SetResult(nativeImage);
|
||||
// });
|
||||
// _socket.Emit("appGetFileIcon", filePath);
|
||||
|
||||
// return await taskCompletionSource.Task;
|
||||
//}
|
||||
|
||||
// TODO: Fertig coden
|
||||
//public async static Task<NativeImage> GetFileIconAsync(string filePath, FileIconOptions fileIconOptions)
|
||||
//{
|
||||
// var taskCompletionSource = new TaskCompletionSource<NativeImage>();
|
||||
|
||||
// _socket.On("appGetFileIconCompleted", (results) =>
|
||||
// {
|
||||
// _socket.Off("appGetFileIconCompleted");
|
||||
|
||||
// object[] result = results as object[];
|
||||
// NativeImage nativeImage = (NativeImage)result[1];
|
||||
// taskCompletionSource.SetResult(nativeImage);
|
||||
// });
|
||||
// _socket.Emit("appGetFileIcon", filePath, JObject.FromObject(fileIconOptions, _jsonSerializer));
|
||||
|
||||
// return await taskCompletionSource.Task;
|
||||
//}
|
||||
|
||||
public static void SetPath(string name, string path)
|
||||
{
|
||||
_socket.Emit("appSetPath", name, path);
|
||||
}
|
||||
|
||||
public async static Task<string> GetVersionAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
_socket.On("appGetVersionCompleted", (version) =>
|
||||
{
|
||||
_socket.Off("appGetVersionCompleted");
|
||||
taskCompletionSource.SetResult(version.ToString());
|
||||
});
|
||||
|
||||
_socket.Emit("appGetVersion");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<string> GetNameAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
_socket.On("appGetNameCompleted", (name) =>
|
||||
{
|
||||
_socket.Off("appGetNameCompleted");
|
||||
taskCompletionSource.SetResult(name.ToString());
|
||||
});
|
||||
|
||||
_socket.Emit("appGetName");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void SetName(string name)
|
||||
{
|
||||
_socket.Emit("appSetName", name);
|
||||
}
|
||||
|
||||
public async static Task<string> GetLocaleAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
_socket.On("appGetLocaleCompleted", (locale) =>
|
||||
{
|
||||
_socket.Off("appGetLocaleCompleted");
|
||||
taskCompletionSource.SetResult(locale.ToString());
|
||||
});
|
||||
|
||||
_socket.Emit("appGetLocale");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void AddRecentDocument(string path)
|
||||
{
|
||||
_socket.Emit("appAddRecentDocument", path);
|
||||
}
|
||||
|
||||
public static void ClearRecentDocuments()
|
||||
{
|
||||
_socket.Emit("appClearRecentDocuments");
|
||||
}
|
||||
|
||||
public async static Task<bool> SetAsDefaultProtocolClientAsync(string protocol)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appSetAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appSetAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appSetAsDefaultProtocolClient", protocol);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> SetAsDefaultProtocolClientAsync(string protocol, string path)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appSetAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appSetAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appSetAsDefaultProtocolClient", protocol, path);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appSetAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appSetAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appSetAsDefaultProtocolClient", protocol, path, args);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appRemoveAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appRemoveAsDefaultProtocolClient", protocol);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appRemoveAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appRemoveAsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path, args);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> IsDefaultProtocolClientAsync(string protocol)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appIsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appIsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appIsDefaultProtocolClient", protocol);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> IsDefaultProtocolClientAsync(string protocol, string path)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appIsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appIsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appIsDefaultProtocolClient", protocol, path);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> IsDefaultProtocolClientAsync(string protocol, string path, string[] args)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appIsDefaultProtocolClientCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appIsDefaultProtocolClientCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appIsDefaultProtocolClient", protocol, path, args);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> SetUserTasksAsync(UserTask[] userTasks)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appSetUserTasksCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appSetUserTasksCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appSetUserTasks", JObject.FromObject(userTasks, _jsonSerializer));
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<JumpListSettings> GetJumpListSettingsAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<JumpListSettings>();
|
||||
|
||||
_socket.On("appGetJumpListSettingsCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appGetJumpListSettingsCompleted");
|
||||
taskCompletionSource.SetResult(JObject.Parse(success.ToString()).ToObject<JumpListSettings>());
|
||||
});
|
||||
|
||||
_socket.Emit("appGetJumpListSettings");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void SetJumpList(JumpListCategory[] jumpListCategories)
|
||||
{
|
||||
_socket.Emit("appSetJumpList", JObject.FromObject(jumpListCategories, _jsonSerializer));
|
||||
}
|
||||
|
||||
public async static Task<bool> MakeSingleInstanceAsync(Action<string[], string> newInstanceOpened)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appMakeSingleInstanceCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appMakeSingleInstanceCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Off("newInstanceOpened");
|
||||
_socket.On("newInstanceOpened", (result) =>
|
||||
{
|
||||
JArray results = (JArray)result;
|
||||
string[] args = results.First.ToObject<string[]>();
|
||||
string workdirectory = results.Last.ToObject<string>();
|
||||
|
||||
newInstanceOpened(args, workdirectory);
|
||||
});
|
||||
|
||||
_socket.Emit("appMakeSingleInstance");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void ReleaseSingleInstance()
|
||||
{
|
||||
_socket.Emit("appReleaseSingleInstance");
|
||||
}
|
||||
|
||||
public static void SetUserActivity(string type, object userInfo)
|
||||
{
|
||||
_socket.Emit("appSetUserActivity", type, userInfo);
|
||||
}
|
||||
|
||||
public static void SetUserActivity(string type, object userInfo, string webpageURL)
|
||||
{
|
||||
_socket.Emit("appSetUserActivity", type, userInfo, webpageURL);
|
||||
}
|
||||
|
||||
public async static Task<string> GetCurrentActivityTypeAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
_socket.On("appGetCurrentActivityTypeCompleted", (activityType) =>
|
||||
{
|
||||
_socket.Off("appGetCurrentActivityTypeCompleted");
|
||||
taskCompletionSource.SetResult(activityType.ToString());
|
||||
});
|
||||
|
||||
_socket.Emit("appGetCurrentActivityType");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void SetAppUserModelId(string id)
|
||||
{
|
||||
_socket.Emit("appSetAppUserModelId", id);
|
||||
}
|
||||
|
||||
public async static Task<int> ImportCertificateAsync(ImportCertificateOptions options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<int>();
|
||||
|
||||
_socket.On("appImportCertificateCompleted", (result) =>
|
||||
{
|
||||
_socket.Off("appImportCertificateCompleted");
|
||||
taskCompletionSource.SetResult((int)result);
|
||||
});
|
||||
|
||||
_socket.Emit("appImportCertificate", JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<ProcessMetric[]> GetAppMetricsAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<ProcessMetric[]>();
|
||||
|
||||
_socket.On("appGetAppMetricsCompleted", (result) =>
|
||||
{
|
||||
_socket.Off("appGetAppMetricsCompleted");
|
||||
var processMetrics = ((JArray)result).ToObject<ProcessMetric[]>();
|
||||
|
||||
taskCompletionSource.SetResult(processMetrics);
|
||||
});
|
||||
|
||||
_socket.Emit("appGetAppMetrics");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<GPUFeatureStatus> GetGpuFeatureStatusAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<GPUFeatureStatus>();
|
||||
|
||||
_socket.On("appGetGpuFeatureStatusCompleted", (result) =>
|
||||
{
|
||||
_socket.Off("appGetGpuFeatureStatusCompleted");
|
||||
var gpuFeatureStatus = ((JObject)result).ToObject<GPUFeatureStatus>();
|
||||
|
||||
taskCompletionSource.SetResult(gpuFeatureStatus);
|
||||
});
|
||||
|
||||
_socket.Emit("appGetGpuFeatureStatus");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> SetBadgeCountAsync(int count)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appSetBadgeCountCompleted", (success) =>
|
||||
{
|
||||
_socket.Off("appSetBadgeCountCompleted");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
_socket.Emit("appSetBadgeCount", count);
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<int> GetBadgeCountAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<int>();
|
||||
|
||||
_socket.On("appGetBadgeCountCompleted", (count) =>
|
||||
{
|
||||
_socket.Off("appGetBadgeCountCompleted");
|
||||
taskCompletionSource.SetResult((int)count);
|
||||
});
|
||||
|
||||
_socket.Emit("appGetBadgeCount");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<bool> IsUnityRunningAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appIsUnityRunningCompleted", (isUnityRunning) =>
|
||||
{
|
||||
_socket.Off("appIsUnityRunningCompleted");
|
||||
taskCompletionSource.SetResult((bool)isUnityRunning);
|
||||
});
|
||||
|
||||
_socket.Emit("appIsUnityRunning");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<LoginItemSettings> GetLoginItemSettingsAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<LoginItemSettings>();
|
||||
|
||||
_socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) =>
|
||||
{
|
||||
_socket.Off("appGetLoginItemSettingsCompleted");
|
||||
taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings);
|
||||
});
|
||||
|
||||
_socket.Emit("appGetLoginItemSettings");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public async static Task<LoginItemSettings> GetLoginItemSettingsAsync(LoginItemSettingsOptions options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<LoginItemSettings>();
|
||||
|
||||
_socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) =>
|
||||
{
|
||||
_socket.Off("appGetLoginItemSettingsCompleted");
|
||||
taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings);
|
||||
});
|
||||
|
||||
_socket.Emit("appGetLoginItemSettings", JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void SetLoginItemSettings(LoginSettings loginSettings)
|
||||
{
|
||||
_socket.Emit("appSetLoginItemSettings", JObject.FromObject(loginSettings, _jsonSerializer));
|
||||
}
|
||||
|
||||
public async static Task<bool> IsAccessibilitySupportEnabledAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appIsAccessibilitySupportEnabledCompleted", (isAccessibilitySupportEnabled) =>
|
||||
{
|
||||
_socket.Off("appIsAccessibilitySupportEnabledCompleted");
|
||||
taskCompletionSource.SetResult((bool)isAccessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
_socket.Emit("appIsAccessibilitySupportEnabled");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void SetAboutPanelOptions(AboutPanelOptions options)
|
||||
{
|
||||
_socket.Emit("appSetAboutPanelOptions", JObject.FromObject(options, _jsonSerializer));
|
||||
}
|
||||
|
||||
public static void CommandLineAppendSwitch(string theSwtich)
|
||||
{
|
||||
_socket.Emit("appCommandLineAppendSwitch", theSwtich);
|
||||
}
|
||||
|
||||
public static void CommandLineAppendSwitch(string theSwtich, string value)
|
||||
{
|
||||
_socket.Emit("appCommandLineAppendSwitch", theSwtich, value);
|
||||
}
|
||||
|
||||
public static void CommandLineAppendArgument(string value)
|
||||
{
|
||||
_socket.Emit("appCommandLineAppendArgument", value);
|
||||
}
|
||||
|
||||
public static void EnableMixedSandbox()
|
||||
{
|
||||
_socket.Emit("appEnableMixedSandbox");
|
||||
}
|
||||
|
||||
public async static Task<int> DockBounceAsync(DockBounceType type)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<int>();
|
||||
|
||||
_socket.On("appDockBounceCompleted", (id) =>
|
||||
{
|
||||
_socket.Off("appDockBounceCompleted");
|
||||
taskCompletionSource.SetResult((int)id);
|
||||
});
|
||||
|
||||
_socket.Emit("appDockBounce", type.ToString());
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void DockCancelBounce(int id)
|
||||
{
|
||||
_socket.Emit("appDockCancelBounce", id);
|
||||
}
|
||||
|
||||
public static void DockDownloadFinished(string filePath)
|
||||
{
|
||||
_socket.Emit("appDockDownloadFinished", filePath);
|
||||
}
|
||||
|
||||
public static void DockSetBadge(string text)
|
||||
{
|
||||
_socket.Emit("appDockSetBadge", text);
|
||||
}
|
||||
|
||||
public async static Task<string> DockGetBadgeAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
_socket.On("appDockGetBadgeCompleted", (text) =>
|
||||
{
|
||||
_socket.Off("appDockGetBadgeCompleted");
|
||||
taskCompletionSource.SetResult((string)text);
|
||||
});
|
||||
|
||||
_socket.Emit("appDockGetBadge");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
public static void DockHide()
|
||||
{
|
||||
_socket.Emit("appDockHide");
|
||||
}
|
||||
|
||||
public static void DockShow()
|
||||
{
|
||||
_socket.Emit("appDockShow");
|
||||
}
|
||||
|
||||
public async static Task<bool> DockIsVisibleAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
_socket.On("appDockIsVisibleCompleted", (isVisible) =>
|
||||
{
|
||||
_socket.Off("appDockIsVisibleCompleted");
|
||||
taskCompletionSource.SetResult((bool)isVisible);
|
||||
});
|
||||
|
||||
_socket.Emit("appDockIsVisible");
|
||||
|
||||
return await taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
// TODO: Menu lösung muss gemacht werden und imeplementiert
|
||||
public static void DockSetMenu()
|
||||
{
|
||||
_socket.Emit("appDockSetMenu");
|
||||
}
|
||||
|
||||
public static void DockSetIcon(string image)
|
||||
{
|
||||
_socket.Emit("appDockSetIcon", image);
|
||||
}
|
||||
|
||||
//public static void DockSetIcon(NativeImage image)
|
||||
//{
|
||||
// _socket.Emit("appDockSetIcon", JObject.FromObject(image, _jsonSerializer));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
30
ElectronNET.API/Entities/AboutPanelOptions.cs
Normal file
30
ElectronNET.API/Entities/AboutPanelOptions.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
16
ElectronNET.API/Entities/CPUUsage.cs
Normal file
16
ElectronNET.API/Entities/CPUUsage.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
8
ElectronNET.API/Entities/DockBounceType.cs
Normal file
8
ElectronNET.API/Entities/DockBounceType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
public enum DockBounceType
|
||||
{
|
||||
critical,
|
||||
informational
|
||||
}
|
||||
}
|
||||
12
ElectronNET.API/Entities/FileIconOptions.cs
Normal file
12
ElectronNET.API/Entities/FileIconOptions.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
9
ElectronNET.API/Entities/FileIconSize.cs
Normal file
9
ElectronNET.API/Entities/FileIconSize.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
public enum FileIconSize
|
||||
{
|
||||
small,
|
||||
normal,
|
||||
large
|
||||
}
|
||||
}
|
||||
82
ElectronNET.API/Entities/GPUFeatureStatus.cs
Normal file
82
ElectronNET.API/Entities/GPUFeatureStatus.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
15
ElectronNET.API/Entities/ImportCertificateOptions.cs
Normal file
15
ElectronNET.API/Entities/ImportCertificateOptions.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
11
ElectronNET.API/Entities/JumpListCategory.cs
Normal file
11
ElectronNET.API/Entities/JumpListCategory.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
14
ElectronNET.API/Entities/JumpListItem.cs
Normal file
14
ElectronNET.API/Entities/JumpListItem.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
9
ElectronNET.API/Entities/JumpListSettings.cs
Normal file
9
ElectronNET.API/Entities/JumpListSettings.cs
Normal 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];
|
||||
}
|
||||
}
|
||||
36
ElectronNET.API/Entities/LoginItemSettings.cs
Normal file
36
ElectronNET.API/Entities/LoginItemSettings.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
15
ElectronNET.API/Entities/LoginItemSettingsOptions.cs
Normal file
15
ElectronNET.API/Entities/LoginItemSettingsOptions.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
30
ElectronNET.API/Entities/LoginSettings.cs
Normal file
30
ElectronNET.API/Entities/LoginSettings.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
33
ElectronNET.API/Entities/MemoryInfo.cs
Normal file
33
ElectronNET.API/Entities/MemoryInfo.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
106
ElectronNET.API/Entities/NativeImage.cs
Normal file
106
ElectronNET.API/Entities/NativeImage.cs
Normal 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();
|
||||
// }
|
||||
}
|
||||
}
|
||||
25
ElectronNET.API/Entities/ProcessMetric.cs
Normal file
25
ElectronNET.API/Entities/ProcessMetric.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
12
ElectronNET.API/Entities/UserTask.cs
Normal file
12
ElectronNET.API/Entities/UserTask.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user