mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 20:34:13 +08:00
use ImageFormat.Png/AudioFormat.Wav shortcuts.
This commit is contained in:
parent
ce496ce05f
commit
ba6b8b4f8e
@ -44,7 +44,6 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
Extensions = new string[] { "vaw", "wgq" };
|
Extensions = new string[] { "vaw", "wgq" };
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly Lazy<AudioFormat> WavFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "WAV"));
|
|
||||||
static readonly Lazy<AudioFormat> OggFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "OGG"));
|
static readonly Lazy<AudioFormat> OggFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "OGG"));
|
||||||
|
|
||||||
public override SoundInput TryOpen (Stream file)
|
public override SoundInput TryOpen (Stream file)
|
||||||
@ -60,7 +59,7 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
return null;
|
return null;
|
||||||
if (!Binary.AsciiEqual (header.Bytes, "RIFF"))
|
if (!Binary.AsciiEqual (header.Bytes, "RIFF"))
|
||||||
return null;
|
return null;
|
||||||
format = WavFormat.Value;
|
format = Wav;
|
||||||
offset = 0x40;
|
offset = 0x40;
|
||||||
}
|
}
|
||||||
else if (2 == header.PackType)
|
else if (2 == header.PackType)
|
||||||
|
@ -87,14 +87,6 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImageFormat GetFormat (string tag)
|
|
||||||
{
|
|
||||||
return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
static readonly Lazy<ImageFormat> JpegFormat = new Lazy<ImageFormat> (() => GetFormat ("JPEG"));
|
|
||||||
static readonly Lazy<ImageFormat> PngFormat = new Lazy<ImageFormat> (() => GetFormat ("PNG"));
|
|
||||||
|
|
||||||
public override ImageMetaData ReadMetaData (Stream stream)
|
public override ImageMetaData ReadMetaData (Stream stream)
|
||||||
{
|
{
|
||||||
var header = ResourceHeader.Read (stream);
|
var header = ResourceHeader.Read (stream);
|
||||||
@ -142,10 +134,10 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
switch (meta.PackType)
|
switch (meta.PackType)
|
||||||
{
|
{
|
||||||
case 5: // JPEG
|
case 5: // JPEG
|
||||||
return JpegFormat.Value.Read (input, info);
|
return Jpeg.Read (input, info);
|
||||||
|
|
||||||
case 8: // PNG
|
case 8: // PNG
|
||||||
return PngFormat.Value.Read (input, info);
|
return Png.Read (input, info);
|
||||||
|
|
||||||
case 0: // BMP
|
case 0: // BMP
|
||||||
case 2: // BMP+MASK
|
case 2: // BMP+MASK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user