2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-07-26 19:22:02 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2018-02-15 11:56:22 +08:00
|
|
|
|
using osu.Framework.IO.File;
|
2017-07-26 19:22:02 +08:00
|
|
|
|
|
2018-02-15 11:56:22 +08:00
|
|
|
|
namespace osu.Game.IO.Archives
|
2017-07-26 19:22:02 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reads an extracted legacy beatmap from disk.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class LegacyFilesystemReader : ArchiveReader
|
|
|
|
|
{
|
|
|
|
|
private readonly string path;
|
|
|
|
|
|
2018-02-15 09:20:23 +08:00
|
|
|
|
public LegacyFilesystemReader(string path) : base(Path.GetFileName(path))
|
2017-07-26 19:22:02 +08:00
|
|
|
|
{
|
|
|
|
|
this.path = path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name));
|
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
{
|
|
|
|
|
// no-op
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-18 16:14:29 +08:00
|
|
|
|
public override IEnumerable<string> Filenames => Directory.GetFiles(path, "*", SearchOption.AllDirectories).Select(f => FileSafety.GetRelativePath(f, path)).ToArray();
|
2017-07-26 19:22:02 +08:00
|
|
|
|
|
|
|
|
|
public override Stream GetUnderlyingStream() => null;
|
|
|
|
|
}
|
|
|
|
|
}
|