Files
SourMesen 40335ce735 UI: Update to Avalonia 12, .NET 10 and replace ReactiveUI with MVVM community toolkit (#142)
Also fixes DX11.0 support (for Win7 PCs that aren't fully updated), which stopped working after the recent variable refresh rate changes
2026-07-03 16:04:42 +09:00

27 lines
606 B
C#

using CommunityToolkit.Mvvm.ComponentModel;
using Mesen.Utilities;
using System;
using System.Text.Json;
namespace Mesen.Config
{
public partial class BaseConfig<T> : ObservableObject where T : class
{
public T Clone()
{
if(this is T obj) {
return JsonHelper.Clone<T>(obj);
} else {
throw new InvalidCastException();
}
}
public bool IsIdentical(T other)
{
string a = JsonSerializer.Serialize(this, this.GetType(), MesenSerializerContext.Default);
string b = JsonSerializer.Serialize(other, this.GetType(), MesenSerializerContext.Default);
return a == b;
}
}
}