mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-26 17:02:53 +08:00
Merge pull request #54 from emcifuntik/master
Fixed name for ymts (Now we can add clothes as DLCs)
This commit is contained in:
commit
dc8cc398ec
@ -51,7 +51,7 @@ namespace CodeWalker.GameFiles
|
||||
public ResourceSimpleArray<MetaStructureInfo> StructureInfos { get; set; }
|
||||
public ResourceSimpleArray<MetaEnumInfo> EnumInfos { get; set; }
|
||||
public ResourceSimpleArray<MetaDataBlock> DataBlocks { get; set; }
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; set; }
|
||||
//public string[] Strings { get; set; }
|
||||
|
||||
private string_r NameBlock = null;
|
||||
|
@ -348,7 +348,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
|
||||
|
||||
public Meta GetMeta()
|
||||
public Meta GetMeta(string metaName = "")
|
||||
{
|
||||
Meta m = new Meta();
|
||||
m.FileVFT = 0x405bc808;
|
||||
@ -395,6 +395,8 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
m.DataBlocksCount = (short)m.DataBlocks.Count;
|
||||
|
||||
m.Name = metaName;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -128,13 +128,13 @@ namespace CodeWalker.GameFiles
|
||||
{
|
||||
var cont = new MetaCont(meta);
|
||||
|
||||
WriteNode(sb, 0, cont, meta.RootBlockIndex, 0, XmlTagMode.Structure);
|
||||
WriteNode(sb, 0, cont, meta.RootBlockIndex, 0, XmlTagMode.Structure, 0, (string)meta.Name);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static void WriteNode(StringBuilder sb, int indent, MetaCont cont, int blockId, int offset, XmlTagMode tagMode = XmlTagMode.None, MetaName structName = 0)
|
||||
private static void WriteNode(StringBuilder sb, int indent, MetaCont cont, int blockId, int offset, XmlTagMode tagMode = XmlTagMode.None, MetaName structName = 0, string metaName = "")
|
||||
{
|
||||
|
||||
var block = cont.Meta.GetBlock(blockId);
|
||||
@ -168,13 +168,13 @@ namespace CodeWalker.GameFiles
|
||||
switch (tagMode)
|
||||
{
|
||||
case XmlTagMode.Structure:
|
||||
OpenTag(sb, indent, name);
|
||||
OpenTag(sb, indent, name, true, metaName);
|
||||
break;
|
||||
case XmlTagMode.Item:
|
||||
OpenTag(sb, indent, "Item");
|
||||
OpenTag(sb, indent, "Item", true, metaName);
|
||||
break;
|
||||
case XmlTagMode.ItemAndType:
|
||||
OpenTag(sb, indent, "Item type=\"" + name + "\"");
|
||||
OpenTag(sb, indent, "Item type=\"" + name + "\"", true, metaName);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1599,12 +1599,19 @@ namespace CodeWalker.GameFiles
|
||||
sb.Append("</error>");
|
||||
sb.AppendLine();
|
||||
}
|
||||
public static void OpenTag(StringBuilder sb, int indent, string name, bool appendLine = true)
|
||||
public static void OpenTag(StringBuilder sb, int indent, string name, bool appendLine = true, string metaName = "")
|
||||
{
|
||||
Indent(sb, indent);
|
||||
sb.Append("<");
|
||||
sb.Append(name);
|
||||
sb.Append(">");
|
||||
if (string.IsNullOrWhiteSpace(metaName))
|
||||
{
|
||||
sb.Append(">");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(" name=\"" + metaName + "\">");
|
||||
}
|
||||
if (appendLine) sb.AppendLine();
|
||||
}
|
||||
public static void CloseTag(StringBuilder sb, int indent, string name, bool appendLine = true)
|
||||
|
@ -15,9 +15,12 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
Traverse(doc.DocumentElement, mb, 0, true);
|
||||
|
||||
var meta = mb.GetMeta();
|
||||
XmlNode metaName = doc.DocumentElement.Attributes.GetNamedItem("name");
|
||||
|
||||
return meta;
|
||||
if (metaName != null)
|
||||
return mb.GetMeta(metaName.Value);
|
||||
else
|
||||
return mb.GetMeta();
|
||||
}
|
||||
|
||||
private static byte[] Traverse(XmlNode node, MetaBuilder mb, MetaName type = 0, bool isRoot = false)
|
||||
|
Loading…
Reference in New Issue
Block a user