(Entry.ChangeType): new public method.

This commit is contained in:
morkt 2017-01-25 09:31:20 +04:00
parent a58c29625d
commit ec9f615919

View File

@ -53,6 +53,23 @@ namespace GameRes
{ {
return Offset < max_offset && Size <= max_offset && Offset <= max_offset - Size; return Offset < max_offset && Size <= max_offset && Offset <= max_offset - Size;
} }
/// <summary>
/// Change entry type to the type of resource <paramref name="res"/>.
/// Entry name extension is changed accordingly.
/// </summary>
public void ChangeType (IResource res)
{
if (null == res)
return;
Type = res.Type;
foreach (var ext in res.Extensions)
{
if (!string.IsNullOrEmpty (ext))
Name = Path.ChangeExtension (Name, ext);
break;
}
}
} }
public class PackedEntry : Entry public class PackedEntry : Entry