Fix resharper inspections

This commit is contained in:
smoogipoo
2018-09-17 13:30:27 +09:00
parent 033d4f9e1c
commit f2b0f2a658
7 changed files with 18 additions and 15 deletions

View File

@@ -473,6 +473,9 @@ namespace osu.Framework.Tests.Visual
break;
var container = (CompositeDrawable)currentMenu.InternalChildren[1];
// ReSharper disable once ArrangeRedundantParentheses
// Broken resharper inspection (https://youtrack.jetbrains.com/issue/RIDER-19843)
currentMenu = (container.InternalChildren.Count > 0 ? container.InternalChildren[0] : null) as Menu;
}

View File

@@ -405,8 +405,8 @@ namespace osu.Framework.Tests.Visual
currentTimeText.Text = time.ToString("n0");
seekingTick.X = currentTimeText.X = (float)(time / (wrapping.MaxTime - wrapping.MinTime));
maxTimeText.Text = wrapping.MaxTime.ToString("n0");
maxTimeText.Colour = time > wrapping.MaxTime ? Color4.Gray : (wrapping.Time.Elapsed > 0 ? Color4.Blue : Color4.Red);
minTimeText.Colour = time < wrapping.MinTime ? Color4.Gray : (content.Time.Elapsed > 0 ? Color4.Blue : Color4.Red);
maxTimeText.Colour = time > wrapping.MaxTime ? Color4.Gray : wrapping.Time.Elapsed > 0 ? Color4.Blue : Color4.Red;
minTimeText.Colour = time < wrapping.MinTime ? Color4.Gray : content.Time.Elapsed > 0 ? Color4.Blue : Color4.Red;
if (displayedTransforms == null || !ExaminableDrawable.Transforms.SequenceEqual(displayedTransforms))
{
transforms.Clear();

View File

@@ -87,7 +87,7 @@ namespace osu.Framework.Graphics.Containers
private Cached<bool> isIntersectingBacking;
protected bool IsIntersecting => isIntersectingBacking.IsValid ? isIntersectingBacking : (isIntersectingBacking.Value = checkScrollIntersection());
protected bool IsIntersecting => isIntersectingBacking.IsValid ? isIntersectingBacking : isIntersectingBacking.Value = checkScrollIntersection();
internal IOnScreenOptimisingContainer OptimisingContainer { get; private set; }
@@ -118,7 +118,7 @@ namespace osu.Framework.Graphics.Containers
/// <summary>
/// Schedule a repeating action from a child to perform checks even when the child is potentially masked.
/// Repeats every frame until manually cancelled.
/// Repeats every frame until manually cancelled.
/// </summary>
/// <param name="action">The action to perform.</param>
/// <returns>The scheduled delegate.</returns>

View File

@@ -701,7 +701,7 @@ namespace osu.Framework.Graphics
/// <summary>
/// Absolute size of this Drawable in the <see cref="Parent"/>'s coordinate system.
/// </summary>
public Vector2 DrawSize => drawSizeBacking.IsValid ? drawSizeBacking : (drawSizeBacking.Value = ApplyRelativeAxes(RelativeSizeAxes, Size, FillMode));
public Vector2 DrawSize => drawSizeBacking.IsValid ? drawSizeBacking : drawSizeBacking.Value = ApplyRelativeAxes(RelativeSizeAxes, Size, FillMode);
/// <summary>
/// X component of <see cref="DrawSize"/>.
@@ -1438,7 +1438,7 @@ namespace osu.Framework.Graphics
/// <summary>
/// The screen-space quad this drawable occupies.
/// </summary>
public virtual Quad ScreenSpaceDrawQuad => screenSpaceDrawQuadBacking.IsValid ? screenSpaceDrawQuadBacking : (screenSpaceDrawQuadBacking.Value = ComputeScreenSpaceDrawQuad());
public virtual Quad ScreenSpaceDrawQuad => screenSpaceDrawQuadBacking.IsValid ? screenSpaceDrawQuadBacking : screenSpaceDrawQuadBacking.Value = ComputeScreenSpaceDrawQuad();
private Cached<DrawInfo> drawInfoBacking;
@@ -1460,14 +1460,14 @@ namespace osu.Framework.Graphics
/// <summary>
/// Contains the linear transformation of this <see cref="Drawable"/> that is used during draw.
/// </summary>
public virtual DrawInfo DrawInfo => drawInfoBacking.IsValid ? drawInfoBacking : (drawInfoBacking.Value = computeDrawInfo());
public virtual DrawInfo DrawInfo => drawInfoBacking.IsValid ? drawInfoBacking : drawInfoBacking.Value = computeDrawInfo();
private Cached<DrawColourInfo> drawColourInfoBacking;
/// <summary>
/// Contains the colour and blending information of this <see cref="Drawable"/> that are used during draw.
/// </summary>
public virtual DrawColourInfo DrawColourInfo => drawColourInfoBacking.IsValid? drawColourInfoBacking : (drawColourInfoBacking.Value = computeDrawColourInfo());
public virtual DrawColourInfo DrawColourInfo => drawColourInfoBacking.IsValid? drawColourInfoBacking : drawColourInfoBacking.Value = computeDrawColourInfo();
private DrawColourInfo computeDrawColourInfo()
{
@@ -1558,7 +1558,7 @@ namespace osu.Framework.Graphics
/// zero in that dimension; i.e. we no longer fit into the parent.
/// This behavior is prominent with non-centre and non-custom <see cref="Anchor"/> values.
/// </summary>
internal Vector2 RequiredParentSizeToFit => requiredParentSizeToFitBacking.IsValid ? requiredParentSizeToFitBacking : (requiredParentSizeToFitBacking.Value = computeRequiredParentSizeToFit());
internal Vector2 RequiredParentSizeToFit => requiredParentSizeToFitBacking.IsValid ? requiredParentSizeToFitBacking : requiredParentSizeToFitBacking.Value = computeRequiredParentSizeToFit();
private static readonly AtomicCounter invalidation_counter = new AtomicCounter();

View File

@@ -382,7 +382,7 @@ namespace osu.Framework.Graphics.OpenGL.Textures
GLWrapper.BindTexture(this);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter,
(int)(manualMipmaps ? filteringMode : (filteringMode == All.Linear ? All.LinearMipmapLinear : All.Nearest)));
(int)(manualMipmaps ? filteringMode : filteringMode == All.Linear ? All.LinearMipmapLinear : All.Nearest));
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)filteringMode);
// 33085 is GL_TEXTURE_MAX_LEVEL, which is not available within TextureParameterName.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
@@ -472,10 +472,10 @@ namespace osu.Framework.Graphics.Sprites
}
private Cached<float> constantWidthCache;
private float constantWidth => constantWidthCache.IsValid ? constantWidthCache.Value : (constantWidthCache.Value = GetTextureForCharacter('D')?.DisplayWidth ?? 0);
private float constantWidth => constantWidthCache.IsValid ? constantWidthCache.Value : constantWidthCache.Value = GetTextureForCharacter('D')?.DisplayWidth ?? 0;
private Cached<Vector2> shadowOffsetCache;
private Vector2 shadowOffset => shadowOffsetCache.IsValid ? shadowOffsetCache.Value : (shadowOffsetCache.Value = ToScreenSpace(shadow_offset * TextSize) - ToScreenSpace(Vector2.Zero));
private Vector2 shadowOffset => shadowOffsetCache.IsValid ? shadowOffsetCache.Value : shadowOffsetCache.Value = ToScreenSpace(shadow_offset * TextSize) - ToScreenSpace(Vector2.Zero);
#endregion

View File

@@ -287,12 +287,12 @@ namespace osu.Framework.Graphics.UserInterface
protected override void UpdateBackgroundColour()
{
Background.FadeColour(IsHovered ? BackgroundColourHover : (IsSelected ? BackgroundColourSelected : BackgroundColour));
Background.FadeColour(IsHovered ? BackgroundColourHover : IsSelected ? BackgroundColourSelected : BackgroundColour);
}
protected override void UpdateForegroundColour()
{
Foreground.FadeColour(IsHovered ? ForegroundColourHover : (IsSelected ? ForegroundColourSelected : ForegroundColour));
Foreground.FadeColour(IsHovered ? ForegroundColourHover : IsSelected ? ForegroundColourSelected : ForegroundColour);
}
protected override void LoadComplete()