mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Clean up stable lookup and mutate logic
This commit is contained in:
parent
8346c50ce1
commit
ba8df3ba92
@ -486,7 +486,7 @@ namespace osu.Game.Database
|
||||
/// <summary>
|
||||
/// Set a storage with access to an osu-stable install for import purposes.
|
||||
/// </summary>
|
||||
public Func<Storage> GetStableStorage { protected get; set; }
|
||||
public Func<Storage> GetStableStorage { private get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Denotes whether an osu-stable installation is present to perform automated imports from.
|
||||
@ -501,7 +501,7 @@ namespace osu.Game.Database
|
||||
/// <summary>
|
||||
/// Selects paths to import from.
|
||||
/// </summary>
|
||||
protected abstract IEnumerable<string> GetStableImportPaths();
|
||||
protected virtual IEnumerable<string> GetStableImportPaths(Storage stableStoage) => stableStoage.GetDirectories(ImportFromStablePath);
|
||||
|
||||
/// <summary>
|
||||
/// Whether this specified path should be removed after successful import.
|
||||
@ -530,7 +530,7 @@ namespace osu.Game.Database
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
return Task.Run(async () => await Import(GetStableImportPaths().Select(f => stable.GetFullPath(f)).ToArray()));
|
||||
return Task.Run(async () => await Import(GetStableImportPaths(GetStableStorage()).Select(f => stable.GetFullPath(f)).ToArray()));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -56,9 +56,8 @@ namespace osu.Game.Scoring
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> GetStableImportPaths()
|
||||
=> GetStableStorage().GetFiles(ImportFromStablePath)
|
||||
.Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.InvariantCultureIgnoreCase) ?? false));
|
||||
protected override IEnumerable<string> GetStableImportPaths(Storage stableStorage)
|
||||
=> stableStorage.GetFiles(ImportFromStablePath).Where(p => HandledExtensions.Any(ext => Path.GetExtension(p)?.Equals(ext, StringComparison.InvariantCultureIgnoreCase) ?? false));
|
||||
|
||||
public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps(), Files.Store);
|
||||
|
||||
|
@ -55,8 +55,6 @@ namespace osu.Game.Skinning
|
||||
};
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> GetStableImportPaths() => GetStableStorage().GetDirectories(ImportFromStablePath);
|
||||
|
||||
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osk";
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user