mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 22:33:05 +08:00
Avoid constructor overhead for realm SkinInfo
parameterless constructor
This commit is contained in:
parent
70cc03fe43
commit
0bd7486a83
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user