* Claunia.RsrcFork/Resource.cs:

Added method to check if an ID exists.

	* Claunia.RsrcFork/ResourceFork.cs:
	  Corrected check of offsets.
This commit is contained in:
2016-09-06 18:20:33 +01:00
parent d83669a004
commit 4e1e2af239
3 changed files with 12 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2016-09-06 Natalia Portillo <claunia@claunia.com>
* Resource.cs: Added method to check if an ID exists.
* ResourceFork.cs: Corrected check of offsets.
2016-09-02 Natalia Portillo <claunia@claunia.com>
* Claunia.RsrcFork.csproj: Downgrade framework requisites to

View File

@@ -162,6 +162,11 @@ namespace Claunia.RsrcFork
{
return ids.ToArray();
}
public bool ContainsId(short id)
{
return ids.Contains(id);
}
}
}

View File

@@ -79,7 +79,7 @@ namespace Claunia.RsrcFork
rsrcStream.Read(tmp, 0, 4);
header.resourceMapLen = BitConverter.ToInt32(tmp.Reverse().ToArray(), 0);
if(header.resourceDataOff <= 0 || header.resourceDataOff <= 0 || header.resourceDataLen <= 0 || header.resourceMapLen <= 0)
if(header.resourceDataOff <= 0 || header.resourceMapOff <= 0 || header.resourceDataLen <= 0 || header.resourceMapLen <= 0)
throw new InvalidCastException("Not a resource fork");
if(header.resourceDataOff + header.resourceDataLen > rsrcStream.Length ||