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 Switch_Toolbox.Library.IO;
using Syroot.BinaryData;
using System.IO;
namespace FirstPlugin
{
public class SAHT
{
public SAHT(string FileName) {
Read(new FileReader(FileName));
public string FileName { get; set; }
public SAHT(string fileName) {
FileName = fileName;
Read(new FileReader(fileName));
}
public List<HashEntry> HashEntries = new List<HashEntry>();
@ -32,10 +36,19 @@ namespace FirstPlugin
HashEntries.Add(entry);
}
ToTextFile();
}
public void ToTextFile()
{
StringWriter writer = new StringWriter();
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

View file

@ -184,11 +184,18 @@ namespace FirstPlugin
}
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);
item.SubItems.Add(ValueType.ToString());
item.SubItems.Add(ValueTypeString);
item.SubItems.Add(ValueText);
listViewCustom1.Items.Add(item);