37 lines
711 B
C#
37 lines
711 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Questionable.Model.Changelog;
|
|
|
|
internal sealed record ChangelogEntry(string Version, DateOnly ReleaseDate, List<ChangeEntry> Changes)
|
|
{
|
|
public bool IsNewVersion(string? lastViewedVersion, IReadOnlyList<ChangelogEntry> allChangelogs)
|
|
{
|
|
if (string.IsNullOrEmpty(lastViewedVersion))
|
|
{
|
|
return true;
|
|
}
|
|
int num = -1;
|
|
int num2 = -1;
|
|
for (int i = 0; i < allChangelogs.Count; i++)
|
|
{
|
|
if (allChangelogs[i].Version == Version)
|
|
{
|
|
num = i;
|
|
}
|
|
if (allChangelogs[i].Version == lastViewedVersion)
|
|
{
|
|
num2 = i;
|
|
}
|
|
}
|
|
if (num2 == -1)
|
|
{
|
|
return true;
|
|
}
|
|
if (num == -1)
|
|
{
|
|
return false;
|
|
}
|
|
return num < num2;
|
|
}
|
|
}
|