1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Avoid constructor overhead for realm SkinInfo parameterless constructor

This commit is contained in:
Dean Herbert 2022-01-20 17:29:03 +09:00
parent 70cc03fe43
commit 0bd7486a83

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Testing;
@ -26,16 +27,16 @@ namespace osu.Game.Skinning
[PrimaryKey]
[JsonProperty]
public Guid ID { get; set; } = Guid.NewGuid();
public Guid ID { get; set; }
[JsonProperty]
public string Name { get; set; } = string.Empty;
public string Name { get; set; } = null!;
[JsonProperty]
public string Creator { get; set; } = string.Empty;
public string Creator { get; set; } = null!;
[JsonProperty]
public string InstantiationInfo { get; set; } = string.Empty;
public string InstantiationInfo { get; set; } = null!;
public string Hash { get; set; } = string.Empty;
@ -55,6 +56,19 @@ namespace osu.Game.Skinning
public bool DeletePending { get; set; }
public SkinInfo(string? name = null, string? creator = null, string? instantiationInfo = null)
{
Name = name ?? string.Empty;
Creator = creator ?? string.Empty;
InstantiationInfo = instantiationInfo ?? string.Empty;
ID = Guid.NewGuid();
}
[UsedImplicitly] // Realm
private SkinInfo()
{
}
public bool Equals(SkinInfo? other)
{
if (ReferenceEquals(this, other)) return true;