1
0
mirror of synced 2025-02-22 13:20:23 +01:00

Fix byaml nodes not adding dictionaries properly in arrays

This commit is contained in:
KillzXGaming 2019-04-25 21:59:44 -04:00
parent 38e4cbad6a
commit 46c962ff0a
6 changed files with 11 additions and 4 deletions

Binary file not shown.

View File

@ -25,6 +25,10 @@ namespace FirstPlugin
{ {
using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true)) using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true))
{ {
//File too small to have any data
if (stream.Length <= 16)
return false;
if (reader.CheckSignature(2, "BY") || reader.CheckSignature(2, "YB")) if (reader.CheckSignature(2, "BY") || reader.CheckSignature(2, "YB"))
return true; return true;
else else

View File

@ -182,6 +182,8 @@ namespace FirstPlugin
{ {
foreach (dynamic k in list) foreach (dynamic k in list)
{ {
Console.WriteLine("array item " + k.ToString());
if ((k is Dictionary<string, dynamic>) || if ((k is Dictionary<string, dynamic>) ||
(k is List<dynamic>) || (k is List<dynamic>) ||
(k is List<ByamlPathPoint>)) (k is List<ByamlPathPoint>))
@ -200,9 +202,11 @@ namespace FirstPlugin
ValueTypeString = ValueType.ToString(); ValueTypeString = ValueType.ToString();
} }
ListViewItem item = new ListViewItem(ValueText); ListViewItem item = new ListViewItem(ValueText);
item.SubItems.Add(ValueTypeString); item.SubItems.Add(ValueTypeString);
item.SubItems.Add(ValueText); item.SubItems.Add(ValueText);
if (k != null) item.Tag = new EditableNode(k, k);
listViewCustom1.Items.Add(item); listViewCustom1.Items.Add(item);
} }
@ -226,13 +230,13 @@ namespace FirstPlugin
{ {
current.Text += $" : <Dictionary> {dictionaryIndex++}"; current.Text += $" : <Dictionary> {dictionaryIndex++}";
current.Tag = node[k]; current.Tag = node[k];
// current.Nodes.Add("✯✯dummy✯✯"); //a text that can't be in a byml current.Nodes.Add("✯✯dummy✯✯"); //a text that can't be in a byml
} }
else if (node[k] is IList<dynamic>) else if (node[k] is IList<dynamic>)
{ {
current.Text += $" : <Array> {arrayIndex++}"; current.Text += $" : <Array> {arrayIndex++}";
current.Tag = ((IList<dynamic>)node[k]); current.Tag = ((IList<dynamic>)node[k]);
// current.Nodes.Add("✯✯dummy✯✯"); current.Nodes.Add("✯✯dummy✯✯");
} }
else if (node[k] is IList<ByamlPathPoint>) else if (node[k] is IList<ByamlPathPoint>)
{ {
@ -273,13 +277,12 @@ namespace FirstPlugin
{ {
TreeNode current = addto.Add($"<Dictionary> {dictionaryIndex++}"); TreeNode current = addto.Add($"<Dictionary> {dictionaryIndex++}");
current.Tag = ((IDictionary<string, dynamic>)k); current.Tag = ((IDictionary<string, dynamic>)k);
// current.Nodes.Add("✯✯dummy✯✯"); current.Nodes.Add("✯✯dummy✯✯");
} }
else if (k is IList<dynamic>) else if (k is IList<dynamic>)
{ {
TreeNode current = addto.Add($"<Array> {arrayIndex++}"); TreeNode current = addto.Add($"<Array> {arrayIndex++}");
current.Tag = ((IList<dynamic>)k); current.Tag = ((IList<dynamic>)k);
// current.Nodes.Add("✯✯dummy✯✯");
} }
else if (k is IList<ByamlPathPoint>) else if (k is IList<ByamlPathPoint>)
{ {