muffin v7.38

This commit is contained in:
alydev 2025-11-17 11:31:27 +10:00
parent 411c0bbe76
commit e5b98b3d57
35 changed files with 10700 additions and 7610 deletions

View file

@ -0,0 +1,32 @@
using System.Numerics;
namespace Questionable.Model.Changelog;
internal static class ChangeCategoryExtensions
{
public static string ToDisplayString(this EChangeCategory category)
{
return category switch
{
EChangeCategory.Added => "Added",
EChangeCategory.Changed => "Changed",
EChangeCategory.Fixed => "Fixed",
EChangeCategory.Removed => "Removed",
EChangeCategory.QuestUpdates => "Quest Updates",
_ => category.ToString(),
};
}
public static Vector4 GetColor(this EChangeCategory category)
{
return category switch
{
EChangeCategory.Added => new Vector4(0.3f, 0.8f, 0.4f, 1f),
EChangeCategory.Changed => new Vector4(0.4f, 0.6f, 0.9f, 1f),
EChangeCategory.Fixed => new Vector4(0.9f, 0.6f, 0.3f, 1f),
EChangeCategory.Removed => new Vector4(0.9f, 0.3f, 0.3f, 1f),
EChangeCategory.QuestUpdates => new Vector4(0.8f, 0.8f, 0.4f, 1f),
_ => new Vector4(0.7f, 0.7f, 0.7f, 1f),
};
}
}

View file

@ -0,0 +1,5 @@
using System.Collections.Generic;
namespace Questionable.Model.Changelog;
internal sealed record ChangeEntry(EChangeCategory Category, string Description, List<string>? SubItems = null);

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Questionable.Model.Changelog;
internal sealed record ChangelogEntry(string Version, DateOnly ReleaseDate, List<ChangeEntry> Changes)
{
public bool IsNewVersion(string? lastViewedVersion)
{
if (string.IsNullOrEmpty(lastViewedVersion))
{
return true;
}
return CompareVersions(Version, lastViewedVersion) > 0;
}
private static int CompareVersions(string version1, string version2)
{
int result;
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);
int num4 = ((num2 < array2.Length) ? array2[num2] : 0);
if (num3 != num4)
{
return num3.CompareTo(num4);
}
}
return 0;
}
}

View file

@ -0,0 +1,10 @@
namespace Questionable.Model.Changelog;
internal enum EChangeCategory
{
Added,
Changed,
Fixed,
Removed,
QuestUpdates
}