A game framework written with osu! in mind.
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use pattern matching for type check.

+12 -41
+2 -2
.editorconfig
··· 145 145 #Style - null/type checks 146 146 dotnet_style_coalesce_expression = true:warning 147 147 dotnet_style_null_propagation = true:warning 148 - csharp_style_pattern_matching_over_is_with_cast_check = true:silent 149 - csharp_style_pattern_matching_over_as_with_null_check = true:silent 148 + csharp_style_pattern_matching_over_is_with_cast_check = true:warning 149 + csharp_style_pattern_matching_over_as_with_null_check = true:warning 150 150 csharp_style_throw_expression = true:silent 151 151 csharp_style_conditional_delegate_call = true:suggestion 152 152
+3 -4
osu.Framework/Allocation/IReadOnlyDependencyContainer.cs
··· 75 75 /// <returns>The requested dependency, or default(<typeparamref name="T"/>) if not found.</returns> 76 76 internal static T GetValue<T>(this IReadOnlyDependencyContainer container, CacheInfo info) 77 77 { 78 - var result = container.Get(typeof(T), info); 79 - if (result == null) 80 - return default; 78 + if (container.Get(typeof(T), info) is T value) 79 + return value; 81 80 82 - return (T)container.Get(typeof(T), info); 81 + return default; 83 82 } 84 83 85 84 /// <summary>
+2 -4
osu.Framework/Allocation/ObjectHandle.cs
··· 66 66 67 67 try 68 68 { 69 - var value = handle.Target; 70 - 71 - if (value is T) 69 + if (handle.Target is T value) 72 70 { 73 - target = (T)value; 71 + target = value; 74 72 return true; 75 73 } 76 74 }
+1 -3
osu.Framework/Graphics/Containers/SearchContainer.cs
··· 71 71 !filterable.FilterTerms.Any(filterTerm => 72 72 filterTerm.IndexOf(term, StringComparison.InvariantCultureIgnoreCase) >= 0)).ToArray(); 73 73 74 - var hasFilterableChildren = filterable as IHasFilterableChildren; 75 - 76 74 bool matching = childTerms.Length == 0; 77 75 78 76 //We need to check the children and should any child match this matches as well 79 - if (hasFilterableChildren != null) 77 + if (filterable is IHasFilterableChildren hasFilterableChildren) 80 78 { 81 79 foreach (IFilterable child in hasFilterableChildren.FilterableChildren) 82 80 matching |= match(child, childTerms, searchActive);
+1 -8
osu.Framework/Graphics/Primitives/RectangleF.cs
··· 131 131 /// <returns>This method returns true if obj is a <see cref="RectangleF"/> and its X, Y, Width, and Height properties are equal to the corresponding properties of this <see cref="RectangleF"/>; otherwise, false.</returns> 132 132 /// <param name="obj">The <see cref="System.Object"/> to test.</param> 133 133 /// <filterpriority>1</filterpriority> 134 - public override bool Equals(object obj) 135 - { 136 - if (!(obj is RectangleF)) 137 - return false; 138 - 139 - RectangleF ef = (RectangleF)obj; 140 - return ef.X == X && ef.Y == Y && ef.Width == Width && ef.Height == Height; 141 - } 134 + public override bool Equals(object obj) => obj is RectangleF rec && Equals(rec); 142 135 143 136 /// <summary>Tests whether two <see cref="RectangleF"/> structures have equal location and size.</summary> 144 137 /// <returns>This operator returns true if the two specified <see cref="RectangleF"/> structures have equal <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and <see cref="Height"/> properties.</returns>
+1 -8
osu.Framework/Graphics/Primitives/RectangleI.cs
··· 96 96 /// <returns>This method returns true if obj is a <see cref="RectangleI"/> and its X, Y, Width, and Height properties are equal to the corresponding properties of this <see cref="RectangleI"/>; otherwise, false.</returns> 97 97 /// <param name="obj">The <see cref="T:System.Object"/> to test. </param> 98 98 /// <filterpriority>1</filterpriority> 99 - public override bool Equals(object obj) 100 - { 101 - if (!(obj is RectangleI)) 102 - return false; 103 - 104 - RectangleI ef = (RectangleI)obj; 105 - return ef.X == X && ef.Y == Y && ef.Width == Width && ef.Height == Height; 106 - } 99 + public override bool Equals(object obj) => obj is RectangleI rec && Equals(rec); 107 100 108 101 /// <summary>Tests whether two <see cref="RectangleI"/> structures have equal location and size.</summary> 109 102 /// <returns>This operator returns true if the two specified <see cref="RectangleI"/> structures have equal <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and <see cref="Height"/> properties.</returns>
+1 -6
osu.Framework/Graphics/Sprites/FontUsage.cs
··· 100 100 101 101 public bool Equals(FontUsage other) => string.Equals(Family, other.Family) && string.Equals(Weight, other.Weight) && Italics == other.Italics && Size.Equals(other.Size) && FixedWidth == other.FixedWidth; 102 102 103 - public override bool Equals(object obj) 104 - { 105 - if (ReferenceEquals(null, obj)) return false; 106 - 107 - return obj is FontUsage other && Equals(other); 108 - } 103 + public override bool Equals(object obj) => obj is FontUsage other && Equals(other); 109 104 110 105 public override int GetHashCode() 111 106 {
+1 -6
osu.Framework/Graphics/Sprites/IconUsage.cs
··· 72 72 73 73 public bool Equals(IconUsage other) => Icon == other.Icon && string.Equals(Family, other.Family) && string.Equals(Weight, other.Weight); 74 74 75 - public override bool Equals(object obj) 76 - { 77 - if (ReferenceEquals(null, obj)) return false; 78 - 79 - return obj is IconUsage other && Equals(other); 80 - } 75 + public override bool Equals(object obj) => obj is IconUsage other && Equals(other); 81 76 82 77 public override int GetHashCode() 83 78 {