mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:12:54 +08:00
Skip quick import clause when importing a single item
Closes https://github.com/ppy/osu/issues/18600.
This commit is contained in:
parent
7affef75b0
commit
2f8290831a
@ -225,10 +225,10 @@ namespace osu.Game.Tests.Online
|
|||||||
this.testBeatmapManager = testBeatmapManager;
|
this.testBeatmapManager = testBeatmapManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Live<BeatmapSetInfo> Import(BeatmapSetInfo item, ArchiveReader archive = null, CancellationToken cancellationToken = default)
|
public override Live<BeatmapSetInfo> Import(BeatmapSetInfo item, ArchiveReader archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
testBeatmapManager.AllowImport.Task.WaitSafely();
|
testBeatmapManager.AllowImport.Task.WaitSafely();
|
||||||
return (testBeatmapManager.CurrentImport = base.Import(item, archive, cancellationToken));
|
return (testBeatmapManager.CurrentImport = base.Import(item, archive, quickSkipIfExisting, cancellationToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public Task<Live<BeatmapSetInfo>?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, lowPriority, cancellationToken);
|
public Task<Live<BeatmapSetInfo>?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default) => beatmapModelManager.Import(archive, lowPriority, cancellationToken);
|
||||||
|
|
||||||
public Live<BeatmapSetInfo>? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, cancellationToken);
|
public Live<BeatmapSetInfo>? Import(BeatmapSetInfo item, ArchiveReader? archive = null, CancellationToken cancellationToken = default) => beatmapModelManager.Import(item, archive, false, cancellationToken);
|
||||||
|
|
||||||
public IEnumerable<string> HandledExtensions => beatmapModelManager.HandledExtensions;
|
public IEnumerable<string> HandledExtensions => beatmapModelManager.HandledExtensions;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
public Task<IEnumerable<Live<ScoreInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks);
|
public Task<IEnumerable<Live<ScoreInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks);
|
||||||
|
|
||||||
public Live<ScoreInfo> Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, cancellationToken);
|
public Live<ScoreInfo> Import(ScoreInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, lowPriority, cancellationToken);
|
||||||
|
|
||||||
public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model);
|
public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ namespace osu.Game.Stores
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, cancellationToken),
|
var scheduledImport = Task.Factory.StartNew(() => Import(model, archive, lowPriority, cancellationToken),
|
||||||
cancellationToken,
|
cancellationToken,
|
||||||
TaskCreationOptions.HideScheduler,
|
TaskCreationOptions.HideScheduler,
|
||||||
lowPriority ? import_scheduler_low_priority : import_scheduler);
|
lowPriority ? import_scheduler_low_priority : import_scheduler);
|
||||||
@ -248,17 +248,16 @@ namespace osu.Game.Stores
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The model to be imported.</param>
|
/// <param name="item">The model to be imported.</param>
|
||||||
/// <param name="archive">An optional archive to use for model population.</param>
|
/// <param name="archive">An optional archive to use for model population.</param>
|
||||||
|
/// <param name="quickSkipIfExisting">If <c>true</c>, imports will be skipped before they begin, given an existing model matches on hash and filenames. Should generally only be used for large batch imports, as it may defy user expectations when updating an existing model.</param>
|
||||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||||
public virtual Live<TModel>? Import(TModel item, ArchiveReader? archive = null, CancellationToken cancellationToken = default)
|
public virtual Live<TModel>? Import(TModel item, ArchiveReader? archive = null, bool quickSkipIfExisting = false, CancellationToken cancellationToken = default) => Realm.Run(realm =>
|
||||||
{
|
|
||||||
return Realm.Run(realm =>
|
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
bool checkedExisting = false;
|
bool checkedExisting = false;
|
||||||
TModel? existing = null;
|
TModel? existing = null;
|
||||||
|
|
||||||
if (archive != null && !HasCustomHashFunction)
|
if (quickSkipIfExisting && archive != null && !HasCustomHashFunction)
|
||||||
{
|
{
|
||||||
// this is a fast bail condition to improve large import performance.
|
// this is a fast bail condition to improve large import performance.
|
||||||
item.Hash = computeHashFast(archive);
|
item.Hash = computeHashFast(archive);
|
||||||
@ -347,7 +346,6 @@ namespace osu.Game.Stores
|
|||||||
|
|
||||||
return (Live<TModel>?)item.ToLive(Realm);
|
return (Live<TModel>?)item.ToLive(Realm);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Any file extensions which should be included in hash creation.
|
/// Any file extensions which should be included in hash creation.
|
||||||
|
Loading…
Reference in New Issue
Block a user