Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions BundleFormat/BundleArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,45 @@ private void ProcessRST(string rst)
}
}

private void RebuildRST()
{
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("ResourceStringTable");
doc.AppendChild(root);

bool hasNamedResources = false;

foreach (BundleEntry entry in Entries)
{
string name = entry.DebugInfo.Name?.Trim();
if (string.IsNullOrEmpty(name))
continue;

XmlElement resource = doc.CreateElement("Resource");
resource.SetAttribute("id", entry.ID.ToString("X8"));
resource.SetAttribute("name", name);
resource.SetAttribute(
"type",
string.IsNullOrWhiteSpace(entry.DebugInfo.TypeName)
? entry.Type.ToString()
: entry.DebugInfo.TypeName
);

root.AppendChild(resource);
hasNamedResources = true;
}

if (!hasNamedResources)
{
ResourceStringTable = null;
Flags &= ~Flags.HasResourceStringTable;
return;
}

ResourceStringTable = doc.OuterXml;
Flags |= Flags.HasResourceStringTable;
}

public static BundleArchive Read(string path)
{
using (Stream s = File.OpenRead(path))
Expand Down Expand Up @@ -580,6 +619,8 @@ public void Write(string path)

public void Write(BinaryWriter2 bw)
{
RebuildRST();

bw.Write(BND2Magic);
bw.Write(Version);
bw.Write((int)Platform);
Expand Down
270 changes: 270 additions & 0 deletions BundleManager/ImportResourceForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading