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