Пример #1
0
        /// <summary>
        /// Write this ID into the given packet writer.
        /// </summary>
        public void WriteTo(JdwpPacket.DataReaderWriter readerWriter)
        {
            switch (idSize)
            {
            case 4:
                readerWriter.SetInt((int)id);
                break;

            case 8:
                readerWriter.SetLong(id);
                break;

            default:
                throw new ArgumentException("Unsupported ID size " + idSize);
            }
        }
Пример #2
0
        /// <summary>
        /// Read an untagged value.
        /// </summary>
        private static void WriteValue(JdwpPacket.DataReaderWriter data, Jdwp.Tag tag, object obj)
        {
            switch (tag)
            {
            //case Jdwp.Tag.Array:
            //case Jdwp.Tag.Object:
            //case Jdwp.Tag.String:
            //case Jdwp.Tag.Thread:
            //case Jdwp.Tag.ThreadGroup:
            //case Jdwp.Tag.ClassLoader:
            //case Jdwp.Tag.ClassObject:
            //    return new ObjectId(readerWriter);
            case Jdwp.Tag.Byte:
                data.SetByte((byte)obj);
                break;

            case Jdwp.Tag.Short:
            case Jdwp.Tag.Char:
                data.SetInt16((int)obj);
                break;

            //case Jdwp.Tag.Float:
            //    readerWriter.GetFloat(); //?
            //    break;
            //case Jdwp.Tag.Double:
            //    return readerWriter.SetDouble(); //?
            case Jdwp.Tag.Int:
                data.SetInt((int)obj);
                break;

            case Jdwp.Tag.Long:
                data.SetLong((long)obj);
                break;

            case Jdwp.Tag.Boolean:
                data.SetBoolean((bool)obj);
                break;

            default:
                throw new ArgumentException("unsupported tag " + tag);
            }
        }