diff --git a/GameRes/GameRes.cs b/GameRes/GameRes.cs index 33923bb2..ea3ef349 100644 --- a/GameRes/GameRes.cs +++ b/GameRes/GameRes.cs @@ -53,6 +53,23 @@ namespace GameRes { return Offset < max_offset && Size <= max_offset && Offset <= max_offset - Size; } + + /// + /// Change entry type to the type of resource . + /// Entry name extension is changed accordingly. + /// + 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