コード例 #1
0
        public GetDataMessage(NetworkMessage message)
            : base("getdata", message.Payload)
        {
            int startIndex = 0;

            int inventoryCount = VarInt.GetInt32(
                Payload,
                ref startIndex);

            for (int i = 0; i < inventoryCount; i += 1)
            {
                Inventories.Add(
                    Inventory.Parse(
                        Payload,
                        ref startIndex));
            }
        }
コード例 #2
0
        public InvMessage(byte[] buffer)
            : base(
                "inv",
                buffer)
        {
            int startIndex = 0;

            int inventoryCount = VarInt.GetInt32(
                Payload,
                ref startIndex);

            for (int i = 0; i < inventoryCount; i++)
            {
                Inventories.Add(
                    Inventory.Parse(
                        Payload,
                        ref startIndex));
            }
        }