Beispiel #1
0
        public TransferRequestPacket(LocalFileStructure fStruct, int localID)
        {
            PacketBuffer buffer = new PacketBuffer();

            buffer.WriteInteger(localID);
            buffer.WriteLong(fStruct.FileSize);
            buffer.WriteString(fStruct.FileName);
            buffer.WriteString(fStruct.FileExtension);
            PacketData = buffer.ToArray();
            PacketType = "_TFR";
        }
Beispiel #2
0
        public byte[] ToByteArray()
        {
            PacketBuffer buffer = new PacketBuffer();

            buffer.WriteBytes(Encoding.ASCII.GetBytes(PacketType));
            buffer.WriteString(PacketText);

            return(buffer.ToArray());
        }
        /// <summary>
        /// Creates a ScoutResponsePacket given a NetworkDevice structure
        /// </summary>
        /// <param name="device"></param>
        public ScoutResponsePacket(NetworkDevice device)
        {
            PacketType = "_SCA";
            PacketBuffer buffer = new PacketBuffer();

            buffer.WriteString(device.Name);
            buffer.WriteByte((byte)device.Type);

            PacketData = buffer.ToArray();
        }