Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,68 @@
#region Header
// _,-'/-'/
// . __,-; ,'( '/
// \. `-.__`-._`:_,-._ _ , . ``
// `:-._,------' ` _,`--` -: `_ , ` ,' :
// `---..__,,--' (C) 2023 ` -'. -'
// # Vita-Nex [http://core.vita-nex.com] #
// {o)xxx|===============- # -===============|xxx(o}
// # #
#endregion
#region References
using System.IO;
using System.IO.Compression;
using System.Text;
#endregion
namespace VitaNex
{
public static class StringCompression
{
public static Encoding DefaultEncoding = Encoding.UTF8;
public static byte[] Pack(string str)
{
return Pack(str, DefaultEncoding);
}
public static byte[] Pack(string str, Encoding enc)
{
var bytes = enc.GetBytes(str);
using (var stdIn = new MemoryStream(bytes))
{
using (var stdOut = new MemoryStream())
{
using (var s = new GZipStream(stdOut, CompressionMode.Compress))
{
stdIn.CopyTo(s);
}
return stdOut.ToArray();
}
}
}
public static string Unpack(byte[] bytes)
{
return Unpack(bytes, DefaultEncoding);
}
public static string Unpack(byte[] bytes, Encoding enc)
{
using (var stdIn = new MemoryStream(bytes))
{
using (var stdOut = new MemoryStream())
{
using (var s = new GZipStream(stdIn, CompressionMode.Decompress))
{
s.CopyTo(stdOut);
}
return enc.GetString(stdOut.ToArray());
}
}
}
}
}