Fix casing on private properties

This commit is contained in:
Drew DeVault
2016-10-10 14:00:33 -04:00
committed by Dean Herbert
parent dc4bd48f29
commit 880399f5a5
5 changed files with 43 additions and 43 deletions

View File

@ -6,18 +6,18 @@ namespace osu.Game.Beatmaps.Formats
{
public abstract class BeatmapDecoder
{
private static Dictionary<string, Type> Decoders { get; set; } = new Dictionary<string, Type>();
private static Dictionary<string, Type> decoders { get; set; } = new Dictionary<string, Type>();
public static BeatmapDecoder GetDecoder(TextReader stream)
{
var line = stream.ReadLine().Trim();
if (!Decoders.ContainsKey(line))
if (!decoders.ContainsKey(line))
throw new IOException("Unknown file format");
return (BeatmapDecoder)Activator.CreateInstance(Decoders[line]);
return (BeatmapDecoder)Activator.CreateInstance(decoders[line]);
}
protected static void AddDecoder<T>(string magic) where T : BeatmapDecoder
{
{
decoders[magic] = typeof(T);
}

View File

@ -13,11 +13,11 @@ namespace osu.Game.Beatmaps.IO
public Type Type { get; set; }
}
private static List<Reader> Readers { get; set; } = new List<Reader>();
private static List<Reader> readers { get; set; } = new List<Reader>();
public static ArchiveReader GetReader(BasicStorage storage, string path)
{
foreach (var reader in Readers)
foreach (var reader in readers)
{
if (reader.Test(storage, path))
return (ArchiveReader)Activator.CreateInstance(reader.Type);
@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps.IO
protected static void AddReader<T>(Func<BasicStorage, string, bool> test) where T : ArchiveReader
{
Readers.Add(new Reader { Test = test, Type = typeof(T) });
readers.Add(new Reader { Test = test, Type = typeof(T) });
}
/// <summary>

View File

@ -23,32 +23,32 @@ namespace osu.Game.Beatmaps.IO
OsuLegacyDecoder.Register();
}
private ZipFile Archive { get; set; }
private string[] Beatmaps { get; set; }
private Beatmap FirstMap { get; set; }
private ZipFile archive { get; set; }
private string[] beatmaps { get; set; }
private Beatmap firstMap { get; set; }
public OszArchiveReader(Stream archive)
public OszArchiveReader(Stream archiveStream)
{
Archive = ZipFile.Read(archive);
Beatmaps = Archive.Entries.Where(e => e.FileName.EndsWith(".osu"))
archive = ZipFile.Read(archiveStream);
beatmaps = archive.Entries.Where(e => e.FileName.EndsWith(".osu"))
.Select(e => e.FileName).ToArray();
if (Beatmaps.Length == 0)
if (beatmaps.Length == 0)
throw new FileNotFoundException("This directory contains no beatmaps");
using (var stream = new StreamReader(ReadFile(Beatmaps[0])))
using (var stream = new StreamReader(ReadFile(beatmaps[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
FirstMap = decoder.Decode(stream);
firstMap = decoder.Decode(stream);
}
}
public override string[] ReadBeatmaps()
{
return Beatmaps;
return beatmaps;
}
public override Stream ReadFile(string name)
{
ZipEntry entry = Archive.Entries.SingleOrDefault(e => e.FileName == name);
ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name);
if (entry == null)
throw new FileNotFoundException();
return entry.OpenReader();
@ -56,11 +56,11 @@ namespace osu.Game.Beatmaps.IO
public override BeatmapMetadata ReadMetadata()
{
return FirstMap.Metadata;
return firstMap.Metadata;
}
public override void Dispose()
{
{
archive.Dispose();
}
}