crashanalysercmd/Libraries/File Formats/Plugins/DExcPlugin/Extractor/DExcExtractorListStackData.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.IO;
       
    20 using System.Text.RegularExpressions;
       
    21 using System.Collections.Generic;
       
    22 using SymbianUtils.DataBuffer;
       
    23 using SymbianUtils.DataBuffer.Primer;
       
    24 
       
    25 namespace DExcPlugin.Extractor
       
    26 {
       
    27 	internal class DExcExtractorListStackData : DExcExtractorList
       
    28     {
       
    29         #region Delegates & events
       
    30         public delegate void StackDataChangeHandler( DExcExtractorListStackData aSelf );
       
    31         public event StackDataChangeHandler StackChanged;
       
    32         #endregion
       
    33 
       
    34         #region Constructors
       
    35         public DExcExtractorListStackData( DExcExtractor.TState aState, DExcExtractorListType aType )
       
    36             : base( aState, aType )
       
    37 		{
       
    38             iPrimer = new DataBufferPrimer( iBuffer );
       
    39 		}
       
    40 		#endregion
       
    41 
       
    42 		#region API
       
    43         public override void Add( string aLine )
       
    44         {
       
    45             base.Add( aLine );
       
    46             //
       
    47             iPrimer.PrimeLine( aLine );
       
    48             if ( StackChanged != null )
       
    49             {
       
    50                 StackChanged( this );
       
    51             }
       
    52         }
       
    53 
       
    54         public void Prime( string aFileName )
       
    55         {
       
    56             using ( FileStream stream = new FileStream( aFileName, FileMode.Open ) )
       
    57             {
       
    58                 long len = stream.Length;
       
    59                 byte[] bytes = new byte[ len ];
       
    60                 stream.Read( bytes, 0, (int) len );
       
    61                 iPrimer.Prime( bytes, 0 );
       
    62             }
       
    63         }
       
    64 		#endregion
       
    65 
       
    66 		#region Properties
       
    67         public DataBuffer StackData
       
    68         {
       
    69             get { return iBuffer; }
       
    70         }
       
    71 		#endregion
       
    72 
       
    73         #region Internal methods
       
    74         #endregion
       
    75 
       
    76         #region From System.Object
       
    77         #endregion
       
    78 
       
    79         #region Data members
       
    80         private readonly DataBufferPrimer iPrimer;
       
    81         private DataBuffer iBuffer = new DataBuffer();
       
    82         #endregion
       
    83     }
       
    84 }