コード例 #1
0
        private static void _writeMethod(string write_method, dynamic value, ref BigEndianWriter writer)
        {
            switch (write_method)
            {
            case "WriteByte": writer.WriteByte((byte)value); return;

            case "WriteUnsignedByte": writer.WriteUnsignedByte((sbyte)value); return;

            case "WriteShort": writer.WriteShort((short)value); return;

            case "WriteUnsignedShort": writer.WriteUnsignedShort((ushort)value); return;

            case "WriteVarShort": writer.WriteVarShort((short)value); return;

            case "WriteVarUhShort": writer.WriteVarUhShort((ushort)value); return;

            case "WriteInt": writer.WriteInt((int)value); return;

            case "WriteUnsignedInt": writer.WriteUnsignedInt((uint)value); return;

            case "WriteVarInt": writer.WriteVarInt((int)value); return;

            case "WriteVarUhInt": writer.WriteVarUhInt((uint)value); return;

            case "WriteLong": writer.WriteLong(value); return;

            case "WriteUnsignedLong": writer.WriteUnsignedLong(value); return;

            case "WriteVarLong": writer.WriteVarLong(value); return;

            case "WriteVarUhLong": writer.WriteVarUhLong(value); return;

            case "WriteUTF": writer.WriteUTF(value); return;

            case "WriteDouble": writer.WriteDouble((double)value); return;

            case "WriteFloat": writer.WriteFloat((float)value); return;

            case "WriteBoolean": writer.WriteBoolean(value); return;

            default:
                throw new NotImplementedException($"Method : '{write_method}' is not implemented");
            }
        }