|
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.Text; |
|
19 using System.Collections.Generic; |
|
20 using CrashItemLib.Crash.InfoHW; |
|
21 using CrashItemLib.Crash.Utils; |
|
22 using CrashXmlPlugin.FileFormat.Versions; |
|
23 |
|
24 namespace CrashXmlPlugin.FileFormat.Segment.Entries.InfoHW |
|
25 { |
|
26 internal class CXmlSegInfoHW : CXmlSegBase |
|
27 { |
|
28 #region Constructors |
|
29 public CXmlSegInfoHW() |
|
30 : base( SegConstants.HWInfo ) |
|
31 { |
|
32 } |
|
33 #endregion |
|
34 |
|
35 #region From CXmlSegBase |
|
36 public override int SegmentPriority |
|
37 { |
|
38 get { return 70; } |
|
39 } |
|
40 #endregion |
|
41 |
|
42 #region From CXmlNode |
|
43 public override void XmlSerialize( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
44 { |
|
45 CIInfoHW info = (CIInfoHW) aParameters.Container.ChildByType( typeof( CIInfoHW ) ); |
|
46 if ( info != null ) |
|
47 { |
|
48 base.XmlSerialize( aParameters ); |
|
49 } |
|
50 } |
|
51 |
|
52 protected override void XmlSerializeContent( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
53 { |
|
54 CIInfoHW info = (CIInfoHW) aParameters.Container.ChildByType( typeof( CIInfoHW ) ); |
|
55 if ( info != null ) |
|
56 { |
|
57 // Product type |
|
58 string productType = info.ProductType; |
|
59 WriteStringIfNotEmpty( aParameters.Writer, SegConstants.HWInfo_ProductType, productType ); |
|
60 |
|
61 // Product code |
|
62 string productCode = info.ProductCode; |
|
63 WriteStringIfNotEmpty( aParameters.Writer, SegConstants.HWInfo_ProductCode, productCode ); |
|
64 |
|
65 // Serial number |
|
66 string serialNumber = info.SerialNumber; |
|
67 WriteStringIfNotEmpty( aParameters.Writer, SegConstants.HWInfo_SerialNumber, serialNumber ); |
|
68 } |
|
69 } |
|
70 |
|
71 protected override void XmlSerializeChildren( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters ) |
|
72 { |
|
73 CIInfoHW info = (CIInfoHW) aParameters.Container.ChildByType( typeof( CIInfoHW ) ); |
|
74 if ( info != null ) |
|
75 { |
|
76 int count = info.VersionCount; |
|
77 if ( count > 0 ) |
|
78 { |
|
79 CXmlVersionText.WriteVersionTextListStart( aParameters.Writer ); |
|
80 foreach ( CIVersionInfo version in info ) |
|
81 { |
|
82 if ( version.IsValid ) |
|
83 { |
|
84 CXmlVersionText xmlVersion = new CXmlVersionText( version.Value ); |
|
85 xmlVersion.XmlSerialize( aParameters ); |
|
86 } |
|
87 } |
|
88 CXmlVersionText.WriteVersionTextListEnd( aParameters.Writer ); |
|
89 } |
|
90 } |
|
91 } |
|
92 #endregion |
|
93 |
|
94 #region Properties |
|
95 #endregion |
|
96 |
|
97 #region From SegBase |
|
98 #endregion |
|
99 |
|
100 #region Data members |
|
101 #endregion |
|
102 } |
|
103 } |