mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 09:13:21 +08:00
Fix namespace, comply with naming rules
This commit is contained in:
parent
caa6e9c82b
commit
c84a9d56f5
@ -58,7 +58,7 @@ namespace osu.Desktop
|
|||||||
var dropData = (object[])e.Data.GetData(DataFormats.FileDrop);
|
var dropData = (object[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
var filePaths = dropData.Select(f => f.ToString()).ToArray();
|
var filePaths = dropData.Select(f => f.ToString()).ToArray();
|
||||||
|
|
||||||
if (filePaths.All(f => Path.GetExtension(f) == BeatmapArchiveReader.OszExtension))
|
if (filePaths.All(f => Path.GetExtension(f) == BeatmapArchiveReader.OSZ_EXTENSION))
|
||||||
Task.Run(() => BeatmapDatabase.Import(filePaths));
|
Task.Run(() => BeatmapDatabase.Import(filePaths));
|
||||||
else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
|
else if (filePaths.All(f => Path.GetExtension(f) == @".osr"))
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
@ -68,7 +68,7 @@ namespace osu.Desktop
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly string[] allowed_extensions = { BeatmapArchiveReader.OszExtension, @".osr" };
|
private static readonly string[] allowed_extensions = { BeatmapArchiveReader.OSZ_EXTENSION, @".osr" };
|
||||||
|
|
||||||
private void dragEnter(DragEventArgs e)
|
private void dragEnter(DragEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
|
|
||||||
private string prepareTempCopy(string path)
|
private string prepareTempCopy(string path)
|
||||||
{
|
{
|
||||||
var temp = Path.GetTempPath() + Guid.NewGuid() + BeatmapArchiveReader.OszExtension;
|
var temp = Path.GetTempPath() + Guid.NewGuid() + BeatmapArchiveReader.OSZ_EXTENSION;
|
||||||
return new FileInfo(path).CopyTo(temp, true).FullName;
|
return new FileInfo(path).CopyTo(temp, true).FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,13 @@ using System;
|
|||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.IO;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.IO
|
namespace osu.Game.Beatmaps.IO
|
||||||
{
|
{
|
||||||
public abstract class BeatmapArchiveReader : ArchiveReader
|
public abstract class BeatmapArchiveReader : ArchiveReader
|
||||||
{
|
{
|
||||||
public const string OszExtension = @".osz";
|
public const string OSZ_EXTENSION = @".osz";
|
||||||
|
|
||||||
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
|
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps.IO
|
|||||||
AddReader<OszArchiveReader>((storage, path) =>
|
AddReader<OszArchiveReader>((storage, path) =>
|
||||||
{
|
{
|
||||||
using (var stream = storage.GetStream(path))
|
using (var stream = storage.GetStream(path))
|
||||||
return Path.GetExtension(path) == OszExtension && ZipFile.IsZipFile(stream, false);
|
return Path.GetExtension(path) == OSZ_EXTENSION && ZipFile.IsZipFile(stream, false);
|
||||||
});
|
});
|
||||||
OsuLegacyDecoder.Register();
|
OsuLegacyDecoder.Register();
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
hash = input.GetMd5Hash();
|
hash = input.GetMd5Hash();
|
||||||
input.Seek(0, SeekOrigin.Begin);
|
input.Seek(0, SeekOrigin.Begin);
|
||||||
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash + BeatmapArchiveReader.OszExtension);
|
path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash + BeatmapArchiveReader.OSZ_EXTENSION);
|
||||||
if (!storage.Exists(path))
|
if (!storage.Exists(path))
|
||||||
using (var output = storage.GetStream(path, FileAccess.Write))
|
using (var output = storage.GetStream(path, FileAccess.Write))
|
||||||
input.CopyTo(output);
|
input.CopyTo(output);
|
||||||
|
@ -7,7 +7,7 @@ using System.IO;
|
|||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.IO
|
namespace osu.Game.IO
|
||||||
{
|
{
|
||||||
public abstract class ArchiveReader : IDisposable, IResourceStore<byte[]>
|
public abstract class ArchiveReader : IDisposable, IResourceStore<byte[]>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user