Beispiel #1
0
        protected virtual void ReadInfo(string filename)
        {
            ValueRead  read = new ValueRead(Header.e_ident[(byte)EI.DataEncoding]);
            FileStream fs;

            for (int i = 0; i < Header.e_shnum; i++)
            {
                if (SectionHeader[i].sh_offset != 0)
                {
                    if ((SectionHeader[i].sh_type & (uint)SHT_RPL.FILEINFO) == (uint)SHT_RPL.FILEINFO)
                    {
                        fs = File.Open(filename, FileMode.Open);
                        byte[] sectiondata = new byte[SectionHeader[i].sh_size];
                        fs.Position = SectionHeader[i].sh_offset;
                        fs.Read(sectiondata, 0, sectiondata.Length);
                        fs.Close();

                        Info = new RPX.FileInfo(sectiondata, 0, read);
                        if (Info.mSrcFileNameOffset != 0)
                        {
                            SrcFileName = ValueRead.ASCIIString(sectiondata, Info.mSrcFileNameOffset);
                        }
                        if (Info.mTagsOffset != 0)
                        {
                            ulong  offset = Info.mTagsOffset;
                            string tag    = ValueRead.ASCIIString(sectiondata, offset);
                            while (tag.Length != 0)
                            {
                                Tags.Add(tag);
                                offset += (ulong)tag.Length + 1;
                                tag     = ValueRead.ASCIIString(sectiondata, offset);
                            }
                        }
                    }
                    else if ((SectionHeader[i].sh_type & (uint)SHT_RPL.CRCS) == (uint)SHT_RPL.CRCS)
                    {
                        fs = File.Open(filename, FileMode.Open);
                        byte[] sectiondata = new byte[SectionHeader[i].sh_size];
                        fs.Position = SectionHeader[i].sh_offset;
                        fs.Read(sectiondata, 0, sectiondata.Length);
                        fs.Close();

                        for (int j = 0; j < Header.e_shnum; j++)
                        {
                            CRC[j] = read.UInt32(sectiondata, (ulong)(j * 4));
                        }
                    }
                }
            }
        }
Beispiel #2
0
 public FileInfo(byte[] data, uint startIndex, ValueRead read)
 {
     magic_version             = read.UInt32(data, startIndex + 0x00);
     mRegBytes_Text            = read.UInt32(data, startIndex + 0x04);
     mRegBytes_TextAlign       = read.UInt32(data, startIndex + 0x08);
     mRegBytes_Data            = read.UInt32(data, startIndex + 0x0c);
     mRegBytes_DataAlign       = read.UInt32(data, startIndex + 0x10);
     mRegBytes_LoaderInfo      = read.UInt32(data, startIndex + 0x14);
     mRegBytes_LoaderInfoAlign = read.UInt32(data, startIndex + 0x18);
     mRegBytes_Temp            = read.UInt32(data, startIndex + 0x1c);
     mTrampAdj          = read.UInt32(data, startIndex + 0x20);
     mSDABase           = read.UInt32(data, startIndex + 0x24);
     mSDA2Base          = read.UInt32(data, startIndex + 0x28);
     mSizeCoreStacks    = read.UInt32(data, startIndex + 0x2c);
     mSrcFileNameOffset = read.UInt32(data, startIndex + 0x30);
     mFlags             = read.UInt32(data, startIndex + 0x34);
     mSysHeapBytes      = read.UInt32(data, startIndex + 0x38);
     mTagsOffset        = read.UInt32(data, startIndex + 0x3c);
 }