crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianImageLib/ROFS/Structures/TRofsHeader.cs
author Matti Laitinen <matti.t.laitinen@nokia.com>
Thu, 11 Feb 2010 15:50:58 +0200
changeset 0 818e61de6cd1
permissions -rw-r--r--
Add initial version of Crash Analyser cmdline under EPL

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
* 
* Description:
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using SymbianStructuresLib.Version;

namespace SymbianImageLib.ROFS.Structures
{
    internal class TRofsHeader
    {
        #region Constructors
        #endregion

        #region API
        public void Read( BinaryReader aReader )
        {
            iIdentifier = SymbianUtils.Strings.StringParsingUtils.BytesToString( aReader.ReadBytes( 4 ) );
            iHeaderSize = aReader.ReadByte();
            iReserved = aReader.ReadByte();
            iRofsFormatVersion = aReader.ReadUInt16();
            iDirTreeOffset = aReader.ReadUInt32();
            iDirTreeSize = aReader.ReadUInt32();
            iDirFileEntriesOffset = aReader.ReadUInt32();
            iDirFileEntriesSize = aReader.ReadUInt32();
            iTime = aReader.ReadInt64();
            iImageVersion.Read( aReader );
            iImageSize = aReader.ReadUInt32();
            iCheckSum = aReader.ReadUInt32();
            iMaxImageSize = aReader.ReadUInt32();
        }
        #endregion

        #region Properties
        public string Identifier
        {
            get { return iIdentifier; }
        }

        public uint Size
        {
            get
            {
                return iHeaderSize;
            }
        }

        public uint RofsFormatVersion
        {
            get { return iRofsFormatVersion; }
        }

        public uint DirTreeOffset
        {
            get { return iDirTreeOffset; }
        }

        public uint DirTreeSize
        {
            get { return iDirTreeSize; }
        }

        public uint DirFileEntriesOffset
        {
            get { return iDirFileEntriesOffset; }
        }

        public uint DirFileEntriesSize
        {
            get { return iDirFileEntriesSize; }
        }

        public uint CheckSum
        {
            get { return iCheckSum; }
        }
        #endregion

        #region Data members
        private string iIdentifier = string.Empty;
        private byte iHeaderSize;
        private byte iReserved;
        private ushort iRofsFormatVersion;
        private uint iDirTreeOffset;	// offset to start of directory structure
        private uint iDirTreeSize;		// size in bytes of directory
        private uint iDirFileEntriesOffset;	// offset to start of file entries
        private uint iDirFileEntriesSize;	// size in bytes of file entry block
        private long iTime;
        private TVersion iImageVersion = new TVersion();		// licensee image version
        private uint iImageSize;
        private uint iCheckSum;
        private uint iMaxImageSize;
        #endregion
    }
}