Example #1
0
        public void ReadAdtlChunk(Byte[] InData)
        {
            Chunks = new List <ListChunk>();
            var dataReader = new BinaryReader(new MemoryStream(InData), Encoding.ASCII);

            while (dataReader.BaseStream.Position < dataReader.BaseStream.Length)
            {
                var  type = new String(dataReader.ReadChars(4));
                uint size = dataReader.ReadUInt32();
                if (size % 2 != 0)               // account for padding
                {
                    size += 1;
                }
                byte[]    ChunkData = dataReader.ReadBytes((int)size);
                ListChunk newChunk  = null;
                switch (type)
                {
                case LiCkAdtlType.labl:
                    newChunk = new LiCkInfoLabl(ChunkData);
                    break;

                case LiCkAdtlType.note:
                    newChunk = new LiCkNote(ChunkData);
                    break;

                case LiCkAdtlType.ltxt:
                    newChunk = new LiCkLtxt(ChunkData);
                    break;
                }
                if (newChunk != null)
                {
                    Chunks.Add(newChunk);
                }
            }
        }
Example #2
0
		public void ReadAdtlChunk(Byte[] InData)
		{
			Chunks = new List<ListChunk>();
			var dataReader = new BinaryReader(new MemoryStream(InData), Encoding.ASCII);
			while (dataReader.BaseStream.Position < dataReader.BaseStream.Length)
			{
				var type = new String(dataReader.ReadChars(4));
				uint size = dataReader.ReadUInt32();
				if (size%2 != 0) // account for padding
					size += 1;
				byte[] ChunkData = dataReader.ReadBytes((int) size);
				ListChunk newChunk = null;
				switch (type)
				{
					case LiCkAdtlType.labl:
						newChunk = new LiCkInfoLabl(ChunkData);
						break;
					case LiCkAdtlType.note:
						newChunk = new LiCkNote(ChunkData);
						break;
					case LiCkAdtlType.ltxt:
						newChunk = new LiCkLtxt(ChunkData);
						break;
				}
				if (newChunk != null)
					Chunks.Add(newChunk);
			}
		}