diff --git a/GZ.cs b/GZ.cs index df3ab85..c6fb0b6 100644 --- a/GZ.cs +++ b/GZ.cs @@ -1,6 +1,9 @@ -using ICSharpCode.SharpZipLib.Tar; +using ICSharpCode.SharpZipLib.GZip; +using ICSharpCode.SharpZipLib.Tar; using System.Diagnostics; using System.IO.Compression; +using System.Text; +using static System.Net.Mime.MediaTypeNames; namespace TaikoSoundEditor { @@ -57,6 +60,20 @@ namespace TaikoSoundEditor { Logger.Info("GZ Compressing file"); + var uncompressed = Encoding.UTF8.GetBytes(content); + + using (MemoryStream outStream = new MemoryStream()) + { + using (GZipOutputStream gzoStream = new GZipOutputStream(outStream)) + { + gzoStream.SetLevel(5); + gzoStream.Write(uncompressed, 0, uncompressed.Length); + } + File.WriteAllBytes(fileName, outStream.ToArray()); + } + + return ""; + var tmp = "~ztmp"; if (!Directory.Exists(tmp)) Directory.CreateDirectory(tmp); diff --git a/Utils/DatatableIO.cs b/Utils/DatatableIO.cs index 204e4ed..ce19d6a 100644 --- a/Utils/DatatableIO.cs +++ b/Utils/DatatableIO.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -14,7 +15,12 @@ namespace TaikoSoundEditor.Utils public T Deserialize(string path) { if (!IsEncrypted) + { + var str = GZ.DecompressString(path); + Debug.WriteLine("----------------------------------------------------------------------"); + Debug.WriteLine(str); return Json.Deserialize(GZ.DecompressString(path)); + } else { var bytes = SSL.DecryptDatatable(File.ReadAllBytes(path));