(IResource.CanWrite): new property.

(ArchiveFormat.CanCreate): renamed to CanWrite.
This commit is contained in:
morkt
2016-10-11 00:05:22 +04:00
parent 3c5a61d580
commit f1d66206bc
248 changed files with 323 additions and 279 deletions

View File

@@ -104,6 +104,7 @@ namespace GameRes
public override string Tag { get { return "WAV"; } }
public override string Description { get { return "Wave audio format"; } }
public override uint Signature { get { return 0x46464952; } } // 'RIFF'
public override bool CanWrite { get { return true; } }
static readonly HashSet<ushort> EmbeddedFormats = new HashSet<ushort> {
0x674f, 0x6751, 0x6771, // Vorbis

View File

@@ -76,6 +76,9 @@ namespace GameRes
/// or zero if it could vary.</summary>
public abstract uint Signature { get; }
/// <summary>Whether resource creation is supported by implementation.</summary>
public virtual bool CanWrite { get { return false; } }
/// <summary>Signatures peculiar to the resource (the one above is also included here).</summary>
public IEnumerable<uint> Signatures { get; protected set; }
@@ -169,8 +172,9 @@ namespace GameRes
{
public override string Type { get { return "archive"; } }
public virtual bool CanCreate { get { return false; } }
/// <summary>
/// Whether archive file system could contain subdirectories.
/// </summary>
public abstract bool IsHierarchic { get; }
public abstract ArcFile TryOpen (ArcView view);

View File

@@ -51,6 +51,7 @@ namespace GameRes
public override string Tag { get { return "BMP"; } }
public override string Description { get { return "Windows device independent bitmap"; } }
public override uint Signature { get { return 0; } }
public override bool CanWrite { get { return true; } }
#pragma warning disable 649
[ImportMany(typeof(IBmpExtension))]

View File

@@ -35,9 +35,10 @@ namespace GameRes
[Export(typeof(ImageFormat))]
public class JpegFormat : ImageFormat
{
public override string Tag { get { return "JPEG"; } }
public override string Tag { get { return "JPEG"; } }
public override string Description { get { return "JPEG image file format"; } }
public override uint Signature { get { return 0; } }
public override uint Signature { get { return 0; } }
public override bool CanWrite { get { return true; } }
public int Quality { get; set; }

View File

@@ -36,9 +36,10 @@ namespace GameRes
[Export(typeof(ImageFormat))]
public class PngFormat : ImageFormat
{
public override string Tag { get { return "PNG"; } }
public override string Tag { get { return "PNG"; } }
public override string Description { get { return "Portable Network Graphics image"; } }
public override uint Signature { get { return 0x474e5089; } }
public override uint Signature { get { return 0x474e5089; } }
public override bool CanWrite { get { return true; } }
public override ImageData Read (Stream file, ImageMetaData info)
{

View File

@@ -47,9 +47,10 @@ namespace GameRes
[Export(typeof(ImageFormat))]
public class TgaFormat : ImageFormat
{
public override string Tag { get { return "TGA"; } }
public override string Tag { get { return "TGA"; } }
public override string Description { get { return "Truevision TGA image"; } }
public override uint Signature { get { return 0; } }
public override uint Signature { get { return 0; } }
public override bool CanWrite { get { return true; } }
public override ImageData Read (Stream stream, ImageMetaData metadata)
{

View File

@@ -35,9 +35,10 @@ namespace GameRes
[Export(typeof(ImageFormat))]
public class TifFormat : ImageFormat
{
public override string Tag { get { return "TIFF"; } }
public override string Tag { get { return "TIFF"; } }
public override string Description { get { return "Tagged Image File Format"; } }
public override uint Signature { get { return 0; } }
public override uint Signature { get { return 0; } }
public override bool CanWrite { get { return true; } }
public TifFormat ()
{