1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 02:22:59 +08:00

Update usages to new naming

This commit is contained in:
Dean Herbert 2022-01-06 22:54:43 +09:00
parent 3ea7588a91
commit 00177a3ae1
42 changed files with 53 additions and 53 deletions

View File

@ -14,4 +14,4 @@ M:Realms.IRealmCollection`1.SubscribeForNotifications`1(Realms.NotificationCallb
M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable<T>,NotificationCallbackDelegate<T>) instead. M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Linq.IQueryable{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IQueryable<T>,NotificationCallbackDelegate<T>) instead.
M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList<T>,NotificationCallbackDelegate<T>) instead. M:Realms.CollectionExtensions.SubscribeForNotifications`1(System.Collections.Generic.IList{``0},Realms.NotificationCallbackDelegate{``0});Use osu.Game.Database.RealmObjectExtensions.QueryAsyncWithNotifications(IList<T>,NotificationCallbackDelegate<T>) instead.
M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks. M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks.
P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.WaitSafelyForResult() to ensure we avoid deadlocks. P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks.

View File

@ -984,7 +984,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var manager = osu.Dependencies.Get<BeatmapManager>(); var manager = osu.Dependencies.Get<BeatmapManager>();
var importedSet = manager.Import(new ImportTask(temp)).WaitSafelyForResult(); var importedSet = manager.Import(new ImportTask(temp)).GetResultSafely();
ensureLoaded(osu).WaitSafely(); ensureLoaded(osu).WaitSafely();
@ -999,7 +999,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var manager = osu.Dependencies.Get<BeatmapManager>(); var manager = osu.Dependencies.Get<BeatmapManager>();
var importedSet = manager.Import(new ImportTask(temp)).WaitSafelyForResult(); var importedSet = manager.Import(new ImportTask(temp)).GetResultSafely();
ensureLoaded(osu).WaitSafely(); ensureLoaded(osu).WaitSafely();

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Beatmaps
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGameBase osu) private void load(OsuGameBase osu)
{ {
importedSet = ImportBeatmapTest.LoadQuickOszIntoOsu(osu).WaitSafelyForResult(); importedSet = ImportBeatmapTest.LoadQuickOszIntoOsu(osu).GetResultSafely();
} }
[SetUpSteps] [SetUpSteps]

View File

@ -43,9 +43,9 @@ namespace osu.Game.Tests.NonVisual
await Task.WhenAll(task1.task, task2.task, task3.task); await Task.WhenAll(task1.task, task2.task, task3.task);
Assert.That(task1.task.WaitSafelyForResult(), Is.EqualTo(1)); Assert.That(task1.task.GetResultSafely(), Is.EqualTo(1));
Assert.That(task2.task.WaitSafelyForResult(), Is.EqualTo(2)); Assert.That(task2.task.GetResultSafely(), Is.EqualTo(2));
Assert.That(task3.task.WaitSafelyForResult(), Is.EqualTo(3)); Assert.That(task3.task.GetResultSafely(), Is.EqualTo(3));
} }
[Test] [Test]
@ -69,9 +69,9 @@ namespace osu.Game.Tests.NonVisual
// Wait on both tasks. // Wait on both tasks.
await Task.WhenAll(task1.task, task3.task); await Task.WhenAll(task1.task, task3.task);
Assert.That(task1.task.WaitSafelyForResult(), Is.EqualTo(1)); Assert.That(task1.task.GetResultSafely(), Is.EqualTo(1));
Assert.That(task2.task.IsCompleted, Is.False); Assert.That(task2.task.IsCompleted, Is.False);
Assert.That(task3.task.WaitSafelyForResult(), Is.EqualTo(2)); Assert.That(task3.task.GetResultSafely(), Is.EqualTo(2));
} }
[Test] [Test]

View File

@ -188,7 +188,7 @@ namespace osu.Game.Tests.Skins.IO
var imported = skinManager.Import(new ImportTask(exportStream, "exported.osk")); var imported = skinManager.Import(new ImportTask(exportStream, "exported.osk"));
imported.WaitSafelyForResult().PerformRead(s => imported.GetResultSafely().PerformRead(s =>
{ {
Assert.IsFalse(s.Protected); Assert.IsFalse(s.Protected);
Assert.AreNotEqual(originalSkinId, s.ID); Assert.AreNotEqual(originalSkinId, s.ID);
@ -223,7 +223,7 @@ namespace osu.Game.Tests.Skins.IO
var imported = skinManager.Import(new ImportTask(exportStream, "exported.osk")); var imported = skinManager.Import(new ImportTask(exportStream, "exported.osk"));
imported.WaitSafelyForResult().PerformRead(s => imported.GetResultSafely().PerformRead(s =>
{ {
Assert.IsFalse(s.Protected); Assert.IsFalse(s.Protected);
Assert.AreNotEqual(originalSkinId, s.ID); Assert.AreNotEqual(originalSkinId, s.ID);

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Skins
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).WaitSafelyForResult(); var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).GetResultSafely();
beatmap = beatmaps.GetWorkingBeatmap(imported.Value.Beatmaps[0]); beatmap = beatmaps.GetWorkingBeatmap(imported.Value.Beatmaps[0]);
beatmap.LoadTrack(); beatmap.LoadTrack();
} }

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Skins
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var imported = skins.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-skin.osk"))).WaitSafelyForResult(); var imported = skins.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-skin.osk"))).GetResultSafely();
skin = imported.PerformRead(skinInfo => skins.GetSkin(skinInfo)); skin = imported.PerformRead(skinInfo => skins.GetSkin(skinInfo));
} }

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Editing
public override void SetUpSteps() public override void SetUpSteps()
{ {
AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).WaitSafelyForResult()); AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely());
base.SetUpSteps(); base.SetUpSteps();
} }

View File

@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Editing
public override void SetUpSteps() public override void SetUpSteps()
{ {
AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game).WaitSafelyForResult()); AddStep("import test beatmap", () => importedBeatmapSet = ImportBeatmapTest.LoadOszIntoOsu(game).GetResultSafely());
base.SetUpSteps(); base.SetUpSteps();
} }

View File

@ -136,7 +136,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded); AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)).WaitSafelyForResult()); AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)).GetResultSafely());
AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable); AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("import beatmap", () => AddStep("import beatmap", () =>
{ {
importedBeatmap = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).WaitSafelyForResult(); importedBeatmap = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely();
importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineID ?? -1; importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineID ?? -1;
}); });
} }

View File

@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Menus
AddStep("import beatmap with track", () => AddStep("import beatmap with track", () =>
{ {
var setWithTrack = Game.BeatmapManager.Import(new ImportTask(TestResources.GetTestBeatmapForImport())).WaitSafelyForResult(); var setWithTrack = Game.BeatmapManager.Import(new ImportTask(TestResources.GetTestBeatmapForImport())).GetResultSafely();
Beatmap.Value = Game.BeatmapManager.GetWorkingBeatmap(setWithTrack.Value.Beatmaps.First()); Beatmap.Value = Game.BeatmapManager.GetWorkingBeatmap(setWithTrack.Value.Beatmaps.First());
}); });

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
importedSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).WaitSafelyForResult(); importedSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely();
importedBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0); importedBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0);
importedBeatmapId = importedBeatmap.OnlineID ?? -1; importedBeatmapId = importedBeatmap.OnlineID ?? -1;
} }

View File

@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{ {
base.SetUpSteps(); base.SetUpSteps();
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).WaitSafelyForResult()); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).GetResultSafely());
AddStep("create leaderboard", () => AddStep("create leaderboard", () =>
{ {
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void TestUserQuit() public void TestUserQuit()
{ {
foreach (int user in users) foreach (int user in users)
AddStep($"mark user {user} quit", () => Client.RemoveUser(LookupCache.GetUserAsync(user).WaitSafelyForResult().AsNonNull())); AddStep($"mark user {user} quit", () => Client.RemoveUser(LookupCache.GetUserAsync(user).GetResultSafely().AsNonNull()));
} }
[Test] [Test]

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{ {
base.SetUpSteps(); base.SetUpSteps();
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).WaitSafelyForResult()); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).GetResultSafely());
AddStep("create leaderboard", () => AddStep("create leaderboard", () =>
{ {

View File

@ -127,7 +127,7 @@ namespace osu.Game.Tests.Visual.Navigation
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
}, },
} }
}).WaitSafelyForResult().Value; }).GetResultSafely().Value;
}); });
AddAssert($"import {i} succeeded", () => imported != null); AddAssert($"import {i} succeeded", () => imported != null);

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Navigation
Ruleset = new OsuRuleset().RulesetInfo Ruleset = new OsuRuleset().RulesetInfo
}, },
} }
}).WaitSafelyForResult().Value; }).GetResultSafely().Value;
}); });
} }
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Visual.Navigation
OnlineID = i, OnlineID = i,
BeatmapInfo = beatmap.Beatmaps.First(), BeatmapInfo = beatmap.Beatmaps.First(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
}).WaitSafelyForResult().Value; }).GetResultSafely().Value;
}); });
AddAssert($"import {i} succeeded", () => imported != null); AddAssert($"import {i} succeeded", () => imported != null);

View File

@ -202,7 +202,7 @@ namespace osu.Game.Tests.Visual.Playlists
}); });
} }
private void importBeatmap() => AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).WaitSafelyForResult()); private void importBeatmap() => AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).GetResultSafely());
private class TestPlaylistsRoomSubScreen : PlaylistsRoomSubScreen private class TestPlaylistsRoomSubScreen : PlaylistsRoomSubScreen
{ {

View File

@ -182,7 +182,7 @@ namespace osu.Game.Tests.Visual.SongSelect
beatmap.DifficultyName = $"SR{i + 1}"; beatmap.DifficultyName = $"SR{i + 1}";
} }
return Game.BeatmapManager.Import(beatmapSet).WaitSafelyForResult().Value; return Game.BeatmapManager.Import(beatmapSet).GetResultSafely().Value;
} }
private bool ensureAllBeatmapSetsImported(IEnumerable<BeatmapSetInfo> beatmapSets) => beatmapSets.All(set => set != null); private bool ensureAllBeatmapSetsImported(IEnumerable<BeatmapSetInfo> beatmapSets) => beatmapSets.All(set => set != null);

View File

@ -760,7 +760,7 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("import huge difficulty count map", () => AddStep("import huge difficulty count map", () =>
{ {
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray(); var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
imported = manager.Import(TestResources.CreateTestBeatmapSetInfo(50, usableRulesets)).WaitSafelyForResult().Value; imported = manager.Import(TestResources.CreateTestBeatmapSetInfo(50, usableRulesets)).GetResultSafely().Value;
}); });
AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported.Beatmaps.First())); AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported.Beatmaps.First()));

View File

@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual.UserInterface
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, ContextFactory, Scheduler)); dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, ContextFactory, Scheduler));
beatmapInfo = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).WaitSafelyForResult().Value.Beatmaps[0]; beatmapInfo = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely().Value.Beatmaps[0];
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
{ {
@ -102,7 +102,7 @@ namespace osu.Game.Tests.Visual.UserInterface
User = new APIUser { Username = "TestUser" }, User = new APIUser { Username = "TestUser" },
}; };
importedScores.Add(scoreManager.Import(score).WaitSafelyForResult().Value); importedScores.Add(scoreManager.Import(score).GetResultSafely().Value);
} }
return dependencies; return dependencies;

View File

@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
this.api = api; this.api = api;
testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).WaitSafelyForResult(); testBeatmap = ImportBeatmapTest.LoadOszIntoOsu(osu).GetResultSafely();
} }
[Test] [Test]

View File

@ -270,7 +270,7 @@ namespace osu.Game.Beatmaps
if (cancellationToken.IsCancellationRequested) if (cancellationToken.IsCancellationRequested)
return; return;
var starDifficulty = task.GetCompletedResult(); var starDifficulty = task.GetResultSafely();
if (starDifficulty != null) if (starDifficulty != null)
bindable.Value = starDifficulty.Value; bindable.Value = starDifficulty.Value;

View File

@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps
} }
}; };
var imported = beatmapModelManager.Import(set).WaitSafelyForResult().Value; var imported = beatmapModelManager.Import(set).GetResultSafely().Value;
return GetWorkingBeatmap(imported.Beatmaps.First()); return GetWorkingBeatmap(imported.Beatmaps.First());
} }

View File

@ -186,7 +186,7 @@ namespace osu.Game.Beatmaps
{ {
try try
{ {
return loadBeatmapAsync().WaitSafelyForResult(); return loadBeatmapAsync().GetResultSafely();
} }
catch (AggregateException ae) catch (AggregateException ae)
{ {

View File

@ -59,7 +59,7 @@ namespace osu.Game.Database
if (!task.IsCompletedSuccessfully) if (!task.IsCompletedSuccessfully)
return null; return null;
return task.GetCompletedResult(); return task.GetResultSafely();
}, token)); }, token));
} }

View File

@ -536,7 +536,7 @@ namespace osu.Game.Online.Chat
// Try to get user in order to open PM chat // Try to get user in order to open PM chat
users.GetUserAsync((int)lastClosedChannel.Id).ContinueWith(task => users.GetUserAsync((int)lastClosedChannel.Id).ContinueWith(task =>
{ {
var user = task.GetCompletedResult(); var user = task.GetResultSafely();
if (user != null) if (user != null)
Schedule(() => CurrentChannel.Value = JoinChannel(new Channel(user))); Schedule(() => CurrentChannel.Value = JoinChannel(new Channel(user)));

View File

@ -85,7 +85,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (loadCancellationSource.IsCancellationRequested) if (loadCancellationSource.IsCancellationRequested)
return; return;
var scores = task.GetCompletedResult(); var scores = task.GetResultSafely();
var topScore = scores.First(); var topScore = scores.First();

View File

@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Dashboard
{ {
users.GetUserAsync(id).ContinueWith(task => users.GetUserAsync(id).ContinueWith(task =>
{ {
var user = task.GetCompletedResult(); var user = task.GetResultSafely();
if (user == null) return; if (user == null) return;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
checkForUpdatesButton.Enabled.Value = false; checkForUpdatesButton.Enabled.Value = false;
Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(task => Schedule(() => Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(task => Schedule(() =>
{ {
if (!task.GetCompletedResult()) if (!task.GetResultSafely())
{ {
notifications?.Post(new SimpleNotification notifications?.Post(new SimpleNotification
{ {

View File

@ -113,7 +113,7 @@ namespace osu.Game.Scoring
public void GetTotalScore([NotNull] ScoreInfo score, [NotNull] Action<long> callback, ScoringMode mode = ScoringMode.Standardised, CancellationToken cancellationToken = default) public void GetTotalScore([NotNull] ScoreInfo score, [NotNull] Action<long> callback, ScoringMode mode = ScoringMode.Standardised, CancellationToken cancellationToken = default)
{ {
GetTotalScoreAsync(score, mode, cancellationToken) GetTotalScoreAsync(score, mode, cancellationToken)
.ContinueWith(task => scheduler.Add(() => callback(task.GetCompletedResult())), TaskContinuationOptions.OnlyOnRanToCompletion); .ContinueWith(task => scheduler.Add(() => callback(task.GetResultSafely())), TaskContinuationOptions.OnlyOnRanToCompletion);
} }
/// <summary> /// <summary>

View File

@ -111,7 +111,7 @@ namespace osu.Game.Screens.Menu
{ {
// if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state. // if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
// this could happen if a user has nuked their files store. for now, reimport to repair this. // this could happen if a user has nuked their files store. for now, reimport to repair this.
var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).WaitSafelyForResult(); var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely();
import.PerformWrite(b => import.PerformWrite(b =>
{ {

View File

@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play.HUD
userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray()).ContinueWith(task => Schedule(() => userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray()).ContinueWith(task => Schedule(() =>
{ {
var users = task.GetCompletedResult(); var users = task.GetResultSafely();
foreach (var user in users) foreach (var user in users)
{ {

View File

@ -76,7 +76,7 @@ namespace osu.Game.Screens.Play.HUD
difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token) difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token)
.ContinueWith(task => Schedule(() => .ContinueWith(task => Schedule(() =>
{ {
timedAttributes = task.GetCompletedResult(); timedAttributes = task.GetResultSafely();
IsValid = true; IsValid = true;

View File

@ -771,7 +771,7 @@ namespace osu.Game.Screens.Play
// This player instance may already be in the process of exiting. // This player instance may already be in the process of exiting.
return; return;
this.Push(CreateResults(prepareScoreForDisplayTask.WaitSafelyForResult())); this.Push(CreateResults(prepareScoreForDisplayTask.GetResultSafely()));
}, Time.Current + delay, 50); }, Time.Current + delay, 50);
Scheduler.Add(resultsDisplayDelegate); Scheduler.Add(resultsDisplayDelegate);

View File

@ -80,7 +80,7 @@ namespace osu.Game.Screens.Ranking.Expanded
statisticDisplays.AddRange(topStatistics); statisticDisplays.AddRange(topStatistics);
statisticDisplays.AddRange(bottomStatistics); statisticDisplays.AddRange(bottomStatistics);
var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).WaitSafelyForResult(); var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).GetResultSafely();
AddInternal(new FillFlowContainer AddInternal(new FillFlowContainer
{ {

View File

@ -38,7 +38,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
else else
{ {
performanceCache.CalculatePerformanceAsync(score, cancellationTokenSource.Token) performanceCache.CalculatePerformanceAsync(score, cancellationTokenSource.Token)
.ContinueWith(t => Schedule(() => setPerformanceValue(t.GetCompletedResult())), cancellationTokenSource.Token); .ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely())), cancellationTokenSource.Token);
} }
} }

View File

@ -153,8 +153,8 @@ namespace osu.Game.Screens.Select.Details
Task.WhenAll(normalStarDifficultyTask, moddedStarDifficultyTask).ContinueWith(_ => Schedule(() => Task.WhenAll(normalStarDifficultyTask, moddedStarDifficultyTask).ContinueWith(_ => Schedule(() =>
{ {
var normalDifficulty = normalStarDifficultyTask.GetCompletedResult(); var normalDifficulty = normalStarDifficultyTask.GetResultSafely();
var moddeDifficulty = moddedStarDifficultyTask.GetCompletedResult(); var moddeDifficulty = moddedStarDifficultyTask.GetResultSafely();
if (normalDifficulty == null || moddeDifficulty == null) if (normalDifficulty == null || moddeDifficulty == null)
return; return;

View File

@ -143,7 +143,7 @@ namespace osu.Game.Screens.Select.Leaderboards
} }
scoreManager.OrderByTotalScoreAsync(scores.ToArray(), cancellationToken) scoreManager.OrderByTotalScoreAsync(scores.ToArray(), cancellationToken)
.ContinueWith(task => scoresCallback?.Invoke(task.GetCompletedResult()), TaskContinuationOptions.OnlyOnRanToCompletion); .ContinueWith(task => scoresCallback?.Invoke(task.GetResultSafely()), TaskContinuationOptions.OnlyOnRanToCompletion);
return null; return null;
} }
@ -184,7 +184,7 @@ namespace osu.Game.Screens.Select.Leaderboards
if (cancellationToken.IsCancellationRequested) if (cancellationToken.IsCancellationRequested)
return; return;
scoresCallback?.Invoke(task.GetCompletedResult()); scoresCallback?.Invoke(task.GetResultSafely());
TopScore = r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo); TopScore = r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo);
}), TaskContinuationOptions.OnlyOnRanToCompletion); }), TaskContinuationOptions.OnlyOnRanToCompletion);
}; };

View File

@ -60,7 +60,7 @@ namespace osu.Game.Screens.Spectate
userLookupCache.GetUsersAsync(users.ToArray()).ContinueWith(task => Schedule(() => userLookupCache.GetUsersAsync(users.ToArray()).ContinueWith(task => Schedule(() =>
{ {
var foundUsers = task.GetCompletedResult(); var foundUsers = task.GetResultSafely();
foreach (var u in foundUsers) foreach (var u in foundUsers)
{ {

View File

@ -154,7 +154,7 @@ namespace osu.Game.Skinning
Name = s.Name + @" (modified)", Name = s.Name + @" (modified)",
Creator = s.Creator, Creator = s.Creator,
InstantiationInfo = s.InstantiationInfo, InstantiationInfo = s.InstantiationInfo,
}).WaitSafelyForResult(); }).GetResultSafely();
if (result != null) if (result != null)
{ {

View File

@ -148,7 +148,7 @@ namespace osu.Game.Tests.Beatmaps
if (!conversionTask.Wait(10000)) if (!conversionTask.Wait(10000))
Assert.Fail("Conversion timed out"); Assert.Fail("Conversion timed out");
return conversionTask.GetCompletedResult(); return conversionTask.GetResultSafely();
} }
protected virtual void OnConversionGenerated(HitObject original, IEnumerable<HitObject> result, IBeatmapConverter beatmapConverter) protected virtual void OnConversionGenerated(HitObject original, IEnumerable<HitObject> result, IBeatmapConverter beatmapConverter)