diff --git a/src/ElectronNET.API/API/App.cs b/src/ElectronNET.API/API/App.cs index c486f90..a184303 100644 --- a/src/ElectronNET.API/API/App.cs +++ b/src/ElectronNET.API/API/App.cs @@ -539,7 +539,7 @@ namespace ElectronNET.API using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { BridgeConnector.Socket.Once("appGetPathCompleted", taskCompletionSource.SetResult); - BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription()); + BridgeConnector.Socket.Emit("appGetPath", pathName); return await taskCompletionSource.Task .ConfigureAwait(false); @@ -560,7 +560,7 @@ namespace ElectronNET.API /// public void SetPath(PathName name, string path) { - this.CallMethod2(name.GetDescription(), path); + this.CallMethod2(name, path); } /// diff --git a/src/ElectronNET.API/API/BrowserWindow.cs b/src/ElectronNET.API/API/BrowserWindow.cs index bd60b77..bc86398 100644 --- a/src/ElectronNET.API/API/BrowserWindow.cs +++ b/src/ElectronNET.API/API/BrowserWindow.cs @@ -681,7 +681,7 @@ public class BrowserWindow : ApiBase /// Values include normal, floating, torn-off-menu, modal-panel, main-menu, /// status, pop-up-menu and screen-saver. The default is floating. /// See the macOS docs - public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level.GetDescription()); + public void SetAlwaysOnTop(bool flag, OnTopLevel level) => this.CallMethod2(flag, level); /// /// Sets whether the window should show always on top of other windows. @@ -694,7 +694,7 @@ public class BrowserWindow : ApiBase /// See the macOS docs /// The number of layers higher to set this window relative to the given level. /// The default is 0. Note that Apple discourages setting levels higher than 1 above screen-saver. - public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level.GetDescription(), relativeLevel); + public void SetAlwaysOnTop(bool flag, OnTopLevel level, int relativeLevel) => this.CallMethod3(flag, level, relativeLevel); /// /// Whether the window is always on top of other windows. @@ -1190,7 +1190,7 @@ public class BrowserWindow : ApiBase /// menu, popover, sidebar, medium-light or ultra-dark. /// See the macOS documentation for more details. [SupportedOSPlatform("macOS")] - public void SetVibrancy(Vibrancy type) => this.CallMethod1(type.GetDescription()); + public void SetVibrancy(Vibrancy type) => this.CallMethod1(type); /// /// Render and control web pages. diff --git a/src/ElectronNET.API/API/Dock.cs b/src/ElectronNET.API/API/Dock.cs index 1186d37..e257759 100644 --- a/src/ElectronNET.API/API/Dock.cs +++ b/src/ElectronNET.API/API/Dock.cs @@ -57,7 +57,7 @@ namespace ElectronNET.API using (cancellationToken.Register(() => tcs.TrySetCanceled())) { BridgeConnector.Socket.Once("dock-bounce-completed", tcs.SetResult); - BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription()); + BridgeConnector.Socket.Emit("dock-bounce", type); return await tcs.Task .ConfigureAwait(false); diff --git a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs b/src/ElectronNET.API/API/Extensions/EnumExtensions.cs deleted file mode 100644 index 4260458..0000000 --- a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.ComponentModel; -using System.Reflection; - -namespace ElectronNET.API.Extensions -{ - internal static class EnumExtensions - { - public static string GetDescription(this T enumerationValue) where T : struct - { - Type type = enumerationValue.GetType(); - if (!type.IsEnum) - { - throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue"); - } - - //Tries to find a DescriptionAttribute for a potential friendly name - //for the enum - MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString()); - if (memberInfo != null && memberInfo.Length > 0) - { - object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); - - if (attrs != null && attrs.Length > 0) - { - //Pull out the description value - return ((DescriptionAttribute)attrs[0]).Description; - } - } - - //If we have no description attribute, just return the ToString of the enum - return enumerationValue.ToString(); - } - } -} \ No newline at end of file diff --git a/src/ElectronNET.API/API/NativeTheme.cs b/src/ElectronNET.API/API/NativeTheme.cs index 71b35cf..620e086 100644 --- a/src/ElectronNET.API/API/NativeTheme.cs +++ b/src/ElectronNET.API/API/NativeTheme.cs @@ -99,7 +99,7 @@ namespace ElectronNET.API /// The new ThemeSource. public void SetThemeSource(ThemeSourceMode themeSourceMode) { - var themeSource = themeSourceMode.GetDescription(); + var themeSource = themeSourceMode; BridgeConnector.Socket.Emit("nativeTheme-themeSource", themeSource); } diff --git a/src/ElectronNET.API/API/Shell.cs b/src/ElectronNET.API/API/Shell.cs index 4c99de8..888b309 100644 --- a/src/ElectronNET.API/API/Shell.cs +++ b/src/ElectronNET.API/API/Shell.cs @@ -134,7 +134,7 @@ namespace ElectronNET.API var tcs = new TaskCompletionSource(); BridgeConnector.Socket.Once("shell-writeShortcutLinkCompleted", tcs.SetResult); - BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.GetDescription(), options); + BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation, options); return tcs.Task; }