mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Fix some more inspections
This commit is contained in:
parent
dd9a418549
commit
192536643c
@ -133,6 +133,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(e.NewItems != null);
|
||||
|
||||
// If inserting in the path (not appending),
|
||||
// update indices of existing connections after insert location
|
||||
if (e.NewStartingIndex < Pieces.Count)
|
||||
@ -164,6 +166,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
foreach (var point in e.OldItems.Cast<PathControlPoint>())
|
||||
{
|
||||
foreach (var piece in Pieces.Where(p => p.ControlPoint == point).ToArray())
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -54,8 +53,6 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
});
|
||||
}
|
||||
|
||||
Debug.Assert(countries != null);
|
||||
|
||||
foreach (var c in countries)
|
||||
Storage.Add(c);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -102,10 +103,14 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(args.NewItems != null);
|
||||
|
||||
args.NewItems.Cast<TModel>().ForEach(i => flow.Add(CreateDrawable(i)));
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(args.OldItems != null);
|
||||
|
||||
args.OldItems.Cast<TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i, true));
|
||||
break;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -20,8 +21,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public partial class LadderEditorSettings : PlayerSettingsGroup
|
||||
{
|
||||
private const int padding = 10;
|
||||
|
||||
private SettingsDropdown<TournamentRound> roundDropdown;
|
||||
private PlayerCheckbox losersCheckbox;
|
||||
private DateTextBox dateTimeBox;
|
||||
@ -103,10 +102,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(args.NewItems != null);
|
||||
|
||||
args.NewItems.Cast<TournamentRound>().ForEach(add);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(args.OldItems != null);
|
||||
|
||||
args.OldItems.Cast<TournamentRound>().ForEach(i => Control.RemoveDropdownItem(i));
|
||||
break;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -25,10 +26,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(args.NewItems != null);
|
||||
|
||||
args.NewItems.Cast<TournamentTeam>().ForEach(add);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(args.OldItems != null);
|
||||
|
||||
args.OldItems.Cast<TournamentTeam>().ForEach(i => Control.RemoveDropdownItem(i));
|
||||
break;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Caching;
|
||||
@ -81,11 +82,15 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(args.NewItems != null);
|
||||
|
||||
foreach (var p in args.NewItems.Cast<TournamentMatch>())
|
||||
addMatch(p);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
Debug.Assert(args.OldItems != null);
|
||||
|
||||
foreach (var p in args.OldItems.Cast<TournamentMatch>())
|
||||
{
|
||||
foreach (var d in MatchesContainer.Where(d => d.Match == p))
|
||||
|
@ -300,7 +300,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
public ControlPointInfo DeepClone()
|
||||
{
|
||||
var controlPointInfo = (ControlPointInfo)Activator.CreateInstance(GetType());
|
||||
var controlPointInfo = (ControlPointInfo)Activator.CreateInstance(GetType())!;
|
||||
|
||||
foreach (var point in AllControlPoints)
|
||||
controlPointInfo.Add(point.Time, point.DeepClone());
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.IO.Serialization.Converters
|
||||
throw new JsonException("Expected $type token.");
|
||||
|
||||
string typeName = lookupTable[(int)tok["$type"]];
|
||||
var instance = (T)Activator.CreateInstance(Type.GetType(typeName).AsNonNull());
|
||||
var instance = (T)Activator.CreateInstance(Type.GetType(typeName).AsNonNull())!;
|
||||
serializer.Populate(itemReader, instance);
|
||||
|
||||
list.Add(instance);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -65,17 +66,24 @@ namespace osu.Game.Skinning.Editor
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
Debug.Assert(e.NewItems != null);
|
||||
|
||||
foreach (var item in e.NewItems.Cast<ISkinnableDrawable>())
|
||||
AddBlueprintFor(item);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
case NotifyCollectionChangedAction.Reset:
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Replace:
|
||||
Debug.Assert(e.NewItems != null);
|
||||
Debug.Assert(e.OldItems != null);
|
||||
|
||||
foreach (var item in e.OldItems.Cast<ISkinnableDrawable>())
|
||||
RemoveBlueprintFor(item);
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected override string[] HashableFileTypes => new[] { ".ini", ".json" };
|
||||
|
||||
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == @".osk";
|
||||
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path).ToLowerInvariant() == @".osk";
|
||||
|
||||
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name ?? @"No name" };
|
||||
|
||||
|
@ -137,7 +137,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
// When reading from a skin, we match stables weird behaviour where `FrameCount` is ignored
|
||||
// and resources are retrieved until the end of the animation.
|
||||
foreach (var texture in skin.GetTextures(Path.GetFileNameWithoutExtension(Animation.Path), default, default, true, string.Empty, out _))
|
||||
foreach (var texture in skin.GetTextures(Path.GetFileNameWithoutExtension(Animation.Path)!, default, default, true, string.Empty, out _))
|
||||
AddFrame(texture, Animation.FrameDelay);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user