mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-09 10:17:49 +00:00
* fix: correct ReleaseNotes deserialization for AutoUpdater (fixes #1039) - TypeScript normalize() now maps string releaseNotes to { note } objects and also handles arrays of strings (both cases were broken in PR #1041) - Added ReleaseNotesConverter (JsonConverter<ReleaseNoteInfo[]>) as defensive C# layer that handles all shapes: null, string, string[], object[] - Added [JsonConverter] attribute on UpdateInfo.ReleaseNotes - Added unit tests (no Electron required) covering all four input shapes * chore: sync generated autoUpdater.js and .map with updated TypeScript source * refactor: address Copilot PR review comments - Fix namespace: ElectronNET.Converter -> ElectronNET.API.Converter - Replace JsonDocument.ParseValue() with JsonSerializer.Deserialize<ReleaseNoteInfo>() for cleaner, allocation-free object array parsing - Fix Write(): empty ReleaseNoteInfo[] now serializes as [] instead of null - Use Array.Empty<ReleaseNoteInfo>() in UpdateInfo default initializer - Add tests: Serialize_WithEmptyReleaseNotes and Serialize_WithNullReleaseNotes
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System;
|
|
using System.Text.Json.Serialization;
|
|
using ElectronNET.API.Converter;
|
|
|
|
namespace ElectronNET.API.Entities
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <remarks>Up-to-date with electron-updater 6.7.2</remarks>
|
|
public class UpdateInfo
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the version.
|
|
/// </summary>
|
|
public string Version { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the files included in this update.
|
|
/// </summary>
|
|
public UpdateFileInfo[] Files { get; set; } = new UpdateFileInfo[0];
|
|
|
|
/// <summary>
|
|
/// Gets or sets the release name.
|
|
/// </summary>
|
|
public string ReleaseName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the release notes.
|
|
/// </summary>
|
|
[JsonConverter(typeof(ReleaseNotesConverter))]
|
|
public ReleaseNoteInfo[] ReleaseNotes { get; set; } = Array.Empty<ReleaseNoteInfo>();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the release date.
|
|
/// </summary>
|
|
public string ReleaseDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the staged rollout percentage, 0-100.
|
|
/// </summary>
|
|
public double StagingPercentage { get; set; }
|
|
}
|
|
} |