コード例 #1
0
        internal static byte[] Encapsulate(byte[] Bytes, string Name, long Length)
        {
            List <byte> full = new List <byte>();

            ObjectContainer c = new ObjectContainer(new FileInfo(Name, Length));
            End             e = End.Default();

            string head = JsonConvert.SerializeObject(c);
            string tail = JsonConvert.SerializeObject(e);

            full.AddRange(Encoding.UTF8.GetBytes(head));
            full.AddRange(Bytes);
            full.AddRange(Encoding.UTF8.GetBytes(tail));

            return(full.ToArray());
        }