crashanalysercmd/Libraries/File Formats/Plugins/CrashXmlPlugin/FileFormat/Segment/CXmlNodeSegmentDictionary.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.Text;
       
    19 using System.Collections.Generic;
       
    20 using CrashItemLib.Engine;
       
    21 using CrashXmlPlugin.FileFormat.Node;
       
    22 using CrashXmlPlugin.FileFormat.Document;
       
    23 using CrashXmlPlugin.FileFormat.Segment.Entries;
       
    24 
       
    25 namespace CrashXmlPlugin.FileFormat.Segment
       
    26 {
       
    27 	internal class CXmlNodeSegmentDictionary : CXmlNode
       
    28 	{
       
    29 		#region Constructors
       
    30         public CXmlNodeSegmentDictionary()
       
    31             : base( Constants.SegmentDictionary )
       
    32 		{
       
    33 		}
       
    34 		#endregion
       
    35 
       
    36         #region From CXmlNode
       
    37         public override void XmlSerialize( CXmlDocumentSerializationParameters aParameters )
       
    38         {
       
    39             base.XmlSerialize( aParameters );
       
    40 
       
    41             // Now write segment table in-memory buffer
       
    42             string segTable = aParameters.Document.SegmentTable.SerializedData;
       
    43             if ( segTable.Length > 0 )
       
    44             {
       
    45                 aParameters.Writer.WriteRaw( segTable );
       
    46             }
       
    47         }
       
    48 
       
    49         protected override void XmlSerializeChildren( CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters )
       
    50         {
       
    51             CXmlDocumentRoot docRoot = ( base.Parent as CXmlDocumentRoot );
       
    52             if ( docRoot != null )
       
    53             {
       
    54                 CXmlNodeSegmentTable table = docRoot.SegmentTable;
       
    55                 if ( table != null )
       
    56                 {
       
    57                     foreach ( CXmlSegBase seg in table )
       
    58                     {
       
    59                         bool wasSerialized = seg.WasSerialized;
       
    60                         if ( wasSerialized )
       
    61                         {
       
    62                             aParameters.Writer.WriteStartElement( Constants.SegmentDictionary_Segment );
       
    63                             //
       
    64                             seg.Version.XmlSerialize( aParameters );
       
    65                             aParameters.Writer.WriteElementString( SegConstants.CmnName, seg.Name );
       
    66                             //
       
    67                             aParameters.Writer.WriteEndElement();
       
    68                         }
       
    69                     }
       
    70                 }
       
    71             }
       
    72         }
       
    73         #endregion
       
    74 
       
    75         #region Properties
       
    76         #endregion
       
    77 
       
    78         #region Internal methods
       
    79         #endregion
       
    80 
       
    81         #region Data members
       
    82         #endregion
       
    83     }
       
    84 }