From 65a0323e6e4e2704d03cee66c5ab945d715f88a2 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Wed, 19 Apr 2023 22:42:28 +0800 Subject: [PATCH 1/2] Update EditorBuildSettings.asset --- ProjectSettings/EditorBuildSettings.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 3dd9e7ae..c6a09d41 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -6,6 +6,6 @@ EditorBuildSettings: serializedVersion: 2 m_Scenes: - enabled: 1 - path: Assets/AATemp/temp.unity - guid: 18a2a610457925e44ac734e90182e6b6 + path: Assets/Scenes/main.unity + guid: ffce650b4a398384a896297542ef0992 m_configObjects: {} From 05a589e95865104fa7dbc2b8ab1d0efca0d1a761 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Thu, 20 Apr 2023 17:55:45 +0800 Subject: [PATCH 2/2] [+] Repleace LubanLib => LubanLib.dll [+] Repleace LubanLib => LubanLib.dll --- .../BattleCore/BattleCore.Runtime.asmdef | 1 - .../HotFix/GameLogic/GameLogic.asmdef | 1 - .../HotFix/GameProto/GameProto.asmdef | 1 - Assets/TEngine/Libraries/LubanLib.dll | Bin 0 -> 62464 bytes Assets/TEngine/Libraries/LubanLib.dll.meta | 33 + Assets/TEngine/Libraries/LubanLib.meta | 8 - Assets/TEngine/Libraries/LubanLib/BeanBase.cs | 9 - .../Libraries/LubanLib/BeanBase.cs.meta | 11 - Assets/TEngine/Libraries/LubanLib/ByteBuf.cs | 1568 ----------------- .../Libraries/LubanLib/ByteBuf.cs.meta | 11 - Assets/TEngine/Libraries/LubanLib/ITypeId.cs | 7 - .../Libraries/LubanLib/ITypeId.cs.meta | 11 - .../Libraries/LubanLib/LubanLib.asmdef | 14 - .../Libraries/LubanLib/LubanLib.asmdef.meta | 7 - .../Libraries/LubanLib/SimpleJSON.meta | 8 - .../Libraries/LubanLib/SimpleJSON/LICENSE | 21 - .../LubanLib/SimpleJSON/LICENSE.meta | 7 - .../Libraries/LubanLib/SimpleJSON/README | 0 .../Libraries/LubanLib/SimpleJSON/README.meta | 7 - .../LubanLib/SimpleJSON/SimpleJSON.cs | 1434 --------------- .../LubanLib/SimpleJSON/SimpleJSON.cs.meta | 11 - .../LubanLib/SimpleJSON/SimpleJSONBinary.cs | 301 ---- .../SimpleJSON/SimpleJSONBinary.cs.meta | 11 - .../SimpleJSON/SimpleJSONDotNetTypes.cs | 516 ------ .../SimpleJSON/SimpleJSONDotNetTypes.cs.meta | 11 - .../LubanLib/SimpleJSON/SimpleJSONUnity.cs | 462 ----- .../SimpleJSON/SimpleJSONUnity.cs.meta | 11 - .../TEngine/Libraries/LubanLib/StringUtil.cs | 52 - .../Libraries/LubanLib/StringUtil.cs.meta | 11 - 29 files changed, 33 insertions(+), 4512 deletions(-) create mode 100644 Assets/TEngine/Libraries/LubanLib.dll create mode 100644 Assets/TEngine/Libraries/LubanLib.dll.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/BeanBase.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/BeanBase.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/ByteBuf.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/ByteBuf.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/ITypeId.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/ITypeId.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef delete mode 100644 Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/README delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/README.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs.meta delete mode 100644 Assets/TEngine/Libraries/LubanLib/StringUtil.cs delete mode 100644 Assets/TEngine/Libraries/LubanLib/StringUtil.cs.meta diff --git a/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef b/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef index d30fb368..b50305bd 100644 --- a/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef +++ b/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef @@ -2,7 +2,6 @@ "name": "BattleCore.Runtime", "rootNamespace": "BattleCore.Runtime", "references": [ - "GUID:b48be955427611241bcb6f2a07949c5b", "GUID:aa06d4cc755c979489c256c1bcca1dfb" ], "includePlatforms": [], diff --git a/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef b/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef index 7b2707b3..38d6f1d6 100644 --- a/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef +++ b/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef @@ -2,7 +2,6 @@ "name": "GameLogic", "rootNamespace": "GameLogic", "references": [ - "GUID:b48be955427611241bcb6f2a07949c5b", "GUID:08c3762f54316454ca6b6fbcb22b40e5", "GUID:a90b2d3377c5e4a4db95cc44fb82045e", "GUID:aa06d4cc755c979489c256c1bcca1dfb", diff --git a/Assets/GameScripts/HotFix/GameProto/GameProto.asmdef b/Assets/GameScripts/HotFix/GameProto/GameProto.asmdef index 6bd487fc..8cc30356 100644 --- a/Assets/GameScripts/HotFix/GameProto/GameProto.asmdef +++ b/Assets/GameScripts/HotFix/GameProto/GameProto.asmdef @@ -2,7 +2,6 @@ "name": "GameProto", "rootNamespace": "", "references": [ - "GUID:b48be955427611241bcb6f2a07949c5b", "GUID:08c3762f54316454ca6b6fbcb22b40e5", "GUID:aa06d4cc755c979489c256c1bcca1dfb" ], diff --git a/Assets/TEngine/Libraries/LubanLib.dll b/Assets/TEngine/Libraries/LubanLib.dll new file mode 100644 index 0000000000000000000000000000000000000000..b8cddc1bfdbfdf6638b656a2371400a2eb3a959b GIT binary patch literal 62464 zcmdqK37C|{@jqVuzBBLKyE8k>>@L?Xf;ch@0-`R6$}K1$awsUeEbI!4%MR@9st71V zyb?7K4IaV7GistH#v^Lf;1Q3+JDO-Diiuy3Z;YDD#AxvMsp@{;d3Sd4h~MY=KhJ+* zYPzbstE;Q3tGnN~-*;vmw}osX3gGkUr$l$-oBt*V{A{oh*=4o&meC!Nrv}}vW?;-qKHZ0p=xjNy6Zp1JDj^n4&@@%p0|wOeT}B zKA^;MgciAsM}7G(cFPY? z1IodNQZyI|`HNb4H00FX04$q<$Q6{WV#!1G0Vke|dj;b;3J*Jmta2sAvehV*hb&@9 zmMsAe;(u0tZ;)F>=n-VuZTX?5nAn!fVLYO5Qtss5%UP5|Ih1AJ)iOe|nxbSWP0aQM zDYILNcuUdR@K6V&Se*-Yl;g`t$TqJ7zcS&svdFMskzp{iQkYDVKKA!_Pke^!gC*qg z)rSMPs_I^UU`c&#Q-oafy9+L3c{b(P1iLaFmM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M%jz9pve!J{bl0Hm%eN^s&R+ zjfsP8YtwP7<9wj2_o^f7kFcL#*E80yMPzho!7lwDFe3N&Zrm^R(eXD-(#0|QucPb^ k{n)a1FF&swMSuDEg=rvXzajcBzx4~N;Fp5`A8X)$0Vza04FCWD literal 0 HcmV?d00001 diff --git a/Assets/TEngine/Libraries/LubanLib.dll.meta b/Assets/TEngine/Libraries/LubanLib.dll.meta new file mode 100644 index 00000000..278844e7 --- /dev/null +++ b/Assets/TEngine/Libraries/LubanLib.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 89116cb4080636043baf4cdf8887f3a5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib.meta b/Assets/TEngine/Libraries/LubanLib.meta deleted file mode 100644 index 713896f0..00000000 --- a/Assets/TEngine/Libraries/LubanLib.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: df9c2517e8a362749a6ff0ec272ad70f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/BeanBase.cs b/Assets/TEngine/Libraries/LubanLib/BeanBase.cs deleted file mode 100644 index 74e956f7..00000000 --- a/Assets/TEngine/Libraries/LubanLib/BeanBase.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Bright.Serialization; - -namespace Bright.Config -{ - public abstract class BeanBase : ITypeId - { - public abstract int GetTypeId(); - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/BeanBase.cs.meta b/Assets/TEngine/Libraries/LubanLib/BeanBase.cs.meta deleted file mode 100644 index 008518e6..00000000 --- a/Assets/TEngine/Libraries/LubanLib/BeanBase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9537f3ca9ccccf045973e0d3eb5f4dfa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs b/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs deleted file mode 100644 index ead9cbdf..00000000 --- a/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs +++ /dev/null @@ -1,1568 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; - -namespace Bright.Serialization -{ - - public enum EDeserializeError - { - OK, - NOT_ENOUGH, - EXCEED_SIZE, - // UNMARSHAL_ERR, - } - - public class SerializationException : Exception - { - public SerializationException() { } - public SerializationException(string msg) : base(msg) { } - - public SerializationException(string message, Exception innerException) : base(message, innerException) - { - } - } - - public readonly struct SegmentSaveState - { - public SegmentSaveState(int readerIndex, int writerIndex) - { - ReaderIndex = readerIndex; - WriterIndex = writerIndex; - } - - public int ReaderIndex { get; } - - public int WriterIndex { get; } - } - - public sealed class ByteBuf : ICloneable, IEquatable - { - public ByteBuf() - { - Bytes = Array.Empty(); - ReaderIndex = WriterIndex = 0; - } - - public ByteBuf(int capacity) - { - Bytes = capacity > 0 ? new byte[capacity] : Array.Empty(); - ReaderIndex = 0; - WriterIndex = 0; - } - - public ByteBuf(byte[] bytes) - { - Bytes = bytes; - ReaderIndex = 0; - WriterIndex = Capacity; - } - - public ByteBuf(byte[] bytes, int readIndex, int writeIndex) - { - Bytes = bytes; - ReaderIndex = readIndex; - WriterIndex = writeIndex; - } - - public ByteBuf(int capacity, Action releaser) : this(capacity) - { - _releaser = releaser; - } - - public static ByteBuf Wrap(byte[] bytes) - { - return new ByteBuf(bytes, 0, bytes.Length); - } - - public void Replace(byte[] bytes) - { - Bytes = bytes; - ReaderIndex = 0; - WriterIndex = Capacity; - } - - public void Replace(byte[] bytes, int beginPos, int endPos) - { - Bytes = bytes; - ReaderIndex = beginPos; - WriterIndex = endPos; - } - - public int ReaderIndex { get; set; } - - public int WriterIndex { get; set; } - - private readonly Action _releaser; - - public int Capacity => Bytes.Length; - - public int Size { get { return WriterIndex - ReaderIndex; } } - - public bool Empty => WriterIndex <= ReaderIndex; - - public bool NotEmpty => WriterIndex > ReaderIndex; - - - public void AddWriteIndex(int add) - { - WriterIndex += add; - } - - public void AddReadIndex(int add) - { - ReaderIndex += add; - } - -#pragma warning disable CA1819 // 属性不应返回数组 - public byte[] Bytes { get; private set; } -#pragma warning restore CA1819 // 属性不应返回数组 - - public byte[] CopyData() - { - var n = Remaining; - if (n > 0) - { - var arr = new byte[n]; - Buffer.BlockCopy(Bytes, ReaderIndex, arr, 0, n); - return arr; - } - else - { - return Array.Empty(); - } - } - - public int Remaining { get { return WriterIndex - ReaderIndex; } } - - public void DiscardReadBytes() - { - WriterIndex -= ReaderIndex; - Array.Copy(Bytes, ReaderIndex, Bytes, 0, WriterIndex); - ReaderIndex = 0; - } - - public int NotCompactWritable { get { return Capacity - WriterIndex; } } - - public void WriteBytesWithoutSize(byte[] bs) - { - WriteBytesWithoutSize(bs, 0, bs.Length); - } - - public void WriteBytesWithoutSize(byte[] bs, int offset, int len) - { - EnsureWrite(len); - Buffer.BlockCopy(bs, offset, Bytes, WriterIndex, len); - WriterIndex += len; - } - - public void Clear() - { - ReaderIndex = WriterIndex = 0; - } - - private const int MIN_CAPACITY = 16; - - private static int PropSize(int initSize, int needSize) - { - for (int i = Math.Max(initSize, MIN_CAPACITY); ; i <<= 1) - { - if (i >= needSize) - { - return i; - } - } - } - - private void EnsureWrite0(int size) - { - var needSize = WriterIndex + size - ReaderIndex; - if (needSize < Capacity) - { - WriterIndex -= ReaderIndex; - Array.Copy(Bytes, ReaderIndex, Bytes, 0, WriterIndex); - ReaderIndex = 0; - } - else - { - int newCapacity = PropSize(Capacity, needSize); - var newBytes = new byte[newCapacity]; - WriterIndex -= ReaderIndex; - Buffer.BlockCopy(Bytes, ReaderIndex, newBytes, 0, WriterIndex); - ReaderIndex = 0; - Bytes = newBytes; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void EnsureWrite(int size) - { - if (WriterIndex + size > Capacity) - { - EnsureWrite0(size); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void EnsureRead(int size) - { - if (ReaderIndex + size > WriterIndex) - { - throw new SerializationException(); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool CanRead(int size) - { - return (ReaderIndex + size <= WriterIndex); - } - - public void Append(byte x) - { - EnsureWrite(1); - Bytes[WriterIndex++] = x; - } - - public void WriteBool(bool b) - { - EnsureWrite(1); - Bytes[WriterIndex++] = (byte)(b ? 1 : 0); - } - - public bool ReadBool() - { - EnsureRead(1); - return Bytes[ReaderIndex++] != 0; - } - - public void WriteByte(byte x) - { - EnsureWrite(1); - Bytes[WriterIndex++] = x; - } - - public byte ReadByte() - { - EnsureRead(1); - return Bytes[ReaderIndex++]; - } - - - public void WriteShort(short x) - { - if (x >= 0) - { - if (x < 0x80) - { - EnsureWrite(1); - Bytes[WriterIndex++] = (byte)x; - return; - } - else if (x < 0x4000) - { - EnsureWrite(2); - Bytes[WriterIndex + 1] = (byte)x; - Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); - WriterIndex += 2; - return; - } - } - EnsureWrite(3); - Bytes[WriterIndex] = 0xff; - Bytes[WriterIndex + 2] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - WriterIndex += 3; - } - - public short ReadShort() - { - EnsureRead(1); - int h = Bytes[ReaderIndex]; - if (h < 0x80) - { - ReaderIndex++; - return (short)h; - } - else if (h < 0xc0) - { - EnsureRead(2); - int x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; - ReaderIndex += 2; - return (short)x; - } - else if ((h == 0xff)) - { - EnsureRead(3); - int x = (Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - ReaderIndex += 3; - return (short)x; - } - else - { - throw new SerializationException(); - } - } - - public short ReadFshort() - { - EnsureRead(2); - short x; -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[ReaderIndex]) - { - x = *(short*)b; - } - } -#else - x = (short)((Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex]); - -#endif - ReaderIndex += 2; - return x; - } - - public void WriteFshort(short x) - { - EnsureWrite(2); -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[WriterIndex]) - { - *(short*)b = x; - } - } -#else - Bytes[WriterIndex] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); -#endif - WriterIndex += 2; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void WriteInt(int x) - { - WriteUint((uint)x); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int ReadInt() - { - return (int)ReadUint(); - } - - - public void WriteUint(uint x) - { - // 如果有修改,记得也把 EndWriteSegment改了 - // 0 111 1111 - if (x < 0x80) - { - EnsureWrite(1); - Bytes[WriterIndex++] = (byte)x; - } - else if (x < 0x4000) // 10 11 1111, - - { - EnsureWrite(2); - Bytes[WriterIndex + 1] = (byte)x; - Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); - WriterIndex += 2; - } - else if (x < 0x200000) // 110 1 1111, -,- - { - EnsureWrite(3); - Bytes[WriterIndex + 2] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - Bytes[WriterIndex] = (byte)((x >> 16) | 0xc0); - WriterIndex += 3; - } - else if (x < 0x10000000) // 1110 1111,-,-,- - { - EnsureWrite(4); - Bytes[WriterIndex + 3] = (byte)x; - Bytes[WriterIndex + 2] = (byte)(x >> 8); - Bytes[WriterIndex + 1] = (byte)(x >> 16); - Bytes[WriterIndex] = (byte)((x >> 24) | 0xe0); - WriterIndex += 4; - } - else - { - EnsureWrite(5); - Bytes[WriterIndex] = 0xf0; - Bytes[WriterIndex + 4] = (byte)x; - Bytes[WriterIndex + 3] = (byte)(x >> 8); - Bytes[WriterIndex + 2] = (byte)(x >> 16); - Bytes[WriterIndex + 1] = (byte)(x >> 24); - WriterIndex += 5; - } - } - - public uint ReadUint() - { - /// - /// 警告! 如有修改,记得调整 TryDeserializeInplaceOctets - EnsureRead(1); - uint h = Bytes[ReaderIndex]; - if (h < 0x80) - { - ReaderIndex++; - return h; - } - else if (h < 0xc0) - { - EnsureRead(2); - uint x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; - ReaderIndex += 2; - return x; - } - else if (h < 0xe0) - { - EnsureRead(3); - uint x = ((h & 0x1f) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - ReaderIndex += 3; - return x; - } - else if (h < 0xf0) - { - - EnsureRead(4); - uint x = ((h & 0x0f) << 24) | ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; - ReaderIndex += 4; - return x; - } - else - { - EnsureRead(5); - uint x = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)(Bytes[ReaderIndex + 2] << 16)) | ((uint)Bytes[ReaderIndex + 3] << 8) | Bytes[ReaderIndex + 4]; - ReaderIndex += 5; - return x; - } - } - - public unsafe void WriteUint_Unsafe(uint x) - { - // 0 111 1111 - if (x < 0x80) - { - EnsureWrite(1); - Bytes[WriterIndex++] = (byte)(x << 1); - } - else if (x < 0x4000)// 10 11 1111, - - { - EnsureWrite(2); - - fixed (byte* wb = &Bytes[WriterIndex]) - { - *(uint*)(wb) = (x << 2 | 0b01); - } - - WriterIndex += 2; - } - else if (x < 0x200000) // 110 1 1111, -,- - { - EnsureWrite(3); - - fixed (byte* wb = &Bytes[WriterIndex]) - { - *(uint*)(wb) = (x << 3 | 0b011); - } - WriterIndex += 3; - } - else if (x < 0x10000000) // 1110 1111,-,-,- - { - EnsureWrite(4); - fixed (byte* wb = &Bytes[WriterIndex]) - { - *(uint*)(wb) = (x << 4 | 0b0111); - } - WriterIndex += 4; - } - else - { - EnsureWrite(5); - fixed (byte* wb = &Bytes[WriterIndex]) - { - *(uint*)(wb) = (x << 5 | 0b01111); - } - WriterIndex += 5; - } - } - - public unsafe uint ReadUint_Unsafe() - { - /// - /// 警告! 如有修改,记得调整 TryDeserializeInplaceOctets - EnsureRead(1); - uint h = Bytes[ReaderIndex]; - if ((h & 0b1) == 0b0) - { - ReaderIndex++; - return (h >> 1); - } - else if ((h & 0b11) == 0b01) - { - EnsureRead(2); - fixed (byte* rb = &Bytes[ReaderIndex]) - { - ReaderIndex += 2; - return (*(uint*)rb) >> 2; - } - } - else if ((h & 0b111) == 0b011) - { - EnsureRead(3); - fixed (byte* rb = &Bytes[ReaderIndex]) - { - ReaderIndex += 3; - return (*(uint*)rb) >> 3; - } - } - else if ((h & 0b1111) == 0b0111) - { - EnsureRead(4); - fixed (byte* rb = &Bytes[ReaderIndex]) - { - ReaderIndex += 4; - return (*(uint*)rb) >> 4; - } - } - else - { - EnsureRead(5); - fixed (byte* rb = &Bytes[ReaderIndex]) - { - ReaderIndex += 5; - return (*(uint*)rb) >> 5; - } - } - } - - public int ReadFint() - { - EnsureRead(4); - int x; -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[ReaderIndex]) - { - x = *(int*)b; - } - } -#else - x = (Bytes[ReaderIndex + 3] << 24) | (Bytes[ReaderIndex + 2] << 16) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); - -#endif - ReaderIndex += 4; - return x; - } - - - public void WriteFint(int x) - { - EnsureWrite(4); -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[WriterIndex]) - { - *(int*)b = x; - } - } -#else - Bytes[WriterIndex] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - Bytes[WriterIndex + 2] = (byte)(x >> 16); - Bytes[WriterIndex + 3] = (byte)(x >> 24); -#endif - WriterIndex += 4; - } - - public int ReadFint_Safe() - { - EnsureRead(4); - int x; - - x = (Bytes[ReaderIndex + 3] << 24) | (Bytes[ReaderIndex + 2] << 16) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); - - ReaderIndex += 4; - return x; - } - - - public void WriteFint_Safe(int x) - { - EnsureWrite(4); - Bytes[WriterIndex] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - Bytes[WriterIndex + 2] = (byte)(x >> 16); - Bytes[WriterIndex + 3] = (byte)(x >> 24); - WriterIndex += 4; - } - - public void WriteLong(long x) - { - WriteUlong((ulong)x); - } - - public long ReadLong() - { - return (long)ReadUlong(); - } - - public void WriteNumberAsLong(double x) - { - WriteLong((long)x); - } - - public double ReadLongAsNumber() - { - return ReadLong(); - } - - private void WriteUlong(ulong x) - { - // 0 111 1111 - if (x < 0x80) - { - EnsureWrite(1); - Bytes[WriterIndex++] = (byte)x; - } - else if (x < 0x4000) // 10 11 1111, - - { - EnsureWrite(2); - Bytes[WriterIndex + 1] = (byte)x; - Bytes[WriterIndex] = (byte)((x >> 8) | 0x80); - WriterIndex += 2; - } - else if (x < 0x200000) // 110 1 1111, -,- - { - EnsureWrite(3); - Bytes[WriterIndex + 2] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - Bytes[WriterIndex] = (byte)((x >> 16) | 0xc0); - WriterIndex += 3; - } - else if (x < 0x10000000) // 1110 1111,-,-,- - { - EnsureWrite(4); - Bytes[WriterIndex + 3] = (byte)x; - Bytes[WriterIndex + 2] = (byte)(x >> 8); - Bytes[WriterIndex + 1] = (byte)(x >> 16); - Bytes[WriterIndex] = (byte)((x >> 24) | 0xe0); - WriterIndex += 4; - } - else if (x < 0x800000000L) // 1111 0xxx,-,-,-,- - { - EnsureWrite(5); - Bytes[WriterIndex + 4] = (byte)x; - Bytes[WriterIndex + 3] = (byte)(x >> 8); - Bytes[WriterIndex + 2] = (byte)(x >> 16); - Bytes[WriterIndex + 1] = (byte)(x >> 24); - Bytes[WriterIndex] = (byte)((x >> 32) | 0xf0); - WriterIndex += 5; - } - else if (x < 0x40000000000L) // 1111 10xx, - { - EnsureWrite(6); - Bytes[WriterIndex + 5] = (byte)x; - Bytes[WriterIndex + 4] = (byte)(x >> 8); - Bytes[WriterIndex + 3] = (byte)(x >> 16); - Bytes[WriterIndex + 2] = (byte)(x >> 24); - Bytes[WriterIndex + 1] = (byte)(x >> 32); - Bytes[WriterIndex] = (byte)((x >> 40) | 0xf8); - WriterIndex += 6; - } - else if (x < 0x200000000000L) // 1111 110x, - { - EnsureWrite(7); - Bytes[WriterIndex + 6] = (byte)x; - Bytes[WriterIndex + 5] = (byte)(x >> 8); - Bytes[WriterIndex + 4] = (byte)(x >> 16); - Bytes[WriterIndex + 3] = (byte)(x >> 24); - Bytes[WriterIndex + 2] = (byte)(x >> 32); - Bytes[WriterIndex + 1] = (byte)(x >> 40); - Bytes[WriterIndex] = (byte)((x >> 48) | 0xfc); - WriterIndex += 7; - } - else if (x < 0x100000000000000L) // 1111 1110 - { - EnsureWrite(8); - Bytes[WriterIndex + 7] = (byte)x; - Bytes[WriterIndex + 6] = (byte)(x >> 8); - Bytes[WriterIndex + 5] = (byte)(x >> 16); - Bytes[WriterIndex + 4] = (byte)(x >> 24); - Bytes[WriterIndex + 3] = (byte)(x >> 32); - Bytes[WriterIndex + 2] = (byte)(x >> 40); - Bytes[WriterIndex + 1] = (byte)(x >> 48); - Bytes[WriterIndex] = 0xfe; - WriterIndex += 8; - } - else // 1111 1111 - { - EnsureWrite(9); - Bytes[WriterIndex] = 0xff; - Bytes[WriterIndex + 8] = (byte)x; - Bytes[WriterIndex + 7] = (byte)(x >> 8); - Bytes[WriterIndex + 6] = (byte)(x >> 16); - Bytes[WriterIndex + 5] = (byte)(x >> 24); - Bytes[WriterIndex + 4] = (byte)(x >> 32); - Bytes[WriterIndex + 3] = (byte)(x >> 40); - Bytes[WriterIndex + 2] = (byte)(x >> 48); - Bytes[WriterIndex + 1] = (byte)(x >> 56); - WriterIndex += 9; - } - } - - public ulong ReadUlong() - { - EnsureRead(1); - uint h = Bytes[ReaderIndex]; - if (h < 0x80) - { - ReaderIndex++; - return h; - } - else if (h < 0xc0) - { - EnsureRead(2); - uint x = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; - ReaderIndex += 2; - return x; - } - else if (h < 0xe0) - { - EnsureRead(3); - uint x = ((h & 0x1f) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - ReaderIndex += 3; - return x; - } - else if (h < 0xf0) - { - EnsureRead(4); - uint x = ((h & 0x0f) << 24) | ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; - ReaderIndex += 4; - return x; - } - else if (h < 0xf8) - { - EnsureRead(5); - uint xl = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)(Bytes[ReaderIndex + 2] << 16)) | ((uint)Bytes[ReaderIndex + 3] << 8) | (Bytes[ReaderIndex + 4]); - uint xh = h & 0x07; - ReaderIndex += 5; - return ((ulong)xh << 32) | xl; - } - else if (h < 0xfc) - { - EnsureRead(6); - uint xl = ((uint)Bytes[ReaderIndex + 2] << 24) | ((uint)(Bytes[ReaderIndex + 3] << 16)) | ((uint)Bytes[ReaderIndex + 4] << 8) | (Bytes[ReaderIndex + 5]); - uint xh = ((h & 0x03) << 8) | Bytes[ReaderIndex + 1]; - ReaderIndex += 6; - return ((ulong)xh << 32) | xl; - } - else if (h < 0xfe) - { - EnsureRead(7); - uint xl = ((uint)Bytes[ReaderIndex + 3] << 24) | ((uint)(Bytes[ReaderIndex + 4] << 16)) | ((uint)Bytes[ReaderIndex + 5] << 8) | (Bytes[ReaderIndex + 6]); - uint xh = ((h & 0x01) << 16) | ((uint)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - ReaderIndex += 7; - return ((ulong)xh << 32) | xl; - } - else if (h < 0xff) - { - EnsureRead(8); - uint xl = ((uint)Bytes[ReaderIndex + 4] << 24) | ((uint)(Bytes[ReaderIndex + 5] << 16)) | ((uint)Bytes[ReaderIndex + 6] << 8) | (Bytes[ReaderIndex + 7]); - uint xh = /*((h & 0x01) << 24) |*/ ((uint)Bytes[ReaderIndex + 1] << 16) | ((uint)Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; - ReaderIndex += 8; - return ((ulong)xh << 32) | xl; - } - else - { - EnsureRead(9); - uint xl = ((uint)Bytes[ReaderIndex + 5] << 24) | ((uint)(Bytes[ReaderIndex + 6] << 16)) | ((uint)Bytes[ReaderIndex + 7] << 8) | (Bytes[ReaderIndex + 8]); - uint xh = ((uint)Bytes[ReaderIndex + 1] << 24) | ((uint)Bytes[ReaderIndex + 2] << 16) | ((uint)Bytes[ReaderIndex + 3] << 8) | Bytes[ReaderIndex + 4]; - ReaderIndex += 9; - return ((ulong)xh << 32) | xl; - } - } - - - public void WriteFlong(long x) - { - EnsureWrite(8); -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[WriterIndex]) - { - *(long*)b = x; - } - } -#else - - Bytes[WriterIndex] = (byte)x; - Bytes[WriterIndex + 1] = (byte)(x >> 8); - Bytes[WriterIndex + 2] = (byte)(x >> 16); - Bytes[WriterIndex + 3] = (byte)(x >> 24); - Bytes[WriterIndex + 4] = (byte)(x >> 32); - Bytes[WriterIndex + 5] = (byte)(x >> 40); - Bytes[WriterIndex + 6] = (byte)(x >> 48); - Bytes[WriterIndex + 7] = (byte)(x >> 56); -#endif - WriterIndex += 8; - } - - public long ReadFlong() - { - EnsureRead(8); - long x; -#if CPU_SUPPORT_MEMORY_NOT_ALIGN - unsafe - { - fixed (byte* b = &Bytes[ReaderIndex]) - { - x = *(long*)b; - } - } -#else - int xl = (Bytes[ReaderIndex + 3] << 24) | ((Bytes[ReaderIndex + 2] << 16)) | (Bytes[ReaderIndex + 1] << 8) | (Bytes[ReaderIndex]); - int xh = (Bytes[ReaderIndex + 7] << 24) | (Bytes[ReaderIndex + 6] << 16) | (Bytes[ReaderIndex + 5] << 8) | Bytes[ReaderIndex + 4]; - x = ((long)xh << 32) | (long)xl; -#endif - ReaderIndex += 8; - return x; - } - - private static unsafe void Copy8(byte* dst, byte* src) - { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - dst[4] = src[4]; - dst[5] = src[5]; - dst[6] = src[6]; - dst[7] = src[7]; - } - - private static unsafe void Copy4(byte* dst, byte* src) - { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - } - - - //const bool isLittleEndian = true; - public void WriteFloat(float x) - { - EnsureWrite(4); - unsafe - { - fixed (byte* b = &Bytes[WriterIndex]) - { -#if !CPU_SUPPORT_MEMORY_NOT_ALIGN - if ((long)b % 4 == 0) - { - *(float*)b = x; - } - else - { - Copy4(b, (byte*)&x); - } -#else - *(float*)b = x; -#endif - } - } - - //if (!BitConverter.IsLittleEndian) - //{ - // Array.Reverse(data, endPos, 4); - //} - WriterIndex += 4; - } - - public float ReadFloat() - { - EnsureRead(4); - //if (!BitConverter.IsLittleEndian) - //{ - // Array.Reverse(data, beginPos, 4); - //} - float x; - unsafe - { - fixed (byte* b = &Bytes[ReaderIndex]) - { -#if !CPU_SUPPORT_MEMORY_NOT_ALIGN - if ((long)b % 4 == 0) - { - x = *(float*)b; - } - else - { - *((int*)&x) = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); - } -#else - x = *(float*)b; -#endif - } - } - - ReaderIndex += 4; - return x; - } - - public void WriteDouble(double x) - { - EnsureWrite(8); - unsafe - { - fixed (byte* b = &Bytes[WriterIndex]) - { -#if !CPU_SUPPORT_MEMORY_NOT_ALIGN - if ((long)b % 8 == 0) - { - *(double*)b = x; - } - else - { - Copy8(b, (byte*)&x); - } -#else - *(double*)b = x; -#endif - } - //if (!BitConverter.IsLittleEndian) - //{ - // Array.Reverse(data, endPos, 8); - //} - } - - WriterIndex += 8; - } - - public double ReadDouble() - { - EnsureRead(8); - //if (!BitConverter.IsLittleEndian) - //{ - // Array.Reverse(data, beginPos, 8); - //} - double x; - unsafe - { - fixed (byte* b = &Bytes[ReaderIndex]) - { -#if !CPU_SUPPORT_MEMORY_NOT_ALIGN - if ((long)b % 8 == 0) - { - x = *(double*)b; - } - else - { - int low = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); - int high = (b[4]) | (b[5] << 8) | (b[6] << 16) | (b[7] << 24); - *((long*)&x) = ((long)high << 32) | (uint)low; - } -#else - x = *(double*)b; -#endif - } - } - - ReaderIndex += 8; - return x; - } - - public void WriteSize(int n) - { - WriteUint((uint)n); - } - - public int ReadSize() - { - return (int)ReadUint(); - } - - // marshal int - // n -> (n << 1) ^ (n >> 31) - // Read - // (x >>> 1) ^ ((x << 31) >> 31) - // (x >>> 1) ^ -(n&1) - public void WriteSint(int x) - { - WriteUint(((uint)x << 1) ^ ((uint)x >> 31)); - } - - public int ReadSint() - { - uint x = ReadUint(); - return (int)((x >> 1) ^ ((x & 1) << 31)); - } - - - // marshal long - // n -> (n << 1) ^ (n >> 63) - // Read - // (x >>> 1) ^((x << 63) >> 63) - // (x >>> 1) ^ -(n&1L) - public void WriteSlong(long x) - { - WriteUlong(((ulong)x << 1) ^ ((ulong)x >> 63)); - } - - public long ReadSlong() - { - long x = ReadLong(); - return ((long)((ulong)x >> 1) ^ ((x & 1) << 63)); - } - - public void WriteString(string x) - { - var n = x != null ? Encoding.UTF8.GetByteCount(x) : 0; - WriteSize(n); - if (n > 0) - { - EnsureWrite(n); - Encoding.UTF8.GetBytes(x, 0, x.Length, Bytes, WriterIndex); - WriterIndex += n; - } - } - - // byte[], [start, end) - public static Func StringCacheFinder { get; set; } - - public string ReadString() - { - var n = ReadSize(); - if (n > 0) - { - EnsureRead(n); - string s; - - if (StringCacheFinder == null) - { - s = Encoding.UTF8.GetString(Bytes, ReaderIndex, n); - } - else - { - // 只缓存比较小的字符串 - s = StringCacheFinder(Bytes, ReaderIndex, n); - } - ReaderIndex += n; - return s; - } - else - { - return string.Empty; - } - } - - public void WriteBytes(byte[] x) - { - var n = x != null ? x.Length : 0; - WriteSize(n); - if (n > 0) - { - EnsureWrite(n); - x.CopyTo(Bytes, WriterIndex); - WriterIndex += n; - } - } - - public byte[] ReadBytes() - { - var n = ReadSize(); - if (n > 0) - { - EnsureRead(n); - var x = new byte[n]; - Buffer.BlockCopy(Bytes, ReaderIndex, x, 0, n); - ReaderIndex += n; - return x; - } - else - { - return Array.Empty(); - } - } - - // 以下是一些特殊类型 - - public void WriteComplex(Complex x) - { - WriteDouble(x.Real); - WriteDouble(x.Imaginary); - } - - public Complex ReadComplex() - { - var x = ReadDouble(); - var y = ReadDouble(); - return new Complex(x, y); - } - - public void WriteVector2(Vector2 x) - { - WriteFloat(x.X); - WriteFloat(x.Y); - } - - public Vector2 ReadVector2() - { - float x = ReadFloat(); - float y = ReadFloat(); - return new Vector2(x, y); - } - - public void WriteVector3(Vector3 x) - { - WriteFloat(x.X); - WriteFloat(x.Y); - WriteFloat(x.Z); - } - - public Vector3 ReadVector3() - { - float x = ReadFloat(); - float y = ReadFloat(); - float z = ReadFloat(); - return new Vector3(x, y, z); - } - - public void WriteVector4(Vector4 x) - { - WriteFloat(x.X); - WriteFloat(x.Y); - WriteFloat(x.Z); - WriteFloat(x.W); - } - - public Vector4 ReadVector4() - { - float x = ReadFloat(); - float y = ReadFloat(); - float z = ReadFloat(); - float w = ReadFloat(); - return new Vector4(x, y, z, w); - } - - - public void WriteQuaternion(Quaternion x) - { - WriteFloat(x.X); - WriteFloat(x.Y); - WriteFloat(x.Z); - WriteFloat(x.W); - } - - public Quaternion ReadQuaternion() - { - float x = ReadFloat(); - float y = ReadFloat(); - float z = ReadFloat(); - float w = ReadFloat(); - return new Quaternion(x, y, z, w); - } - - - public void WriteMatrix4x4(Matrix4x4 x) - { - WriteFloat(x.M11); - WriteFloat(x.M12); - WriteFloat(x.M13); - WriteFloat(x.M14); - WriteFloat(x.M21); - WriteFloat(x.M22); - WriteFloat(x.M23); - WriteFloat(x.M24); - WriteFloat(x.M31); - WriteFloat(x.M32); - WriteFloat(x.M33); - WriteFloat(x.M34); - WriteFloat(x.M41); - WriteFloat(x.M42); - WriteFloat(x.M43); - WriteFloat(x.M44); - } - - public Matrix4x4 ReadMatrix4x4() - { - float m11 = ReadFloat(); - float m12 = ReadFloat(); - float m13 = ReadFloat(); - float m14 = ReadFloat(); - float m21 = ReadFloat(); - float m22 = ReadFloat(); - float m23 = ReadFloat(); - float m24 = ReadFloat(); - float m31 = ReadFloat(); - float m32 = ReadFloat(); - float m33 = ReadFloat(); - float m34 = ReadFloat(); - float m41 = ReadFloat(); - float m42 = ReadFloat(); - float m43 = ReadFloat(); - float m44 = ReadFloat(); - return new Matrix4x4(m11, m12, m13, m14, - m21, m22, m23, m24, - m31, m32, m33, m34, - m41, m42, m43, m44); - } - - internal void SkipBytes() - { - int n = ReadSize(); - EnsureRead(n); - ReaderIndex += n; - } - - - public void WriteByteBufWithSize(ByteBuf o) - { - int n = o.Size; - if (n > 0) - { - WriteSize(n); - WriteBytesWithoutSize(o.Bytes, o.ReaderIndex, n); - } - else - { - WriteByte(0); - } - } - - public void WriteByteBufWithoutSize(ByteBuf o) - { - int n = o.Size; - if (n > 0) - { - WriteBytesWithoutSize(o.Bytes, o.ReaderIndex, n); - } - } - - public bool TryReadByte(out byte x) - { - if (CanRead(1)) - { - x = Bytes[ReaderIndex++]; - return true; - } - else - { - x = 0; - return false; - } - } - - public EDeserializeError TryDeserializeInplaceByteBuf(int maxSize, ByteBuf inplaceTempBody) - { - //if (!CanRead(1)) { return EDeserializeError.NOT_ENOUGH; } - int oldReadIndex = ReaderIndex; - bool commit = false; - try - { - int n; - int h = Bytes[ReaderIndex]; - if (h < 0x80) - { - ReaderIndex++; - n = h; - } - else if (h < 0xc0) - { - if (!CanRead(2)) { return EDeserializeError.NOT_ENOUGH; } - n = ((h & 0x3f) << 8) | Bytes[ReaderIndex + 1]; - ReaderIndex += 2; - } - else if (h < 0xe0) - { - if (!CanRead(3)) { return EDeserializeError.NOT_ENOUGH; } - n = ((h & 0x1f) << 16) | (Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - ReaderIndex += 3; - } - else if (h < 0xf0) - { - if (!CanRead(4)) { return EDeserializeError.NOT_ENOUGH; } - n = ((h & 0x0f) << 24) | (Bytes[ReaderIndex + 1] << 16) | (Bytes[ReaderIndex + 2] << 8) | Bytes[ReaderIndex + 3]; - ReaderIndex += 4; - } - else - { - return EDeserializeError.EXCEED_SIZE; - } - - if (n > maxSize) - { - return EDeserializeError.EXCEED_SIZE; - } - if (Remaining < n) - { - return EDeserializeError.NOT_ENOUGH; - } - - int inplaceReadIndex = ReaderIndex; - ReaderIndex += n; - - inplaceTempBody.Replace(Bytes, inplaceReadIndex, ReaderIndex); - commit = true; - } - finally - { - if (!commit) - { - ReaderIndex = oldReadIndex; - } - } - - return EDeserializeError.OK; - } - - public void WriteRawTag(byte b1) - { - EnsureWrite(1); - Bytes[WriterIndex++] = b1; - } - - public void WriteRawTag(byte b1, byte b2) - { - EnsureWrite(2); - Bytes[WriterIndex] = b1; - Bytes[WriterIndex + 1] = b2; - WriterIndex += 2; - } - - public void WriteRawTag(byte b1, byte b2, byte b3) - { - EnsureWrite(3); - Bytes[WriterIndex] = b1; - Bytes[WriterIndex + 1] = b2; - Bytes[WriterIndex + 2] = b3; - WriterIndex += 3; - } - - #region segment - - - public void BeginWriteSegment(out int oldSize) - { - oldSize = Size; - EnsureWrite(1); - WriterIndex += 1; - } - - public void EndWriteSegment(int oldSize) - { - int startPos = ReaderIndex + oldSize; - int segmentSize = WriterIndex - startPos - 1; - - // 0 111 1111 - if (segmentSize < 0x80) - { - Bytes[startPos] = (byte)segmentSize; - } - else if (segmentSize < 0x4000) // 10 11 1111, - - { - EnsureWrite(1); - Bytes[WriterIndex] = Bytes[startPos + 1]; - Bytes[startPos + 1] = (byte)segmentSize; - - Bytes[startPos] = (byte)((segmentSize >> 8) | 0x80); - WriterIndex += 1; - } - else if (segmentSize < 0x200000) // 110 1 1111, -,- - { - EnsureWrite(2); - Bytes[WriterIndex + 1] = Bytes[startPos + 2]; - Bytes[startPos + 2] = (byte)segmentSize; - - Bytes[WriterIndex] = Bytes[startPos + 1]; - Bytes[startPos + 1] = (byte)(segmentSize >> 8); - - Bytes[startPos] = (byte)((segmentSize >> 16) | 0xc0); - WriterIndex += 2; - } - else if (segmentSize < 0x10000000) // 1110 1111,-,-,- - { - EnsureWrite(3); - Bytes[WriterIndex + 2] = Bytes[startPos + 3]; - Bytes[startPos + 3] = (byte)segmentSize; - - Bytes[WriterIndex + 1] = Bytes[startPos + 2]; - Bytes[startPos + 2] = (byte)(segmentSize >> 8); - - Bytes[WriterIndex] = Bytes[startPos + 1]; - Bytes[startPos + 1] = (byte)(segmentSize >> 16); - - Bytes[startPos] = (byte)((segmentSize >> 24) | 0xe0); - WriterIndex += 3; - } - else - { - throw new SerializationException("exceed max segment size"); - } - } - - public void ReadSegment(out int startIndex, out int segmentSize) - { - EnsureRead(1); - int h = Bytes[ReaderIndex++]; - - startIndex = ReaderIndex; - - if (h < 0x80) - { - segmentSize = h; - ReaderIndex += segmentSize; - } - else if (h < 0xc0) - { - EnsureRead(1); - segmentSize = ((h & 0x3f) << 8) | Bytes[ReaderIndex]; - int endPos = ReaderIndex + segmentSize; - Bytes[ReaderIndex] = Bytes[endPos]; - ReaderIndex += segmentSize + 1; - } - else if (h < 0xe0) - { - EnsureRead(2); - segmentSize = ((h & 0x1f) << 16) | ((int)Bytes[ReaderIndex] << 8) | Bytes[ReaderIndex + 1]; - int endPos = ReaderIndex + segmentSize; - Bytes[ReaderIndex] = Bytes[endPos]; - Bytes[ReaderIndex + 1] = Bytes[endPos + 1]; - ReaderIndex += segmentSize + 2; - } - else if (h < 0xf0) - { - EnsureRead(3); - segmentSize = ((h & 0x0f) << 24) | ((int)Bytes[ReaderIndex] << 16) | ((int)Bytes[ReaderIndex + 1] << 8) | Bytes[ReaderIndex + 2]; - int endPos = ReaderIndex + segmentSize; - Bytes[ReaderIndex] = Bytes[endPos]; - Bytes[ReaderIndex + 1] = Bytes[endPos + 1]; - Bytes[ReaderIndex + 2] = Bytes[endPos + 2]; - ReaderIndex += segmentSize + 3; - } - else - { - throw new SerializationException("exceed max size"); - } - if (ReaderIndex > WriterIndex) - { - throw new SerializationException("segment data not enough"); - } - } - - public void ReadSegment(ByteBuf buf) - { - ReadSegment(out int startPos, out var size); - buf.Bytes = Bytes; - buf.ReaderIndex = startPos; - buf.WriterIndex = startPos + size; - } - - public void EnterSegment(out SegmentSaveState saveState) - { - ReadSegment(out int startPos, out int size); - - saveState = new SegmentSaveState(ReaderIndex, WriterIndex); - ReaderIndex = startPos; - WriterIndex = startPos + size; - } - - public void LeaveSegment(SegmentSaveState saveState) - { - ReaderIndex = saveState.ReaderIndex; - WriterIndex = saveState.WriterIndex; - } - - #endregion - - public override string ToString() - { - string[] datas = new string[WriterIndex - ReaderIndex]; - for (var i = ReaderIndex; i < WriterIndex; i++) - { - datas[i - ReaderIndex] = Bytes[i].ToString("X2"); - } - return string.Join(".", datas); - } - - public override bool Equals(object obj) - { - return (obj is ByteBuf other) && Equals(other); - } - - public bool Equals(ByteBuf other) - { - if (other == null) - { - return false; - } - if (Size != other.Size) - { - return false; - } - for (int i = 0, n = Size; i < n; i++) - { - if (Bytes[ReaderIndex + i] != other.Bytes[other.ReaderIndex + i]) - { - return false; - } - } - return true; - } - - public object Clone() - { - return new ByteBuf(CopyData()); - } - - - public static ByteBuf FromString(string value) - { - var ss = value.Split(','); - byte[] data = new byte[ss.Length]; - for (int i = 0; i < data.Length; i++) - { - data[i] = byte.Parse(ss[i]); - } - return new ByteBuf(data); - } - - public override int GetHashCode() - { - int hash = 17; - for (int i = ReaderIndex; i < WriterIndex; i++) - { - hash = hash * 23 + Bytes[i]; - } - return hash; - } - - public void Release() - { - _releaser?.Invoke(this); - } - -#if SUPPORT_PUERTS_ARRAYBUF - // -- add for puerts - public Puerts.ArrayBuffer ReadArrayBuffer() - { - return new Puerts.ArrayBuffer(ReadBytes()); - } - - public void WriteArrayBuffer(Puerts.ArrayBuffer bytes) - { - WriteBytes(bytes.Bytes); - } -#endif - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs.meta b/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs.meta deleted file mode 100644 index 404bedaf..00000000 --- a/Assets/TEngine/Libraries/LubanLib/ByteBuf.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28207b76cd2c1f94bb989512c6bdee60 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/ITypeId.cs b/Assets/TEngine/Libraries/LubanLib/ITypeId.cs deleted file mode 100644 index 2b8d71a6..00000000 --- a/Assets/TEngine/Libraries/LubanLib/ITypeId.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Bright.Serialization -{ - public interface ITypeId - { - int GetTypeId(); - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/ITypeId.cs.meta b/Assets/TEngine/Libraries/LubanLib/ITypeId.cs.meta deleted file mode 100644 index d0acd452..00000000 --- a/Assets/TEngine/Libraries/LubanLib/ITypeId.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb496f299578d6a429a600f5cce01f2c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef b/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef deleted file mode 100644 index da6c53d7..00000000 --- a/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "LubanLib", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": true, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef.meta b/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef.meta deleted file mode 100644 index 7260dfc0..00000000 --- a/Assets/TEngine/Libraries/LubanLib/LubanLib.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b48be955427611241bcb6f2a07949c5b -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON.meta deleted file mode 100644 index 2408a08a..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 271b7719175d16941ba67aef3e8d58eb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE deleted file mode 100644 index c41ebf5e..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012-2017 Markus Göbel (Bunny83) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE.meta deleted file mode 100644 index a967ad82..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/LICENSE.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: a1c67fb7a28f34040b970bf97f982827 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/README b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/README deleted file mode 100644 index e69de29b..00000000 diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/README.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/README.meta deleted file mode 100644 index 0b1dc488..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/README.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7e1422f3aa49df44599ebc3c951a98f3 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs deleted file mode 100644 index 47777245..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs +++ /dev/null @@ -1,1434 +0,0 @@ -/* * * * * - * A simple JSON Parser / builder - * ------------------------------ - * - * It mainly has been written as a simple JSON parser. It can build a JSON string - * from the node-tree, or generate a node tree from any valid JSON string. - * - * Written by Bunny83 - * 2012-06-09 - * - * Changelog now external. See Changelog.txt - * - * The MIT License (MIT) - * - * Copyright (c) 2012-2019 Markus Göbel (Bunny83) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * * * * */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; - -namespace SimpleJSON -{ - public enum JSONNodeType - { - Array = 1, - Object = 2, - String = 3, - Number = 4, - NullValue = 5, - Boolean = 6, - None = 7, - Custom = 0xFF, - } - public enum JSONTextMode - { - Compact, - Indent - } - - public abstract partial class JSONNode - { - #region Enumerators - public struct Enumerator - { - private enum Type { None, Array, Object } - private Type type; - private Dictionary.Enumerator m_Object; - private List.Enumerator m_Array; - public bool IsValid { get { return type != Type.None; } } - public Enumerator(List.Enumerator aArrayEnum) - { - type = Type.Array; - m_Object = default(Dictionary.Enumerator); - m_Array = aArrayEnum; - } - public Enumerator(Dictionary.Enumerator aDictEnum) - { - type = Type.Object; - m_Object = aDictEnum; - m_Array = default(List.Enumerator); - } - public KeyValuePair Current - { - get - { - if (type == Type.Array) - return new KeyValuePair(string.Empty, m_Array.Current); - else if (type == Type.Object) - return m_Object.Current; - return new KeyValuePair(string.Empty, null); - } - } - public bool MoveNext() - { - if (type == Type.Array) - return m_Array.MoveNext(); - else if (type == Type.Object) - return m_Object.MoveNext(); - return false; - } - } - public struct ValueEnumerator - { - private Enumerator m_Enumerator; - public ValueEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } - public ValueEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } - public ValueEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } - public JSONNode Current { get { return m_Enumerator.Current.Value; } } - public bool MoveNext() { return m_Enumerator.MoveNext(); } - public ValueEnumerator GetEnumerator() { return this; } - } - public struct KeyEnumerator - { - private Enumerator m_Enumerator; - public KeyEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } - public KeyEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } - public KeyEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } - public string Current { get { return m_Enumerator.Current.Key; } } - public bool MoveNext() { return m_Enumerator.MoveNext(); } - public KeyEnumerator GetEnumerator() { return this; } - } - - public class LinqEnumerator : IEnumerator>, IEnumerable> - { - private JSONNode m_Node; - private Enumerator m_Enumerator; - internal LinqEnumerator(JSONNode aNode) - { - m_Node = aNode; - if (m_Node != null) - m_Enumerator = m_Node.GetEnumerator(); - } - public KeyValuePair Current { get { return m_Enumerator.Current; } } - object IEnumerator.Current { get { return m_Enumerator.Current; } } - public bool MoveNext() { return m_Enumerator.MoveNext(); } - - public void Dispose() - { - m_Node = null; - m_Enumerator = new Enumerator(); - } - - public IEnumerator> GetEnumerator() - { - return new LinqEnumerator(m_Node); - } - - public void Reset() - { - if (m_Node != null) - m_Enumerator = m_Node.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return new LinqEnumerator(m_Node); - } - } - - #endregion Enumerators - - #region common interface - - public static bool forceASCII = false; // Use Unicode by default - public static bool longAsString = false; // lazy creator creates a JSONString instead of JSONNumber - public static bool allowLineComments = true; // allow "//"-style comments at the end of a line - - public abstract JSONNodeType Tag { get; } - - public virtual JSONNode this[int aIndex] { get { return null; } set { } } - - public virtual JSONNode this[string aKey] { get { return null; } set { } } - - public virtual string Value { get { return ""; } set { } } - - public virtual int Count { get { return 0; } } - - public virtual bool IsNumber { get { return false; } } - public virtual bool IsString { get { return false; } } - public virtual bool IsBoolean { get { return false; } } - public virtual bool IsNull { get { return false; } } - public virtual bool IsArray { get { return false; } } - public virtual bool IsObject { get { return false; } } - - public virtual bool Inline { get { return false; } set { } } - - public virtual void Add(string aKey, JSONNode aItem) - { - } - public virtual void Add(JSONNode aItem) - { - Add("", aItem); - } - - public virtual JSONNode Remove(string aKey) - { - return null; - } - - public virtual JSONNode Remove(int aIndex) - { - return null; - } - - public virtual JSONNode Remove(JSONNode aNode) - { - return aNode; - } - public virtual void Clear() { } - - public virtual JSONNode Clone() - { - return null; - } - - public virtual IEnumerable Children - { - get - { - yield break; - } - } - - public IEnumerable DeepChildren - { - get - { - foreach (var C in Children) - foreach (var D in C.DeepChildren) - yield return D; - } - } - - public virtual bool HasKey(string aKey) - { - return false; - } - - public virtual JSONNode GetValueOrDefault(string aKey, JSONNode aDefault) - { - return aDefault; - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - WriteToStringBuilder(sb, 0, 0, JSONTextMode.Compact); - return sb.ToString(); - } - - public virtual string ToString(int aIndent) - { - StringBuilder sb = new StringBuilder(); - WriteToStringBuilder(sb, 0, aIndent, JSONTextMode.Indent); - return sb.ToString(); - } - internal abstract void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode); - - public abstract Enumerator GetEnumerator(); - public IEnumerable> Linq { get { return new LinqEnumerator(this); } } - public KeyEnumerator Keys { get { return new KeyEnumerator(GetEnumerator()); } } - public ValueEnumerator Values { get { return new ValueEnumerator(GetEnumerator()); } } - - #endregion common interface - - #region typecasting properties - - - public virtual double AsDouble - { - get - { - double v = 0.0; - if (double.TryParse(Value, NumberStyles.Float, CultureInfo.InvariantCulture, out v)) - return v; - return 0.0; - } - set - { - Value = value.ToString(CultureInfo.InvariantCulture); - } - } - - public virtual int AsInt - { - get { return (int)AsDouble; } - set { AsDouble = value; } - } - - public virtual float AsFloat - { - get { return (float)AsDouble; } - set { AsDouble = value; } - } - - public virtual bool AsBool - { - get - { - bool v = false; - if (bool.TryParse(Value, out v)) - return v; - return !string.IsNullOrEmpty(Value); - } - set - { - Value = (value) ? "true" : "false"; - } - } - - public virtual long AsLong - { - get - { - long val = 0; - if (long.TryParse(Value, out val)) - return val; - return 0L; - } - set - { - Value = value.ToString(); - } - } - - public virtual ulong AsULong - { - get - { - ulong val = 0; - if (ulong.TryParse(Value, out val)) - return val; - return 0; - } - set - { - Value = value.ToString(); - } - } - - public virtual JSONArray AsArray - { - get - { - return this as JSONArray; - } - } - - public virtual JSONObject AsObject - { - get - { - return this as JSONObject; - } - } - - - #endregion typecasting properties - - #region operators - - public static implicit operator JSONNode(string s) - { - return (s == null) ? (JSONNode) JSONNull.CreateOrGet() : new JSONString(s); - } - public static implicit operator string(JSONNode d) - { - return (d == null) ? null : d.Value; - } - - public static implicit operator JSONNode(double n) - { - return new JSONNumber(n); - } - public static implicit operator double(JSONNode d) - { - return (d == null) ? 0 : d.AsDouble; - } - - public static implicit operator JSONNode(float n) - { - return new JSONNumber(n); - } - public static implicit operator float(JSONNode d) - { - return (d == null) ? 0 : d.AsFloat; - } - - public static implicit operator JSONNode(int n) - { - return new JSONNumber(n); - } - public static implicit operator int(JSONNode d) - { - return (d == null) ? 0 : d.AsInt; - } - - public static implicit operator JSONNode(long n) - { - if (longAsString) - return new JSONString(n.ToString()); - return new JSONNumber(n); - } - public static implicit operator long(JSONNode d) - { - return (d == null) ? 0L : d.AsLong; - } - - public static implicit operator JSONNode(ulong n) - { - if (longAsString) - return new JSONString(n.ToString()); - return new JSONNumber(n); - } - public static implicit operator ulong(JSONNode d) - { - return (d == null) ? 0 : d.AsULong; - } - - public static implicit operator JSONNode(bool b) - { - return new JSONBool(b); - } - public static implicit operator bool(JSONNode d) - { - return (d == null) ? false : d.AsBool; - } - - public static implicit operator JSONNode(KeyValuePair aKeyValue) - { - return aKeyValue.Value; - } - - public static bool operator ==(JSONNode a, object b) - { - if (ReferenceEquals(a, b)) - return true; - bool aIsNull = a is JSONNull || ReferenceEquals(a, null) || a is JSONLazyCreator; - bool bIsNull = b is JSONNull || ReferenceEquals(b, null) || b is JSONLazyCreator; - if (aIsNull && bIsNull) - return true; - return !aIsNull && a.Equals(b); - } - - public static bool operator !=(JSONNode a, object b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - return ReferenceEquals(this, obj); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #endregion operators - - [ThreadStatic] - private static StringBuilder m_EscapeBuilder; - internal static StringBuilder EscapeBuilder - { - get - { - if (m_EscapeBuilder == null) - m_EscapeBuilder = new StringBuilder(); - return m_EscapeBuilder; - } - } - internal static string Escape(string aText) - { - var sb = EscapeBuilder; - sb.Length = 0; - if (sb.Capacity < aText.Length + aText.Length / 10) - sb.Capacity = aText.Length + aText.Length / 10; - foreach (char c in aText) - { - switch (c) - { - case '\\': - sb.Append("\\\\"); - break; - case '\"': - sb.Append("\\\""); - break; - case '\n': - sb.Append("\\n"); - break; - case '\r': - sb.Append("\\r"); - break; - case '\t': - sb.Append("\\t"); - break; - case '\b': - sb.Append("\\b"); - break; - case '\f': - sb.Append("\\f"); - break; - default: - if (c < ' ' || (forceASCII && c > 127)) - { - ushort val = c; - sb.Append("\\u").Append(val.ToString("X4")); - } - else - sb.Append(c); - break; - } - } - string result = sb.ToString(); - sb.Length = 0; - return result; - } - - private static JSONNode ParseElement(string token, bool quoted) - { - if (quoted) - return token; - if (token.Length <= 5) - { - string tmp = token.ToLower(); - if (tmp == "false" || tmp == "true") - return tmp == "true"; - if (tmp == "null") - return JSONNull.CreateOrGet(); - } - double val; - if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out val)) - return val; - else - return token; - } - - public static JSONNode Parse(string aJSON) - { - Stack stack = new Stack(); - JSONNode ctx = null; - int i = 0; - StringBuilder Token = new StringBuilder(); - string TokenName = ""; - bool QuoteMode = false; - bool TokenIsQuoted = false; - bool HasNewlineChar = false; - while (i < aJSON.Length) - { - switch (aJSON[i]) - { - case '{': - if (QuoteMode) - { - Token.Append(aJSON[i]); - break; - } - stack.Push(new JSONObject()); - if (ctx != null) - { - ctx.Add(TokenName, stack.Peek()); - } - TokenName = ""; - Token.Length = 0; - ctx = stack.Peek(); - HasNewlineChar = false; - break; - - case '[': - if (QuoteMode) - { - Token.Append(aJSON[i]); - break; - } - - stack.Push(new JSONArray()); - if (ctx != null) - { - ctx.Add(TokenName, stack.Peek()); - } - TokenName = ""; - Token.Length = 0; - ctx = stack.Peek(); - HasNewlineChar = false; - break; - - case '}': - case ']': - if (QuoteMode) - { - - Token.Append(aJSON[i]); - break; - } - if (stack.Count == 0) - throw new Exception("JSON Parse: Too many closing brackets"); - - stack.Pop(); - if (Token.Length > 0 || TokenIsQuoted) - ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); - if (ctx != null) - ctx.Inline = !HasNewlineChar; - TokenIsQuoted = false; - TokenName = ""; - Token.Length = 0; - if (stack.Count > 0) - ctx = stack.Peek(); - break; - - case ':': - if (QuoteMode) - { - Token.Append(aJSON[i]); - break; - } - TokenName = Token.ToString(); - Token.Length = 0; - TokenIsQuoted = false; - break; - - case '"': - QuoteMode ^= true; - TokenIsQuoted |= QuoteMode; - break; - - case ',': - if (QuoteMode) - { - Token.Append(aJSON[i]); - break; - } - if (Token.Length > 0 || TokenIsQuoted) - ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); - TokenIsQuoted = false; - TokenName = ""; - Token.Length = 0; - TokenIsQuoted = false; - break; - - case '\r': - case '\n': - HasNewlineChar = true; - break; - - case ' ': - case '\t': - if (QuoteMode) - Token.Append(aJSON[i]); - break; - - case '\\': - ++i; - if (QuoteMode) - { - char C = aJSON[i]; - switch (C) - { - case 't': - Token.Append('\t'); - break; - case 'r': - Token.Append('\r'); - break; - case 'n': - Token.Append('\n'); - break; - case 'b': - Token.Append('\b'); - break; - case 'f': - Token.Append('\f'); - break; - case 'u': - { - string s = aJSON.Substring(i + 1, 4); - Token.Append((char)int.Parse( - s, - System.Globalization.NumberStyles.AllowHexSpecifier)); - i += 4; - break; - } - default: - Token.Append(C); - break; - } - } - break; - case '/': - if (allowLineComments && !QuoteMode && i + 1 < aJSON.Length && aJSON[i + 1] == '/') - { - while (++i < aJSON.Length && aJSON[i] != '\n' && aJSON[i] != '\r') ; - break; - } - Token.Append(aJSON[i]); - break; - case '\uFEFF': // remove / ignore BOM (Byte Order Mark) - break; - - default: - Token.Append(aJSON[i]); - break; - } - ++i; - } - if (QuoteMode) - { - throw new Exception("JSON Parse: Quotation marks seems to be messed up."); - } - if (ctx == null) - return ParseElement(Token.ToString(), TokenIsQuoted); - return ctx; - } - - } - // End of JSONNode - - public partial class JSONArray : JSONNode - { - private List m_List = new List(); - private bool inline = false; - public override bool Inline - { - get { return inline; } - set { inline = value; } - } - - public override JSONNodeType Tag { get { return JSONNodeType.Array; } } - public override bool IsArray { get { return true; } } - public override Enumerator GetEnumerator() { return new Enumerator(m_List.GetEnumerator()); } - - public override JSONNode this[int aIndex] - { - get - { - if (aIndex < 0 || aIndex >= m_List.Count) - return new JSONLazyCreator(this); - return m_List[aIndex]; - } - set - { - if (value == null) - value = JSONNull.CreateOrGet(); - if (aIndex < 0 || aIndex >= m_List.Count) - m_List.Add(value); - else - m_List[aIndex] = value; - } - } - - public override JSONNode this[string aKey] - { - get { return new JSONLazyCreator(this); } - set - { - if (value == null) - value = JSONNull.CreateOrGet(); - m_List.Add(value); - } - } - - public override int Count - { - get { return m_List.Count; } - } - - public override void Add(string aKey, JSONNode aItem) - { - if (aItem == null) - aItem = JSONNull.CreateOrGet(); - m_List.Add(aItem); - } - - public override JSONNode Remove(int aIndex) - { - if (aIndex < 0 || aIndex >= m_List.Count) - return null; - JSONNode tmp = m_List[aIndex]; - m_List.RemoveAt(aIndex); - return tmp; - } - - public override JSONNode Remove(JSONNode aNode) - { - m_List.Remove(aNode); - return aNode; - } - - public override void Clear() - { - m_List.Clear(); - } - - public override JSONNode Clone() - { - var node = new JSONArray(); - node.m_List.Capacity = m_List.Capacity; - foreach(var n in m_List) - { - if (n != null) - node.Add(n.Clone()); - else - node.Add(null); - } - return node; - } - - public override IEnumerable Children - { - get - { - foreach (JSONNode N in m_List) - yield return N; - } - } - - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append('['); - int count = m_List.Count; - if (inline) - aMode = JSONTextMode.Compact; - for (int i = 0; i < count; i++) - { - if (i > 0) - aSB.Append(','); - if (aMode == JSONTextMode.Indent) - aSB.AppendLine(); - - if (aMode == JSONTextMode.Indent) - aSB.Append(' ', aIndent + aIndentInc); - m_List[i].WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); - } - if (aMode == JSONTextMode.Indent) - aSB.AppendLine().Append(' ', aIndent); - aSB.Append(']'); - } - } - // End of JSONArray - - public partial class JSONObject : JSONNode - { - private Dictionary m_Dict = new Dictionary(); - - private bool inline = false; - public override bool Inline - { - get { return inline; } - set { inline = value; } - } - - public override JSONNodeType Tag { get { return JSONNodeType.Object; } } - public override bool IsObject { get { return true; } } - - public override Enumerator GetEnumerator() { return new Enumerator(m_Dict.GetEnumerator()); } - - - public override JSONNode this[string aKey] - { - get - { - if (m_Dict.ContainsKey(aKey)) - return m_Dict[aKey]; - else - return new JSONLazyCreator(this, aKey); - } - set - { - if (value == null) - value = JSONNull.CreateOrGet(); - if (m_Dict.ContainsKey(aKey)) - m_Dict[aKey] = value; - else - m_Dict.Add(aKey, value); - } - } - - public override JSONNode this[int aIndex] - { - get - { - if (aIndex < 0 || aIndex >= m_Dict.Count) - return null; - return m_Dict.ElementAt(aIndex).Value; - } - set - { - if (value == null) - value = JSONNull.CreateOrGet(); - if (aIndex < 0 || aIndex >= m_Dict.Count) - return; - string key = m_Dict.ElementAt(aIndex).Key; - m_Dict[key] = value; - } - } - - public override int Count - { - get { return m_Dict.Count; } - } - - public override void Add(string aKey, JSONNode aItem) - { - if (aItem == null) - aItem = JSONNull.CreateOrGet(); - - if (aKey != null) - { - if (m_Dict.ContainsKey(aKey)) - m_Dict[aKey] = aItem; - else - m_Dict.Add(aKey, aItem); - } - else - m_Dict.Add(Guid.NewGuid().ToString(), aItem); - } - - public override JSONNode Remove(string aKey) - { - if (!m_Dict.ContainsKey(aKey)) - return null; - JSONNode tmp = m_Dict[aKey]; - m_Dict.Remove(aKey); - return tmp; - } - - public override JSONNode Remove(int aIndex) - { - if (aIndex < 0 || aIndex >= m_Dict.Count) - return null; - var item = m_Dict.ElementAt(aIndex); - m_Dict.Remove(item.Key); - return item.Value; - } - - public override JSONNode Remove(JSONNode aNode) - { - try - { - var item = m_Dict.Where(k => k.Value == aNode).First(); - m_Dict.Remove(item.Key); - return aNode; - } - catch - { - return null; - } - } - - public override void Clear() - { - m_Dict.Clear(); - } - - public override JSONNode Clone() - { - var node = new JSONObject(); - foreach (var n in m_Dict) - { - node.Add(n.Key, n.Value.Clone()); - } - return node; - } - - public override bool HasKey(string aKey) - { - return m_Dict.ContainsKey(aKey); - } - - public override JSONNode GetValueOrDefault(string aKey, JSONNode aDefault) - { - JSONNode res; - if (m_Dict.TryGetValue(aKey, out res)) - return res; - return aDefault; - } - - public override IEnumerable Children - { - get - { - foreach (KeyValuePair N in m_Dict) - yield return N.Value; - } - } - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append('{'); - bool first = true; - if (inline) - aMode = JSONTextMode.Compact; - foreach (var k in m_Dict) - { - if (!first) - aSB.Append(','); - first = false; - if (aMode == JSONTextMode.Indent) - aSB.AppendLine(); - if (aMode == JSONTextMode.Indent) - aSB.Append(' ', aIndent + aIndentInc); - aSB.Append('\"').Append(Escape(k.Key)).Append('\"'); - if (aMode == JSONTextMode.Compact) - aSB.Append(':'); - else - aSB.Append(" : "); - k.Value.WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); - } - if (aMode == JSONTextMode.Indent) - aSB.AppendLine().Append(' ', aIndent); - aSB.Append('}'); - } - - } - // End of JSONObject - - public partial class JSONString : JSONNode - { - private string m_Data; - - public override JSONNodeType Tag { get { return JSONNodeType.String; } } - public override bool IsString { get { return true; } } - - public override Enumerator GetEnumerator() { return new Enumerator(); } - - - public override string Value - { - get { return m_Data; } - set - { - m_Data = value; - } - } - - public JSONString(string aData) - { - m_Data = aData; - } - public override JSONNode Clone() - { - return new JSONString(m_Data); - } - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append('\"').Append(Escape(m_Data)).Append('\"'); - } - public override bool Equals(object obj) - { - if (base.Equals(obj)) - return true; - string s = obj as string; - if (s != null) - return m_Data == s; - JSONString s2 = obj as JSONString; - if (s2 != null) - return m_Data == s2.m_Data; - return false; - } - public override int GetHashCode() - { - return m_Data.GetHashCode(); - } - public override void Clear() - { - m_Data = ""; - } - } - // End of JSONString - - public partial class JSONNumber : JSONNode - { - private double m_Data; - - public override JSONNodeType Tag { get { return JSONNodeType.Number; } } - public override bool IsNumber { get { return true; } } - public override Enumerator GetEnumerator() { return new Enumerator(); } - - public override string Value - { - get { return m_Data.ToString(CultureInfo.InvariantCulture); } - set - { - double v; - if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out v)) - m_Data = v; - } - } - - public override double AsDouble - { - get { return m_Data; } - set { m_Data = value; } - } - public override long AsLong - { - get { return (long)m_Data; } - set { m_Data = value; } - } - public override ulong AsULong - { - get { return (ulong)m_Data; } - set { m_Data = value; } - } - - public JSONNumber(double aData) - { - m_Data = aData; - } - - public JSONNumber(string aData) - { - Value = aData; - } - - public override JSONNode Clone() - { - return new JSONNumber(m_Data); - } - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append(Value); - } - private static bool IsNumeric(object value) - { - return value is int || value is uint - || value is float || value is double - || value is decimal - || value is long || value is ulong - || value is short || value is ushort - || value is sbyte || value is byte; - } - public override bool Equals(object obj) - { - if (obj == null) - return false; - if (base.Equals(obj)) - return true; - JSONNumber s2 = obj as JSONNumber; - if (s2 != null) - return m_Data == s2.m_Data; - if (IsNumeric(obj)) - return Convert.ToDouble(obj) == m_Data; - return false; - } - public override int GetHashCode() - { - return m_Data.GetHashCode(); - } - public override void Clear() - { - m_Data = 0; - } - } - // End of JSONNumber - - public partial class JSONBool : JSONNode - { - private bool m_Data; - - public override JSONNodeType Tag { get { return JSONNodeType.Boolean; } } - public override bool IsBoolean { get { return true; } } - public override Enumerator GetEnumerator() { return new Enumerator(); } - - public override string Value - { - get { return m_Data.ToString(); } - set - { - bool v; - if (bool.TryParse(value, out v)) - m_Data = v; - } - } - public override bool AsBool - { - get { return m_Data; } - set { m_Data = value; } - } - - public JSONBool(bool aData) - { - m_Data = aData; - } - - public JSONBool(string aData) - { - Value = aData; - } - - public override JSONNode Clone() - { - return new JSONBool(m_Data); - } - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append((m_Data) ? "true" : "false"); - } - public override bool Equals(object obj) - { - if (obj == null) - return false; - if (obj is bool) - return m_Data == (bool)obj; - return false; - } - public override int GetHashCode() - { - return m_Data.GetHashCode(); - } - public override void Clear() - { - m_Data = false; - } - } - // End of JSONBool - - public partial class JSONNull : JSONNode - { - static JSONNull m_StaticInstance = new JSONNull(); - public static bool reuseSameInstance = true; - public static JSONNull CreateOrGet() - { - if (reuseSameInstance) - return m_StaticInstance; - return new JSONNull(); - } - private JSONNull() { } - - public override JSONNodeType Tag { get { return JSONNodeType.NullValue; } } - public override bool IsNull { get { return true; } } - public override Enumerator GetEnumerator() { return new Enumerator(); } - - public override string Value - { - get { return "null"; } - set { } - } - public override bool AsBool - { - get { return false; } - set { } - } - - public override JSONNode Clone() - { - return CreateOrGet(); - } - - public override bool Equals(object obj) - { - if (object.ReferenceEquals(this, obj)) - return true; - return (obj is JSONNull); - } - public override int GetHashCode() - { - return 0; - } - - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append("null"); - } - } - // End of JSONNull - - internal partial class JSONLazyCreator : JSONNode - { - private JSONNode m_Node = null; - private string m_Key = null; - public override JSONNodeType Tag { get { return JSONNodeType.None; } } - public override Enumerator GetEnumerator() { return new Enumerator(); } - - public JSONLazyCreator(JSONNode aNode) - { - m_Node = aNode; - m_Key = null; - } - - public JSONLazyCreator(JSONNode aNode, string aKey) - { - m_Node = aNode; - m_Key = aKey; - } - - private T Set(T aVal) where T : JSONNode - { - if (m_Key == null) - m_Node.Add(aVal); - else - m_Node.Add(m_Key, aVal); - m_Node = null; // Be GC friendly. - return aVal; - } - - public override JSONNode this[int aIndex] - { - get { return new JSONLazyCreator(this); } - set { Set(new JSONArray()).Add(value); } - } - - public override JSONNode this[string aKey] - { - get { return new JSONLazyCreator(this, aKey); } - set { Set(new JSONObject()).Add(aKey, value); } - } - - public override void Add(JSONNode aItem) - { - Set(new JSONArray()).Add(aItem); - } - - public override void Add(string aKey, JSONNode aItem) - { - Set(new JSONObject()).Add(aKey, aItem); - } - - public static bool operator ==(JSONLazyCreator a, object b) - { - if (b == null) - return true; - return System.Object.ReferenceEquals(a, b); - } - - public static bool operator !=(JSONLazyCreator a, object b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - if (obj == null) - return true; - return System.Object.ReferenceEquals(this, obj); - } - - public override int GetHashCode() - { - return 0; - } - - public override int AsInt - { - get { Set(new JSONNumber(0)); return 0; } - set { Set(new JSONNumber(value)); } - } - - public override float AsFloat - { - get { Set(new JSONNumber(0.0f)); return 0.0f; } - set { Set(new JSONNumber(value)); } - } - - public override double AsDouble - { - get { Set(new JSONNumber(0.0)); return 0.0; } - set { Set(new JSONNumber(value)); } - } - - public override long AsLong - { - get - { - if (longAsString) - Set(new JSONString("0")); - else - Set(new JSONNumber(0.0)); - return 0L; - } - set - { - if (longAsString) - Set(new JSONString(value.ToString())); - else - Set(new JSONNumber(value)); - } - } - - public override ulong AsULong - { - get - { - if (longAsString) - Set(new JSONString("0")); - else - Set(new JSONNumber(0.0)); - return 0L; - } - set - { - if (longAsString) - Set(new JSONString(value.ToString())); - else - Set(new JSONNumber(value)); - } - } - - public override bool AsBool - { - get { Set(new JSONBool(false)); return false; } - set { Set(new JSONBool(value)); } - } - - public override JSONArray AsArray - { - get { return Set(new JSONArray()); } - } - - public override JSONObject AsObject - { - get { return Set(new JSONObject()); } - } - internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) - { - aSB.Append("null"); - } - } - // End of JSONLazyCreator - - public static class JSON - { - public static JSONNode Parse(string aJSON) - { - return JSONNode.Parse(aJSON); - } - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs.meta deleted file mode 100644 index 8391748f..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSON.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 94f6ac1c525fff1408a03b9f299e6252 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs deleted file mode 100644 index df72f133..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs +++ /dev/null @@ -1,301 +0,0 @@ -//#define USE_SharpZipLib -/* * * * * - * This is an extension of the SimpleJSON framework to provide methods to - * serialize a JSON object tree into a compact binary format. Optionally the - * binary stream can be compressed with the SharpZipLib when using the define - * "USE_SharpZipLib" - * - * Those methods where originally part of the framework but since it's rarely - * used I've extracted this part into this seperate module file. - * - * You can use the define "SimpleJSON_ExcludeBinary" to selectively disable - * this extension without the need to remove the file from the project. - * - * If you want to use compression when saving to file / stream / B64 you have to include - * SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) in your project and - * define "USE_SharpZipLib" at the top of the file - * - * - * The MIT License (MIT) - * - * Copyright (c) 2012-2017 Markus Göbel (Bunny83) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * * * * */ -using System; - -namespace SimpleJSON -{ -#if !SimpleJSON_ExcludeBinary - public abstract partial class JSONNode - { - public abstract void SerializeBinary(System.IO.BinaryWriter aWriter); - - public void SaveToBinaryStream(System.IO.Stream aData) - { - var W = new System.IO.BinaryWriter(aData); - SerializeBinary(W); - } - -#if USE_SharpZipLib - public void SaveToCompressedStream(System.IO.Stream aData) - { - using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData)) - { - gzipOut.IsStreamOwner = false; - SaveToBinaryStream(gzipOut); - gzipOut.Close(); - } - } - - public void SaveToCompressedFile(string aFileName) - { - - System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); - using(var F = System.IO.File.OpenWrite(aFileName)) - { - SaveToCompressedStream(F); - } - } - public string SaveToCompressedBase64() - { - using (var stream = new System.IO.MemoryStream()) - { - SaveToCompressedStream(stream); - stream.Position = 0; - return System.Convert.ToBase64String(stream.ToArray()); - } - } - -#else - public void SaveToCompressedStream(System.IO.Stream aData) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public void SaveToCompressedFile(string aFileName) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public string SaveToCompressedBase64() - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } -#endif - - public void SaveToBinaryFile(string aFileName) - { - System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); - using (var F = System.IO.File.OpenWrite(aFileName)) - { - SaveToBinaryStream(F); - } - } - - public string SaveToBinaryBase64() - { - using (var stream = new System.IO.MemoryStream()) - { - SaveToBinaryStream(stream); - stream.Position = 0; - return System.Convert.ToBase64String(stream.ToArray()); - } - } - - public static JSONNode DeserializeBinary(System.IO.BinaryReader aReader) - { - JSONNodeType type = (JSONNodeType)aReader.ReadByte(); - switch (type) - { - case JSONNodeType.Array: - { - int count = aReader.ReadInt32(); - JSONArray tmp = new JSONArray(); - for (int i = 0; i < count; i++) - tmp.Add(DeserializeBinary(aReader)); - return tmp; - } - case JSONNodeType.Object: - { - int count = aReader.ReadInt32(); - JSONObject tmp = new JSONObject(); - for (int i = 0; i < count; i++) - { - string key = aReader.ReadString(); - var val = DeserializeBinary(aReader); - tmp.Add(key, val); - } - return tmp; - } - case JSONNodeType.String: - { - return new JSONString(aReader.ReadString()); - } - case JSONNodeType.Number: - { - return new JSONNumber(aReader.ReadDouble()); - } - case JSONNodeType.Boolean: - { - return new JSONBool(aReader.ReadBoolean()); - } - case JSONNodeType.NullValue: - { - return JSONNull.CreateOrGet(); - } - default: - { - throw new Exception("Error deserializing JSON. Unknown tag: " + type); - } - } - } - -#if USE_SharpZipLib - public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) - { - var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData); - return LoadFromBinaryStream(zin); - } - public static JSONNode LoadFromCompressedFile(string aFileName) - { - using(var F = System.IO.File.OpenRead(aFileName)) - { - return LoadFromCompressedStream(F); - } - } - public static JSONNode LoadFromCompressedBase64(string aBase64) - { - var tmp = System.Convert.FromBase64String(aBase64); - var stream = new System.IO.MemoryStream(tmp); - stream.Position = 0; - return LoadFromCompressedStream(stream); - } -#else - public static JSONNode LoadFromCompressedFile(string aFileName) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } - - public static JSONNode LoadFromCompressedBase64(string aBase64) - { - throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); - } -#endif - - public static JSONNode LoadFromBinaryStream(System.IO.Stream aData) - { - using (var R = new System.IO.BinaryReader(aData)) - { - return DeserializeBinary(R); - } - } - - public static JSONNode LoadFromBinaryFile(string aFileName) - { - using (var F = System.IO.File.OpenRead(aFileName)) - { - return LoadFromBinaryStream(F); - } - } - - public static JSONNode LoadFromBinaryBase64(string aBase64) - { - var tmp = System.Convert.FromBase64String(aBase64); - var stream = new System.IO.MemoryStream(tmp); - stream.Position = 0; - return LoadFromBinaryStream(stream); - } - } - - public partial class JSONArray : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.Array); - aWriter.Write(m_List.Count); - for (int i = 0; i < m_List.Count; i++) - { - m_List[i].SerializeBinary(aWriter); - } - } - } - - public partial class JSONObject : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.Object); - aWriter.Write(m_Dict.Count); - foreach (string K in m_Dict.Keys) - { - aWriter.Write(K); - m_Dict[K].SerializeBinary(aWriter); - } - } - } - - public partial class JSONString : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.String); - aWriter.Write(m_Data); - } - } - - public partial class JSONNumber : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.Number); - aWriter.Write(m_Data); - } - } - - public partial class JSONBool : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.Boolean); - aWriter.Write(m_Data); - } - } - public partial class JSONNull : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - aWriter.Write((byte)JSONNodeType.NullValue); - } - } - internal partial class JSONLazyCreator : JSONNode - { - public override void SerializeBinary(System.IO.BinaryWriter aWriter) - { - - } - } -#endif -} diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs.meta deleted file mode 100644 index c0f7b78c..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONBinary.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 527736d8e73a6a044a27a4c3f5a713d3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs deleted file mode 100644 index 9c24e136..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs +++ /dev/null @@ -1,516 +0,0 @@ -#region License and information -/* * * * * - * - * Extension file for the SimpleJSON framework for better support of some common - * .NET types. It does only work together with the SimpleJSON.cs - * It provides direct conversion support for types like decimal, char, byte, - * sbyte, short, ushort, uint, DateTime, TimeSpan and Guid. In addition there - * are conversion helpers for converting an array of number values into a byte[] - * or a List as well as converting an array of string values into a string[] - * or List. - * Finally there are some additional type conversion operators for some nullable - * types like short?, int?, float?, double?, long? and bool?. They will actually - * assign a JSONNull value when it's null or a JSONNumber when it's not. - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Markus Göbel (Bunny83) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * * * * */ - -#endregion License and information - -namespace SimpleJSON -{ - using System.Globalization; - using System.Collections.Generic; - public partial class JSONNode - { - #region Decimal - public virtual decimal AsDecimal - { - get - { - decimal result; - if (!decimal.TryParse(Value, out result)) - result = 0; - return result; - } - set - { - Value = value.ToString(); - } - } - - public static implicit operator JSONNode(decimal aDecimal) - { - return new JSONString(aDecimal.ToString()); - } - - public static implicit operator decimal(JSONNode aNode) - { - return aNode.AsDecimal; - } - #endregion Decimal - - #region Char - public virtual char AsChar - { - get - { - if (IsString && Value.Length > 0) - return Value[0]; - if (IsNumber) - return (char)AsInt; - return '\0'; - } - set - { - if (IsString) - Value = value.ToString(); - else if (IsNumber) - AsInt = (int)value; - } - } - - public static implicit operator JSONNode(char aChar) - { - return new JSONString(aChar.ToString()); - } - - public static implicit operator char(JSONNode aNode) - { - return aNode.AsChar; - } - #endregion Decimal - - #region UInt - public virtual uint AsUInt - { - get - { - return (uint)AsDouble; - } - set - { - AsDouble = value; - } - } - - public static implicit operator JSONNode(uint aUInt) - { - return new JSONNumber(aUInt); - } - - public static implicit operator uint(JSONNode aNode) - { - return aNode.AsUInt; - } - #endregion UInt - - #region Byte - public virtual byte AsByte - { - get - { - return (byte)AsInt; - } - set - { - AsInt = value; - } - } - - public static implicit operator JSONNode(byte aByte) - { - return new JSONNumber(aByte); - } - - public static implicit operator byte(JSONNode aNode) - { - return aNode.AsByte; - } - #endregion Byte - #region SByte - public virtual sbyte AsSByte - { - get - { - return (sbyte)AsInt; - } - set - { - AsInt = value; - } - } - - public static implicit operator JSONNode(sbyte aSByte) - { - return new JSONNumber(aSByte); - } - - public static implicit operator sbyte(JSONNode aNode) - { - return aNode.AsSByte; - } - #endregion SByte - - #region Short - public virtual short AsShort - { - get - { - return (short)AsInt; - } - set - { - AsInt = value; - } - } - - public static implicit operator JSONNode(short aShort) - { - return new JSONNumber(aShort); - } - - public static implicit operator short(JSONNode aNode) - { - return aNode.AsShort; - } - #endregion Short - #region UShort - public virtual ushort AsUShort - { - get - { - return (ushort)AsInt; - } - set - { - AsInt = value; - } - } - - public static implicit operator JSONNode(ushort aUShort) - { - return new JSONNumber(aUShort); - } - - public static implicit operator ushort(JSONNode aNode) - { - return aNode.AsUShort; - } - #endregion UShort - - #region DateTime - public virtual System.DateTime AsDateTime - { - get - { - System.DateTime result; - if (!System.DateTime.TryParse(Value, CultureInfo.InvariantCulture, DateTimeStyles.None, out result)) - result = new System.DateTime(0); - return result; - } - set - { - Value = value.ToString(CultureInfo.InvariantCulture); - } - } - - public static implicit operator JSONNode(System.DateTime aDateTime) - { - return new JSONString(aDateTime.ToString(CultureInfo.InvariantCulture)); - } - - public static implicit operator System.DateTime(JSONNode aNode) - { - return aNode.AsDateTime; - } - #endregion DateTime - #region TimeSpan - public virtual System.TimeSpan AsTimeSpan - { - get - { - System.TimeSpan result; - if (!System.TimeSpan.TryParse(Value, CultureInfo.InvariantCulture, out result)) - result = new System.TimeSpan(0); - return result; - } - set - { - Value = value.ToString(); - } - } - - public static implicit operator JSONNode(System.TimeSpan aTimeSpan) - { - return new JSONString(aTimeSpan.ToString()); - } - - public static implicit operator System.TimeSpan(JSONNode aNode) - { - return aNode.AsTimeSpan; - } - #endregion TimeSpan - - #region Guid - public virtual System.Guid AsGuid - { - get - { - System.Guid result; - System.Guid.TryParse(Value, out result); - return result; - } - set - { - Value = value.ToString(); - } - } - - public static implicit operator JSONNode(System.Guid aGuid) - { - return new JSONString(aGuid.ToString()); - } - - public static implicit operator System.Guid(JSONNode aNode) - { - return aNode.AsGuid; - } - #endregion Guid - - #region ByteArray - public virtual byte[] AsByteArray - { - get - { - if (this.IsNull || !this.IsArray) - return null; - int count = Count; - byte[] result = new byte[count]; - for (int i = 0; i < count; i++) - result[i] = this[i].AsByte; - return result; - } - set - { - if (!IsArray || value == null) - return; - Clear(); - for (int i = 0; i < value.Length; i++) - Add(value[i]); - } - } - - public static implicit operator JSONNode(byte[] aByteArray) - { - return new JSONArray { AsByteArray = aByteArray }; - } - - public static implicit operator byte[](JSONNode aNode) - { - return aNode.AsByteArray; - } - #endregion ByteArray - #region ByteList - public virtual List AsByteList - { - get - { - if (this.IsNull || !this.IsArray) - return null; - int count = Count; - List result = new List(count); - for (int i = 0; i < count; i++) - result.Add(this[i].AsByte); - return result; - } - set - { - if (!IsArray || value == null) - return; - Clear(); - for (int i = 0; i < value.Count; i++) - Add(value[i]); - } - } - - public static implicit operator JSONNode(List aByteList) - { - return new JSONArray { AsByteList = aByteList }; - } - - public static implicit operator List (JSONNode aNode) - { - return aNode.AsByteList; - } - #endregion ByteList - - #region StringArray - public virtual string[] AsStringArray - { - get - { - if (this.IsNull || !this.IsArray) - return null; - int count = Count; - string[] result = new string[count]; - for (int i = 0; i < count; i++) - result[i] = this[i].Value; - return result; - } - set - { - if (!IsArray || value == null) - return; - Clear(); - for (int i = 0; i < value.Length; i++) - Add(value[i]); - } - } - - public static implicit operator JSONNode(string[] aStringArray) - { - return new JSONArray { AsStringArray = aStringArray }; - } - - public static implicit operator string[] (JSONNode aNode) - { - return aNode.AsStringArray; - } - #endregion StringArray - #region StringList - public virtual List AsStringList - { - get - { - if (this.IsNull || !this.IsArray) - return null; - int count = Count; - List result = new List(count); - for (int i = 0; i < count; i++) - result.Add(this[i].Value); - return result; - } - set - { - if (!IsArray || value == null) - return; - Clear(); - for (int i = 0; i < value.Count; i++) - Add(value[i]); - } - } - - public static implicit operator JSONNode(List aStringList) - { - return new JSONArray { AsStringList = aStringList }; - } - - public static implicit operator List (JSONNode aNode) - { - return aNode.AsStringList; - } - #endregion StringList - - #region NullableTypes - public static implicit operator JSONNode(int? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONNumber((int)aValue); - } - public static implicit operator int?(JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsInt; - } - - public static implicit operator JSONNode(float? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONNumber((float)aValue); - } - public static implicit operator float? (JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsFloat; - } - - public static implicit operator JSONNode(double? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONNumber((double)aValue); - } - public static implicit operator double? (JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsDouble; - } - - public static implicit operator JSONNode(bool? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONBool((bool)aValue); - } - public static implicit operator bool? (JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsBool; - } - - public static implicit operator JSONNode(long? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONNumber((long)aValue); - } - public static implicit operator long? (JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsLong; - } - - public static implicit operator JSONNode(short? aValue) - { - if (aValue == null) - return JSONNull.CreateOrGet(); - return new JSONNumber((short)aValue); - } - public static implicit operator short? (JSONNode aNode) - { - if (aNode == null || aNode.IsNull) - return null; - return aNode.AsShort; - } - #endregion NullableTypes - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs.meta deleted file mode 100644 index 871d3c64..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONDotNetTypes.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ed716432925e134a8ab90917c118c9d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs deleted file mode 100644 index ee8a9121..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs +++ /dev/null @@ -1,462 +0,0 @@ -#if UNITY_5_3_OR_NEWER -#region License and information -/* * * * * - * - * Unity extension for the SimpleJSON framework. It does only work together with - * the SimpleJSON.cs - * It provides several helpers and conversion operators to serialize/deserialize - * common Unity types such as Vector2/3/4, Rect, RectOffset, Quaternion and - * Matrix4x4 as JSONObject or JSONArray. - * This extension will add 3 static settings to the JSONNode class: - * ( VectorContainerType, QuaternionContainerType, RectContainerType ) which - * control what node type should be used for serializing the given type. So a - * Vector3 as array would look like [12,32,24] and {"x":12, "y":32, "z":24} as - * object. - * - * - * The MIT License (MIT) - * - * Copyright (c) 2012-2017 Markus Göbel (Bunny83) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * * * * */ - -#endregion License and information -using UnityEngine; - -namespace SimpleJSON -{ - public enum JSONContainerType { Array, Object } - public partial class JSONNode - { - public static byte Color32DefaultAlpha = 255; - public static float ColorDefaultAlpha = 1f; - public static JSONContainerType VectorContainerType = JSONContainerType.Array; - public static JSONContainerType QuaternionContainerType = JSONContainerType.Array; - public static JSONContainerType RectContainerType = JSONContainerType.Array; - public static JSONContainerType ColorContainerType = JSONContainerType.Array; - private static JSONNode GetContainer(JSONContainerType aType) - { - if (aType == JSONContainerType.Array) - return new JSONArray(); - return new JSONObject(); - } - - #region implicit conversion operators - public static implicit operator JSONNode(Vector2 aVec) - { - JSONNode n = GetContainer(VectorContainerType); - n.WriteVector2(aVec); - return n; - } - public static implicit operator JSONNode(Vector3 aVec) - { - JSONNode n = GetContainer(VectorContainerType); - n.WriteVector3(aVec); - return n; - } - public static implicit operator JSONNode(Vector4 aVec) - { - JSONNode n = GetContainer(VectorContainerType); - n.WriteVector4(aVec); - return n; - } - public static implicit operator JSONNode(Color aCol) - { - JSONNode n = GetContainer(ColorContainerType); - n.WriteColor(aCol); - return n; - } - public static implicit operator JSONNode(Color32 aCol) - { - JSONNode n = GetContainer(ColorContainerType); - n.WriteColor32(aCol); - return n; - } - public static implicit operator JSONNode(Quaternion aRot) - { - JSONNode n = GetContainer(QuaternionContainerType); - n.WriteQuaternion(aRot); - return n; - } - public static implicit operator JSONNode(Rect aRect) - { - JSONNode n = GetContainer(RectContainerType); - n.WriteRect(aRect); - return n; - } - public static implicit operator JSONNode(RectOffset aRect) - { - JSONNode n = GetContainer(RectContainerType); - n.WriteRectOffset(aRect); - return n; - } - - public static implicit operator Vector2(JSONNode aNode) - { - return aNode.ReadVector2(); - } - public static implicit operator Vector3(JSONNode aNode) - { - return aNode.ReadVector3(); - } - public static implicit operator Vector4(JSONNode aNode) - { - return aNode.ReadVector4(); - } - public static implicit operator Color(JSONNode aNode) - { - return aNode.ReadColor(); - } - public static implicit operator Color32(JSONNode aNode) - { - return aNode.ReadColor32(); - } - public static implicit operator Quaternion(JSONNode aNode) - { - return aNode.ReadQuaternion(); - } - public static implicit operator Rect(JSONNode aNode) - { - return aNode.ReadRect(); - } - public static implicit operator RectOffset(JSONNode aNode) - { - return aNode.ReadRectOffset(); - } - #endregion implicit conversion operators - - #region Vector2 - public Vector2 ReadVector2(Vector2 aDefault) - { - if (IsObject) - return new Vector2(this["x"].AsFloat, this["y"].AsFloat); - if (IsArray) - return new Vector2(this[0].AsFloat, this[1].AsFloat); - return aDefault; - } - public Vector2 ReadVector2(string aXName, string aYName) - { - if (IsObject) - { - return new Vector2(this[aXName].AsFloat, this[aYName].AsFloat); - } - return Vector2.zero; - } - - public Vector2 ReadVector2() - { - return ReadVector2(Vector2.zero); - } - public JSONNode WriteVector2(Vector2 aVec, string aXName = "x", string aYName = "y") - { - if (IsObject) - { - Inline = true; - this[aXName].AsFloat = aVec.x; - this[aYName].AsFloat = aVec.y; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aVec.x; - this[1].AsFloat = aVec.y; - } - return this; - } - #endregion Vector2 - - #region Vector3 - public Vector3 ReadVector3(Vector3 aDefault) - { - if (IsObject) - return new Vector3(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat); - if (IsArray) - return new Vector3(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat); - return aDefault; - } - public Vector3 ReadVector3(string aXName, string aYName, string aZName) - { - if (IsObject) - return new Vector3(this[aXName].AsFloat, this[aYName].AsFloat, this[aZName].AsFloat); - return Vector3.zero; - } - public Vector3 ReadVector3() - { - return ReadVector3(Vector3.zero); - } - public JSONNode WriteVector3(Vector3 aVec, string aXName = "x", string aYName = "y", string aZName = "z") - { - if (IsObject) - { - Inline = true; - this[aXName].AsFloat = aVec.x; - this[aYName].AsFloat = aVec.y; - this[aZName].AsFloat = aVec.z; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aVec.x; - this[1].AsFloat = aVec.y; - this[2].AsFloat = aVec.z; - } - return this; - } - #endregion Vector3 - - #region Vector4 - public Vector4 ReadVector4(Vector4 aDefault) - { - if (IsObject) - return new Vector4(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); - if (IsArray) - return new Vector4(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); - return aDefault; - } - public Vector4 ReadVector4() - { - return ReadVector4(Vector4.zero); - } - public JSONNode WriteVector4(Vector4 aVec) - { - if (IsObject) - { - Inline = true; - this["x"].AsFloat = aVec.x; - this["y"].AsFloat = aVec.y; - this["z"].AsFloat = aVec.z; - this["w"].AsFloat = aVec.w; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aVec.x; - this[1].AsFloat = aVec.y; - this[2].AsFloat = aVec.z; - this[3].AsFloat = aVec.w; - } - return this; - } - #endregion Vector4 - - #region Color / Color32 - public Color ReadColor(Color aDefault) - { - if (IsObject) - return new Color(this["r"].AsFloat, this["g"].AsFloat, this["b"].AsFloat, HasKey("a")?this["a"].AsFloat:ColorDefaultAlpha); - if (IsArray) - return new Color(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, (Count>3)?this[3].AsFloat:ColorDefaultAlpha); - return aDefault; - } - public Color ReadColor() - { - return ReadColor(Color.clear); - } - public JSONNode WriteColor(Color aCol) - { - if (IsObject) - { - Inline = true; - this["r"].AsFloat = aCol.r; - this["g"].AsFloat = aCol.g; - this["b"].AsFloat = aCol.b; - this["a"].AsFloat = aCol.a; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aCol.r; - this[1].AsFloat = aCol.g; - this[2].AsFloat = aCol.b; - this[3].AsFloat = aCol.a; - } - return this; - } - - public Color32 ReadColor32(Color32 aDefault) - { - if (IsObject) - return new Color32((byte)this["r"].AsInt, (byte)this["g"].AsInt, (byte)this["b"].AsInt, (byte)(HasKey("a")?this["a"].AsInt:Color32DefaultAlpha)); - if (IsArray) - return new Color32((byte)this[0].AsInt, (byte)this[1].AsInt, (byte)this[2].AsInt, (byte)((Count>3)?this[3].AsInt:Color32DefaultAlpha)); - return aDefault; - } - public Color32 ReadColor32() - { - return ReadColor32(new Color32()); - } - public JSONNode WriteColor32(Color32 aCol) - { - if (IsObject) - { - Inline = true; - this["r"].AsInt = aCol.r; - this["g"].AsInt = aCol.g; - this["b"].AsInt = aCol.b; - this["a"].AsInt = aCol.a; - } - else if (IsArray) - { - Inline = true; - this[0].AsInt = aCol.r; - this[1].AsInt = aCol.g; - this[2].AsInt = aCol.b; - this[3].AsInt = aCol.a; - } - return this; - } - - #endregion Color / Color32 - - #region Quaternion - public Quaternion ReadQuaternion(Quaternion aDefault) - { - if (IsObject) - return new Quaternion(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); - if (IsArray) - return new Quaternion(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); - return aDefault; - } - public Quaternion ReadQuaternion() - { - return ReadQuaternion(Quaternion.identity); - } - public JSONNode WriteQuaternion(Quaternion aRot) - { - if (IsObject) - { - Inline = true; - this["x"].AsFloat = aRot.x; - this["y"].AsFloat = aRot.y; - this["z"].AsFloat = aRot.z; - this["w"].AsFloat = aRot.w; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aRot.x; - this[1].AsFloat = aRot.y; - this[2].AsFloat = aRot.z; - this[3].AsFloat = aRot.w; - } - return this; - } - #endregion Quaternion - - #region Rect - public Rect ReadRect(Rect aDefault) - { - if (IsObject) - return new Rect(this["x"].AsFloat, this["y"].AsFloat, this["width"].AsFloat, this["height"].AsFloat); - if (IsArray) - return new Rect(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); - return aDefault; - } - public Rect ReadRect() - { - return ReadRect(new Rect()); - } - public JSONNode WriteRect(Rect aRect) - { - if (IsObject) - { - Inline = true; - this["x"].AsFloat = aRect.x; - this["y"].AsFloat = aRect.y; - this["width"].AsFloat = aRect.width; - this["height"].AsFloat = aRect.height; - } - else if (IsArray) - { - Inline = true; - this[0].AsFloat = aRect.x; - this[1].AsFloat = aRect.y; - this[2].AsFloat = aRect.width; - this[3].AsFloat = aRect.height; - } - return this; - } - #endregion Rect - - #region RectOffset - public RectOffset ReadRectOffset(RectOffset aDefault) - { - if (this is JSONObject) - return new RectOffset(this["left"].AsInt, this["right"].AsInt, this["top"].AsInt, this["bottom"].AsInt); - if (this is JSONArray) - return new RectOffset(this[0].AsInt, this[1].AsInt, this[2].AsInt, this[3].AsInt); - return aDefault; - } - public RectOffset ReadRectOffset() - { - return ReadRectOffset(new RectOffset()); - } - public JSONNode WriteRectOffset(RectOffset aRect) - { - if (IsObject) - { - Inline = true; - this["left"].AsInt = aRect.left; - this["right"].AsInt = aRect.right; - this["top"].AsInt = aRect.top; - this["bottom"].AsInt = aRect.bottom; - } - else if (IsArray) - { - Inline = true; - this[0].AsInt = aRect.left; - this[1].AsInt = aRect.right; - this[2].AsInt = aRect.top; - this[3].AsInt = aRect.bottom; - } - return this; - } - #endregion RectOffset - - #region Matrix4x4 - public Matrix4x4 ReadMatrix() - { - Matrix4x4 result = Matrix4x4.identity; - if (IsArray) - { - for (int i = 0; i < 16; i++) - { - result[i] = this[i].AsFloat; - } - } - return result; - } - public JSONNode WriteMatrix(Matrix4x4 aMatrix) - { - if (IsArray) - { - Inline = true; - for (int i = 0; i < 16; i++) - { - this[i].AsFloat = aMatrix[i]; - } - } - return this; - } - #endregion Matrix4x4 - } -} -#endif diff --git a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs.meta b/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs.meta deleted file mode 100644 index a6246f41..00000000 --- a/Assets/TEngine/Libraries/LubanLib/SimpleJSON/SimpleJSONUnity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 03ae607b1bfdb9043ba6bba186e06165 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/TEngine/Libraries/LubanLib/StringUtil.cs b/Assets/TEngine/Libraries/LubanLib/StringUtil.cs deleted file mode 100644 index c91f2a11..00000000 --- a/Assets/TEngine/Libraries/LubanLib/StringUtil.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.Text; - -namespace Bright.Common -{ - public static class StringUtil - { - public static string ToStr(object o) - { - return ToStr(o, new StringBuilder()); - } - - public static string ToStr(object o, StringBuilder sb) - { - foreach (var p in o.GetType().GetFields()) - { - - sb.Append($"{p.Name} = {p.GetValue(o)},"); - } - - foreach (var p in o.GetType().GetProperties()) - { - sb.Append($"{p.Name} = {p.GetValue(o)},"); - } - return sb.ToString(); - } - - public static string ArrayToString(T[] arr) - { - return "[" + string.Join(",", arr) + "]"; - } - - - public static string CollectionToString(IEnumerable arr) - { - return "[" + string.Join(",", arr) + "]"; - } - - - public static string CollectionToString(IDictionary dic) - { - var sb = new StringBuilder('{'); - foreach (var e in dic) - { - sb.Append(e.Key).Append(':'); - sb.Append(e.Value).Append(','); - } - sb.Append('}'); - return sb.ToString(); - } - } -} diff --git a/Assets/TEngine/Libraries/LubanLib/StringUtil.cs.meta b/Assets/TEngine/Libraries/LubanLib/StringUtil.cs.meta deleted file mode 100644 index 75ec967b..00000000 --- a/Assets/TEngine/Libraries/LubanLib/StringUtil.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aab76bc328e69914394493ca645f6988 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: