public AREFile(DATFileEntry source)
        {
            this.source = source;

            try
            {
                parse();
            }
            catch (Exception e)
            {
                Error = e.Message;
            }
        }
Exemplo n.º 2
0
        public ICOFile(DATFileEntry source, Palette palette)
        {
            this.source  = source;
            this.palette = palette;

            try
            {
                parse();
            }
            catch (Exception e)
            {
                Error = e.Message;
            }
        }
Exemplo n.º 3
0
        public BOBFile(DATFileEntry source, Palette palette)
        {
            this.source  = source;
            this.palette = palette;

            try
            {
                parse();
            }
            catch (Exception e)
            {
                // does not happen with original assets of the game
                Error = e.Message;
            }
        }
Exemplo n.º 4
0
        private void parse()
        {
            byte[] data        = File.ReadAllBytes(path);
            int    numEntries  = BitConverter.ToUInt16(data, data.Length - 4) + 1;
            int    offset      = BitConverter.ToInt32(data, data.Length - 8);
            int    indexOffset = offset;

            DATFileEntry[] files = new DATFileEntry[numEntries];

            Log = "Num entries: " + numEntries.ToString() + Environment.NewLine + "Index address: " + offset.ToString() + Environment.NewLine;

            for (int i = 0; i < numEntries; i++)
            {
                DATFileEntry entry = new DATFileEntry();

                int nameLen = BitConverter.ToUInt16(data, offset);
                offset          += 2;
                entry.Filename   = Encoding.UTF8.GetString(data, offset, nameLen); //BitConverter.ToString(data, offset, nameLen);
                offset          += nameLen;
                entry.Offset     = BitConverter.ToInt32(data, offset);
                offset          += 4;
                files[i]         = entry;
                Log             += entry.ToString() + Environment.NewLine;
                entry.ExportPath = Path.Combine(exportDirectory, entry.Filename);
            }

            for (int i = 0; i < numEntries; i++)
            {
                DATFileEntry file   = files[i];
                int          length = (i < numEntries - 1 ? files[i + 1].Offset : indexOffset) - file.Offset;
                file.Data = data.SubArray(file.Offset, length);
                Entries.Add(file.Filename, file);
            }

            Ready = true;
        }