trying to change gzip compressor
This commit is contained in:
parent
0cc23812da
commit
b3bb2d1312
19
GZ.cs
19
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);
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user