From a5ba80e55fbe238488970ae2cade120a58b8e6d3 Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 9 Feb 2018 07:59:12 +0400 Subject: [PATCH] (RIO): map archive object tree onto directory tree. --- ArcFormats/rUGP/ArcRIO.cs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/ArcFormats/rUGP/ArcRIO.cs b/ArcFormats/rUGP/ArcRIO.cs index 106ea759..c8263ae3 100644 --- a/ArcFormats/rUGP/ArcRIO.cs +++ b/ArcFormats/rUGP/ArcRIO.cs @@ -40,7 +40,7 @@ namespace GameRes.Formats.Rugp public override string Tag { get { return "RIO"; } } public override string Description { get { return "rUGP engine resource archive"; } } public override uint Signature { get { return 0; } } - public override bool IsHierarchic { get { return false; } } + public override bool IsHierarchic { get { return true; } } public override bool CanWrite { get { return false; } } public RioOpener () @@ -71,7 +71,7 @@ namespace GameRes.Formats.Rugp var dir = from node in nodes where SupportedClasses.ContainsKey (node.ClassName) select new Entry { - Name = node.Name, + Name = node.GetPathName(), Type = SupportedClasses[node.ClassName], Offset = node.Offset, Size = node.Size @@ -956,6 +956,7 @@ namespace GameRes.Formats.Rugp { "CObjectArcMan", new CObjectFactory() }, { "CrelicUnitedGameProject", new CObjectFactory() }, { "CStdb", new CObjectFactory() }, + { "CObjectOcean", new CObjectFactory() }, }; } @@ -1358,6 +1359,13 @@ namespace GameRes.Formats.Rugp } } + internal class CObjectOcean : CObject + { + public override void Deserialize (CRioArchive arc) + { + } + } + internal class COceanNode : CObject { public string Name; @@ -1374,6 +1382,21 @@ namespace GameRes.Formats.Rugp { throw new NotImplementedException ("COceanNode.Deserialize not impelemented"); } + + public string GetPathName () + { + return string.Join ("/", TraversePath().Reverse()); + } + + private IEnumerable TraversePath () + { + COceanNode node = this; + while (node != null && node.ClassName != null && !string.IsNullOrEmpty (node.Name)) + { + yield return node.Name; + node = node.Parent as COceanNode; + } + } } internal interface IObjectFactory