mirror of
https://github.com/kwsch/pkNX.git
synced 2026-09-12 04:25:21 -05:00
File scoped namespaces for all lib projects netstandard2.0 => net6; now uniform. bye netframework!
28 lines
783 B
C#
28 lines
783 B
C#
using System.IO;
|
|
|
|
namespace pkNX.Structures.FlatBuffers;
|
|
|
|
public static class FlatDumper
|
|
{
|
|
public static string GetTable<T1, T2>(string path) where T1 : class, IFlatBufferArchive<T2> where T2 : class
|
|
{
|
|
var data = File.ReadAllBytes(path);
|
|
return GetTable<T1, T2>(data);
|
|
}
|
|
|
|
public static string GetTable<T1, T2>(byte[] data) where T1 : class, IFlatBufferArchive<T2> where T2 : class
|
|
{
|
|
var obj = FlatBufferConverter.DeserializeFrom<T1>(data);
|
|
var table = obj.Table;
|
|
return TableUtil.GetTable(table);
|
|
}
|
|
|
|
public static string GetSchema<T>() where T : class, new()
|
|
{
|
|
var t = typeof(T);
|
|
var obj = new T();
|
|
var dump = new FlatSchemaDump(obj);
|
|
return dump.GetSingleFileSchema(t);
|
|
}
|
|
}
|