Exemplo n.º 1
0
        /// <inheritdoc />
        public override byte[] GetBytes()
        {
            int Offset = 0;

            byte[] lnk = new byte[Size];
            Buffer.BlockCopy(base.GetBytes(), 0, lnk, 0, (int)HeaderSize);
            Offset += (int)HeaderSize;

            if ((LinkFlags & LinkFlags.HasLinkTargetIDList) != 0)
            {
                Buffer.BlockCopy(LinkTargetIDList.GetBytes(), 0, lnk, Offset, LinkTargetIDList.IDListSize + 2);
                Offset += LinkTargetIDList.IDListSize + 2;
            }

            if ((LinkFlags & LinkFlags.HasLinkInfo) != 0)
            {
                Buffer.BlockCopy(LinkInfo.GetBytes(), 0, lnk, Offset, (int)LinkInfo.LinkInfoSize);
                Offset += (int)LinkInfo.LinkInfoSize;
            }

            if (StringData != null)
            {
                Buffer.BlockCopy(StringData.GetBytes(), 0, lnk, Offset, (int)StringData.StringDataSize);
                Offset += (int)StringData.StringDataSize;
            }

            Buffer.BlockCopy(ExtraData.GetBytes(), 0, lnk, Offset, (int)ExtraData.ExtraDataSize);
            return(lnk);
        }
Exemplo n.º 2
0
        public byte[] GetBytes()
        {
            if (ByteData != null)
            {
                return(ByteData);
            }

            if (StringData.IsNotEmpty())
            {
                return(StringData.GetBytes());
            }

            return(new byte[]
            {
            });
        }