muffin v7.4.3

This commit is contained in:
alydev 2025-12-22 00:05:42 +10:00
parent bddffe21ae
commit 5791858984
4 changed files with 835 additions and 816 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,37 +1,37 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Questionable.Model.Changelog; namespace Questionable.Model.Changelog;
internal sealed record ChangelogEntry(string Version, DateOnly ReleaseDate, List<ChangeEntry> Changes) internal sealed record ChangelogEntry(string Version, DateOnly ReleaseDate, List<ChangeEntry> Changes)
{ {
public bool IsNewVersion(string? lastViewedVersion) public bool IsNewVersion(string? lastViewedVersion, IReadOnlyList<ChangelogEntry> allChangelogs)
{ {
if (string.IsNullOrEmpty(lastViewedVersion)) if (string.IsNullOrEmpty(lastViewedVersion))
{ {
return true; return true;
} }
return CompareVersions(Version, lastViewedVersion) > 0; int num = -1;
} int num2 = -1;
for (int i = 0; i < allChangelogs.Count; i++)
private static int CompareVersions(string version1, string version2)
{ {
int result; if (allChangelogs[i].Version == Version)
int[] array = (from p in version1.Split('.')
select int.TryParse(p, out result) ? result : 0).ToArray();
int[] array2 = (from p in version2.Split('.')
select int.TryParse(p, out result) ? result : 0).ToArray();
int num = Math.Max(array.Length, array2.Length);
for (int num2 = 0; num2 < num; num2++)
{ {
int num3 = ((num2 < array.Length) ? array[num2] : 0); num = i;
int num4 = ((num2 < array2.Length) ? array2[num2] : 0); }
if (num3 != num4) if (allChangelogs[i].Version == lastViewedVersion)
{ {
return num3.CompareTo(num4); num2 = i;
} }
} }
return 0; if (num2 == -1)
{
return true;
}
if (num == -1)
{
return false;
}
return num < num2;
} }
} }

View file

@ -5,6 +5,7 @@ using System.Numerics;
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using Questionable.Data;
using Questionable.Model.Changelog; using Questionable.Model.Changelog;
namespace Questionable.Windows.ChangelogComponents; namespace Questionable.Windows.ChangelogComponents;
@ -26,7 +27,7 @@ internal sealed class ChangelogEntryComponent
public void Draw(ChangelogEntry changelog, bool isLatest, bool hasSetInitialState) public void Draw(ChangelogEntry changelog, bool isLatest, bool hasSetInitialState)
{ {
bool isNew = changelog.IsNewVersion(_configuration.LastViewedChangelogVersion); bool isNew = changelog.IsNewVersion(_configuration.LastViewedChangelogVersion, ChangelogData.Changelogs);
ImGui.GetWindowDrawList(); ImGui.GetWindowDrawList();
string text = changelog.ReleaseDate.ToString("MMMM dd, yyyy", CultureInfo.InvariantCulture); string text = changelog.ReleaseDate.ToString("MMMM dd, yyyy", CultureInfo.InvariantCulture);
if (!hasSetInitialState) if (!hasSetInitialState)

View file

@ -21,6 +21,7 @@ using Questionable.Controller.Utils;
using Questionable.Data; using Questionable.Data;
using Questionable.External; using Questionable.External;
using Questionable.Functions; using Questionable.Functions;
using Questionable.Model.Changelog;
using Questionable.Validation; using Questionable.Validation;
using Questionable.Validation.Validators; using Questionable.Validation.Validators;
using Questionable.Windows; using Questionable.Windows;
@ -300,8 +301,8 @@ public sealed class QuestionablePlugin : IDalamudPlugin, IDisposable
Configuration requiredService2 = serviceProvider.GetRequiredService<Configuration>(); Configuration requiredService2 = serviceProvider.GetRequiredService<Configuration>();
if (requiredService2.IsPluginSetupComplete() && requiredService2.General.ShowChangelogOnUpdate) if (requiredService2.IsPluginSetupComplete() && requiredService2.General.ShowChangelogOnUpdate)
{ {
string text = ChangelogData.Changelogs.FirstOrDefault()?.Version; ChangelogEntry changelogEntry = ChangelogData.Changelogs.FirstOrDefault();
if (text != null && (string.IsNullOrEmpty(requiredService2.LastViewedChangelogVersion) || string.CompareOrdinal(text, requiredService2.LastViewedChangelogVersion) > 0)) if (changelogEntry != null && changelogEntry.IsNewVersion(requiredService2.LastViewedChangelogVersion, ChangelogData.Changelogs))
{ {
requiredService.IsOpenAndUncollapsed = true; requiredService.IsOpenAndUncollapsed = true;
} }