Example #1
0
 public FrameHeader(byte[] rawData)
 {
     _title       = Encoding.ASCII.GetString(rawData.Take(4).ToArray());
     _size        = SizeHelper.GetSize(rawData.Skip(4).Take(4).ToArray());
     _initialSize = _size;
     _flags       = rawData.Skip(8).ToArray();
 }
Example #2
0
 public TagHeader(byte[] rawData)
 {
     _title        = Encoding.ASCII.GetString(rawData.Take(3).ToArray());
     _magorVersion = rawData[3];
     _minorVersion = rawData[4];
     _flags        = rawData[5];
     _size         = SizeHelper.GetSize(rawData.Skip(6).ToArray());
 }
Example #3
0
        public byte[] GetRawRepresentation()
        {
            byte[] toRet = new byte[10];

            using (MemoryStream mem = new MemoryStream(toRet))
            {
                mem.Write(Encoding.ASCII.GetBytes(_title), 0, 4);
                mem.Write(SizeHelper.EncodeSize(_size), 0, 4);
                mem.Write(_flags, 0, 2);
            }

            return(toRet);
        }
Example #4
0
        public byte[] GetRawRepresentation()
        {
            byte[] toRet = new byte[10];

            using (MemoryStream mem = new MemoryStream(toRet))
            {
                mem.Write(Encoding.ASCII.GetBytes(_title), 0, 3);
                mem.Write(new byte[] { _magorVersion }, 0, 1);
                mem.Write(new byte[] { _minorVersion }, 0, 1);
                mem.Write(new byte[] { _flags }, 0, 1);
                mem.Write(SizeHelper.EncodeSize(Convert.ToInt32(_size)), 0, 4);
            }

            return(toRet);
        }