mirror of
https://github.com/ppy/osu
synced 2024-12-29 02:12:43 +00:00
Merge branch 'master' into clean-carousel-tests
This commit is contained in:
commit
af01d8ca34
4
CodeAnalysis/BannedSymbols.txt
Normal file
4
CodeAnalysis/BannedSymbols.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
|
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
|
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
|
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
@ -14,6 +14,10 @@
|
|||||||
<ItemGroup Label="Resources">
|
<ItemGroup Label="Resources">
|
||||||
<EmbeddedResource Include="Resources\**\*.*" />
|
<EmbeddedResource Include="Resources\**\*.*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup Label="Code Analysis">
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="2.9.7" PrivateAssets="All" />
|
||||||
|
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
<!-- DeepEqual is not netstandard-compatible. This is fine since we run tests with .NET Framework anyway.
|
<!-- DeepEqual is not netstandard-compatible. This is fine since we run tests with .NET Framework anyway.
|
||||||
This is required due to https://github.com/NuGet/Home/issues/5740 -->
|
This is required due to https://github.com/NuGet/Home/issues/5740 -->
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
|
|
||||||
# osu!
|
# osu!
|
||||||
|
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy)
|
[![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu)
|
||||||
|
[![GitHub release](https://img.shields.io/github/release/ppy/osu.svg)]()
|
||||||
|
[![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu)
|
||||||
|
[![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy)
|
||||||
|
|
||||||
Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! Commonly known by the codename "osu!lazer". Pew pew.
|
Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! Commonly known by the codename "osu!lazer". Pew pew.
|
||||||
|
|
||||||
|
@ -411,6 +411,48 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task TestImportWithDuplicateHashes()
|
||||||
|
{
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportNestedStructure)))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = loadOsu(host);
|
||||||
|
|
||||||
|
var temp = TestResources.GetTestBeatmapForImport();
|
||||||
|
|
||||||
|
string extractedFolder = $"{temp}_extracted";
|
||||||
|
Directory.CreateDirectory(extractedFolder);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var zip = ZipArchive.Open(temp))
|
||||||
|
zip.WriteToDirectory(extractedFolder);
|
||||||
|
|
||||||
|
using (var zip = ZipArchive.Create())
|
||||||
|
{
|
||||||
|
zip.AddAllFromDirectory(extractedFolder);
|
||||||
|
zip.AddEntry("duplicate.osu", Directory.GetFiles(extractedFolder, "*.osu").First());
|
||||||
|
zip.SaveTo(temp, new ZipWriterOptions(CompressionType.Deflate));
|
||||||
|
}
|
||||||
|
|
||||||
|
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||||
|
|
||||||
|
ensureLoaded(osu);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Directory.Delete(extractedFolder, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestImportNestedStructure()
|
public async Task TestImportNestedStructure()
|
||||||
{
|
{
|
||||||
|
@ -296,8 +296,13 @@ namespace osu.Game.Beatmaps
|
|||||||
var decoder = Decoder.GetDecoder<Beatmap>(sr);
|
var decoder = Decoder.GetDecoder<Beatmap>(sr);
|
||||||
IBeatmap beatmap = decoder.Decode(sr);
|
IBeatmap beatmap = decoder.Decode(sr);
|
||||||
|
|
||||||
|
string hash = ms.ComputeSHA2Hash();
|
||||||
|
|
||||||
|
if (beatmapInfos.Any(b => b.Hash == hash))
|
||||||
|
continue;
|
||||||
|
|
||||||
beatmap.BeatmapInfo.Path = file.Filename;
|
beatmap.BeatmapInfo.Path = file.Filename;
|
||||||
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
|
beatmap.BeatmapInfo.Hash = hash;
|
||||||
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
||||||
|
|
||||||
var ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
var ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
get => scope;
|
get => scope;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value.Equals(scope))
|
if (EqualityComparer<TScope>.Default.Equals(value, scope))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scope = value;
|
scope = value;
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Overlays
|
|||||||
get => beatmapSets;
|
get => beatmapSets;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (beatmapSets?.Equals(value) ?? false) return;
|
if (ReferenceEquals(beatmapSets, value)) return;
|
||||||
|
|
||||||
beatmapSets = value?.ToList();
|
beatmapSets = value?.ToList();
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
CommitOnFocusLost = true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays
|
|||||||
get => users;
|
get => users;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (users?.Equals(value) ?? false)
|
if (ReferenceEquals(users, value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
users = value?.ToList();
|
users = value?.ToList();
|
||||||
|
@ -102,7 +102,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes)
|
private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes)
|
||||||
{
|
{
|
||||||
d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
|
d.FadeTo(Math.Max(0, ((ReferenceEquals(d, leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
|
||||||
.Then()
|
.Then()
|
||||||
.FadeOut(beatLength, Easing.In);
|
.FadeOut(beatLength, Easing.In);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class KeyCounterAction<T> : KeyCounter
|
public class KeyCounterAction<T> : KeyCounter
|
||||||
@ -16,7 +18,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool OnPressed(T action, bool forwards)
|
public bool OnPressed(T action, bool forwards)
|
||||||
{
|
{
|
||||||
if (!action.Equals(Action))
|
if (!EqualityComparer<T>.Default.Equals(action, Action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IsLit = true;
|
IsLit = true;
|
||||||
@ -27,7 +29,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool OnReleased(T action, bool forwards)
|
public bool OnReleased(T action, bool forwards)
|
||||||
{
|
{
|
||||||
if (!action.Equals(Action))
|
if (!EqualityComparer<T>.Default.Equals(action, Action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IsLit = false;
|
IsLit = false;
|
||||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Container FooterPanels;
|
protected readonly Container FooterPanels;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
protected readonly BeatmapCarousel Carousel;
|
protected readonly BeatmapCarousel Carousel;
|
||||||
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
||||||
@ -405,7 +405,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
// We may be arriving here due to another component changing the bindable Beatmap.
|
// We may be arriving here due to another component changing the bindable Beatmap.
|
||||||
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
|
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
|
||||||
if (!Equals(beatmap, Beatmap.Value.BeatmapInfo))
|
if (!EqualityComparer<BeatmapInfo>.Default.Equals(beatmap, Beatmap.Value.BeatmapInfo))
|
||||||
{
|
{
|
||||||
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");
|
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user