Beispiel #1
0
        public override UnprocessedChunk Unprocess(int chunkid)
        {
            byte[] data = new byte [Length];
            BitConv.ToInt16(data, 0, Magic);
            BitConv.ToInt16(data, 2, Type);
            BitConv.ToInt32(data, 4, chunkid);
            BitConv.ToInt32(data, 8, entries.Count);
            // Checksum is here, but calculated later
            int offset = 20 + entries.Count * 4;

            for (int i = 0; i < entries.Count; i++)
            {
                UnprocessedEntry entry     = entries[i].Unprocess();
                byte[]           entrydata = entry.Save();
                offset += entry.HeaderLength;
                Aligner.Align(ref offset, Alignment);
                offset -= entry.HeaderLength;
                if (offset + entrydata.Length > Length)
                {
                    throw new PackingException();
                }
                BitConv.ToInt32(data, 16 + i * 4, offset);
                entrydata.CopyTo(data, offset);
                offset += entrydata.Length;
            }
            BitConv.ToInt32(data, 16 + entries.Count * 4, offset);
            int checksum = CalculateChecksum(data);

            BitConv.ToInt32(data, 12, checksum);
            return(new UnprocessedChunk(data));
        }
 public UnprocessedEntryController(EntryChunkController entrychunkcontroller,UnprocessedEntry unprocessedentry)
     : base(entrychunkcontroller,unprocessedentry)
 {
     this.unprocessedentry = unprocessedentry;
     Node.Text = string.Format("Unprocessed T{0} Entry ({1})",unprocessedentry.Type,unprocessedentry.EIDString);
     Node.ImageKey = "unprocessedentry";
     Node.SelectedImageKey = "unprocessedentry";
     AddMenu("Process Entry",Menu_Process_Entry);
 }