1
0
mirror of synced 2024-11-23 20:10:57 +01:00

trying to change gzip compressor

This commit is contained in:
NotImplementedLife 2023-09-18 19:51:03 +03:00
parent 0cc23812da
commit b3bb2d1312
2 changed files with 24 additions and 1 deletions

19
GZ.cs
View File

@ -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);

View File

@ -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<T>(string path)
{
if (!IsEncrypted)
{
var str = GZ.DecompressString(path);
Debug.WriteLine("----------------------------------------------------------------------");
Debug.WriteLine(str);
return Json.Deserialize<T>(GZ.DecompressString(path));
}
else
{
var bytes = SSL.DecryptDatatable(File.ReadAllBytes(path));