Example #1
0
 public TRPReader()
 {
     this._hdr        = new TRPReader.TRPHeader();
     this._trophyList = new List <Archiver>();
     this._hdrmagic   = new byte[4]
     {
         (byte)220,
         (byte)162,
         (byte)77,
         (byte)0
     };
     this._throwerror = true;
 }
Example #2
0
        private void ReadHeader(FileStream fs)
        {
            TRPReader.TRPHeader trpHeader = new TRPReader.TRPHeader();
            trpHeader.magic        = new byte[4];
            trpHeader.version      = new byte[4];
            trpHeader.file_size    = new byte[8];
            trpHeader.files_count  = new byte[4];
            trpHeader.element_size = new byte[4];
            trpHeader.dev_flag     = new byte[4];
            trpHeader.sha1         = new byte[20];
            trpHeader.padding      = new byte[36];
            fs.Read(trpHeader.magic, 0, trpHeader.magic.Length);
            fs.Read(trpHeader.version, 0, trpHeader.version.Length);
            fs.Read(trpHeader.file_size, 0, trpHeader.file_size.Length);
            fs.Read(trpHeader.files_count, 0, trpHeader.files_count.Length);
            fs.Read(trpHeader.element_size, 0, trpHeader.element_size.Length);
            fs.Read(trpHeader.dev_flag, 0, trpHeader.dev_flag.Length);
            switch (TRPReader.byteArrayToLittleEndianInteger(trpHeader.version))
            {
            case 1:
                fs.Read(trpHeader.padding, 0, trpHeader.padding.Length);
                break;

            case 2:
                fs.Read(trpHeader.sha1, 0, trpHeader.sha1.Length);
                trpHeader.padding = new byte[16];
                fs.Read(trpHeader.padding, 0, trpHeader.padding.Length);
                break;

            case 3:
                fs.Read(trpHeader.sha1, 0, trpHeader.sha1.Length);
                trpHeader.padding = new byte[48];
                fs.Read(trpHeader.padding, 0, trpHeader.padding.Length);
                break;
            }
            this._hdr = trpHeader;
        }