This commit is contained in:
Crsky
2023-10-28 18:21:20 +08:00
90 changed files with 10589 additions and 792 deletions

View File

@@ -197,8 +197,8 @@ namespace GameRes
return null;
}
public static AudioFormat Wav { get { return s_WavFormat.Value; } }
public static AudioFormat Wav => s_WavFormat.Value;
static readonly Lazy<AudioFormat> s_WavFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "WAV"));
static readonly ResourceInstance<AudioFormat> s_WavFormat = new ResourceInstance<AudioFormat> ("WAV");
}
}

View File

@@ -833,10 +833,7 @@ namespace GameRes
return false;
// now, compare length of filename portion of the path
int filename_index = path.LastIndexOfAny (PathSeparatorChars);
if (-1 == filename_index)
filename_index = 0;
else
filename_index++;
filename_index++;
int filename_portion_length = path.Length - filename_index;
return filename.Length == filename_portion_length;
}

View File

@@ -189,15 +189,15 @@ namespace GameRes
return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == tag);
}
static readonly Lazy<ImageFormat> s_JpegFormat = new Lazy<ImageFormat> (() => FindByTag ("JPEG"));
static readonly Lazy<ImageFormat> s_PngFormat = new Lazy<ImageFormat> (() => FindByTag ("PNG"));
static readonly Lazy<ImageFormat> s_BmpFormat = new Lazy<ImageFormat> (() => FindByTag ("BMP"));
static readonly Lazy<ImageFormat> s_TgaFormat = new Lazy<ImageFormat> (() => FindByTag ("TGA"));
static readonly ResourceInstance<ImageFormat> s_JpegFormat = new ResourceInstance<ImageFormat> ("JPEG");
static readonly ResourceInstance<ImageFormat> s_PngFormat = new ResourceInstance<ImageFormat> ("PNG");
static readonly ResourceInstance<ImageFormat> s_BmpFormat = new ResourceInstance<ImageFormat> ("BMP");
static readonly ResourceInstance<ImageFormat> s_TgaFormat = new ResourceInstance<ImageFormat> ("TGA");
public static ImageFormat Jpeg { get { return s_JpegFormat.Value; } }
public static ImageFormat Png { get { return s_PngFormat.Value; } }
public static ImageFormat Bmp { get { return s_BmpFormat.Value; } }
public static ImageFormat Tga { get { return s_TgaFormat.Value; } }
public static ImageFormat Jpeg => s_JpegFormat.Value;
public static ImageFormat Png => s_PngFormat.Value;
public static ImageFormat Bmp => s_BmpFormat.Value;
public static ImageFormat Tga => s_TgaFormat.Value;
/// <summary>
/// Desereialize color map from <paramref name="input"/> stream, consisting of specified number of

View File

@@ -47,6 +47,7 @@ namespace GameRes
}
[Export(typeof(ImageFormat))]
[ExportMetadata("Priority", 10)]
public sealed class BmpFormat : ImageFormat
{
public override string Tag { get { return "BMP"; } }

View File

@@ -34,6 +34,7 @@ using GameRes.Utility;
namespace GameRes
{
[Export(typeof(ImageFormat))]
[ExportMetadata("Priority", 10)]
public class JpegFormat : ImageFormat
{
public override string Tag { get { return "JPEG"; } }