コード例 #1
0
        static object DeserializePrimitive(TeraBinaryReader reader, Type type)
        {
            object value;

            if (type == typeof(bool))
            {
                value = reader.ReadBoolean();
            }
            else if (type == typeof(byte))
            {
                value = reader.ReadByte();
            }
            else if (type == typeof(sbyte))
            {
                value = reader.ReadSByte();
            }
            else if (type == typeof(ushort))
            {
                value = reader.ReadUInt16();
            }
            else if (type == typeof(short))
            {
                value = reader.ReadInt16();
            }
            else if (type == typeof(uint))
            {
                value = reader.ReadUInt32();
            }
            else if (type == typeof(int))
            {
                value = reader.ReadInt32();
            }
            else if (type == typeof(ulong))
            {
                value = reader.ReadUInt64();
            }
            else if (type == typeof(long))
            {
                value = reader.ReadInt64();
            }
            else if (type == typeof(float))
            {
                value = reader.ReadSingle();
            }
            else if (type == typeof(Vector3))
            {
                value = reader.ReadVector3();
            }
            else if (type == typeof(EntityId))
            {
                value = reader.ReadEntityId();
            }
            else if (type == typeof(SkillId))
            {
                value = reader.ReadSkillId();
            }
            else if (type == typeof(Angle))
            {
                value = reader.ReadAngle();
            }
            else
            {
                throw Assert.Unreachable();
            }

            return(value);
        }