1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 03:37:20 +08:00

Shortcut checking for whether directories are files ()

Shortcut checking for whether directories are files
This commit is contained in:
Dean Herbert 2019-06-26 17:47:21 +09:00 committed by GitHub
commit 5a791dcd86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

@ -41,7 +41,7 @@ namespace osu.Game.Beatmaps
}
}
private string getPathForFile(string filename) => BeatmapSetInfo.Files.First(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase)).FileInfo.StoragePath;
private string getPathForFile(string filename) => BeatmapSetInfo.Files.FirstOrDefault(f => string.Equals(f.Filename, filename, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
private TextureStore textureStore;

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
using SharpCompress.Archives.Zip;
namespace osu.Game.Utils
@ -10,6 +11,9 @@ namespace osu.Game.Utils
{
public static bool IsZipArchive(string path)
{
if (!File.Exists(path))
return false;
try
{
using (var arc = ZipArchive.Open(path))