diff --git a/Assets/UniGLTF/Runtime/UniJSON/Extensions/ParserExtensions.cs b/Assets/UniGLTF/Runtime/UniJSON/Extensions/ParserExtensions.cs index 7caf664dd..94ece61bc 100644 --- a/Assets/UniGLTF/Runtime/UniJSON/Extensions/ParserExtensions.cs +++ b/Assets/UniGLTF/Runtime/UniJSON/Extensions/ParserExtensions.cs @@ -21,32 +21,5 @@ namespace UniJSON { return JsonParser.Parse(new Utf8String(bytes)); } - - public static ListTreeNode ParseAsMsgPack(this byte[] bytes) - { - return MsgPackParser.Parse(bytes); - } - public static ListTreeNode ParseAsMsgPack(this ArraySegment bytes) - { - return MsgPackParser.Parse(bytes); - } - - public static ListTreeNode ParseAsToml(this string toml) - { - return TomlParser.Parse(toml); - } - public static ListTreeNode ParseAsToml(this Utf8String toml) - { - return TomlParser.Parse(toml); - } - public static ListTreeNode ParseAsToml(this byte[] bytes) - { - return TomlParser.Parse(new Utf8String(bytes)); - } - public static ListTreeNode ParseAsToml(this ArraySegment bytes) - { - return TomlParser.Parse(new Utf8String(bytes)); - } - } } diff --git a/Assets/UniGLTF/Runtime/UniJSON/GenericCast.cs b/Assets/UniGLTF/Runtime/UniJSON/GenericCast.cs index fafc29bd2..b40612ed1 100644 --- a/Assets/UniGLTF/Runtime/UniJSON/GenericCast.cs +++ b/Assets/UniGLTF/Runtime/UniJSON/GenericCast.cs @@ -13,7 +13,7 @@ namespace UniJSON } else { - throw new MsgPackTypeException("can not null"); + throw new Exception("can not null"); } } diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack.meta deleted file mode 100644 index d50a251e1..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1cffddcba2f97d44589d1fe7e05dfc2d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs deleted file mode 100644 index 63439db6d..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs +++ /dev/null @@ -1,434 +0,0 @@ -using System; -using System.Net; - -namespace UniJSON -{ - public static class EndianConverter - { -#if false - /* - #region Converter - /// - /// Read Uint16 From NetworkBytesOrder to HostBytesOrder - /// - /// - /// - public static UInt16 N2H_UInt16(this ArraySegment self) - { - if (BitConverter.IsLittleEndian) - { - return (UInt16)(self.Get(0) << 8 | self.Get(1)); - } - else - { - return BitConverter.ToUInt16(self.Array, self.Offset); - } - } - - public static UInt32 N2H_UInt32(this ArraySegment self) - { - if (BitConverter.IsLittleEndian) - { - return (UInt32)(self.Get(0) << 24 | self.Get(1) << 16 | self.Get(2) << 8 | self.Get(3)); - } - else - { - return BitConverter.ToUInt32(self.Array, self.Offset); - } - } - - public static UInt64 N2H_UInt64(this ArraySegment self) - { - var uvalue = BitConverter.ToUInt64(self.Array, self.Offset); - if (BitConverter.IsLittleEndian) - { - ulong swapped = - ((0x00000000000000FF) & (uvalue >> 56) - | (0x000000000000FF00) & (uvalue >> 40) - | (0x0000000000FF0000) & (uvalue >> 24) - | (0x00000000FF000000) & (uvalue >> 8) - | (0x000000FF00000000) & (uvalue << 8) - | (0x0000FF0000000000) & (uvalue << 24) - | (0x00FF000000000000) & (uvalue << 40) - | (0xFF00000000000000) & (uvalue << 56)); - return swapped; - } - else - { - return uvalue; - } - } - - public static Int16 N2H_Int16(this ArraySegment self) - { - if (BitConverter.IsLittleEndian) - { - return (Int16)(self.Get(0) << 8 | self.Get(1)); - } - else - { - return BitConverter.ToInt16(self.Array, self.Offset); - } - } - - public static Int32 N2H_Int32(this ArraySegment self) - { - if (BitConverter.IsLittleEndian) - { - return (Int32)(self.Get(0) << 24 | self.Get(1) << 16 | self.Get(2) << 8 | self.Get(3)); - } - else - { - return BitConverter.ToInt32(self.Array, self.Offset); - } - } - - public static Int64 N2H_Int64(this ArraySegment self) - { - var value = BitConverter.ToUInt64(self.Array, self.Offset); - if (BitConverter.IsLittleEndian) - { - ulong swapped = - ((0x00000000000000FF) & (value >> 56) - | (0x000000000000FF00) & (value >> 40) - | (0x0000000000FF0000) & (value >> 24) - | (0x00000000FF000000) & (value >> 8) - | (0x000000FF00000000) & (value << 8) - | (0x0000FF0000000000) & (value << 24) - | (0x00FF000000000000) & (value << 40) - | (0xFF00000000000000) & (value << 56)); - return (long)swapped; - } - else - { - return (long)value; - } - } - - public static Single N2H_Single(this ArraySegment self) - { - if (BitConverter.IsLittleEndian) - { - return BitConverter.ToSingle(self.TakeReversedArray(4), 0); - } - else - { - return BitConverter.ToSingle(self.Array, self.Offset); - } - } - - public static Double N2H_Double(this ArraySegment self) - { - return BitConverter.Int64BitsToDouble(self.N2H_Int64()); - } - - public static void N2H_CopyTo(this ArraySegment self, Byte[] buffer, int elementSize) - { - if (buffer.Length < self.Count) throw new ArgumentException(); - - for (int i = 0; i < self.Count; i += elementSize) - { - for (int j = 0; j < elementSize; ++j) - { - buffer[i + j] = self.Get(i + elementSize - 1 - j); - } - } - } - - public static void N2H_CopyTo(this ArraySegment self, Array result, Byte[] buffer) - { - if (BitConverter.IsLittleEndian) - { - if (buffer.Length < self.Count) - { - throw new ArgumentException(); - } - self.N2H_CopyTo(buffer, Marshal.SizeOf(result.GetType().GetElementType())); - - Buffer.BlockCopy(buffer, 0, result, 0, self.Count); - } - else - { - Buffer.BlockCopy(self.Array, self.Offset, result, 0, self.Count); - } - } - #endregion - */ - -#else - #region Signed - public static Int16 NetworkByteWordToSignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.WordValue - { - Byte0 = bytes.Get(1), - Byte1 = bytes.Get(0), - }; - return value.Signed; - } - else - { - // Network to Big - var value = new ByteUnion.WordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - }; - return value.Signed; - } - } - public static Int32 NetworkByteDWordToSignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(3), - Byte1 = bytes.Get(2), - Byte2 = bytes.Get(1), - Byte3 = bytes.Get(0), - }; - return value.Signed; - } - else - { - // Network to Big - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - }; - return value.Signed; - } - } - public static Int64 NetworkByteQWordToSignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(7), - Byte1 = bytes.Get(6), - Byte2 = bytes.Get(5), - Byte3 = bytes.Get(4), - Byte4 = bytes.Get(3), - Byte5 = bytes.Get(2), - Byte6 = bytes.Get(1), - Byte7 = bytes.Get(0), - }; - return value.Signed; - } - else - { - // Network to Big - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - Byte4 = bytes.Get(4), - Byte5 = bytes.Get(5), - Byte6 = bytes.Get(6), - Byte7 = bytes.Get(7), - }; - return value.Signed; - } - } - #endregion - #region Unsigned - public static UInt16 NetworkByteWordToUnsignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.WordValue - { - Byte0 = bytes.Get(1), - Byte1 = bytes.Get(0), - }; - return value.Unsigned; - } - else - { - // Network to Big - var value = new ByteUnion.WordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - }; - return value.Unsigned; - } - } - public static UInt32 NetworkByteDWordToUnsignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(3), - Byte1 = bytes.Get(2), - Byte2 = bytes.Get(1), - Byte3 = bytes.Get(0), - }; - return value.Unsigned; - } - else - { - // Network to Big - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - }; - return value.Unsigned; - } - } - public static UInt64 NetworkByteQWordToUnsignedNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(7), - Byte1 = bytes.Get(6), - Byte2 = bytes.Get(5), - Byte3 = bytes.Get(4), - Byte4 = bytes.Get(3), - Byte5 = bytes.Get(2), - Byte6 = bytes.Get(1), - Byte7 = bytes.Get(0), - }; - return value.Unsigned; - } - else - { - // Network to Big - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - Byte4 = bytes.Get(4), - Byte5 = bytes.Get(5), - Byte6 = bytes.Get(6), - Byte7 = bytes.Get(7), - }; - return value.Unsigned; - } - } - #endregion - #region Floating - public static Single NetworkByteDWordToFloatNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(3), - Byte1 = bytes.Get(2), - Byte2 = bytes.Get(1), - Byte3 = bytes.Get(0), - }; - return value.Float; - } - else - { - // Network to Big - var value = new ByteUnion.DWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - }; - return value.Float; - } - } - public static Double NetworkByteQWordToFloatNativeByteOrder(ArraySegment bytes) - { - if (BitConverter.IsLittleEndian) - { - // Network to Little - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(7), - Byte1 = bytes.Get(6), - Byte2 = bytes.Get(5), - Byte3 = bytes.Get(4), - Byte4 = bytes.Get(3), - Byte5 = bytes.Get(2), - Byte6 = bytes.Get(1), - Byte7 = bytes.Get(0), - }; - return value.Float; - } - else - { - // Network to Big - var value = new ByteUnion.QWordValue - { - Byte0 = bytes.Get(0), - Byte1 = bytes.Get(1), - Byte2 = bytes.Get(2), - Byte3 = bytes.Get(3), - Byte4 = bytes.Get(4), - Byte5 = bytes.Get(5), - Byte6 = bytes.Get(6), - Byte7 = bytes.Get(7), - }; - return value.Float; - } - } - #endregion -#endif - - public static Int16 ToNetworkByteOrder(this Int16 value) - { - return ByteUnion.WordValue.Create(value).HostToNetworkOrder().Signed; - } - public static UInt16 ToNetworkByteOrder(this UInt16 value) - { - return ByteUnion.WordValue.Create(value).HostToNetworkOrder().Unsigned; - } - - public static Int32 ToNetworkByteOrder(this Int32 value) - { - return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Signed; - } - public static UInt32 ToNetworkByteOrder(this UInt32 value) - { - return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Unsigned; - } - public static Single ToNetworkByteOrder(this Single value) - { - return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Float; - } - - public static Int64 ToNetworkByteOrder(this Int64 value) - { - return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Signed; - } - public static UInt64 ToNetworkByteOrder(this UInt64 value) - { - return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Unsigned; - } - public static Double ToNetworkByteOrder(this Double value) - { - return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Float; - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs.meta deleted file mode 100644 index f6008eb96..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/EndianConverter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2d72520a65b562f4f862ac0760306215 -timeCreated: 1540879367 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs deleted file mode 100644 index da23af399..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace UniJSON -{ - - public class MsgPackTypeException : Exception - { - public MsgPackTypeException(string msg) : base(msg) - { } - - } - -} \ No newline at end of file diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs.meta deleted file mode 100644 index 76095e45c..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/Exceptions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc09dae63ba521545a0b9a8ef120b95a -timeCreated: 1540906879 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs deleted file mode 100644 index f20543f93..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs +++ /dev/null @@ -1,609 +0,0 @@ -using System; - - -namespace UniJSON -{ - public class MsgPackFormatter : IFormatter - { - IStore m_store; - public MsgPackFormatter(IStore store) - { - m_store = store; - } - - public MsgPackFormatter() : this(new BytesStore()) - { - } - - public void Clear() - { - m_store.Clear(); - } - -#if false - public bool MsgPack_Ext(IList list) - { - var t = list.GetType(); - var et = t.GetElementType(); - if (et.IsClass()) - { - return false; - } - m_store.Write((Byte)MsgPackType.EXT32); - var itemSize = Marshal.SizeOf(et); - WriteInt32_NBO(list.Count * itemSize); - - Action pack; - if (et == typeof(UInt16)) - { - m_store.Write((Byte)ExtType.UINT16_BE); - pack = o => WriteUInt16_NBO((UInt16)o); - } - else if (et == typeof(UInt32)) - { - m_store.Write((Byte)ExtType.UINT32_BE); - pack = o => WriteUInt32_NBO((UInt32)o); - } - else if (et == typeof(UInt64)) - { - m_store.Write((Byte)ExtType.UINT64_BE); - pack = o => WriteUInt64_NBO((UInt64)o); - } - else if (et == typeof(Int16)) - { - m_store.Write((Byte)ExtType.INT16_BE); - pack = o => WriteInt16_NBO((Int16)o); - } - else if (et == typeof(Int32)) - { - m_store.Write((Byte)ExtType.INT32_BE); - pack = o => WriteInt32_NBO((Int32)o); - } - else if (et == typeof(Int64)) - { - m_store.Write((Byte)ExtType.INT64_BE); - pack = o => WriteInt64_NBO((Int64)o); - } - else if (et == typeof(Single)) - { - m_store.Write((Byte)ExtType.SINGLE_BE); - pack = o => WriteSingle_NBO((Single)o); - } - else if (et == typeof(Double)) - { - m_store.Write((Byte)ExtType.DOUBLE_BE); - pack = o => WriteDouble_NBO((Double)o); - } - else - { - return false; - } - - foreach (var i in list) - { - pack(i); - } - return true; - } -#endif - - public void BeginList(int n) - { - if (n < 0x0F) - { - m_store.Write((Byte)((Byte)MsgPackType.FIX_ARRAY | n)); - } - else if (n < 0xFFFF) - { - m_store.Write((Byte)MsgPackType.ARRAY16); - m_store.WriteBigEndian((UInt16)n); - } - else - { - m_store.Write((Byte)MsgPackType.ARRAY32); - m_store.WriteBigEndian(n); - } - } - - public void EndList() - { - } - - public void BeginMap(int n) - { - if (n < 0x0F) - { - m_store.Write((Byte)((Byte)MsgPackType.FIX_MAP | n)); - } - else if (n < 0xFFFF) - { - m_store.Write((Byte)MsgPackType.MAP16); - m_store.WriteBigEndian((UInt16)n); - } - else - { - m_store.Write((Byte)MsgPackType.MAP32); - m_store.WriteBigEndian(n.ToNetworkByteOrder()); - } - } - - public void EndMap() - { - } - - public void Null() - { - m_store.Write((Byte)MsgPackType.NIL); - } - - public void Key(Utf8String key) - { - Value(key); - } - - public void Value(String s) - { - Value(Utf8String.From(s)); - } - - public void Value(Utf8String s) - { - var bytes = s.Bytes; - int size = bytes.Count; - if (size < 32) - { - m_store.Write((Byte)((Byte)MsgPackType.FIX_STR | size)); - m_store.Write(bytes); - } - else if (size < 0xFF) - { - m_store.Write((Byte)(MsgPackType.STR8)); - m_store.Write((Byte)(size)); - m_store.Write(bytes); - } - else if (size < 0xFFFF) - { - m_store.Write((Byte)MsgPackType.STR16); - m_store.WriteBigEndian((UInt16)size); - m_store.Write(bytes); - } - else - { - m_store.Write((Byte)MsgPackType.STR32); - m_store.WriteBigEndian(size); - m_store.Write(bytes); - } - } - - public void Value(bool value) - { - if (value) - { - m_store.Write((Byte)MsgPackType.TRUE); - } - else - { - m_store.Write((Byte)MsgPackType.FALSE); - } - } - - #region Singed - public void Value(sbyte n) - { - if (n >= 0) - { - // positive - Value((Byte)n); - } - else if (n >= -32) - { - var value = (MsgPackType)((n + 32) + (Byte)MsgPackType.NEGATIVE_FIXNUM); - m_store.Write((Byte)value); - } - else - { - m_store.Write((Byte)MsgPackType.INT8); - m_store.Write((Byte)n); - } - } - - public void Value(short n) - { - if (n >= 0) - { - // positive - if (n <= 0xFF) - { - Value((Byte)n); - } - else - { - Value((UInt16)n); - } - } - else - { - // negative - if (n >= -128) - { - m_store.Write((SByte)n); - } - else - { - m_store.Write((Byte)MsgPackType.INT16); - m_store.WriteBigEndian(n); - } - } - } - - public void Value(int n) - { - if (n >= 0) - { - // positive - if (n <= 0xFF) - { - Value((Byte)n); - } - else if (n <= 0xFFFF) - { - Value((UInt16)n); - } - else - { - Value((UInt32)n); - } - } - else - { - // negative - if (n >= -128) - { - Value((SByte)n); - } - else if (n >= -32768) - { - Value((Int16)n); - } - else - { - m_store.Write((Byte)MsgPackType.INT32); - m_store.WriteBigEndian(n); - } - } - } - - public void Value(long n) - { - if (n >= 0) - { - // positive - if (n <= 0xFF) - { - Value((Byte)n); - } - else if (n <= 0xFFFF) - { - Value((UInt16)n); - } - else if (n <= 0xFFFFFFFF) - { - Value((UInt32)n); - } - else - { - Value((UInt64)n); - } - } - else - { - // negative - if (n >= -128) - { - Value((SByte)n); - } - else if (n >= -32768) - { - Value((Int16)n); - } - else if (n >= -2147483648) - { - Value((Int32)n); - } - else - { - m_store.Write((Byte)MsgPackType.INT64); - m_store.WriteBigEndian(n); - } - } - } - #endregion - - #region Unsigned - public void Value(byte n) - { - if (n <= 0x7F) - { - // FormatType.POSITIVE_FIXNUM - m_store.Write(n); - } - else - { - m_store.Write((Byte)MsgPackType.UINT8); - m_store.Write(n); - } - } - - public void Value(ushort n) - { - if (n <= 0xFF) - { - Value((Byte)n); - } - else - { - m_store.Write((Byte)MsgPackType.UINT16); - m_store.WriteBigEndian(n); - } - } - - public void Value(uint n) - { - if (n <= 0xFF) - { - Value((Byte)n); - } - else if (n <= 0xFFFF) - { - Value((UInt16)n); - } - else - { - m_store.Write((Byte)MsgPackType.UINT32); - m_store.WriteBigEndian(n); - } - } - - public void Value(ulong n) - { - if (n <= 0xFF) - { - Value((Byte)n); - } - else if (n <= 0xFFFF) - { - Value((UInt16)n); - } - else if (n <= 0xFFFFFFFF) - { - Value((UInt32)n); - } - else - { - m_store.Write((Byte)MsgPackType.UINT64); - m_store.WriteBigEndian(n); - } - } - #endregion - - public void Value(float value) - { - m_store.Write((Byte)MsgPackType.FLOAT); - m_store.WriteBigEndian(value); - } - - public void Value(double value) - { - m_store.Write((Byte)MsgPackType.DOUBLE); - m_store.WriteBigEndian(value); - } - - public void Value(ArraySegment bytes) - { - if (bytes.Count < 0xFF) - { - m_store.Write((Byte)(MsgPackType.BIN8)); - m_store.Write((Byte)(bytes.Count)); - m_store.Write(bytes); - } - else if (bytes.Count < 0xFFFF) - { - m_store.Write((Byte)MsgPackType.BIN16); - m_store.WriteBigEndian((UInt16)bytes.Count); - m_store.Write(bytes); - } - else - { - m_store.Write((Byte)MsgPackType.BIN32); - m_store.WriteBigEndian(bytes.Count); - m_store.Write(bytes); - } - } - - public void TimeStamp32(DateTimeOffset time) - { - // https://github.com/ousttrue/UniJSON/blob/1.2/Scripts/Extensions/DateTimeOffsetExtensions.cs#L13-L16 - if (time < DateTimeOffsetExtensions.EpochTime) - { - throw new ArgumentOutOfRangeException(); - } - m_store.Write((Byte)MsgPackType.FIX_EXT_4); - m_store.Write((SByte)(-1)); - m_store.WriteBigEndian((uint)time.ToUnixTimeSeconds()); - } - - public void Value(DateTimeOffset time) - { - TimeStamp32(time); - } - - public void Value(ListTreeNode node) - { - m_store.Write(node.Value.Bytes); - } - - public IStore GetStore() - { - return m_store; - } - - #region IRpc - public const int REQUEST_TYPE = 0; - public const int RESPONSE_TYPE = 1; - public const int NOTIFY_TYPE = 2; - - int m_msgId = 1; - - public void Request(Utf8String method) - { - BeginList(4); - Value(REQUEST_TYPE); - Value(m_msgId++); - Value(method); - BeginList(0); // params - { - } - EndList(); - EndList(); - } - - public void Request(Utf8String method, A0 a0) - { - BeginList(4); - Value(REQUEST_TYPE); - Value(m_msgId++); - Value(method); - BeginList(1); // params - { - this.Serialize(a0); - } - EndList(); - EndList(); - } - - public void Request(Utf8String method, A0 a0, A1 a1) - { - BeginList(4); - Value(REQUEST_TYPE); - Value(m_msgId++); - Value(method); - BeginList(2); // params - { - this.Serialize(a0); - this.Serialize(a1); - } - EndList(); - EndList(); - } - - public void Request(Utf8String method, A0 a0, A1 a1, A2 a2) - { - throw new NotImplementedException(); - } - - public void Request(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3) - { - throw new NotImplementedException(); - } - - public void Request(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - throw new NotImplementedException(); - } - - public void Request(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { - throw new NotImplementedException(); - } - - public void ResponseSuccess(int id) - { - BeginList(4); - Value(RESPONSE_TYPE); - Value(id); - Null(); - Null(); - EndList(); - } - - public void ResponseSuccess(int id, T result) - { - BeginList(4); - Value(RESPONSE_TYPE); - Value(id); - Null(); - this.Serialize(result); - EndList(); - } - - public void ResponseError(int id, Exception error) - { - BeginList(4); - Value(RESPONSE_TYPE); - Value(id); - this.Serialize(error); - Null(); - EndList(); - } - - public void Notify(Utf8String method) - { - BeginList(3); - Value(NOTIFY_TYPE); - Value(method); - BeginList(0); // params - { - } - EndList(); - EndList(); - } - - public void Notify(Utf8String method, A0 a0) - { - BeginList(3); - Value(NOTIFY_TYPE); - Value(method); - BeginList(1); // params - { - this.Serialize(a0); - } - EndList(); - EndList(); - } - - public void Notify(Utf8String method, A0 a0, A1 a1) - { - BeginList(3); - Value(NOTIFY_TYPE); - Value(method); - BeginList(2); // params - { - this.Serialize(a0); - this.Serialize(a1); - } - EndList(); - EndList(); - } - - public void Notify(Utf8String method, A0 a0, A1 a1, A2 a2) - { - throw new NotImplementedException(); - } - - public void Notify(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3) - { - throw new NotImplementedException(); - } - - public void Notify(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - throw new NotImplementedException(); - } - - public void Notify(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { - throw new NotImplementedException(); - } - #endregion - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs.meta deleted file mode 100644 index cdcbc7f3f..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackFormatter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 41153eff97391fd46a31361bac5804fb -timeCreated: 1540879112 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs deleted file mode 100644 index cf0e07f60..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs +++ /dev/null @@ -1,416 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace UniJSON -{ - public static class MsgPackParser - { - public static ListTreeNode Parse(Byte[] bytes) - { - return Parse(new ArraySegment(bytes)); - } - - static MsgPackType GetFormat(ArraySegment bytes) - { - return (MsgPackType)bytes.Get(0); - } - - /// - /// Array又はMapの子要素の数を得る - /// - /// - /// - static ArraySegment GetItemCount(ArraySegment bytes, MsgPackType formatType, out UInt32 count) - { - switch (formatType) - { - case MsgPackType.FIX_ARRAY: count = 0; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x1: count = 1; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x2: count = 2; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x3: count = 3; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x4: count = 4; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x5: count = 5; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x6: count = 6; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x7: count = 7; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x8: count = 8; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0x9: count = 9; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xA: count = 10; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xB: count = 11; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xC: count = 12; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xD: count = 13; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xE: count = 14; return bytes.Advance(1); - case MsgPackType.FIX_ARRAY_0xF: count = 15; return bytes.Advance(1); - - case MsgPackType.FIX_MAP: count = 0; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x1: count = 1; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x2: count = 2; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x3: count = 3; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x4: count = 4; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x5: count = 5; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x6: count = 6; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x7: count = 7; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x8: count = 8; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0x9: count = 9; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xA: count = 10; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xB: count = 11; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xC: count = 12; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xD: count = 13; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xE: count = 14; return bytes.Advance(1); - case MsgPackType.FIX_MAP_0xF: count = 15; return bytes.Advance(1); - - case MsgPackType.ARRAY16: - case MsgPackType.MAP16: - count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 2); - - case MsgPackType.ARRAY32: - case MsgPackType.MAP32: - count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 4); - - default: - throw new ArgumentException("is not collection: " + formatType); - } - } - - /// - /// ArrayとMap以外のタイプのペイロードを得る - /// - /// - static ArraySegment GetBody(ArraySegment bytes, MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FIX_STR: return bytes.Advance(1).Take(0); - case MsgPackType.FIX_STR_0x01: return bytes.Advance(1).Take(1); - case MsgPackType.FIX_STR_0x02: return bytes.Advance(1).Take(2); - case MsgPackType.FIX_STR_0x03: return bytes.Advance(1).Take(3); - case MsgPackType.FIX_STR_0x04: return bytes.Advance(1).Take(4); - case MsgPackType.FIX_STR_0x05: return bytes.Advance(1).Take(5); - case MsgPackType.FIX_STR_0x06: return bytes.Advance(1).Take(6); - case MsgPackType.FIX_STR_0x07: return bytes.Advance(1).Take(7); - case MsgPackType.FIX_STR_0x08: return bytes.Advance(1).Take(8); - case MsgPackType.FIX_STR_0x09: return bytes.Advance(1).Take(9); - case MsgPackType.FIX_STR_0x0A: return bytes.Advance(1).Take(10); - case MsgPackType.FIX_STR_0x0B: return bytes.Advance(1).Take(11); - case MsgPackType.FIX_STR_0x0C: return bytes.Advance(1).Take(12); - case MsgPackType.FIX_STR_0x0D: return bytes.Advance(1).Take(13); - case MsgPackType.FIX_STR_0x0E: return bytes.Advance(1).Take(14); - case MsgPackType.FIX_STR_0x0F: return bytes.Advance(1).Take(15); - - case MsgPackType.FIX_STR_0x10: return bytes.Advance(1).Take(16); - case MsgPackType.FIX_STR_0x11: return bytes.Advance(1).Take(17); - case MsgPackType.FIX_STR_0x12: return bytes.Advance(1).Take(18); - case MsgPackType.FIX_STR_0x13: return bytes.Advance(1).Take(19); - case MsgPackType.FIX_STR_0x14: return bytes.Advance(1).Take(20); - case MsgPackType.FIX_STR_0x15: return bytes.Advance(1).Take(21); - case MsgPackType.FIX_STR_0x16: return bytes.Advance(1).Take(22); - case MsgPackType.FIX_STR_0x17: return bytes.Advance(1).Take(23); - case MsgPackType.FIX_STR_0x18: return bytes.Advance(1).Take(24); - case MsgPackType.FIX_STR_0x19: return bytes.Advance(1).Take(25); - case MsgPackType.FIX_STR_0x1A: return bytes.Advance(1).Take(26); - case MsgPackType.FIX_STR_0x1B: return bytes.Advance(1).Take(27); - case MsgPackType.FIX_STR_0x1C: return bytes.Advance(1).Take(28); - case MsgPackType.FIX_STR_0x1D: return bytes.Advance(1).Take(29); - case MsgPackType.FIX_STR_0x1E: return bytes.Advance(1).Take(30); - case MsgPackType.FIX_STR_0x1F: return bytes.Advance(1).Take(31); - - case MsgPackType.STR8: - case MsgPackType.BIN8: - { - var count = bytes.Get(1); - return bytes.Advance(1 + 1).Take(count); - } - - case MsgPackType.STR16: - case MsgPackType.BIN16: - { - var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 2).Take(count); - } - - case MsgPackType.STR32: - case MsgPackType.BIN32: - { - var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 4).Take((int)count); - } - - case MsgPackType.NIL: - case MsgPackType.TRUE: - case MsgPackType.FALSE: - case MsgPackType.POSITIVE_FIXNUM: - case MsgPackType.POSITIVE_FIXNUM_0x01: - case MsgPackType.POSITIVE_FIXNUM_0x02: - case MsgPackType.POSITIVE_FIXNUM_0x03: - case MsgPackType.POSITIVE_FIXNUM_0x04: - case MsgPackType.POSITIVE_FIXNUM_0x05: - case MsgPackType.POSITIVE_FIXNUM_0x06: - case MsgPackType.POSITIVE_FIXNUM_0x07: - case MsgPackType.POSITIVE_FIXNUM_0x08: - case MsgPackType.POSITIVE_FIXNUM_0x09: - case MsgPackType.POSITIVE_FIXNUM_0x0A: - case MsgPackType.POSITIVE_FIXNUM_0x0B: - case MsgPackType.POSITIVE_FIXNUM_0x0C: - case MsgPackType.POSITIVE_FIXNUM_0x0D: - case MsgPackType.POSITIVE_FIXNUM_0x0E: - case MsgPackType.POSITIVE_FIXNUM_0x0F: - - case MsgPackType.POSITIVE_FIXNUM_0x10: - case MsgPackType.POSITIVE_FIXNUM_0x11: - case MsgPackType.POSITIVE_FIXNUM_0x12: - case MsgPackType.POSITIVE_FIXNUM_0x13: - case MsgPackType.POSITIVE_FIXNUM_0x14: - case MsgPackType.POSITIVE_FIXNUM_0x15: - case MsgPackType.POSITIVE_FIXNUM_0x16: - case MsgPackType.POSITIVE_FIXNUM_0x17: - case MsgPackType.POSITIVE_FIXNUM_0x18: - case MsgPackType.POSITIVE_FIXNUM_0x19: - case MsgPackType.POSITIVE_FIXNUM_0x1A: - case MsgPackType.POSITIVE_FIXNUM_0x1B: - case MsgPackType.POSITIVE_FIXNUM_0x1C: - case MsgPackType.POSITIVE_FIXNUM_0x1D: - case MsgPackType.POSITIVE_FIXNUM_0x1E: - case MsgPackType.POSITIVE_FIXNUM_0x1F: - - case MsgPackType.POSITIVE_FIXNUM_0x20: - case MsgPackType.POSITIVE_FIXNUM_0x21: - case MsgPackType.POSITIVE_FIXNUM_0x22: - case MsgPackType.POSITIVE_FIXNUM_0x23: - case MsgPackType.POSITIVE_FIXNUM_0x24: - case MsgPackType.POSITIVE_FIXNUM_0x25: - case MsgPackType.POSITIVE_FIXNUM_0x26: - case MsgPackType.POSITIVE_FIXNUM_0x27: - case MsgPackType.POSITIVE_FIXNUM_0x28: - case MsgPackType.POSITIVE_FIXNUM_0x29: - case MsgPackType.POSITIVE_FIXNUM_0x2A: - case MsgPackType.POSITIVE_FIXNUM_0x2B: - case MsgPackType.POSITIVE_FIXNUM_0x2C: - case MsgPackType.POSITIVE_FIXNUM_0x2D: - case MsgPackType.POSITIVE_FIXNUM_0x2E: - case MsgPackType.POSITIVE_FIXNUM_0x2F: - - case MsgPackType.POSITIVE_FIXNUM_0x30: - case MsgPackType.POSITIVE_FIXNUM_0x31: - case MsgPackType.POSITIVE_FIXNUM_0x32: - case MsgPackType.POSITIVE_FIXNUM_0x33: - case MsgPackType.POSITIVE_FIXNUM_0x34: - case MsgPackType.POSITIVE_FIXNUM_0x35: - case MsgPackType.POSITIVE_FIXNUM_0x36: - case MsgPackType.POSITIVE_FIXNUM_0x37: - case MsgPackType.POSITIVE_FIXNUM_0x38: - case MsgPackType.POSITIVE_FIXNUM_0x39: - case MsgPackType.POSITIVE_FIXNUM_0x3A: - case MsgPackType.POSITIVE_FIXNUM_0x3B: - case MsgPackType.POSITIVE_FIXNUM_0x3C: - case MsgPackType.POSITIVE_FIXNUM_0x3D: - case MsgPackType.POSITIVE_FIXNUM_0x3E: - case MsgPackType.POSITIVE_FIXNUM_0x3F: - - case MsgPackType.POSITIVE_FIXNUM_0x40: - case MsgPackType.POSITIVE_FIXNUM_0x41: - case MsgPackType.POSITIVE_FIXNUM_0x42: - case MsgPackType.POSITIVE_FIXNUM_0x43: - case MsgPackType.POSITIVE_FIXNUM_0x44: - case MsgPackType.POSITIVE_FIXNUM_0x45: - case MsgPackType.POSITIVE_FIXNUM_0x46: - case MsgPackType.POSITIVE_FIXNUM_0x47: - case MsgPackType.POSITIVE_FIXNUM_0x48: - case MsgPackType.POSITIVE_FIXNUM_0x49: - case MsgPackType.POSITIVE_FIXNUM_0x4A: - case MsgPackType.POSITIVE_FIXNUM_0x4B: - case MsgPackType.POSITIVE_FIXNUM_0x4C: - case MsgPackType.POSITIVE_FIXNUM_0x4D: - case MsgPackType.POSITIVE_FIXNUM_0x4E: - case MsgPackType.POSITIVE_FIXNUM_0x4F: - - case MsgPackType.POSITIVE_FIXNUM_0x50: - case MsgPackType.POSITIVE_FIXNUM_0x51: - case MsgPackType.POSITIVE_FIXNUM_0x52: - case MsgPackType.POSITIVE_FIXNUM_0x53: - case MsgPackType.POSITIVE_FIXNUM_0x54: - case MsgPackType.POSITIVE_FIXNUM_0x55: - case MsgPackType.POSITIVE_FIXNUM_0x56: - case MsgPackType.POSITIVE_FIXNUM_0x57: - case MsgPackType.POSITIVE_FIXNUM_0x58: - case MsgPackType.POSITIVE_FIXNUM_0x59: - case MsgPackType.POSITIVE_FIXNUM_0x5A: - case MsgPackType.POSITIVE_FIXNUM_0x5B: - case MsgPackType.POSITIVE_FIXNUM_0x5C: - case MsgPackType.POSITIVE_FIXNUM_0x5D: - case MsgPackType.POSITIVE_FIXNUM_0x5E: - case MsgPackType.POSITIVE_FIXNUM_0x5F: - - case MsgPackType.POSITIVE_FIXNUM_0x60: - case MsgPackType.POSITIVE_FIXNUM_0x61: - case MsgPackType.POSITIVE_FIXNUM_0x62: - case MsgPackType.POSITIVE_FIXNUM_0x63: - case MsgPackType.POSITIVE_FIXNUM_0x64: - case MsgPackType.POSITIVE_FIXNUM_0x65: - case MsgPackType.POSITIVE_FIXNUM_0x66: - case MsgPackType.POSITIVE_FIXNUM_0x67: - case MsgPackType.POSITIVE_FIXNUM_0x68: - case MsgPackType.POSITIVE_FIXNUM_0x69: - case MsgPackType.POSITIVE_FIXNUM_0x6A: - case MsgPackType.POSITIVE_FIXNUM_0x6B: - case MsgPackType.POSITIVE_FIXNUM_0x6C: - case MsgPackType.POSITIVE_FIXNUM_0x6D: - case MsgPackType.POSITIVE_FIXNUM_0x6E: - case MsgPackType.POSITIVE_FIXNUM_0x6F: - - case MsgPackType.POSITIVE_FIXNUM_0x70: - case MsgPackType.POSITIVE_FIXNUM_0x71: - case MsgPackType.POSITIVE_FIXNUM_0x72: - case MsgPackType.POSITIVE_FIXNUM_0x73: - case MsgPackType.POSITIVE_FIXNUM_0x74: - case MsgPackType.POSITIVE_FIXNUM_0x75: - case MsgPackType.POSITIVE_FIXNUM_0x76: - case MsgPackType.POSITIVE_FIXNUM_0x77: - case MsgPackType.POSITIVE_FIXNUM_0x78: - case MsgPackType.POSITIVE_FIXNUM_0x79: - case MsgPackType.POSITIVE_FIXNUM_0x7A: - case MsgPackType.POSITIVE_FIXNUM_0x7B: - case MsgPackType.POSITIVE_FIXNUM_0x7C: - case MsgPackType.POSITIVE_FIXNUM_0x7D: - case MsgPackType.POSITIVE_FIXNUM_0x7E: - case MsgPackType.POSITIVE_FIXNUM_0x7F: - - case MsgPackType.NEGATIVE_FIXNUM: - case MsgPackType.NEGATIVE_FIXNUM_0x01: - case MsgPackType.NEGATIVE_FIXNUM_0x02: - case MsgPackType.NEGATIVE_FIXNUM_0x03: - case MsgPackType.NEGATIVE_FIXNUM_0x04: - case MsgPackType.NEGATIVE_FIXNUM_0x05: - case MsgPackType.NEGATIVE_FIXNUM_0x06: - case MsgPackType.NEGATIVE_FIXNUM_0x07: - case MsgPackType.NEGATIVE_FIXNUM_0x08: - case MsgPackType.NEGATIVE_FIXNUM_0x09: - case MsgPackType.NEGATIVE_FIXNUM_0x0A: - case MsgPackType.NEGATIVE_FIXNUM_0x0B: - case MsgPackType.NEGATIVE_FIXNUM_0x0C: - case MsgPackType.NEGATIVE_FIXNUM_0x0D: - case MsgPackType.NEGATIVE_FIXNUM_0x0E: - case MsgPackType.NEGATIVE_FIXNUM_0x0F: - case MsgPackType.NEGATIVE_FIXNUM_0x10: - case MsgPackType.NEGATIVE_FIXNUM_0x11: - case MsgPackType.NEGATIVE_FIXNUM_0x12: - case MsgPackType.NEGATIVE_FIXNUM_0x13: - case MsgPackType.NEGATIVE_FIXNUM_0x14: - case MsgPackType.NEGATIVE_FIXNUM_0x15: - case MsgPackType.NEGATIVE_FIXNUM_0x16: - case MsgPackType.NEGATIVE_FIXNUM_0x17: - case MsgPackType.NEGATIVE_FIXNUM_0x18: - case MsgPackType.NEGATIVE_FIXNUM_0x19: - case MsgPackType.NEGATIVE_FIXNUM_0x1A: - case MsgPackType.NEGATIVE_FIXNUM_0x1B: - case MsgPackType.NEGATIVE_FIXNUM_0x1C: - case MsgPackType.NEGATIVE_FIXNUM_0x1D: - case MsgPackType.NEGATIVE_FIXNUM_0x1E: - case MsgPackType.NEGATIVE_FIXNUM_0x1F: - return bytes.Advance(1).Take(0); - - case MsgPackType.UINT8: - case MsgPackType.INT8: - return bytes.Advance(1).Take(1); - - case MsgPackType.UINT16: - case MsgPackType.INT16: - return bytes.Advance(1).Take(2); - - case MsgPackType.UINT32: - case MsgPackType.INT32: - case MsgPackType.FLOAT: - return bytes.Advance(1).Take(4); - - case MsgPackType.UINT64: - case MsgPackType.INT64: - case MsgPackType.DOUBLE: - return bytes.Advance(1).Take(8); - - case MsgPackType.FIX_EXT_1: - return bytes.Advance(2).Take(1); - case MsgPackType.FIX_EXT_2: - return bytes.Advance(2).Take(2); - case MsgPackType.FIX_EXT_4: - return bytes.Advance(2).Take(4); - case MsgPackType.FIX_EXT_8: - return bytes.Advance(2).Take(8); - case MsgPackType.FIX_EXT_16: - return bytes.Advance(2).Take(16); - case MsgPackType.EXT8: - { - var count = bytes.Get(1); - return bytes.Advance(1 + 1 + 1).Take(count); - } - case MsgPackType.EXT16: - { - var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 2 + 1).Take(count); - } - case MsgPackType.EXT32: - { - var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 4 + 1).Take((int)count); - } - default: - throw new ArgumentException("unknown type: " + formatType); - } - } - - static ListTreeNode _Parse(ListTreeNode tree, ArraySegment bytes) - { - MsgPackType formatType = GetFormat(bytes); - if (formatType.IsArray()) - { - var array = tree.AddValue(bytes, ValueNodeType.Array); - - uint count; - bytes = GetItemCount(bytes, formatType, out count); - for (var i = 0; i < count; ++i) - { - var child = _Parse(array, bytes); - bytes = bytes.Advance(child.Value.Bytes.Count); - } - - array.SetValueBytesCount(bytes.Offset - array.Value.Bytes.Offset); - - return array; - } - else if (formatType.IsMap()) - { - var obj = tree.AddValue(bytes, ValueNodeType.Object); - - uint count; - bytes = GetItemCount(bytes, formatType, out count); - for (var i = 0; i < count; ++i) - { - // key - var key = _Parse(obj, bytes); - bytes = bytes.Advance(key.Value.Bytes.Count); - - // value - var value = _Parse(obj, bytes); - bytes = bytes.Advance(value.Value.Bytes.Count); - } - - obj.SetValueBytesCount(bytes.Offset - obj.Value.Bytes.Offset); - - return obj; - } - else - { - var body = GetBody(bytes, formatType); - var headerSize = body.Offset - bytes.Offset; - var size = headerSize + body.Count; - - var value = tree.AddValue(bytes.Take(size), ValueNodeType.Null); - return value; - } - } - - public static ListTreeNode Parse(ArraySegment bytes) - { - return _Parse(default(ListTreeNode), bytes); - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs.meta deleted file mode 100644 index ba4452ea7..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackParser.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 96621564d26fc294291143738c163a3d -timeCreated: 1540815282 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs deleted file mode 100644 index dd71d3d36..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs +++ /dev/null @@ -1,313 +0,0 @@ -namespace UniJSON -{ - public enum MsgPackType : byte - { - #region POSITIVE_FIXNUM 0x00-0x7F - POSITIVE_FIXNUM = 0x00, - POSITIVE_FIXNUM_0x01 = 0x01, - POSITIVE_FIXNUM_0x02 = 0x02, - POSITIVE_FIXNUM_0x03 = 0x03, - POSITIVE_FIXNUM_0x04 = 0x04, - POSITIVE_FIXNUM_0x05 = 0x05, - POSITIVE_FIXNUM_0x06 = 0x06, - POSITIVE_FIXNUM_0x07 = 0x07, - POSITIVE_FIXNUM_0x08 = 0x08, - POSITIVE_FIXNUM_0x09 = 0x09, - POSITIVE_FIXNUM_0x0A = 0x0A, - POSITIVE_FIXNUM_0x0B = 0x0B, - POSITIVE_FIXNUM_0x0C = 0x0C, - POSITIVE_FIXNUM_0x0D = 0x0D, - POSITIVE_FIXNUM_0x0E = 0x0E, - POSITIVE_FIXNUM_0x0F = 0x0F, - - POSITIVE_FIXNUM_0x10 = 0x10, - POSITIVE_FIXNUM_0x11 = 0x11, - POSITIVE_FIXNUM_0x12 = 0x12, - POSITIVE_FIXNUM_0x13 = 0x13, - POSITIVE_FIXNUM_0x14 = 0x14, - POSITIVE_FIXNUM_0x15 = 0x15, - POSITIVE_FIXNUM_0x16 = 0x16, - POSITIVE_FIXNUM_0x17 = 0x17, - POSITIVE_FIXNUM_0x18 = 0x18, - POSITIVE_FIXNUM_0x19 = 0x19, - POSITIVE_FIXNUM_0x1A = 0x1A, - POSITIVE_FIXNUM_0x1B = 0x1B, - POSITIVE_FIXNUM_0x1C = 0x1C, - POSITIVE_FIXNUM_0x1D = 0x1D, - POSITIVE_FIXNUM_0x1E = 0x1E, - POSITIVE_FIXNUM_0x1F = 0x1F, - - POSITIVE_FIXNUM_0x20 = 0x20, - POSITIVE_FIXNUM_0x21 = 0x21, - POSITIVE_FIXNUM_0x22 = 0x22, - POSITIVE_FIXNUM_0x23 = 0x23, - POSITIVE_FIXNUM_0x24 = 0x24, - POSITIVE_FIXNUM_0x25 = 0x25, - POSITIVE_FIXNUM_0x26 = 0x26, - POSITIVE_FIXNUM_0x27 = 0x27, - POSITIVE_FIXNUM_0x28 = 0x28, - POSITIVE_FIXNUM_0x29 = 0x29, - POSITIVE_FIXNUM_0x2A = 0x2A, - POSITIVE_FIXNUM_0x2B = 0x2B, - POSITIVE_FIXNUM_0x2C = 0x2C, - POSITIVE_FIXNUM_0x2D = 0x2D, - POSITIVE_FIXNUM_0x2E = 0x2E, - POSITIVE_FIXNUM_0x2F = 0x2F, - - POSITIVE_FIXNUM_0x30 = 0x30, - POSITIVE_FIXNUM_0x31 = 0x31, - POSITIVE_FIXNUM_0x32 = 0x32, - POSITIVE_FIXNUM_0x33 = 0x33, - POSITIVE_FIXNUM_0x34 = 0x34, - POSITIVE_FIXNUM_0x35 = 0x35, - POSITIVE_FIXNUM_0x36 = 0x36, - POSITIVE_FIXNUM_0x37 = 0x37, - POSITIVE_FIXNUM_0x38 = 0x38, - POSITIVE_FIXNUM_0x39 = 0x39, - POSITIVE_FIXNUM_0x3A = 0x3A, - POSITIVE_FIXNUM_0x3B = 0x3B, - POSITIVE_FIXNUM_0x3C = 0x3C, - POSITIVE_FIXNUM_0x3D = 0x3D, - POSITIVE_FIXNUM_0x3E = 0x3E, - POSITIVE_FIXNUM_0x3F = 0x3F, - - POSITIVE_FIXNUM_0x40 = 0x40, - POSITIVE_FIXNUM_0x41 = 0x41, - POSITIVE_FIXNUM_0x42 = 0x42, - POSITIVE_FIXNUM_0x43 = 0x43, - POSITIVE_FIXNUM_0x44 = 0x44, - POSITIVE_FIXNUM_0x45 = 0x45, - POSITIVE_FIXNUM_0x46 = 0x46, - POSITIVE_FIXNUM_0x47 = 0x47, - POSITIVE_FIXNUM_0x48 = 0x48, - POSITIVE_FIXNUM_0x49 = 0x49, - POSITIVE_FIXNUM_0x4A = 0x4A, - POSITIVE_FIXNUM_0x4B = 0x4B, - POSITIVE_FIXNUM_0x4C = 0x4C, - POSITIVE_FIXNUM_0x4D = 0x4D, - POSITIVE_FIXNUM_0x4E = 0x4E, - POSITIVE_FIXNUM_0x4F = 0x4F, - - POSITIVE_FIXNUM_0x50 = 0x50, - POSITIVE_FIXNUM_0x51 = 0x51, - POSITIVE_FIXNUM_0x52 = 0x52, - POSITIVE_FIXNUM_0x53 = 0x53, - POSITIVE_FIXNUM_0x54 = 0x54, - POSITIVE_FIXNUM_0x55 = 0x55, - POSITIVE_FIXNUM_0x56 = 0x56, - POSITIVE_FIXNUM_0x57 = 0x57, - POSITIVE_FIXNUM_0x58 = 0x58, - POSITIVE_FIXNUM_0x59 = 0x59, - POSITIVE_FIXNUM_0x5A = 0x5A, - POSITIVE_FIXNUM_0x5B = 0x5B, - POSITIVE_FIXNUM_0x5C = 0x5C, - POSITIVE_FIXNUM_0x5D = 0x5D, - POSITIVE_FIXNUM_0x5E = 0x5E, - POSITIVE_FIXNUM_0x5F = 0x5F, - - POSITIVE_FIXNUM_0x60 = 0x60, - POSITIVE_FIXNUM_0x61 = 0x61, - POSITIVE_FIXNUM_0x62 = 0x62, - POSITIVE_FIXNUM_0x63 = 0x63, - POSITIVE_FIXNUM_0x64 = 0x64, - POSITIVE_FIXNUM_0x65 = 0x65, - POSITIVE_FIXNUM_0x66 = 0x66, - POSITIVE_FIXNUM_0x67 = 0x67, - POSITIVE_FIXNUM_0x68 = 0x68, - POSITIVE_FIXNUM_0x69 = 0x69, - POSITIVE_FIXNUM_0x6A = 0x6A, - POSITIVE_FIXNUM_0x6B = 0x6B, - POSITIVE_FIXNUM_0x6C = 0x6C, - POSITIVE_FIXNUM_0x6D = 0x6D, - POSITIVE_FIXNUM_0x6E = 0x6E, - POSITIVE_FIXNUM_0x6F = 0x6F, - - POSITIVE_FIXNUM_0x70 = 0x70, - POSITIVE_FIXNUM_0x71 = 0x71, - POSITIVE_FIXNUM_0x72 = 0x72, - POSITIVE_FIXNUM_0x73 = 0x73, - POSITIVE_FIXNUM_0x74 = 0x74, - POSITIVE_FIXNUM_0x75 = 0x75, - POSITIVE_FIXNUM_0x76 = 0x76, - POSITIVE_FIXNUM_0x77 = 0x77, - POSITIVE_FIXNUM_0x78 = 0x78, - POSITIVE_FIXNUM_0x79 = 0x79, - POSITIVE_FIXNUM_0x7A = 0x7A, - POSITIVE_FIXNUM_0x7B = 0x7B, - POSITIVE_FIXNUM_0x7C = 0x7C, - POSITIVE_FIXNUM_0x7D = 0x7D, - POSITIVE_FIXNUM_0x7E = 0x7E, - POSITIVE_FIXNUM_0x7F = 0x7F, - #endregion - - #region FIX_MAP 0x80-0x8F - FIX_MAP = 0x80, - FIX_MAP_0x1 = 0x81, - FIX_MAP_0x2 = 0x82, - FIX_MAP_0x3 = 0x83, - FIX_MAP_0x4 = 0x84, - FIX_MAP_0x5 = 0x85, - FIX_MAP_0x6 = 0x86, - FIX_MAP_0x7 = 0x87, - FIX_MAP_0x8 = 0x88, - FIX_MAP_0x9 = 0x89, - FIX_MAP_0xA = 0x8A, - FIX_MAP_0xB = 0x8B, - FIX_MAP_0xC = 0x8C, - FIX_MAP_0xD = 0x8D, - FIX_MAP_0xE = 0x8E, - FIX_MAP_0xF = 0x8F, - #endregion - - #region FIX_ARRAY 0x90-0x9F - FIX_ARRAY = 0x90, - FIX_ARRAY_0x1 = 0x91, - FIX_ARRAY_0x2 = 0x92, - FIX_ARRAY_0x3 = 0x93, - FIX_ARRAY_0x4 = 0x94, - FIX_ARRAY_0x5 = 0x95, - FIX_ARRAY_0x6 = 0x96, - FIX_ARRAY_0x7 = 0x97, - FIX_ARRAY_0x8 = 0x98, - FIX_ARRAY_0x9 = 0x99, - FIX_ARRAY_0xA = 0x9A, - FIX_ARRAY_0xB = 0x9B, - FIX_ARRAY_0xC = 0x9C, - FIX_ARRAY_0xD = 0x9D, - FIX_ARRAY_0xE = 0x9E, - FIX_ARRAY_0xF = 0x9F, - #endregion - - #region FIX_STR 0xA0-0xBF - FIX_STR = 0xA0, - FIX_STR_0x01 = 0xA1, - FIX_STR_0x02 = 0xA2, - FIX_STR_0x03 = 0xA3, - FIX_STR_0x04 = 0xA4, - FIX_STR_0x05 = 0xA5, - FIX_STR_0x06 = 0xA6, - FIX_STR_0x07 = 0xA7, - FIX_STR_0x08 = 0xA8, - FIX_STR_0x09 = 0xA9, - FIX_STR_0x0A = 0xAA, - FIX_STR_0x0B = 0xAB, - FIX_STR_0x0C = 0xAC, - FIX_STR_0x0D = 0xAD, - FIX_STR_0x0E = 0xAE, - FIX_STR_0x0F = 0xAF, - FIX_STR_0x10 = 0xB0, - FIX_STR_0x11 = 0xB1, - FIX_STR_0x12 = 0xB2, - FIX_STR_0x13 = 0xB3, - FIX_STR_0x14 = 0xB4, - FIX_STR_0x15 = 0xB5, - FIX_STR_0x16 = 0xB6, - FIX_STR_0x17 = 0xB7, - FIX_STR_0x18 = 0xB8, - FIX_STR_0x19 = 0xB9, - FIX_STR_0x1A = 0xBA, - FIX_STR_0x1B = 0xBB, - FIX_STR_0x1C = 0xBC, - FIX_STR_0x1D = 0xBD, - FIX_STR_0x1E = 0xBE, - FIX_STR_0x1F = 0xBF, - #endregion - - NIL = 0xC0, - NEVER_USED = 0xC1, - FALSE = 0xC2, - TRUE = 0xC3, - - BIN8 = 0xC4, - BIN16 = 0xC5, - BIN32 = 0xC6, - - EXT8 = 0xC7, - EXT16 = 0xC8, - EXT32 = 0xC9, - - FLOAT = 0xCA, - DOUBLE = 0xCB, - UINT8 = 0xCC, - UINT16 = 0xCD, - UINT32 = 0xCE, - UINT64 = 0xCF, - INT8 = 0xD0, - INT16 = 0xD1, - INT32 = 0xD2, - INT64 = 0xD3, - - FIX_EXT_1 = 0xD4, - FIX_EXT_2 = 0xD5, - FIX_EXT_4 = 0xD6, - FIX_EXT_8 = 0xD7, - FIX_EXT_16 = 0xD8, - - STR8 = 0xD9, - STR16 = 0xDA, - STR32 = 0xDB, - - ARRAY16 = 0xDC, - ARRAY32 = 0xDD, - MAP16 = 0xDE, - MAP32 = 0xDF, - - #region NEGATIVE_FIXNUM 0xE0-0xFF - NEGATIVE_FIXNUM = 0xE0, // 1110 0000 = -32 - NEGATIVE_FIXNUM_0x1F = 0xE1, // -31 - NEGATIVE_FIXNUM_0x1E = 0xE2, - NEGATIVE_FIXNUM_0x1D = 0xE3, - NEGATIVE_FIXNUM_0x1C = 0xE4, - NEGATIVE_FIXNUM_0x1B = 0xE5, - NEGATIVE_FIXNUM_0x1A = 0xE6, - NEGATIVE_FIXNUM_0x19 = 0xE7, - NEGATIVE_FIXNUM_0x18 = 0xE8, - NEGATIVE_FIXNUM_0x17 = 0xE9, - NEGATIVE_FIXNUM_0x16 = 0xEA, - NEGATIVE_FIXNUM_0x15 = 0xEB, - NEGATIVE_FIXNUM_0x14 = 0xEC, - NEGATIVE_FIXNUM_0x13 = 0xED, - NEGATIVE_FIXNUM_0x12 = 0xEE, - NEGATIVE_FIXNUM_0x11 = 0xEF, - NEGATIVE_FIXNUM_0x10 = 0xF0, - NEGATIVE_FIXNUM_0x0F = 0xF1, - NEGATIVE_FIXNUM_0x0E = 0xF2, - NEGATIVE_FIXNUM_0x0D = 0xF3, - NEGATIVE_FIXNUM_0x0C = 0xF4, - NEGATIVE_FIXNUM_0x0B = 0xF5, - NEGATIVE_FIXNUM_0x0A = 0xF6, - NEGATIVE_FIXNUM_0x09 = 0xF7, - NEGATIVE_FIXNUM_0x08 = 0xF8, - NEGATIVE_FIXNUM_0x07 = 0xF9, - NEGATIVE_FIXNUM_0x06 = 0xFA, - NEGATIVE_FIXNUM_0x05 = 0xFB, - NEGATIVE_FIXNUM_0x04 = 0xFC, - NEGATIVE_FIXNUM_0x03 = 0xFD, - NEGATIVE_FIXNUM_0x02 = 0xFE, - NEGATIVE_FIXNUM_0x01 = 0xFF, // -1 - #endregion - } - - public enum ExtType : byte - { - UNKNOWN = 0x00, - - UINT16_BE = 0x01, - UINT32_BE = 0x02, - UINT64_BE = 0x03, - INT16_BE = 0x04, - INT32_BE = 0x05, - INT64_BE = 0x06, - SINGLE_BE = 0x07, - DOUBLE_BE = 0x08, - - UINT16_LE = 0x09, - UINT32_LE = 0x0A, - UINT64_LE = 0x0B, - INT16_LE = 0x0C, - INT32_LE = 0x0D, - INT64_LE = 0x0E, - SINGLE_LE = 0x0F, - DOUBLE_LE = 0x10, - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs.meta deleted file mode 100644 index 702f717e8..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackType.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4c6d91a562e590e438f0baa988389d61 -timeCreated: 1540814648 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs deleted file mode 100644 index a81026a47..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs +++ /dev/null @@ -1,341 +0,0 @@ -namespace UniJSON -{ - public static class MsgPackTypeExtensions - { - public static bool IsArray(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FIX_ARRAY: - case MsgPackType.FIX_ARRAY_0x1: - case MsgPackType.FIX_ARRAY_0x2: - case MsgPackType.FIX_ARRAY_0x3: - case MsgPackType.FIX_ARRAY_0x4: - case MsgPackType.FIX_ARRAY_0x5: - case MsgPackType.FIX_ARRAY_0x6: - case MsgPackType.FIX_ARRAY_0x7: - case MsgPackType.FIX_ARRAY_0x8: - case MsgPackType.FIX_ARRAY_0x9: - case MsgPackType.FIX_ARRAY_0xA: - case MsgPackType.FIX_ARRAY_0xB: - case MsgPackType.FIX_ARRAY_0xC: - case MsgPackType.FIX_ARRAY_0xD: - case MsgPackType.FIX_ARRAY_0xE: - case MsgPackType.FIX_ARRAY_0xF: - case MsgPackType.ARRAY16: - case MsgPackType.ARRAY32: - return true; - - default: - return false; - } - } - - public static bool IsMap(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FIX_MAP: - case MsgPackType.FIX_MAP_0x1: - case MsgPackType.FIX_MAP_0x2: - case MsgPackType.FIX_MAP_0x3: - case MsgPackType.FIX_MAP_0x4: - case MsgPackType.FIX_MAP_0x5: - case MsgPackType.FIX_MAP_0x6: - case MsgPackType.FIX_MAP_0x7: - case MsgPackType.FIX_MAP_0x8: - case MsgPackType.FIX_MAP_0x9: - case MsgPackType.FIX_MAP_0xA: - case MsgPackType.FIX_MAP_0xB: - case MsgPackType.FIX_MAP_0xC: - case MsgPackType.FIX_MAP_0xD: - case MsgPackType.FIX_MAP_0xE: - case MsgPackType.FIX_MAP_0xF: - case MsgPackType.MAP16: - case MsgPackType.MAP32: - return true; - - default: - return false; - } - } - - public static bool IsInteger(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.POSITIVE_FIXNUM: - case MsgPackType.POSITIVE_FIXNUM_0x01: - case MsgPackType.POSITIVE_FIXNUM_0x02: - case MsgPackType.POSITIVE_FIXNUM_0x03: - case MsgPackType.POSITIVE_FIXNUM_0x04: - case MsgPackType.POSITIVE_FIXNUM_0x05: - case MsgPackType.POSITIVE_FIXNUM_0x06: - case MsgPackType.POSITIVE_FIXNUM_0x07: - case MsgPackType.POSITIVE_FIXNUM_0x08: - case MsgPackType.POSITIVE_FIXNUM_0x09: - case MsgPackType.POSITIVE_FIXNUM_0x0A: - case MsgPackType.POSITIVE_FIXNUM_0x0B: - case MsgPackType.POSITIVE_FIXNUM_0x0C: - case MsgPackType.POSITIVE_FIXNUM_0x0D: - case MsgPackType.POSITIVE_FIXNUM_0x0E: - case MsgPackType.POSITIVE_FIXNUM_0x0F: - - case MsgPackType.POSITIVE_FIXNUM_0x10: - case MsgPackType.POSITIVE_FIXNUM_0x11: - case MsgPackType.POSITIVE_FIXNUM_0x12: - case MsgPackType.POSITIVE_FIXNUM_0x13: - case MsgPackType.POSITIVE_FIXNUM_0x14: - case MsgPackType.POSITIVE_FIXNUM_0x15: - case MsgPackType.POSITIVE_FIXNUM_0x16: - case MsgPackType.POSITIVE_FIXNUM_0x17: - case MsgPackType.POSITIVE_FIXNUM_0x18: - case MsgPackType.POSITIVE_FIXNUM_0x19: - case MsgPackType.POSITIVE_FIXNUM_0x1A: - case MsgPackType.POSITIVE_FIXNUM_0x1B: - case MsgPackType.POSITIVE_FIXNUM_0x1C: - case MsgPackType.POSITIVE_FIXNUM_0x1D: - case MsgPackType.POSITIVE_FIXNUM_0x1E: - case MsgPackType.POSITIVE_FIXNUM_0x1F: - - case MsgPackType.POSITIVE_FIXNUM_0x20: - case MsgPackType.POSITIVE_FIXNUM_0x21: - case MsgPackType.POSITIVE_FIXNUM_0x22: - case MsgPackType.POSITIVE_FIXNUM_0x23: - case MsgPackType.POSITIVE_FIXNUM_0x24: - case MsgPackType.POSITIVE_FIXNUM_0x25: - case MsgPackType.POSITIVE_FIXNUM_0x26: - case MsgPackType.POSITIVE_FIXNUM_0x27: - case MsgPackType.POSITIVE_FIXNUM_0x28: - case MsgPackType.POSITIVE_FIXNUM_0x29: - case MsgPackType.POSITIVE_FIXNUM_0x2A: - case MsgPackType.POSITIVE_FIXNUM_0x2B: - case MsgPackType.POSITIVE_FIXNUM_0x2C: - case MsgPackType.POSITIVE_FIXNUM_0x2D: - case MsgPackType.POSITIVE_FIXNUM_0x2E: - case MsgPackType.POSITIVE_FIXNUM_0x2F: - - case MsgPackType.POSITIVE_FIXNUM_0x30: - case MsgPackType.POSITIVE_FIXNUM_0x31: - case MsgPackType.POSITIVE_FIXNUM_0x32: - case MsgPackType.POSITIVE_FIXNUM_0x33: - case MsgPackType.POSITIVE_FIXNUM_0x34: - case MsgPackType.POSITIVE_FIXNUM_0x35: - case MsgPackType.POSITIVE_FIXNUM_0x36: - case MsgPackType.POSITIVE_FIXNUM_0x37: - case MsgPackType.POSITIVE_FIXNUM_0x38: - case MsgPackType.POSITIVE_FIXNUM_0x39: - case MsgPackType.POSITIVE_FIXNUM_0x3A: - case MsgPackType.POSITIVE_FIXNUM_0x3B: - case MsgPackType.POSITIVE_FIXNUM_0x3C: - case MsgPackType.POSITIVE_FIXNUM_0x3D: - case MsgPackType.POSITIVE_FIXNUM_0x3E: - case MsgPackType.POSITIVE_FIXNUM_0x3F: - - case MsgPackType.POSITIVE_FIXNUM_0x40: - case MsgPackType.POSITIVE_FIXNUM_0x41: - case MsgPackType.POSITIVE_FIXNUM_0x42: - case MsgPackType.POSITIVE_FIXNUM_0x43: - case MsgPackType.POSITIVE_FIXNUM_0x44: - case MsgPackType.POSITIVE_FIXNUM_0x45: - case MsgPackType.POSITIVE_FIXNUM_0x46: - case MsgPackType.POSITIVE_FIXNUM_0x47: - case MsgPackType.POSITIVE_FIXNUM_0x48: - case MsgPackType.POSITIVE_FIXNUM_0x49: - case MsgPackType.POSITIVE_FIXNUM_0x4A: - case MsgPackType.POSITIVE_FIXNUM_0x4B: - case MsgPackType.POSITIVE_FIXNUM_0x4C: - case MsgPackType.POSITIVE_FIXNUM_0x4D: - case MsgPackType.POSITIVE_FIXNUM_0x4E: - case MsgPackType.POSITIVE_FIXNUM_0x4F: - - case MsgPackType.POSITIVE_FIXNUM_0x50: - case MsgPackType.POSITIVE_FIXNUM_0x51: - case MsgPackType.POSITIVE_FIXNUM_0x52: - case MsgPackType.POSITIVE_FIXNUM_0x53: - case MsgPackType.POSITIVE_FIXNUM_0x54: - case MsgPackType.POSITIVE_FIXNUM_0x55: - case MsgPackType.POSITIVE_FIXNUM_0x56: - case MsgPackType.POSITIVE_FIXNUM_0x57: - case MsgPackType.POSITIVE_FIXNUM_0x58: - case MsgPackType.POSITIVE_FIXNUM_0x59: - case MsgPackType.POSITIVE_FIXNUM_0x5A: - case MsgPackType.POSITIVE_FIXNUM_0x5B: - case MsgPackType.POSITIVE_FIXNUM_0x5C: - case MsgPackType.POSITIVE_FIXNUM_0x5D: - case MsgPackType.POSITIVE_FIXNUM_0x5E: - case MsgPackType.POSITIVE_FIXNUM_0x5F: - - case MsgPackType.POSITIVE_FIXNUM_0x60: - case MsgPackType.POSITIVE_FIXNUM_0x61: - case MsgPackType.POSITIVE_FIXNUM_0x62: - case MsgPackType.POSITIVE_FIXNUM_0x63: - case MsgPackType.POSITIVE_FIXNUM_0x64: - case MsgPackType.POSITIVE_FIXNUM_0x65: - case MsgPackType.POSITIVE_FIXNUM_0x66: - case MsgPackType.POSITIVE_FIXNUM_0x67: - case MsgPackType.POSITIVE_FIXNUM_0x68: - case MsgPackType.POSITIVE_FIXNUM_0x69: - case MsgPackType.POSITIVE_FIXNUM_0x6A: - case MsgPackType.POSITIVE_FIXNUM_0x6B: - case MsgPackType.POSITIVE_FIXNUM_0x6C: - case MsgPackType.POSITIVE_FIXNUM_0x6D: - case MsgPackType.POSITIVE_FIXNUM_0x6E: - case MsgPackType.POSITIVE_FIXNUM_0x6F: - - case MsgPackType.POSITIVE_FIXNUM_0x70: - case MsgPackType.POSITIVE_FIXNUM_0x71: - case MsgPackType.POSITIVE_FIXNUM_0x72: - case MsgPackType.POSITIVE_FIXNUM_0x73: - case MsgPackType.POSITIVE_FIXNUM_0x74: - case MsgPackType.POSITIVE_FIXNUM_0x75: - case MsgPackType.POSITIVE_FIXNUM_0x76: - case MsgPackType.POSITIVE_FIXNUM_0x77: - case MsgPackType.POSITIVE_FIXNUM_0x78: - case MsgPackType.POSITIVE_FIXNUM_0x79: - case MsgPackType.POSITIVE_FIXNUM_0x7A: - case MsgPackType.POSITIVE_FIXNUM_0x7B: - case MsgPackType.POSITIVE_FIXNUM_0x7C: - case MsgPackType.POSITIVE_FIXNUM_0x7D: - case MsgPackType.POSITIVE_FIXNUM_0x7E: - case MsgPackType.POSITIVE_FIXNUM_0x7F: - - case MsgPackType.NEGATIVE_FIXNUM: - case MsgPackType.NEGATIVE_FIXNUM_0x01: - case MsgPackType.NEGATIVE_FIXNUM_0x02: - case MsgPackType.NEGATIVE_FIXNUM_0x03: - case MsgPackType.NEGATIVE_FIXNUM_0x04: - case MsgPackType.NEGATIVE_FIXNUM_0x05: - case MsgPackType.NEGATIVE_FIXNUM_0x06: - case MsgPackType.NEGATIVE_FIXNUM_0x07: - case MsgPackType.NEGATIVE_FIXNUM_0x08: - case MsgPackType.NEGATIVE_FIXNUM_0x09: - case MsgPackType.NEGATIVE_FIXNUM_0x0A: - case MsgPackType.NEGATIVE_FIXNUM_0x0B: - case MsgPackType.NEGATIVE_FIXNUM_0x0C: - case MsgPackType.NEGATIVE_FIXNUM_0x0D: - case MsgPackType.NEGATIVE_FIXNUM_0x0E: - case MsgPackType.NEGATIVE_FIXNUM_0x0F: - case MsgPackType.NEGATIVE_FIXNUM_0x10: - case MsgPackType.NEGATIVE_FIXNUM_0x11: - case MsgPackType.NEGATIVE_FIXNUM_0x12: - case MsgPackType.NEGATIVE_FIXNUM_0x13: - case MsgPackType.NEGATIVE_FIXNUM_0x14: - case MsgPackType.NEGATIVE_FIXNUM_0x15: - case MsgPackType.NEGATIVE_FIXNUM_0x16: - case MsgPackType.NEGATIVE_FIXNUM_0x17: - case MsgPackType.NEGATIVE_FIXNUM_0x18: - case MsgPackType.NEGATIVE_FIXNUM_0x19: - case MsgPackType.NEGATIVE_FIXNUM_0x1A: - case MsgPackType.NEGATIVE_FIXNUM_0x1B: - case MsgPackType.NEGATIVE_FIXNUM_0x1C: - case MsgPackType.NEGATIVE_FIXNUM_0x1D: - case MsgPackType.NEGATIVE_FIXNUM_0x1E: - case MsgPackType.NEGATIVE_FIXNUM_0x1F: - - case MsgPackType.INT8: - case MsgPackType.INT16: - case MsgPackType.INT32: - case MsgPackType.INT64: - case MsgPackType.UINT8: - case MsgPackType.UINT16: - case MsgPackType.UINT32: - case MsgPackType.UINT64: - return true; - - default: - return false; - } - } - - public static bool IsFloat(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FLOAT: - case MsgPackType.DOUBLE: - return true; - - default: - return false; - } - } - - public static bool IsString(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FIX_STR: - case MsgPackType.FIX_STR_0x01: - case MsgPackType.FIX_STR_0x02: - case MsgPackType.FIX_STR_0x03: - case MsgPackType.FIX_STR_0x04: - case MsgPackType.FIX_STR_0x05: - case MsgPackType.FIX_STR_0x06: - case MsgPackType.FIX_STR_0x07: - case MsgPackType.FIX_STR_0x08: - case MsgPackType.FIX_STR_0x09: - case MsgPackType.FIX_STR_0x0A: - case MsgPackType.FIX_STR_0x0B: - case MsgPackType.FIX_STR_0x0C: - case MsgPackType.FIX_STR_0x0D: - case MsgPackType.FIX_STR_0x0E: - case MsgPackType.FIX_STR_0x0F: - case MsgPackType.FIX_STR_0x10: - case MsgPackType.FIX_STR_0x11: - case MsgPackType.FIX_STR_0x12: - case MsgPackType.FIX_STR_0x13: - case MsgPackType.FIX_STR_0x14: - case MsgPackType.FIX_STR_0x15: - case MsgPackType.FIX_STR_0x16: - case MsgPackType.FIX_STR_0x17: - case MsgPackType.FIX_STR_0x18: - case MsgPackType.FIX_STR_0x19: - case MsgPackType.FIX_STR_0x1A: - case MsgPackType.FIX_STR_0x1B: - case MsgPackType.FIX_STR_0x1C: - case MsgPackType.FIX_STR_0x1D: - case MsgPackType.FIX_STR_0x1E: - case MsgPackType.FIX_STR_0x1F: - case MsgPackType.STR8: - case MsgPackType.STR16: - case MsgPackType.STR32: - return true; - } - return false; - } - - public static bool IsExt(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.FIX_EXT_1: - case MsgPackType.FIX_EXT_2: - case MsgPackType.FIX_EXT_4: - case MsgPackType.FIX_EXT_8: - case MsgPackType.FIX_EXT_16: - case MsgPackType.EXT8: - case MsgPackType.EXT16: - case MsgPackType.EXT32: - return true; - - default: - return false; - } - } - - public static bool IsBinary(this MsgPackType formatType) - { - switch (formatType) - { - case MsgPackType.BIN8: - case MsgPackType.BIN16: - case MsgPackType.BIN32: - return true; - - default: - return false; - } - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs.meta deleted file mode 100644 index 4c4ef420a..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackTypeExtensions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6e803181a063cd940b8272f45497b506 -timeCreated: 1540898737 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs deleted file mode 100644 index 77c43f296..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs +++ /dev/null @@ -1,767 +0,0 @@ -using System; -using System.Text; - -namespace UniJSON -{ - public struct MsgPackValue: IListTreeItem, IValue - { - public int ParentIndex - { - get; - private set; - } - - public ArraySegment Bytes - { - get; - private set; - } - public void SetBytesCount(int count) - { - Bytes = new ArraySegment(Bytes.Array, Bytes.Offset, count); - } - - public MsgPackType Format - { - get - { - return (MsgPackType)Bytes.Get(0); - } - } - - public ValueNodeType ValueType - { - get - { - switch (Format) - { - case MsgPackType.NIL: - return ValueNodeType.Null; - - case MsgPackType.TRUE: - case MsgPackType.FALSE: - return ValueNodeType.Boolean; - - default: - if (Format.IsArray()) - { - return ValueNodeType.Array; - } - else if (Format.IsMap()) - { - return ValueNodeType.Object; - } - else if (Format.IsInteger()) - { - return ValueNodeType.Integer; - } - else if (Format.IsFloat()) - { - return ValueNodeType.Number; - } - else if (Format.IsString()) - { - return ValueNodeType.String; - } - else if (Format.IsBinary()) - { - return ValueNodeType.Binary; - } - else - { - throw new NotImplementedException(); - } - } - } - } - - int _childCount; - public int ChildCount - { - get { return _childCount; } - } - public void SetChildCount(int count) - { - _childCount = count; - } - - public MsgPackValue(ArraySegment segment, int parentIndex) : this() - { - Bytes = segment; - ParentIndex = parentIndex; - } - - public MsgPackValue New(ArraySegment bytes, ValueNodeType valueType, int parentIndex) - { - return new MsgPackValue(bytes, parentIndex); - } - - public MsgPackValue Key(Utf8String key, int parentIndex) - { - throw new NotImplementedException(); - } - - /// - /// ArrayとMap以外のタイプのペイロードを得る - /// - /// - public ArraySegment GetBody() - { - var bytes = Bytes; - var formatType = Format; - switch (formatType) - { - case MsgPackType.FIX_STR: return bytes.Advance(1).Take(0); - case MsgPackType.FIX_STR_0x01: return bytes.Advance(1).Take(1); - case MsgPackType.FIX_STR_0x02: return bytes.Advance(1).Take(2); - case MsgPackType.FIX_STR_0x03: return bytes.Advance(1).Take(3); - case MsgPackType.FIX_STR_0x04: return bytes.Advance(1).Take(4); - case MsgPackType.FIX_STR_0x05: return bytes.Advance(1).Take(5); - case MsgPackType.FIX_STR_0x06: return bytes.Advance(1).Take(6); - case MsgPackType.FIX_STR_0x07: return bytes.Advance(1).Take(7); - case MsgPackType.FIX_STR_0x08: return bytes.Advance(1).Take(8); - case MsgPackType.FIX_STR_0x09: return bytes.Advance(1).Take(9); - case MsgPackType.FIX_STR_0x0A: return bytes.Advance(1).Take(10); - case MsgPackType.FIX_STR_0x0B: return bytes.Advance(1).Take(11); - case MsgPackType.FIX_STR_0x0C: return bytes.Advance(1).Take(12); - case MsgPackType.FIX_STR_0x0D: return bytes.Advance(1).Take(13); - case MsgPackType.FIX_STR_0x0E: return bytes.Advance(1).Take(14); - case MsgPackType.FIX_STR_0x0F: return bytes.Advance(1).Take(15); - - case MsgPackType.FIX_STR_0x10: return bytes.Advance(1).Take(16); - case MsgPackType.FIX_STR_0x11: return bytes.Advance(1).Take(17); - case MsgPackType.FIX_STR_0x12: return bytes.Advance(1).Take(18); - case MsgPackType.FIX_STR_0x13: return bytes.Advance(1).Take(19); - case MsgPackType.FIX_STR_0x14: return bytes.Advance(1).Take(20); - case MsgPackType.FIX_STR_0x15: return bytes.Advance(1).Take(21); - case MsgPackType.FIX_STR_0x16: return bytes.Advance(1).Take(22); - case MsgPackType.FIX_STR_0x17: return bytes.Advance(1).Take(23); - case MsgPackType.FIX_STR_0x18: return bytes.Advance(1).Take(24); - case MsgPackType.FIX_STR_0x19: return bytes.Advance(1).Take(25); - case MsgPackType.FIX_STR_0x1A: return bytes.Advance(1).Take(26); - case MsgPackType.FIX_STR_0x1B: return bytes.Advance(1).Take(27); - case MsgPackType.FIX_STR_0x1C: return bytes.Advance(1).Take(28); - case MsgPackType.FIX_STR_0x1D: return bytes.Advance(1).Take(29); - case MsgPackType.FIX_STR_0x1E: return bytes.Advance(1).Take(30); - case MsgPackType.FIX_STR_0x1F: return bytes.Advance(1).Take(31); - - case MsgPackType.STR8: - case MsgPackType.BIN8: - { - var count = bytes.Get(1); - return bytes.Advance(1 + 1).Take(count); - } - - case MsgPackType.STR16: - case MsgPackType.BIN16: - { - var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 2).Take(count); - } - - case MsgPackType.STR32: - case MsgPackType.BIN32: - { - var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 4).Take((int)count); - } - - case MsgPackType.NIL: - case MsgPackType.TRUE: - case MsgPackType.FALSE: - case MsgPackType.POSITIVE_FIXNUM: - case MsgPackType.POSITIVE_FIXNUM_0x01: - case MsgPackType.POSITIVE_FIXNUM_0x02: - case MsgPackType.POSITIVE_FIXNUM_0x03: - case MsgPackType.POSITIVE_FIXNUM_0x04: - case MsgPackType.POSITIVE_FIXNUM_0x05: - case MsgPackType.POSITIVE_FIXNUM_0x06: - case MsgPackType.POSITIVE_FIXNUM_0x07: - case MsgPackType.POSITIVE_FIXNUM_0x08: - case MsgPackType.POSITIVE_FIXNUM_0x09: - case MsgPackType.POSITIVE_FIXNUM_0x0A: - case MsgPackType.POSITIVE_FIXNUM_0x0B: - case MsgPackType.POSITIVE_FIXNUM_0x0C: - case MsgPackType.POSITIVE_FIXNUM_0x0D: - case MsgPackType.POSITIVE_FIXNUM_0x0E: - case MsgPackType.POSITIVE_FIXNUM_0x0F: - - case MsgPackType.POSITIVE_FIXNUM_0x10: - case MsgPackType.POSITIVE_FIXNUM_0x11: - case MsgPackType.POSITIVE_FIXNUM_0x12: - case MsgPackType.POSITIVE_FIXNUM_0x13: - case MsgPackType.POSITIVE_FIXNUM_0x14: - case MsgPackType.POSITIVE_FIXNUM_0x15: - case MsgPackType.POSITIVE_FIXNUM_0x16: - case MsgPackType.POSITIVE_FIXNUM_0x17: - case MsgPackType.POSITIVE_FIXNUM_0x18: - case MsgPackType.POSITIVE_FIXNUM_0x19: - case MsgPackType.POSITIVE_FIXNUM_0x1A: - case MsgPackType.POSITIVE_FIXNUM_0x1B: - case MsgPackType.POSITIVE_FIXNUM_0x1C: - case MsgPackType.POSITIVE_FIXNUM_0x1D: - case MsgPackType.POSITIVE_FIXNUM_0x1E: - case MsgPackType.POSITIVE_FIXNUM_0x1F: - - case MsgPackType.POSITIVE_FIXNUM_0x20: - case MsgPackType.POSITIVE_FIXNUM_0x21: - case MsgPackType.POSITIVE_FIXNUM_0x22: - case MsgPackType.POSITIVE_FIXNUM_0x23: - case MsgPackType.POSITIVE_FIXNUM_0x24: - case MsgPackType.POSITIVE_FIXNUM_0x25: - case MsgPackType.POSITIVE_FIXNUM_0x26: - case MsgPackType.POSITIVE_FIXNUM_0x27: - case MsgPackType.POSITIVE_FIXNUM_0x28: - case MsgPackType.POSITIVE_FIXNUM_0x29: - case MsgPackType.POSITIVE_FIXNUM_0x2A: - case MsgPackType.POSITIVE_FIXNUM_0x2B: - case MsgPackType.POSITIVE_FIXNUM_0x2C: - case MsgPackType.POSITIVE_FIXNUM_0x2D: - case MsgPackType.POSITIVE_FIXNUM_0x2E: - case MsgPackType.POSITIVE_FIXNUM_0x2F: - - case MsgPackType.POSITIVE_FIXNUM_0x30: - case MsgPackType.POSITIVE_FIXNUM_0x31: - case MsgPackType.POSITIVE_FIXNUM_0x32: - case MsgPackType.POSITIVE_FIXNUM_0x33: - case MsgPackType.POSITIVE_FIXNUM_0x34: - case MsgPackType.POSITIVE_FIXNUM_0x35: - case MsgPackType.POSITIVE_FIXNUM_0x36: - case MsgPackType.POSITIVE_FIXNUM_0x37: - case MsgPackType.POSITIVE_FIXNUM_0x38: - case MsgPackType.POSITIVE_FIXNUM_0x39: - case MsgPackType.POSITIVE_FIXNUM_0x3A: - case MsgPackType.POSITIVE_FIXNUM_0x3B: - case MsgPackType.POSITIVE_FIXNUM_0x3C: - case MsgPackType.POSITIVE_FIXNUM_0x3D: - case MsgPackType.POSITIVE_FIXNUM_0x3E: - case MsgPackType.POSITIVE_FIXNUM_0x3F: - - case MsgPackType.POSITIVE_FIXNUM_0x40: - case MsgPackType.POSITIVE_FIXNUM_0x41: - case MsgPackType.POSITIVE_FIXNUM_0x42: - case MsgPackType.POSITIVE_FIXNUM_0x43: - case MsgPackType.POSITIVE_FIXNUM_0x44: - case MsgPackType.POSITIVE_FIXNUM_0x45: - case MsgPackType.POSITIVE_FIXNUM_0x46: - case MsgPackType.POSITIVE_FIXNUM_0x47: - case MsgPackType.POSITIVE_FIXNUM_0x48: - case MsgPackType.POSITIVE_FIXNUM_0x49: - case MsgPackType.POSITIVE_FIXNUM_0x4A: - case MsgPackType.POSITIVE_FIXNUM_0x4B: - case MsgPackType.POSITIVE_FIXNUM_0x4C: - case MsgPackType.POSITIVE_FIXNUM_0x4D: - case MsgPackType.POSITIVE_FIXNUM_0x4E: - case MsgPackType.POSITIVE_FIXNUM_0x4F: - - case MsgPackType.POSITIVE_FIXNUM_0x50: - case MsgPackType.POSITIVE_FIXNUM_0x51: - case MsgPackType.POSITIVE_FIXNUM_0x52: - case MsgPackType.POSITIVE_FIXNUM_0x53: - case MsgPackType.POSITIVE_FIXNUM_0x54: - case MsgPackType.POSITIVE_FIXNUM_0x55: - case MsgPackType.POSITIVE_FIXNUM_0x56: - case MsgPackType.POSITIVE_FIXNUM_0x57: - case MsgPackType.POSITIVE_FIXNUM_0x58: - case MsgPackType.POSITIVE_FIXNUM_0x59: - case MsgPackType.POSITIVE_FIXNUM_0x5A: - case MsgPackType.POSITIVE_FIXNUM_0x5B: - case MsgPackType.POSITIVE_FIXNUM_0x5C: - case MsgPackType.POSITIVE_FIXNUM_0x5D: - case MsgPackType.POSITIVE_FIXNUM_0x5E: - case MsgPackType.POSITIVE_FIXNUM_0x5F: - - case MsgPackType.POSITIVE_FIXNUM_0x60: - case MsgPackType.POSITIVE_FIXNUM_0x61: - case MsgPackType.POSITIVE_FIXNUM_0x62: - case MsgPackType.POSITIVE_FIXNUM_0x63: - case MsgPackType.POSITIVE_FIXNUM_0x64: - case MsgPackType.POSITIVE_FIXNUM_0x65: - case MsgPackType.POSITIVE_FIXNUM_0x66: - case MsgPackType.POSITIVE_FIXNUM_0x67: - case MsgPackType.POSITIVE_FIXNUM_0x68: - case MsgPackType.POSITIVE_FIXNUM_0x69: - case MsgPackType.POSITIVE_FIXNUM_0x6A: - case MsgPackType.POSITIVE_FIXNUM_0x6B: - case MsgPackType.POSITIVE_FIXNUM_0x6C: - case MsgPackType.POSITIVE_FIXNUM_0x6D: - case MsgPackType.POSITIVE_FIXNUM_0x6E: - case MsgPackType.POSITIVE_FIXNUM_0x6F: - - case MsgPackType.POSITIVE_FIXNUM_0x70: - case MsgPackType.POSITIVE_FIXNUM_0x71: - case MsgPackType.POSITIVE_FIXNUM_0x72: - case MsgPackType.POSITIVE_FIXNUM_0x73: - case MsgPackType.POSITIVE_FIXNUM_0x74: - case MsgPackType.POSITIVE_FIXNUM_0x75: - case MsgPackType.POSITIVE_FIXNUM_0x76: - case MsgPackType.POSITIVE_FIXNUM_0x77: - case MsgPackType.POSITIVE_FIXNUM_0x78: - case MsgPackType.POSITIVE_FIXNUM_0x79: - case MsgPackType.POSITIVE_FIXNUM_0x7A: - case MsgPackType.POSITIVE_FIXNUM_0x7B: - case MsgPackType.POSITIVE_FIXNUM_0x7C: - case MsgPackType.POSITIVE_FIXNUM_0x7D: - case MsgPackType.POSITIVE_FIXNUM_0x7E: - case MsgPackType.POSITIVE_FIXNUM_0x7F: - - case MsgPackType.NEGATIVE_FIXNUM: - case MsgPackType.NEGATIVE_FIXNUM_0x01: - case MsgPackType.NEGATIVE_FIXNUM_0x02: - case MsgPackType.NEGATIVE_FIXNUM_0x03: - case MsgPackType.NEGATIVE_FIXNUM_0x04: - case MsgPackType.NEGATIVE_FIXNUM_0x05: - case MsgPackType.NEGATIVE_FIXNUM_0x06: - case MsgPackType.NEGATIVE_FIXNUM_0x07: - case MsgPackType.NEGATIVE_FIXNUM_0x08: - case MsgPackType.NEGATIVE_FIXNUM_0x09: - case MsgPackType.NEGATIVE_FIXNUM_0x0A: - case MsgPackType.NEGATIVE_FIXNUM_0x0B: - case MsgPackType.NEGATIVE_FIXNUM_0x0C: - case MsgPackType.NEGATIVE_FIXNUM_0x0D: - case MsgPackType.NEGATIVE_FIXNUM_0x0E: - case MsgPackType.NEGATIVE_FIXNUM_0x0F: - case MsgPackType.NEGATIVE_FIXNUM_0x10: - case MsgPackType.NEGATIVE_FIXNUM_0x11: - case MsgPackType.NEGATIVE_FIXNUM_0x12: - case MsgPackType.NEGATIVE_FIXNUM_0x13: - case MsgPackType.NEGATIVE_FIXNUM_0x14: - case MsgPackType.NEGATIVE_FIXNUM_0x15: - case MsgPackType.NEGATIVE_FIXNUM_0x16: - case MsgPackType.NEGATIVE_FIXNUM_0x17: - case MsgPackType.NEGATIVE_FIXNUM_0x18: - case MsgPackType.NEGATIVE_FIXNUM_0x19: - case MsgPackType.NEGATIVE_FIXNUM_0x1A: - case MsgPackType.NEGATIVE_FIXNUM_0x1B: - case MsgPackType.NEGATIVE_FIXNUM_0x1C: - case MsgPackType.NEGATIVE_FIXNUM_0x1D: - case MsgPackType.NEGATIVE_FIXNUM_0x1E: - case MsgPackType.NEGATIVE_FIXNUM_0x1F: - return bytes.Advance(1).Take(0); - - case MsgPackType.UINT8: - case MsgPackType.INT8: - return bytes.Advance(1).Take(1); - - case MsgPackType.UINT16: - case MsgPackType.INT16: - return bytes.Advance(1).Take(2); - - case MsgPackType.UINT32: - case MsgPackType.INT32: - case MsgPackType.FLOAT: - return bytes.Advance(1).Take(4); - - case MsgPackType.UINT64: - case MsgPackType.INT64: - case MsgPackType.DOUBLE: - return bytes.Advance(1).Take(8); - - case MsgPackType.FIX_EXT_1: - return bytes.Advance(2).Take(1); - case MsgPackType.FIX_EXT_2: - return bytes.Advance(2).Take(2); - case MsgPackType.FIX_EXT_4: - return bytes.Advance(2).Take(4); - case MsgPackType.FIX_EXT_8: - return bytes.Advance(2).Take(8); - case MsgPackType.FIX_EXT_16: - return bytes.Advance(2).Take(16); - case MsgPackType.EXT8: - { - var count = bytes.Get(1); - return bytes.Advance(1 + 1 + 1).Take(count); - } - case MsgPackType.EXT16: - { - var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 2 + 1).Take(count); - } - case MsgPackType.EXT32: - { - var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1)); - return bytes.Advance(1 + 4 + 1).Take((int)count); - } - default: - throw new ArgumentException("unknown type: " + formatType); - } - } - - public SByte GetExtType() - { - var formatType = Format; - switch (formatType) - { - case MsgPackType.FIX_EXT_4: - return (SByte)Bytes.Get(1); - } - - throw new NotImplementedException(); - } - - /// - /// ArrayとMap以外のタイプの値を得る - /// - /// - public T GetValue() - { - var formatType = Format; - switch (formatType) - { - case MsgPackType.NIL: return GenericCast.Null(); - case MsgPackType.TRUE: return GenericCast.Const(true)(); - case MsgPackType.FALSE: return GenericCast.Const(false)(); - case MsgPackType.POSITIVE_FIXNUM: return GenericCast.Const(0)(); - case MsgPackType.POSITIVE_FIXNUM_0x01: return GenericCast.Const(1)(); - case MsgPackType.POSITIVE_FIXNUM_0x02: return GenericCast.Const(2)(); - case MsgPackType.POSITIVE_FIXNUM_0x03: return GenericCast.Const(3)(); - case MsgPackType.POSITIVE_FIXNUM_0x04: return GenericCast.Const(4)(); - case MsgPackType.POSITIVE_FIXNUM_0x05: return GenericCast.Const(5)(); - case MsgPackType.POSITIVE_FIXNUM_0x06: return GenericCast.Const(6)(); - case MsgPackType.POSITIVE_FIXNUM_0x07: return GenericCast.Const(7)(); - case MsgPackType.POSITIVE_FIXNUM_0x08: return GenericCast.Const(8)(); - case MsgPackType.POSITIVE_FIXNUM_0x09: return GenericCast.Const(9)(); - case MsgPackType.POSITIVE_FIXNUM_0x0A: return GenericCast.Const(10)(); - case MsgPackType.POSITIVE_FIXNUM_0x0B: return GenericCast.Const(11)(); - case MsgPackType.POSITIVE_FIXNUM_0x0C: return GenericCast.Const(12)(); - case MsgPackType.POSITIVE_FIXNUM_0x0D: return GenericCast.Const(13)(); - case MsgPackType.POSITIVE_FIXNUM_0x0E: return GenericCast.Const(14)(); - case MsgPackType.POSITIVE_FIXNUM_0x0F: return GenericCast.Const(15)(); - - case MsgPackType.POSITIVE_FIXNUM_0x10: return GenericCast.Const(16)(); - case MsgPackType.POSITIVE_FIXNUM_0x11: return GenericCast.Const(17)(); - case MsgPackType.POSITIVE_FIXNUM_0x12: return GenericCast.Const(18)(); - case MsgPackType.POSITIVE_FIXNUM_0x13: return GenericCast.Const(19)(); - case MsgPackType.POSITIVE_FIXNUM_0x14: return GenericCast.Const(20)(); - case MsgPackType.POSITIVE_FIXNUM_0x15: return GenericCast.Const(21)(); - case MsgPackType.POSITIVE_FIXNUM_0x16: return GenericCast.Const(22)(); - case MsgPackType.POSITIVE_FIXNUM_0x17: return GenericCast.Const(23)(); - case MsgPackType.POSITIVE_FIXNUM_0x18: return GenericCast.Const(24)(); - case MsgPackType.POSITIVE_FIXNUM_0x19: return GenericCast.Const(25)(); - case MsgPackType.POSITIVE_FIXNUM_0x1A: return GenericCast.Const(26)(); - case MsgPackType.POSITIVE_FIXNUM_0x1B: return GenericCast.Const(27)(); - case MsgPackType.POSITIVE_FIXNUM_0x1C: return GenericCast.Const(28)(); - case MsgPackType.POSITIVE_FIXNUM_0x1D: return GenericCast.Const(29)(); - case MsgPackType.POSITIVE_FIXNUM_0x1E: return GenericCast.Const(30)(); - case MsgPackType.POSITIVE_FIXNUM_0x1F: return GenericCast.Const(31)(); - - case MsgPackType.POSITIVE_FIXNUM_0x20: return GenericCast.Const(32)(); - case MsgPackType.POSITIVE_FIXNUM_0x21: return GenericCast.Const(33)(); - case MsgPackType.POSITIVE_FIXNUM_0x22: return GenericCast.Const(34)(); - case MsgPackType.POSITIVE_FIXNUM_0x23: return GenericCast.Const(35)(); - case MsgPackType.POSITIVE_FIXNUM_0x24: return GenericCast.Const(36)(); - case MsgPackType.POSITIVE_FIXNUM_0x25: return GenericCast.Const(37)(); - case MsgPackType.POSITIVE_FIXNUM_0x26: return GenericCast.Const(38)(); - case MsgPackType.POSITIVE_FIXNUM_0x27: return GenericCast.Const(39)(); - case MsgPackType.POSITIVE_FIXNUM_0x28: return GenericCast.Const(40)(); - case MsgPackType.POSITIVE_FIXNUM_0x29: return GenericCast.Const(41)(); - case MsgPackType.POSITIVE_FIXNUM_0x2A: return GenericCast.Const(42)(); - case MsgPackType.POSITIVE_FIXNUM_0x2B: return GenericCast.Const(43)(); - case MsgPackType.POSITIVE_FIXNUM_0x2C: return GenericCast.Const(44)(); - case MsgPackType.POSITIVE_FIXNUM_0x2D: return GenericCast.Const(45)(); - case MsgPackType.POSITIVE_FIXNUM_0x2E: return GenericCast.Const(46)(); - case MsgPackType.POSITIVE_FIXNUM_0x2F: return GenericCast.Const(47)(); - - case MsgPackType.POSITIVE_FIXNUM_0x30: return GenericCast.Const(48)(); - case MsgPackType.POSITIVE_FIXNUM_0x31: return GenericCast.Const(49)(); - case MsgPackType.POSITIVE_FIXNUM_0x32: return GenericCast.Const(50)(); - case MsgPackType.POSITIVE_FIXNUM_0x33: return GenericCast.Const(51)(); - case MsgPackType.POSITIVE_FIXNUM_0x34: return GenericCast.Const(52)(); - case MsgPackType.POSITIVE_FIXNUM_0x35: return GenericCast.Const(53)(); - case MsgPackType.POSITIVE_FIXNUM_0x36: return GenericCast.Const(54)(); - case MsgPackType.POSITIVE_FIXNUM_0x37: return GenericCast.Const(55)(); - case MsgPackType.POSITIVE_FIXNUM_0x38: return GenericCast.Const(56)(); - case MsgPackType.POSITIVE_FIXNUM_0x39: return GenericCast.Const(57)(); - case MsgPackType.POSITIVE_FIXNUM_0x3A: return GenericCast.Const(58)(); - case MsgPackType.POSITIVE_FIXNUM_0x3B: return GenericCast.Const(59)(); - case MsgPackType.POSITIVE_FIXNUM_0x3C: return GenericCast.Const(60)(); - case MsgPackType.POSITIVE_FIXNUM_0x3D: return GenericCast.Const(61)(); - case MsgPackType.POSITIVE_FIXNUM_0x3E: return GenericCast.Const(62)(); - case MsgPackType.POSITIVE_FIXNUM_0x3F: return GenericCast.Const(63)(); - - case MsgPackType.POSITIVE_FIXNUM_0x40: return GenericCast.Const(64)(); - case MsgPackType.POSITIVE_FIXNUM_0x41: return GenericCast.Const(65)(); - case MsgPackType.POSITIVE_FIXNUM_0x42: return GenericCast.Const(66)(); - case MsgPackType.POSITIVE_FIXNUM_0x43: return GenericCast.Const(67)(); - case MsgPackType.POSITIVE_FIXNUM_0x44: return GenericCast.Const(68)(); - case MsgPackType.POSITIVE_FIXNUM_0x45: return GenericCast.Const(69)(); - case MsgPackType.POSITIVE_FIXNUM_0x46: return GenericCast.Const(70)(); - case MsgPackType.POSITIVE_FIXNUM_0x47: return GenericCast.Const(71)(); - case MsgPackType.POSITIVE_FIXNUM_0x48: return GenericCast.Const(72)(); - case MsgPackType.POSITIVE_FIXNUM_0x49: return GenericCast.Const(73)(); - case MsgPackType.POSITIVE_FIXNUM_0x4A: return GenericCast.Const(74)(); - case MsgPackType.POSITIVE_FIXNUM_0x4B: return GenericCast.Const(75)(); - case MsgPackType.POSITIVE_FIXNUM_0x4C: return GenericCast.Const(76)(); - case MsgPackType.POSITIVE_FIXNUM_0x4D: return GenericCast.Const(77)(); - case MsgPackType.POSITIVE_FIXNUM_0x4E: return GenericCast.Const(78)(); - case MsgPackType.POSITIVE_FIXNUM_0x4F: return GenericCast.Const(79)(); - - case MsgPackType.POSITIVE_FIXNUM_0x50: return GenericCast.Const(80)(); - case MsgPackType.POSITIVE_FIXNUM_0x51: return GenericCast.Const(81)(); - case MsgPackType.POSITIVE_FIXNUM_0x52: return GenericCast.Const(82)(); - case MsgPackType.POSITIVE_FIXNUM_0x53: return GenericCast.Const(83)(); - case MsgPackType.POSITIVE_FIXNUM_0x54: return GenericCast.Const(84)(); - case MsgPackType.POSITIVE_FIXNUM_0x55: return GenericCast.Const(85)(); - case MsgPackType.POSITIVE_FIXNUM_0x56: return GenericCast.Const(86)(); - case MsgPackType.POSITIVE_FIXNUM_0x57: return GenericCast.Const(87)(); - case MsgPackType.POSITIVE_FIXNUM_0x58: return GenericCast.Const(88)(); - case MsgPackType.POSITIVE_FIXNUM_0x59: return GenericCast.Const(89)(); - case MsgPackType.POSITIVE_FIXNUM_0x5A: return GenericCast.Const(90)(); - case MsgPackType.POSITIVE_FIXNUM_0x5B: return GenericCast.Const(91)(); - case MsgPackType.POSITIVE_FIXNUM_0x5C: return GenericCast.Const(92)(); - case MsgPackType.POSITIVE_FIXNUM_0x5D: return GenericCast.Const(93)(); - case MsgPackType.POSITIVE_FIXNUM_0x5E: return GenericCast.Const(94)(); - case MsgPackType.POSITIVE_FIXNUM_0x5F: return GenericCast.Const(95)(); - - case MsgPackType.POSITIVE_FIXNUM_0x60: return GenericCast.Const(96)(); - case MsgPackType.POSITIVE_FIXNUM_0x61: return GenericCast.Const(97)(); - case MsgPackType.POSITIVE_FIXNUM_0x62: return GenericCast.Const(98)(); - case MsgPackType.POSITIVE_FIXNUM_0x63: return GenericCast.Const(99)(); - case MsgPackType.POSITIVE_FIXNUM_0x64: return GenericCast.Const(100)(); - case MsgPackType.POSITIVE_FIXNUM_0x65: return GenericCast.Const(101)(); - case MsgPackType.POSITIVE_FIXNUM_0x66: return GenericCast.Const(102)(); - case MsgPackType.POSITIVE_FIXNUM_0x67: return GenericCast.Const(103)(); - case MsgPackType.POSITIVE_FIXNUM_0x68: return GenericCast.Const(104)(); - case MsgPackType.POSITIVE_FIXNUM_0x69: return GenericCast.Const(105)(); - case MsgPackType.POSITIVE_FIXNUM_0x6A: return GenericCast.Const(106)(); - case MsgPackType.POSITIVE_FIXNUM_0x6B: return GenericCast.Const(107)(); - case MsgPackType.POSITIVE_FIXNUM_0x6C: return GenericCast.Const(108)(); - case MsgPackType.POSITIVE_FIXNUM_0x6D: return GenericCast.Const(109)(); - case MsgPackType.POSITIVE_FIXNUM_0x6E: return GenericCast.Const(110)(); - case MsgPackType.POSITIVE_FIXNUM_0x6F: return GenericCast.Const(111)(); - - case MsgPackType.POSITIVE_FIXNUM_0x70: return GenericCast.Const(112)(); - case MsgPackType.POSITIVE_FIXNUM_0x71: return GenericCast.Const(113)(); - case MsgPackType.POSITIVE_FIXNUM_0x72: return GenericCast.Const(114)(); - case MsgPackType.POSITIVE_FIXNUM_0x73: return GenericCast.Const(115)(); - case MsgPackType.POSITIVE_FIXNUM_0x74: return GenericCast.Const(116)(); - case MsgPackType.POSITIVE_FIXNUM_0x75: return GenericCast.Const(117)(); - case MsgPackType.POSITIVE_FIXNUM_0x76: return GenericCast.Const(118)(); - case MsgPackType.POSITIVE_FIXNUM_0x77: return GenericCast.Const(119)(); - case MsgPackType.POSITIVE_FIXNUM_0x78: return GenericCast.Const(120)(); - case MsgPackType.POSITIVE_FIXNUM_0x79: return GenericCast.Const(121)(); - case MsgPackType.POSITIVE_FIXNUM_0x7A: return GenericCast.Const(122)(); - case MsgPackType.POSITIVE_FIXNUM_0x7B: return GenericCast.Const(123)(); - case MsgPackType.POSITIVE_FIXNUM_0x7C: return GenericCast.Const(124)(); - case MsgPackType.POSITIVE_FIXNUM_0x7D: return GenericCast.Const(125)(); - case MsgPackType.POSITIVE_FIXNUM_0x7E: return GenericCast.Const(126)(); - case MsgPackType.POSITIVE_FIXNUM_0x7F: return GenericCast.Const(127)(); - - case MsgPackType.NEGATIVE_FIXNUM: return GenericCast.Const(-32)(); - case MsgPackType.NEGATIVE_FIXNUM_0x01: return GenericCast.Const(-1)(); - case MsgPackType.NEGATIVE_FIXNUM_0x02: return GenericCast.Const(-2)(); - case MsgPackType.NEGATIVE_FIXNUM_0x03: return GenericCast.Const(-3)(); - case MsgPackType.NEGATIVE_FIXNUM_0x04: return GenericCast.Const(-4)(); - case MsgPackType.NEGATIVE_FIXNUM_0x05: return GenericCast.Const(-5)(); - case MsgPackType.NEGATIVE_FIXNUM_0x06: return GenericCast.Const(-6)(); - case MsgPackType.NEGATIVE_FIXNUM_0x07: return GenericCast.Const(-7)(); - case MsgPackType.NEGATIVE_FIXNUM_0x08: return GenericCast.Const(-8)(); - case MsgPackType.NEGATIVE_FIXNUM_0x09: return GenericCast.Const(-9)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0A: return GenericCast.Const(-10)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0B: return GenericCast.Const(-11)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0C: return GenericCast.Const(-12)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0D: return GenericCast.Const(-13)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0E: return GenericCast.Const(-14)(); - case MsgPackType.NEGATIVE_FIXNUM_0x0F: return GenericCast.Const(-15)(); - case MsgPackType.NEGATIVE_FIXNUM_0x10: return GenericCast.Const(-16)(); - case MsgPackType.NEGATIVE_FIXNUM_0x11: return GenericCast.Const(-17)(); - case MsgPackType.NEGATIVE_FIXNUM_0x12: return GenericCast.Const(-18)(); - case MsgPackType.NEGATIVE_FIXNUM_0x13: return GenericCast.Const(-19)(); - case MsgPackType.NEGATIVE_FIXNUM_0x14: return GenericCast.Const(-20)(); - case MsgPackType.NEGATIVE_FIXNUM_0x15: return GenericCast.Const(-21)(); - case MsgPackType.NEGATIVE_FIXNUM_0x16: return GenericCast.Const(-22)(); - case MsgPackType.NEGATIVE_FIXNUM_0x17: return GenericCast.Const(-23)(); - case MsgPackType.NEGATIVE_FIXNUM_0x18: return GenericCast.Const(-24)(); - case MsgPackType.NEGATIVE_FIXNUM_0x19: return GenericCast.Const(-25)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1A: return GenericCast.Const(-26)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1B: return GenericCast.Const(-27)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1C: return GenericCast.Const(-28)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1D: return GenericCast.Const(-29)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1E: return GenericCast.Const(-30)(); - case MsgPackType.NEGATIVE_FIXNUM_0x1F: return GenericCast.Const(-31)(); - - case MsgPackType.INT8: return GenericCast.Cast((SByte)GetBody().Get(0)); - case MsgPackType.INT16: return GenericCast.Cast(EndianConverter.NetworkByteWordToSignedNativeByteOrder(GetBody())); - case MsgPackType.INT32: return GenericCast.Cast(EndianConverter.NetworkByteDWordToSignedNativeByteOrder(GetBody())); - case MsgPackType.INT64: return GenericCast.Cast(EndianConverter.NetworkByteQWordToSignedNativeByteOrder(GetBody())); - case MsgPackType.UINT8: return GenericCast.Cast(GetBody().Get(0)); - case MsgPackType.UINT16: return GenericCast.Cast(EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(GetBody())); - case MsgPackType.UINT32: return GenericCast.Cast(EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(GetBody())); - case MsgPackType.UINT64: return GenericCast.Cast(EndianConverter.NetworkByteQWordToUnsignedNativeByteOrder(GetBody())); - case MsgPackType.FLOAT: return GenericCast.Cast(EndianConverter.NetworkByteDWordToFloatNativeByteOrder(GetBody())); - case MsgPackType.DOUBLE: return GenericCast.Cast(EndianConverter.NetworkByteQWordToFloatNativeByteOrder(GetBody())); - - case MsgPackType.FIX_STR: return GenericCast.Const("")(); - case MsgPackType.FIX_STR_0x01: - case MsgPackType.FIX_STR_0x02: - case MsgPackType.FIX_STR_0x03: - case MsgPackType.FIX_STR_0x04: - case MsgPackType.FIX_STR_0x05: - case MsgPackType.FIX_STR_0x06: - case MsgPackType.FIX_STR_0x07: - case MsgPackType.FIX_STR_0x08: - case MsgPackType.FIX_STR_0x09: - case MsgPackType.FIX_STR_0x0A: - case MsgPackType.FIX_STR_0x0B: - case MsgPackType.FIX_STR_0x0C: - case MsgPackType.FIX_STR_0x0D: - case MsgPackType.FIX_STR_0x0E: - case MsgPackType.FIX_STR_0x0F: - case MsgPackType.FIX_STR_0x10: - case MsgPackType.FIX_STR_0x11: - case MsgPackType.FIX_STR_0x12: - case MsgPackType.FIX_STR_0x13: - case MsgPackType.FIX_STR_0x14: - case MsgPackType.FIX_STR_0x15: - case MsgPackType.FIX_STR_0x16: - case MsgPackType.FIX_STR_0x17: - case MsgPackType.FIX_STR_0x18: - case MsgPackType.FIX_STR_0x19: - case MsgPackType.FIX_STR_0x1A: - case MsgPackType.FIX_STR_0x1B: - case MsgPackType.FIX_STR_0x1C: - case MsgPackType.FIX_STR_0x1D: - case MsgPackType.FIX_STR_0x1E: - case MsgPackType.FIX_STR_0x1F: - case MsgPackType.STR8: - case MsgPackType.STR16: - case MsgPackType.STR32: - { - var body = GetBody(); - var str = Encoding.UTF8.GetString(body.Array, body.Offset, body.Count); - return GenericCast.Cast(str); - } - - case MsgPackType.BIN8: - case MsgPackType.BIN16: - case MsgPackType.BIN32: - { - var body = GetBody(); - return GenericCast, T>.Cast(body); - } - - case MsgPackType.FIX_EXT_4: - { - if (GetExtType() == -1) - { - var unixtime = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(GetBody()); - var dt = new DateTimeOffset(unixtime * DateTimeOffsetExtensions.TicksPerSecond + DateTimeOffsetExtensions.EpochTime.Ticks, TimeSpan.Zero); - return GenericCast.Cast(dt); - } - break; - } - } - - throw new ArgumentException("GetValue to array or map: " + formatType); - } - - public bool GetBoolean() - { - switch (Format) - { - case MsgPackType.TRUE: return true; - case MsgPackType.FALSE: return false; - default: throw new MsgPackTypeException("Not boolean"); - } - } - - public ArraySegment GetBytes() - { - if (!Format.IsBinary()) - { - throw new MsgPackTypeException("Not bin"); - } - return GetBody(); - } - - public string GetString() - { - if (!Format.IsString()) - { - throw new MsgPackTypeException("Not str"); - } - var bytes = GetBody(); - return Encoding.UTF8.GetString(bytes.Array, bytes.Offset, bytes.Count); - } - - public Utf8String GetUtf8String() - { - if (!Format.IsString()) - { - throw new MsgPackTypeException("Not str"); - } - var bytes = GetBody(); - return new Utf8String(bytes); - } - - public SByte GetSByte() - { - return GetValue(); - } - - public Int16 GetInt16() - { - return GetValue(); - } - - public Int32 GetInt32() - { - return GetValue(); - } - - public Int64 GetInt64() - { - return GetValue(); - } - - public Byte GetByte() - { - return GetValue(); - } - - public UInt16 GetUInt16() - { - return GetValue(); - } - - public UInt32 GetUInt32() - { - return GetValue(); - } - - public UInt64 GetUInt64() - { - return GetValue(); - } - - public float GetSingle() - { - return GetValue(); - } - - public double GetDouble() - { - return GetValue(); - } - - public void SetValue(Utf8String jsonPointer, T value) - { - throw new NotImplementedException(); - } - - public void RemoveValue(Utf8String jsonPointer) - { - throw new NotImplementedException(); - } - - public void AddKey(Utf8String key) - { - throw new NotImplementedException(); - } - - public void AddValue(ArraySegment bytes, ValueNodeType valueType) - { - throw new NotImplementedException(); - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs.meta deleted file mode 100644 index e67e534a4..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/MsgPack/MsgPackValue.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e201eb676758d5d419ae0629fda171ac -timeCreated: 1540904080 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/Toml.meta b/Assets/UniGLTF/Runtime/UniJSON/Toml.meta deleted file mode 100644 index 94236f5d2..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/Toml.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 69e0a1360efdf0a4093b010d322bc05a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs b/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs deleted file mode 100644 index ec4dd6fbb..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs +++ /dev/null @@ -1,185 +0,0 @@ -using System; -using System.Collections.Generic; - - -namespace UniJSON -{ - public static class TomlParser - { - static TomlValue ParseLHS(Utf8String segment, int parentIndex) - { - var it = segment.GetIterator(); - while (it.MoveNext()) - { - if (it.Current == '"') - { - throw new NotImplementedException(); - } - else if (it.Current == '.') - { - throw new NotImplementedException(); - } - else if (it.Current == ' ' || it.Current == '\t' || it.Current == '=') - { - return new TomlValue(segment.Subbytes(0, it.BytePosition), - TomlValueType.BareKey, parentIndex); - } - } - - throw new NotImplementedException(); - } - - static TomlValue ParseRHS(Utf8String segment, int parentIndex) - { - switch ((char)segment[0]) - { - case '+': - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (segment.IsInt) - { - return new TomlValue(segment.SplitInteger(), TomlValueType.Integer, parentIndex); - } - else - { - return new TomlValue(segment, TomlValueType.Float, parentIndex); - } - - case '"': - { - int pos; - if (segment.TrySearchAscii((Byte)'"', 1, out pos)) - { - return new TomlValue(segment.Subbytes(0, pos + 1), TomlValueType.BasicString, parentIndex); - } - else - { - throw new ParserException("no close string: " + segment); - } - } - - case '[': - { - throw new NotImplementedException(); - } - } - - throw new NotImplementedException(); - } - - public static ListTreeNode Parse(Utf8String segment) - { - var values = new List() - { - new TomlValue(segment, TomlValueType.Table, -1), - }; - var current = 0; - - while (!segment.IsEmpty) - { - segment = segment.TrimStart(); - if (segment.IsEmpty) - { - break; - } - - if (segment[0] == '#') - { - // comment line - // skip to line end - segment = segment.Subbytes(segment.GetLine().ByteLength); - continue; - } - - if (segment.ByteLength>=4 && segment[0]=='[' && segment[1]=='[') - { - // [[array_name]] - throw new NotImplementedException(); - } - else if (segment.ByteLength>=2 && segment[0]=='[') - { - // [table_name] - int table_end; - if (!segment.TrySearchByte(x => x == ']', out table_end)) - { - throw new ParserException("] not found"); - } - var table_name = segment.Subbytes(1, table_end-1).Trim(); - if (table_name.IsEmpty) - { - throw new ParserException("empty table name"); - } - - // top level key - values.Add(new TomlValue(table_name, TomlValueType.Table, 0)); - current = values.Count - 1; - - // skip to line end - segment = segment.Subbytes(segment.GetLine().ByteLength); - } - else - { - // key = value - { - var key = ParseLHS(segment, current); - switch(key.TomlValueType) - { - case TomlValueType.BareKey: - case TomlValueType.QuotedKey: - { - values.Add(key); - - // skip key - segment = segment.Subbytes(key.Bytes.Count); - } - break; - - case TomlValueType.DottedKey: - throw new NotImplementedException(); - } - } - - { - // search and skip = - int eq; - if (!segment.TrySearchByte(x => x == '=', out eq)) - { - throw new ParserException("= not found"); - } - segment = segment.Subbytes(eq + 1); - - // skip white space - segment = segment.TrimStart(); - } - - { - var value = ParseRHS(segment, current); - values.Add(value); - - // skip value - segment = segment.Subbytes(value.Bytes.Count); - - // skip to line end - segment = segment.Subbytes(segment.GetLine().ByteLength); - } - } - } - - return new ListTreeNode(values); - } - - public static ListTreeNode Parse(String Toml) - { - return Parse(Utf8String.From(Toml)); - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs.meta deleted file mode 100644 index 553353580..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlParser.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3fcee2cba67aa504a9385323813c07df -timeCreated: 1545735557 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs b/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs deleted file mode 100644 index 9a8391b66..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; - - -namespace UniJSON -{ - public enum TomlValueType - { - BareKey, // key - QuotedKey, // "key" - DottedKey, // key.nested - BasicString, // "str" - MultilineBasicString, // """str""" - LiteralString, // 'str' - MultilineLiteralString, // '''str''' - Integer, - Float, - Boolean, - OffsetDatetime, - Array, // [1, 2, 3] - Table, // [table_name] - } - - public struct TomlValue : IListTreeItem, IValue - { - public override string ToString() - { - return m_segment.ToString(); - } - - public int ParentIndex { get; private set; } - - public TomlValueType TomlValueType - { - get; - private set; - } - - public ValueNodeType ValueType - { - get - { - switch (TomlValueType) - { - case TomlValueType.Integer: return ValueNodeType.Integer; - case TomlValueType.Float: return ValueNodeType.Number; - case TomlValueType.Boolean: return ValueNodeType.Boolean; - - case TomlValueType.BareKey: return ValueNodeType.String; - case TomlValueType.QuotedKey: return ValueNodeType.String; - case TomlValueType.DottedKey: return ValueNodeType.String; - - case TomlValueType.BasicString: return ValueNodeType.String; - case TomlValueType.MultilineBasicString: return ValueNodeType.String; - case TomlValueType.LiteralString: return ValueNodeType.String; - case TomlValueType.MultilineLiteralString: return ValueNodeType.String; - - case TomlValueType.Table: return ValueNodeType.Object; - case TomlValueType.Array: return ValueNodeType.Array; - } - throw new NotImplementedException(); - } - } - - Utf8String m_segment; - - public ArraySegment Bytes { get { return m_segment.Bytes; } } - public void SetBytesCount(int count) - { - throw new NotImplementedException(); - } - - public int ChildCount - { - get - { - throw new NotImplementedException(); - } - } - public void SetChildCount(int count) - { - throw new NotImplementedException(); - } - - public TomlValue(Utf8String segment, TomlValueType valueType, int parentIndex) : this() - { - ParentIndex = parentIndex; - TomlValueType = valueType; - m_segment = segment; - } - - public bool GetBoolean() - { - throw new NotImplementedException(); - } - - public byte GetByte() - { - throw new NotImplementedException(); - } - - public double GetDouble() - { - throw new NotImplementedException(); - } - - public short GetInt16() - { - throw new NotImplementedException(); - } - - public int GetInt32() - { - return m_segment.ToInt32(); - } - - public long GetInt64() - { - throw new NotImplementedException(); - } - - public sbyte GetSByte() - { - throw new NotImplementedException(); - } - - public float GetSingle() - { - throw new NotImplementedException(); - } - - public string GetString() - { - throw new NotImplementedException(); - } - - public ushort GetUInt16() - { - throw new NotImplementedException(); - } - - public uint GetUInt32() - { - throw new NotImplementedException(); - } - - public ulong GetUInt64() - { - throw new NotImplementedException(); - } - - public Utf8String GetUtf8String() - { - return m_segment; - } - - public U GetValue() - { - throw new NotImplementedException(); - } - - public TomlValue Key(Utf8String key, int parentIndex) - { - throw new NotImplementedException(); - } - - public TomlValue New(ArraySegment bytes, ValueNodeType valueType, int parentIndex) - { - throw new NotImplementedException(); - } - } -} diff --git a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs.meta b/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs.meta deleted file mode 100644 index 5443be452..000000000 --- a/Assets/UniGLTF/Runtime/UniJSON/Toml/TomlValue.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e62dc750f570d764ab8c88742ceaa383 -timeCreated: 1545735558 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack.meta deleted file mode 100644 index 7dc894002..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a6fe9c2c8212b42459b037f4181cd3ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs deleted file mode 100644 index 7f7c01ea8..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs +++ /dev/null @@ -1,92 +0,0 @@ -using NUnit.Framework; -using System; -using System.Linq; - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class ArrayTest - { - [Test] - public void fix_array() - { - var f = new MsgPackFormatter(); - // Object[] not supported - f.Serialize(new[] { 0, 1, false, (Object)null }); - var _bytes = f.GetStoreBytes(); - var bytes = _bytes.Array.Skip(_bytes.Offset).Take(_bytes.Count).ToArray(); - - Assert.AreEqual(new Byte[]{ - (Byte)MsgPackType.FIX_ARRAY_0x4, - (Byte)MsgPackType.POSITIVE_FIXNUM, - (Byte)MsgPackType.POSITIVE_FIXNUM_0x01, - (Byte)MsgPackType.FALSE, - (Byte)MsgPackType.NIL - }, bytes); - - var parsed = MsgPackParser.Parse(bytes); - - Assert.AreEqual(4, parsed.GetArrayCount()); - Assert.AreEqual(0, parsed[0].GetValue()); - Assert.AreEqual(1, parsed[1].GetValue()); - Assert.False((Boolean)parsed[2].GetValue()); - Assert.AreEqual(null, parsed[3].GetValue()); - } - - [Test] - public void array16() - { - var f = new MsgPackFormatter(); - var data = Enumerable.Range(0, 20).Select(x => (Object)x).ToArray(); - f.Serialize(data); - var bytes = f.GetStoreBytes(); - - var value = MsgPackParser.Parse(bytes); - Assert.IsTrue(value.IsArray()); - Assert.AreEqual(20, value.GetArrayCount()); - for (int i = 0; i < 20; ++i) - { - Assert.AreEqual(i, value[i].GetValue()); - } - } - - [Test] - public void array129() - { - { - var i128 = Enumerable.Range(0, 128).ToArray(); - var f = new MsgPackFormatter(); - f.Serialize(i128); - var bytes128 = f.GetStoreBytes(); - var deserialized = MsgPackParser.Parse(bytes128); - Assert.AreEqual(128, deserialized.GetArrayCount()); - for (int i = 0; i < i128.Length; ++i) - { - Assert.AreEqual(i128[i], deserialized[i].GetValue()); - } - } - - { - var i129 = Enumerable.Range(0, 129).ToArray(); - var f = new MsgPackFormatter(); - f.Serialize(i129); - var bytes129 = f.GetStoreBytes(); - var deserialized = MsgPackParser.Parse(bytes129); - Assert.AreEqual(129, deserialized.GetArrayCount()); - for (int i = 0; i < i129.Length; ++i) - { - Assert.AreEqual(i129[i], deserialized[i].GetValue()); - } - } - } - - [Test] - public void ReadTest() - { - var data = new int[] { -108, 0, 1, -90, 108, 111, 103, 103, 101, 114, -110, -91, 69, 114, 114, 111, 114, -94, 101, 50 } - .Select(x => (Byte)x).ToArray(); - var parsed = MsgPackParser.Parse(data); - Assert.True(parsed.IsArray()); - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs.meta deleted file mode 100644 index 733ee7e6e..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/ArrayTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4b485b0360ebfd246ac90bbe8ad1895b -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs deleted file mode 100644 index 5b38abb5a..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs +++ /dev/null @@ -1,50 +0,0 @@ -using NUnit.Framework; -using System; - - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class BooleanTest - { - [Test] - public void nil() - { - { - var f = new MsgPackFormatter(); - f.Null(); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[] { 0xC0 }, bytes.ToEnumerable()); - - var parsed = MsgPackParser.Parse(bytes); - Assert.True(parsed.IsNull()); - } - } - - [Test] - public void True() - { - var f = new MsgPackFormatter(); - f.Value(true); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[] { 0xC3 }, bytes.ToEnumerable()); - - var value = MsgPackParser.Parse(bytes); - var j = value.GetBoolean(); - Assert.AreEqual(true, j); - } - - [Test] - public void False() - { - var f = new MsgPackFormatter(); - f.Value(false); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[] { 0xC2 }, bytes.ToEnumerable()); - - var value = MsgPackParser.Parse(bytes); - var j = value.GetBoolean(); - Assert.AreEqual(false, j); - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs.meta deleted file mode 100644 index d179af7c2..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/BooleanTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d0f19e48b365cd446982ed0b7ba6251e -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs deleted file mode 100644 index 82e1a63b1..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs +++ /dev/null @@ -1,50 +0,0 @@ -using NUnit.Framework; -using System; -using System.Linq; - - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class FloatTest - { - [Test] - public void Float32() - { - var i = 1.1f; - var float_be = new byte[] - { - (Byte)MsgPackType.FLOAT, 0x3f, 0x8c, 0xcc, 0xcd - }; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - var value = MsgPackParser.Parse(bytes); - var body = value.Value.Bytes; - Assert.AreEqual(float_be, body.ToEnumerable().ToArray()); - - Assert.AreEqual(i, value.GetValue()); - } - - [Test] - public void Float64() - { - var i = 1.1; - var double_be = new Byte[]{ - (Byte)MsgPackType.DOUBLE, 0x3f, 0xf1, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9a, - }; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - var value = MsgPackParser.Parse(bytes); - var body = value.Value.Bytes; - Assert.AreEqual(double_be, body.ToEnumerable().ToArray()); - - Assert.AreEqual(i, value.GetValue()); - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs.meta deleted file mode 100644 index b2893722d..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/FloatTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 51cdc6be3b73a34429cae41cd020c71c -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs deleted file mode 100644 index 4f341129d..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs +++ /dev/null @@ -1,220 +0,0 @@ -using NUnit.Framework; -using System; - - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class IntTest - { - [Test] - public void positive_fixnum() - { - for (Byte i = 0; i < 128; ++i) - { - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[] { i }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void negative_fixnum() - { - for (SByte i = -32; i < 0; ++i) - { - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void uint8() - { - { - Byte i = 0x7F + 20; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xcc, 0x93, - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void cast_large_type() - { - { - Byte i = 0x7F + 20; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xcc, 0x93, - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void uint16() - { - { - UInt16 i = 0xFF + 20; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xcd, 0x01, 0x13 - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void uint32() - { - { - UInt32 i = 0xFFFF + 20; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xce, 0x00, 0x01, 0x00, 0x13 - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void uint64() - { - { - UInt64 i = 0xFFFFFFFF; - i += 20; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xcf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13 - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void int8() - { - { - SByte i = -64; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - Assert.AreEqual(new Byte[]{ - 0xd0, 0xc0, - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void int128Test() - { - int i = 128; - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - Assert.AreEqual(new Byte[]{ - 0xcc, 0x80, - }, bytes.ToEnumerable()); - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - - [Test] - public void int16() - { - { - Int16 i = -150; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - Assert.AreEqual(new Byte[]{ - 0xd1, 0xFF, 0x6a - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void int32() - { - { - Int32 i = -35000; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - Assert.AreEqual(new Byte[]{ - 0xd2, 0xff, 0xff, 0x77, 0x48 - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - - [Test] - public void int64() - { - { - Int64 i = -2147483650; - - var f = new MsgPackFormatter(); - f.Value(i); - var bytes = f.GetStoreBytes(); - - Assert.AreEqual(new Byte[]{ - 0xd3, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe - }, bytes.ToEnumerable()); - - var j = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(i, j); - } - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs.meta deleted file mode 100644 index c2800a7fd..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/IntTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8d6f5e40bc0825b449887d877c0ad5c5 -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs deleted file mode 100644 index d1bfb3e55..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs +++ /dev/null @@ -1,120 +0,0 @@ -using NUnit.Framework; -using System; -using System.IO; -using System.Linq; - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class MapTest - { - [Test] - public void fix_map() - { - var f = new MsgPackFormatter(); - f.BeginMap(2); - f.Key("0"); f.Value(1); - f.Key("2"); f.Value(3); - f.EndMap(); - var bytes = - f.GetStoreBytes(); - ; - - Assert.AreEqual(new Byte[]{ - 0x82, // map2 - - 0xa1, 0x30, // "0" - 0x01, // 1 - - 0xa1, 0x32, // "2" - 0x03 // 3 - }, bytes.ToEnumerable()); - - var value = MsgPackParser.Parse(bytes); - - Assert.AreEqual(2, value.GetObjectCount()); - Assert.AreEqual(1, value["0"].GetValue()); - Assert.AreEqual(3, value["2"].GetValue()); - } - - [Test] - public void map16() - { - var w = new MsgPackFormatter(); - int size = 18; - w.BeginMap(size); - for (int i = 0; i < size; ++i) - { - w.Value(i.ToString()); - w.Value(i + 5); - } - var bytes = w.GetStoreBytes().ToEnumerable().ToArray(); - - - var expected = new Byte[]{ - 0xde, // map18 - 0x0, 0x12, // 18 - - 0xa1, 0x30, // "0" - 0x5, - - 0xa1, 0x31, // "1" - 0x6, - - 0xa1, 0x32, // "2" - 0x7, - - 0xa1, 0x33, // "3" - 0x8, - - 0xa1, 0x34, // "4" - 0x9, - - 0xa1, 0x35, // "5" - 0xa, - - 0xa1, 0x36, // "6" - 0xb, - - 0xa1, 0x37, // "7" - 0xc, - - 0xa1, 0x38, // "8" - 0xd, - - 0xa1, 0x39, // "9" - 0xe, - - 0xa2, 0x31, 0x30, // "10" - 0xf, - - 0xa2, 0x31, 0x31, // "11" - 0x10, - - 0xa2, 0x31, 0x32, // "12" - 0x11, - - 0xa2, 0x31, 0x33, // "13" - 0x12, - - 0xa2, 0x31, 0x34, // "14" - 0x13, - - 0xa2, 0x31, 0x35, // "15" - 0x14, - - 0xa2, 0x31, 0x36, // "16" - 0x15, - - 0xa2, 0x31, 0x37, // "17", - 0x16 - }; - - Assert.AreEqual(expected, bytes); - - var value = MsgPackParser.Parse(bytes); - - Assert.AreEqual(15, value["10"].GetValue()); - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs.meta deleted file mode 100644 index 7c87a562d..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/MapTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 87a626e93589db14fbe4526c9880b110 -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs deleted file mode 100644 index d3a458622..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs +++ /dev/null @@ -1,34 +0,0 @@ -using NUnit.Framework; -using System; -using System.Linq; - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class RawTest - { - [Test] - public void fix_raw() - { - var src = new Byte[] { 0, 1, 2 }; - var f = new MsgPackFormatter(); - f.Value(src); - var bytes = f.GetStoreBytes(); - - var v = MsgPackParser.Parse(bytes).Value.GetBody(); - Assert.True(src.SequenceEqual(v.ToEnumerable())); - } - - [Test] - public void raw16() - { - var src = Enumerable.Range(0, 50).Select(x => (Byte)x).ToArray(); - var f = new MsgPackFormatter(); - f.Value(src); - var bytes = f.GetStoreBytes(); - - var v = MsgPackParser.Parse(bytes).Value.GetBody(); - Assert.True(src.SequenceEqual(v.ToEnumerable())); - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs.meta deleted file mode 100644 index 402252f92..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/RawTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 331bd613923afe5438ef4ff3a59fc5b3 -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs deleted file mode 100644 index c85e899da..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs +++ /dev/null @@ -1,36 +0,0 @@ -using NUnit.Framework; -using System; -using System.Linq; - -namespace UniJSON.MsgPack -{ - [TestFixture] - public class StringTest - { - [Test] - public void str() - { - var f = new MsgPackFormatter(); - f.Value("文字列"); - var bytes = f.GetStoreBytes(); - - var v = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual("文字列", v); - } - - [Test] - public void fix_str() - { - for (int i = 1; i < 32; ++i) - { - var str = String.Join("", Enumerable.Range(0, i).Select(_ => "0").ToArray()); - var f = new MsgPackFormatter(); - f.Value(str); - var bytes = f.GetStoreBytes(); - - var value = MsgPackParser.Parse(bytes); - Assert.AreEqual(i, ((String)value.GetValue()).Length); - } - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs.meta deleted file mode 100644 index 438025580..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/StringTest.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3942810073614d946a76d87cbbfb222c -timeCreated: 1540812276 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs b/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs deleted file mode 100644 index 16e764f82..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs +++ /dev/null @@ -1,50 +0,0 @@ -using NUnit.Framework; -using System; - - -namespace UniJSON.MsgPack -{ - public class TimeTests - { - [Test] - public void TimeTest() - { - var f = new MsgPackFormatter(); - - { - f.GetStore().Clear(); - var time = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero); - f.Value(time); - - var bytes = f.GetStoreBytes().ArrayOrCopy(); - unchecked - { - Assert.AreEqual(new byte[] - { - (byte)MsgPackType.FIX_EXT_4, (byte)-1, 0, 0, 0, 0 - }, bytes); - } - var parsed = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(time, parsed); - } - - { - var time = new DateTimeOffset(2018, 12, 8, 2, 12, 15, TimeSpan.Zero); - Assert.AreEqual(1544235135, time.ToUnixTimeSeconds()); - f.GetStore().Clear(); - f.Value(time); - var bytes = f.GetStoreBytes().ArrayOrCopy(); - var parsed = MsgPackParser.Parse(bytes).GetValue(); - Assert.AreEqual(time, parsed); - } - - { - f.GetStore().Clear(); - Assert.Catch(() => - { - f.Value(new DateTimeOffset()); - }); - } - } - } -} diff --git a/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs.meta b/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs.meta deleted file mode 100644 index e1ae14b8c..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/MsgPack/TimeTests.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0a025b475357b4d4aa104e839e6791be -timeCreated: 1544154226 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/Toml.meta b/Assets/UniGLTF/Tests/UniJSON/Toml.meta deleted file mode 100644 index 3d8cdb15a..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/Toml.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8536361e247bd4b408d82604d3b16a10 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs b/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs deleted file mode 100644 index 2069c41de..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs +++ /dev/null @@ -1,128 +0,0 @@ -using NUnit.Framework; - - -/* -namespace UniJSON.Toml -{ - class TomlParserTests - { - [Test] - public void BareKeyTests() - { - { - var result = TomlParser.Parse(@" -value = 1 -"); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["value"].GetInt32()); - } - } - - [Test] - public void DottedKeyTests() - { - { - var result = TomlParser.Parse(@" -value.value2 = 1 -"); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["value"]["value2"].GetInt32()); - } - } - - [Test] - public void DuplicatedKey() - { - { - Assert.Catch(() => TomlParser.Parse(@" -value = 1 -value = 2 -")); - } - } - - [Test] - public void QuotedKeyTests() - { - { - var result = TomlParser.Parse(@" -""value"" = 1 -"); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["value"].GetInt32()); - } - - { - var result = TomlParser.Parse(@" -""[key=value]"" = 1 -"); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["value"].GetInt32()); - } - } - - [Test] - public void TableTests() - { - { - var result = @" -[table] -value = 1 -".ParseAsToml(); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["table"]["value"].GetInt32()); - } - - { - var result = @" -[table.table2] -value = 1 -".ParseAsToml(); - Assert.True(result.IsMap()); - Assert.AreEqual(1, result["table"]["table2"]["value"].GetInt32()); - } - } - - [Test] - public void TomlExample() - { - var result = @" -# This is a TOML document. - -title = ""TOML Example"" - -[owner] -name = ""Tom Preston-Werner"" -dob = 1979 - 05 - 27T07: 32:00 - 08:00 # First class dates - -[database] -server = ""192.168.1.1"" -ports = [8001, 8001, 8002] -connection_max = 5000 -enabled = true - -[servers] - -# Indentation (tabs and/or spaces) is allowed but not required - [servers.alpha] - ip = ""10.0.0.1"" - dc = ""eqdc10"" - - [servers.beta] - ip = ""10.0.0.2"" - dc = ""eqdc10"" - -[clients] -data = [ [""gamma"", ""delta""], [1, 2] ] - -# Line breaks are OK when inside arrays -hosts = [ - ""alpha"", - ""omega"" -] -".ParseAsToml(); - Assert.AreEqual("TOML Example", result["title"].GetString()); - } - } -} -*/ diff --git a/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs.meta b/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs.meta deleted file mode 100644 index b949e4cd5..000000000 --- a/Assets/UniGLTF/Tests/UniJSON/Toml/TomlParserTests.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7959f4764f02c5e4d9f191e794bc6101 -timeCreated: 1545735557 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: