fix: added usings, simplified imports, using JsonElement.Deserialize directly instead of JsonSerializer.Deserialize(JsonElement), removed some unused attributes

This commit is contained in:
Denny09310
2025-11-09 15:15:52 +01:00
parent 18b1317fc5
commit 4736bc640c
31 changed files with 65 additions and 60 deletions

View File

@@ -213,7 +213,6 @@ namespace ElectronNET.API.Entities
/// The style of window title bar. Default is default. Possible values are:
/// 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover'
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public TitleBarStyle TitleBarStyle { get; set; }
/// <summary>
@@ -256,7 +255,6 @@ namespace ElectronNET.API.Entities
/// appearance-based, light, dark, titlebar, selection, menu, popover, sidebar,
/// medium-light or ultra-dark.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public Vibrancy Vibrancy { get; set; }
/// <summary>

View File

@@ -6,7 +6,6 @@ namespace ElectronNET.API.Entities
/// <summary>
/// The cause of the change
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum CookieChangedCause
{
/// <summary>

View File

@@ -75,7 +75,6 @@ namespace ElectronNET.API.Entities
/// `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
/// `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public InputEventType Type { get; set; }
}
}

View File

@@ -21,7 +21,6 @@ namespace ElectronNET.API.Entities
/// <summary>
/// One of the following: "tasks" | "frequent" | "recent" | "custom"
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public JumpListCategoryType Type { get; set; }
}
}

View File

@@ -52,7 +52,6 @@ namespace ElectronNET.API.Entities
/// <summary>
/// One of the following: "task" | "separator" | "file"
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public JumpListItemType Type { get; set; }
}
}

View File

@@ -19,13 +19,11 @@ namespace ElectronNET.API.Entities
/// Define the action of the menu item, when specified the click property will be
/// ignored.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public MenuRole Role { get; set; }
/// <summary>
/// Can be normal, separator, submenu, checkbox or radio.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public MenuType Type { get; set; }

View File

@@ -13,7 +13,6 @@ namespace ElectronNET.API.Entities
/// 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(JsonStringEnumConverter))]
public MessageBoxType Type { get; set; }
/// <summary>

View File

@@ -1,3 +1,4 @@
using ElectronNET.API.Serialization;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -18,12 +19,12 @@ namespace ElectronNET.API.Entities
}
var scaledImages = value.GetAllScaledImages();
JsonSerializer.Serialize(writer, scaledImages, Serialization.ElectronJson.Options);
JsonSerializer.Serialize(writer, scaledImages, ElectronJson.Options);
}
public override NativeImage Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var dict = JsonSerializer.Deserialize<Dictionary<float, string>>(ref reader, Serialization.ElectronJson.Options);
var dict = JsonSerializer.Deserialize<Dictionary<float, string>>(ref reader, ElectronJson.Options);
var newDictionary = new Dictionary<float, Image>();
foreach (var item in dict)
{

View File

@@ -13,7 +13,6 @@ namespace ElectronNET.API.Entities
/// 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(JsonStringEnumConverter))]
public DevToolsMode Mode { get; set; }
}
}

View File

@@ -11,7 +11,6 @@ namespace ElectronNET.API.Entities
/// <summary>
/// Mode for the progress bar. Can be 'none' | 'normal' | 'indeterminate' | 'error' | 'paused'.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public ProgressBarMode Mode { get; set; }
}
}

View File

@@ -28,7 +28,6 @@ namespace ElectronNET.API.Entities
/// Scheme of the authentication. Can be basic, digest, ntlm, negotiate.
/// Must be provided if removing by origin.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public Scheme Scheme { get; set; }
/// <summary>