Fix null types when clicked on in byaml editor

This commit is contained in:
KillzXGaming 2019-04-21 15:55:21 -04:00
parent 589198eb3a
commit a3b9d1363c
6 changed files with 25 additions and 5 deletions

Binary file not shown.

View file

@ -5,13 +5,17 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Switch_Toolbox.Library.IO; using Switch_Toolbox.Library.IO;
using Syroot.BinaryData; using Syroot.BinaryData;
using System.IO;
namespace FirstPlugin namespace FirstPlugin
{ {
public class SAHT public class SAHT
{ {
public SAHT(string FileName) { public string FileName { get; set; }
Read(new FileReader(FileName));
public SAHT(string fileName) {
FileName = fileName;
Read(new FileReader(fileName));
} }
public List<HashEntry> HashEntries = new List<HashEntry>(); public List<HashEntry> HashEntries = new List<HashEntry>();
@ -32,10 +36,19 @@ namespace FirstPlugin
HashEntries.Add(entry); HashEntries.Add(entry);
} }
ToTextFile();
}
public void ToTextFile()
{
StringWriter writer = new StringWriter();
foreach (var entry in HashEntries) foreach (var entry in HashEntries)
{ {
Console.WriteLine(entry.Hash + " " + entry.Name); writer.WriteLine($"{entry.Name}={entry.Hash.ToString("x")}");
} }
File.WriteAllText(FileName + ".txt", writer.ToString());
} }
public class HashEntry public class HashEntry

View file

@ -184,11 +184,18 @@ namespace FirstPlugin
} }
string ValueText = (k == null ? "<NULL>" : k.ToString()); string ValueText = (k == null ? "<NULL>" : k.ToString());
string ValueTypeString = "";
Type ValueType = k.GetType(); if (k == null)
ValueTypeString = "NULL";
else
{
Type ValueType = k.GetType();
ValueTypeString = ValueType.ToString();
}
ListViewItem item = new ListViewItem(ValueText); ListViewItem item = new ListViewItem(ValueText);
item.SubItems.Add(ValueType.ToString()); item.SubItems.Add(ValueTypeString);
item.SubItems.Add(ValueText); item.SubItems.Add(ValueText);
listViewCustom1.Items.Add(item); listViewCustom1.Items.Add(item);