|
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 |
|
22 namespace SymbianImageLib.ROM.Structures |
|
23 { |
|
24 internal class TRomLoad |
|
25 { |
|
26 #region Constructors |
|
27 #endregion |
|
28 |
|
29 #region API |
|
30 public void Read( BinaryReader aReader ) |
|
31 { |
|
32 ReadBytesAsChars( aReader, iName ); |
|
33 ReadBytesAsChars( aReader, iVersionStr ); |
|
34 ReadBytesAsChars( aReader, iBuildNumStr ); |
|
35 iRomSize = aReader.ReadUInt32(); |
|
36 iWrapSize = aReader.ReadUInt32(); |
|
37 } |
|
38 #endregion |
|
39 |
|
40 #region Properties |
|
41 public static uint Size |
|
42 { |
|
43 get |
|
44 { |
|
45 uint ret = 0; |
|
46 // |
|
47 ret += KRomNameSize; |
|
48 ret += 4; // iVersionStr |
|
49 ret += 4; // iBuildNumStr |
|
50 ret += 4; // iRomSize |
|
51 ret += 4; // iWrapSize |
|
52 // |
|
53 return ret; |
|
54 } |
|
55 } |
|
56 |
|
57 public string Name |
|
58 { |
|
59 get |
|
60 { |
|
61 |
|
62 StringBuilder ret = new StringBuilder(); |
|
63 ret.Append( iName ); |
|
64 return ret.ToString(); |
|
65 } |
|
66 } |
|
67 |
|
68 public string Version |
|
69 { |
|
70 get |
|
71 { |
|
72 StringBuilder ret = new StringBuilder(); |
|
73 ret.Append( iVersionStr ); |
|
74 return ret.ToString(); |
|
75 } |
|
76 } |
|
77 |
|
78 public string BuildNumber |
|
79 { |
|
80 get |
|
81 { |
|
82 StringBuilder ret = new StringBuilder(); |
|
83 ret.Append( iBuildNumStr ); |
|
84 return ret.ToString(); |
|
85 } |
|
86 } |
|
87 #endregion |
|
88 |
|
89 #region Internal constants |
|
90 private const int KRomNameSize = 16; |
|
91 #endregion |
|
92 |
|
93 #region Internal methods |
|
94 private void ReadBytesAsChars( BinaryReader aReader, char[] aDest ) |
|
95 { |
|
96 byte[] bytes = aReader.ReadBytes( aDest.Length ); |
|
97 // |
|
98 int pos = 0; |
|
99 foreach ( byte b in bytes ) |
|
100 { |
|
101 aDest[ pos++ ] = System.Convert.ToChar( b ); |
|
102 } |
|
103 } |
|
104 #endregion |
|
105 |
|
106 #region Data members |
|
107 private char[] iName = new char[ KRomNameSize ]; |
|
108 private char[] iVersionStr = new char[ 4 ]; |
|
109 private char[] iBuildNumStr = new char[ 4 ]; |
|
110 private uint iRomSize; |
|
111 private uint iWrapSize; |
|
112 #endregion |
|
113 } |
|
114 } |