mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 18:43:04 +08:00
Disable resharper inspections on case-by-case basis
This commit is contained in:
parent
f0966a2e12
commit
aac41d2de6
@ -310,12 +310,12 @@ namespace osu.Desktop.Deploy
|
||||
|
||||
foreach (var tag in toUpdate)
|
||||
{
|
||||
int startIndex = l.IndexOf(tag);
|
||||
int startIndex = l.IndexOf(tag, StringComparison.InvariantCulture);
|
||||
if (startIndex == -1)
|
||||
continue;
|
||||
startIndex += tag.Length;
|
||||
|
||||
int endIndex = l.IndexOf("<", startIndex);
|
||||
int endIndex = l.IndexOf("<", startIndex, StringComparison.InvariantCulture);
|
||||
line = $"{l.Substring(0, startIndex)}{version}{l.Substring(endIndex)}";
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,16 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using osu.Desktop.Overlays;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game;
|
||||
using OpenTK.Input;
|
||||
|
||||
#if NET461
|
||||
using Microsoft.Win32;
|
||||
#endif
|
||||
|
||||
namespace osu.Desktop
|
||||
{
|
||||
internal class OsuGameDesktop : OsuGame
|
||||
@ -45,9 +48,9 @@ namespace osu.Desktop
|
||||
{
|
||||
Func<string, bool> checkExists = p => Directory.Exists(Path.Combine(p, "Songs"));
|
||||
|
||||
#if NET461
|
||||
string stableInstallPath;
|
||||
|
||||
#if NET461
|
||||
try
|
||||
{
|
||||
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("osu"))
|
||||
@ -61,7 +64,11 @@ namespace osu.Desktop
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET461
|
||||
stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!");
|
||||
#else
|
||||
var stableInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"osu!");
|
||||
#endif
|
||||
if (checkExists(stableInstallPath))
|
||||
return stableInstallPath;
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Graphics;
|
||||
@ -12,7 +10,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -23,6 +20,9 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
#if NET461
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.Logging;
|
||||
using Squirrel;
|
||||
#endif
|
||||
|
||||
@ -101,8 +101,10 @@ namespace osu.Desktop.Overlays
|
||||
}
|
||||
};
|
||||
|
||||
#if NET461
|
||||
if (game.IsDeployedBuild)
|
||||
checkForUpdateAsync();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -150,9 +152,9 @@ namespace osu.Desktop.Overlays
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET461
|
||||
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
||||
{
|
||||
#if NET461
|
||||
//should we schedule a retry on completion of this check?
|
||||
bool scheduleRetry = true;
|
||||
|
||||
@ -223,8 +225,8 @@ namespace osu.Desktop.Overlays
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
|
@ -128,6 +128,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
Trace.Assert(lastPosition.HasValue);
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
Vector2 pos1 = lastPosition.Value;
|
||||
Vector2 diff = pos2 - pos1;
|
||||
float distance = diff.Length;
|
||||
|
@ -307,6 +307,7 @@ namespace osu.Game.Beatmaps
|
||||
context.ChangeTracker.AutoDetectChangesEnabled = false;
|
||||
|
||||
// re-fetch the beatmap set on the import context.
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
beatmapSet = context.BeatmapSetInfo.Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == beatmapSet.ID);
|
||||
|
||||
// create local stores so we can isolate and thread safely, and share a context/transaction.
|
||||
|
@ -33,6 +33,7 @@ namespace osu.Game.Graphics.Cursor
|
||||
|
||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||
// else it can have an annoying effect.
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
startRotation |= Vector2Extensions.Distance(state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;
|
||||
|
||||
if (startRotation)
|
||||
|
@ -186,6 +186,7 @@ namespace osu.Game.IO.Legacy
|
||||
|
||||
Debug.Assert(formatter != null, "formatter != null");
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
return formatter.Deserialize(stream);
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
// if not, let's try using our refresh token to request a new access token.
|
||||
if (!string.IsNullOrEmpty(Token?.RefreshToken))
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
AuthenticateWithRefresh(Token.RefreshToken);
|
||||
|
||||
return accessTokenValid;
|
||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Online.API.Requests
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Online.API.Requests
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLower()}?offset={offset}";
|
||||
}
|
||||
|
||||
@ -27,4 +28,4 @@ namespace osu.Game.Online.API.Requests
|
||||
Firsts,
|
||||
Recent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Online.API.Requests
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
public virtual bool Equals(Message other) => Id == other?.Id;
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
public override int GetHashCode() => Id.GetHashCode();
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Trace.Assert(state.Mouse.PositionMouseDown != null);
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
double targetChatHeight = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
|
||||
|
||||
// If the channel selection screen is shown, mind its minimum height
|
||||
@ -380,6 +381,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
if (channel == null) return;
|
||||
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
var existing = careChannels.Find(c => c.Id == channel.Id);
|
||||
|
||||
if (existing != null)
|
||||
|
@ -71,6 +71,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Trace.Assert(state.Mouse.PositionMouseDown != null, "state.Mouse.PositionMouseDown != null");
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException
|
||||
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||
|
||||
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
||||
|
@ -60,6 +60,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
DifficultyPoint = other.DifficultyPoint;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
public int CompareTo(MultiplierControlPoint other) => StartTime.CompareTo(other?.StartTime);
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
WorkingBeatmap = workingBeatmap;
|
||||
IsForCurrentRuleset = isForCurrentRuleset;
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
Mods = workingBeatmap.Mods.Value;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
@ -255,6 +255,7 @@ namespace osu.Game.Rulesets.UI
|
||||
var sX = (SpeedAdjustmentContainer)x;
|
||||
var sY = (SpeedAdjustmentContainer)y;
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
int result = sY.ControlPoint.StartTime.CompareTo(sX.ControlPoint.StartTime);
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
@ -123,6 +123,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = @"Exo2.0-MediumItalic",
|
||||
TextSize = 22,
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
Text = RankPosition.ToString(),
|
||||
},
|
||||
},
|
||||
|
@ -326,6 +326,7 @@ namespace osu.Game.Screens.Tournament
|
||||
if (line.ToUpper().StartsWith("GROUP"))
|
||||
continue;
|
||||
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
DrawingsTeam teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line);
|
||||
|
||||
if (teamToAdd == null)
|
||||
|
@ -13,9 +13,9 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
@ -118,16 +118,18 @@ namespace osu.Game.Screens.Tournament
|
||||
if (!Children.Any())
|
||||
break;
|
||||
|
||||
Drawable closest = null;
|
||||
ScrollingTeam closest = null;
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (!(c is ScrollingTeam))
|
||||
var stc = c as ScrollingTeam;
|
||||
|
||||
if (stc == null)
|
||||
continue;
|
||||
|
||||
if (closest == null)
|
||||
{
|
||||
closest = c;
|
||||
closest = stc;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -135,14 +137,15 @@ namespace osu.Game.Screens.Tournament
|
||||
float lastOffset = Math.Abs(closest.Position.X + closest.DrawWidth / 2f - DrawWidth / 2f);
|
||||
|
||||
if (o < lastOffset)
|
||||
closest = c;
|
||||
closest = stc;
|
||||
}
|
||||
|
||||
Trace.Assert(closest != null, "closest != null");
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
offset += DrawWidth / 2f - (closest.Position.X + closest.DrawWidth / 2f);
|
||||
|
||||
ScrollingTeam st = closest as ScrollingTeam;
|
||||
ScrollingTeam st = closest;
|
||||
|
||||
availableTeams.RemoveAll(at => at == st.Team);
|
||||
|
||||
|
@ -38,6 +38,7 @@ namespace osu.Game.Screens.Tournament.Teams
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
string[] split = line.Split(':');
|
||||
|
||||
if (split.Length < 2)
|
||||
|
Loading…
Reference in New Issue
Block a user