1
0
mirror of synced 2024-11-30 22:17:17 +01:00
TaikoSoundEditor/Utils/DatatableIO.cs

35 lines
987 B
C#
Raw Normal View History

2023-09-18 17:53:43 +02:00
using System;
using System.Collections.Generic;
2023-09-18 18:51:03 +02:00
using System.Diagnostics;
2023-09-18 17:53:43 +02:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaikoSoundEditor.Data;
namespace TaikoSoundEditor.Utils
{
public class DatatableIO
{
public bool IsEncrypted { get; set; }
public T Deserialize<T>(string path)
{
if (!IsEncrypted)
2023-09-18 18:51:03 +02:00
{
var str = GZ.DecompressString(path);
Debug.WriteLine("----------------------------------------------------------------------");
Debug.WriteLine(str);
2023-09-18 17:53:43 +02:00
return Json.Deserialize<T>(GZ.DecompressString(path));
2023-09-18 18:51:03 +02:00
}
2023-09-18 17:53:43 +02:00
else
{
var bytes = SSL.DecryptDatatable(File.ReadAllBytes(path));
File.WriteAllBytes("res.bin", bytes);
return Json.Deserialize<T>(GZ.DecompressBytes(SSL.DecryptDatatable(File.ReadAllBytes(path))));
}
}
}
}