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.Diagnostics;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using System.Text;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace TaikoSoundEditor
|
namespace TaikoSoundEditor
|
||||||
{
|
{
|
||||||
@ -57,6 +60,20 @@ namespace TaikoSoundEditor
|
|||||||
{
|
{
|
||||||
Logger.Info("GZ Compressing file");
|
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";
|
var tmp = "~ztmp";
|
||||||
if (!Directory.Exists(tmp))
|
if (!Directory.Exists(tmp))
|
||||||
Directory.CreateDirectory(tmp);
|
Directory.CreateDirectory(tmp);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -14,7 +15,12 @@ namespace TaikoSoundEditor.Utils
|
|||||||
public T Deserialize<T>(string path)
|
public T Deserialize<T>(string path)
|
||||||
{
|
{
|
||||||
if (!IsEncrypted)
|
if (!IsEncrypted)
|
||||||
|
{
|
||||||
|
var str = GZ.DecompressString(path);
|
||||||
|
Debug.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Debug.WriteLine(str);
|
||||||
return Json.Deserialize<T>(GZ.DecompressString(path));
|
return Json.Deserialize<T>(GZ.DecompressString(path));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var bytes = SSL.DecryptDatatable(File.ReadAllBytes(path));
|
var bytes = SSL.DecryptDatatable(File.ReadAllBytes(path));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user