crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianImageLib/ROFS/Structures/TRofsEntry.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Text;
       
    20 using System.IO;
       
    21 using SymbianUtils.Tracer;
       
    22 using SymbianUtils.Streams;
       
    23 using SymbianStructuresLib.Uids;
       
    24 using SymbianStructuresLib.Version;
       
    25 
       
    26 namespace SymbianImageLib.ROFS.Structures
       
    27 {
       
    28     internal class TRofsEntry
       
    29     {
       
    30         #region Constructors
       
    31         public TRofsEntry( SymbianStreamReaderLE aReader, ITracer aTracer )
       
    32         {
       
    33             long startPos = aReader.BaseStream.Position;
       
    34 
       
    35             iStructSize = aReader.ReadUInt16();
       
    36             iUids = new TCheckedUid( aReader );
       
    37             
       
    38             // Skip name offset - not useful
       
    39             aReader.ReadUInt8();
       
    40             //
       
    41             iAtt = aReader.ReadUInt8();
       
    42             iFileSize = aReader.ReadUInt32();
       
    43             iFileAddress = aReader.ReadUInt32();
       
    44             iAttExtra = aReader.ReadUInt8();
       
    45 
       
    46             // Read name - the length is in unicode characters.
       
    47             byte nameLength = aReader.ReadUInt8();
       
    48             iName = aReader.ReadStringUTF16( nameLength );
       
    49         }
       
    50         #endregion
       
    51 
       
    52         #region API
       
    53         #endregion
       
    54 
       
    55         #region Properties
       
    56         public uint Size
       
    57         {
       
    58             get { return iStructSize; }
       
    59         }
       
    60 
       
    61         public TCheckedUid Uids
       
    62         {
       
    63             get
       
    64             {
       
    65                 return iUids;
       
    66             }
       
    67         }
       
    68 
       
    69         public uint Att
       
    70         {
       
    71             get { return iAtt; }
       
    72         }
       
    73 
       
    74         public uint FileSize
       
    75         {
       
    76             get { return iFileSize; }
       
    77         }
       
    78 
       
    79         public uint FileAddress
       
    80         {
       
    81             get { return iFileAddress; }
       
    82         }
       
    83 
       
    84         public uint AttExtra
       
    85         {
       
    86             get { return iAttExtra; }
       
    87         }
       
    88 
       
    89         public string Name
       
    90         {
       
    91             get { return iName; }
       
    92         }
       
    93         #endregion
       
    94 
       
    95         #region From System.Object
       
    96         public override string ToString()
       
    97         {
       
    98             return iName;
       
    99         }
       
   100 
       
   101         public override int GetHashCode()
       
   102         {
       
   103             return iName.GetHashCode();
       
   104         }
       
   105         #endregion
       
   106 
       
   107         #region Data members
       
   108         private readonly ushort iStructSize;	    // Total size of entry, header + name + any padding
       
   109         private readonly TCheckedUid iUids;		    // A copy of all the UID info
       
   110         private readonly byte iAtt;			        // standard file attributes
       
   111         private readonly uint iFileSize;		    // real size of file in bytes (may be different from size in image)
       
   112 						                            // for subdirectories this is the total size of the directory
       
   113 						                            // block entry excluding padding
       
   114         private readonly uint iFileAddress;	        // address in image of file start
       
   115         private readonly byte iAttExtra;		    // extra ROFS attributes (these are inverted so 0 = enabled)
       
   116         private readonly string iName;
       
   117         #endregion
       
   118     }
       
   119 }