1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Fix editing some list types in byaml

This commit is contained in:
KillzXGaming 2019-05-17 19:55:06 -04:00
parent 5654105016
commit 8e5dc8e45c
8 changed files with 79 additions and 5 deletions

Binary file not shown.

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox;
using System.Windows.Forms;
using Switch_Toolbox.Library;
using Switch_Toolbox.Library.IO;
namespace FirstPlugin
{
public class NVNSH : IFileFormat
{
public FileType FileType { get; set; } = FileType.Shader;
public bool CanSave { get; set; }
public string[] Description { get; set; } = new string[] { "NVN Shader" };
public string[] Extension { get; set; } = new string[] { "*.nvnbin" };
public string FileName { get; set; }
public string FilePath { get; set; }
public IFileInfo IFileInfo { get; set; }
public bool Identify(System.IO.Stream stream)
{
using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true))
{
return reader.CheckSignature(5, "NVNsh");
}
}
public Type[] Types
{
get
{
List<Type> types = new List<Type>();
return types.ToArray();
}
}
public void Load(System.IO.Stream stream)
{
using (var reader = new FileReader(stream))
{
}
}
public void Unload()
{
}
public byte[] Save()
{
return null;
}
}
}

View File

@ -124,11 +124,27 @@ namespace FirstPlugin
//get a reference to the value to change
class EditableNode
{
public Type type { get { return Node[Index].GetType(); } }
dynamic Node;
dynamic Index;
dynamic Index = -1;
public dynamic Get() { return Node[Index]; }
public Type type
{
get
{
if (Index != -1)
return Node[Index].GetType();
else
return Node.GetType();
}
}
public dynamic Get()
{
if (Index != -1)
return Node[Index];
else
return Node;
}
public void Set(dynamic value) { Node[Index] = value; }
public string GetTreeViewString()
@ -207,7 +223,7 @@ namespace FirstPlugin
ListViewItem item = new ListViewItem(ValueText);
item.SubItems.Add(ValueTypeString);
item.SubItems.Add(ValueText);
if (k != null) item.Tag = new EditableNode(k, k);
if (k != null) item.Tag = new EditableNode(k, -1);
listViewCustom1.Items.Add(item);
}

View File

@ -226,6 +226,7 @@
<Compile Include="FileFormats\Font\BFFNT.cs" />
<Compile Include="FileFormats\Audio\Archives\BFGRP.cs" />
<Compile Include="FileFormats\Hashes\SAHT.cs" />
<Compile Include="FileFormats\Shader\NVNSH.cs" />
<Compile Include="FileFormats\Shader\SHARCFBNX.cs" />
<Compile Include="FileFormats\SizeTables\TPFileSizeTable.cs" />
<Compile Include="FileFormats\Texture\BCLIM.cs" />

View File

@ -1 +1 @@
de397ba635a09cef3e2cf1a780d3519a6c3b7d5d
b3fd6195e956ad1a3ce80bfdafc7f0f462fb99cc