mirror of https://github.com/ppy/osu
Apply notnull constraint
This commit is contained in:
parent
2d8d177807
commit
23c4f9910e
|
@ -52,6 +52,8 @@ public interface ISkin
|
|||
/// </summary>
|
||||
/// <param name="lookup">The requested configuration value.</param>
|
||||
/// <returns>A matching value boxed in an <see cref="IBindable{TValue}"/>, or null if unavailable.</returns>
|
||||
IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup);
|
||||
IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ protected override void ParseConfigurationStream(Stream stream)
|
|||
=> source.ImageLookups.TryGetValue(lookup, out string image) ? new Bindable<string>(image) : null;
|
||||
|
||||
private IBindable<TValue>? legacySettingLookup<TValue>(SkinConfiguration.LegacySetting legacySetting)
|
||||
where TValue : notnull
|
||||
{
|
||||
switch (legacySetting)
|
||||
{
|
||||
|
@ -294,10 +295,9 @@ protected override void ParseConfigurationStream(Stream stream)
|
|||
}
|
||||
|
||||
private IBindable<TValue>? genericLookup<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull
|
||||
{
|
||||
if (lookup == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val))
|
||||
|
|
|
@ -46,7 +46,10 @@ public ResourceStoreBackedSkin(IResourceStore<byte[]> resources, GameHost host,
|
|||
return null;
|
||||
}
|
||||
|
||||
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
||||
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull
|
||||
=> null;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -50,7 +50,9 @@ public abstract class Skin : IDisposable, ISkin
|
|||
|
||||
public abstract Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT);
|
||||
|
||||
public abstract IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup);
|
||||
public abstract IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new skin.
|
||||
|
|
Loading…
Reference in New Issue