crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianCodeLib/Plugins/CLPluginSymbianOS/Provider/ImgSourceProvider.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 
       
    18 using System;
       
    19 using System.IO;
       
    20 using System.Collections.Generic;
       
    21 using System.Text;
       
    22 using SymbianStructuresLib.Debug.Code;
       
    23 using SymbianCodeLib.SourceManagement.Source;
       
    24 using SymbianCodeLib.SourceManagement.Provisioning;
       
    25 using SymbianUtils.FileTypes;
       
    26 using SymbianUtils;
       
    27 using SymbianImageLib.Common.Image;
       
    28 using SymbianImageLib.Common.Content;
       
    29 using CLPluginImg.Reader;
       
    30 using CLPluginImg.Source;
       
    31 
       
    32 namespace CLPluginImg.Provider
       
    33 {
       
    34     public class ImgSourceProvider : CodeSourceProvider
       
    35     {
       
    36         #region Constructors
       
    37         public ImgSourceProvider( CodeSourceProviderManager aManager )
       
    38             : base( aManager )
       
    39         {
       
    40         }
       
    41         #endregion
       
    42           
       
    43         #region From SymSourceProvider
       
    44         public override CodeSourceCollection CreateSources( string aFileName )
       
    45         {
       
    46             SIImage image = SIImage.New( base.Tracer, aFileName );
       
    47             if ( image == null )
       
    48             {
       
    49                 throw new NotSupportedException( "The specified image file is not supported" );
       
    50             }
       
    51 
       
    52             // We need to make a source and (single) collection for each content object within the image.
       
    53             // This enables relocation support when an image is actually used (i.e. read & decompress code
       
    54             // on demand, rather than up front). 
       
    55             CodeSourceCollection sources = new CodeSourceCollection();
       
    56             //
       
    57             foreach ( SIContent content in image )
       
    58             {
       
    59                 CodeCollection collection = CodeCollection.New( base.IdAllocator, aFileName, content.FileName );
       
    60                 collection.IsRelocatable = content.IsRelocationSupported;
       
    61 
       
    62                 // The URI must be unique
       
    63                 string uri = string.Format( "{0} [{1}]", aFileName, content.FileName );
       
    64                 ImgSource source = new ImgSource( uri, this, collection, content );
       
    65                 sources.Add( source );
       
    66             }
       
    67             //
       
    68             return sources;
       
    69         }
       
    70 
       
    71         public override SymFileTypeList FileTypes
       
    72         {
       
    73             get
       
    74             {
       
    75                 SymFileTypeList ret = new SymFileTypeList();
       
    76                 //
       
    77                 ret.Add( new SymFileType( ".img", "Symbian OS Image Files" ) );
       
    78                 //
       
    79                 return ret;
       
    80             }
       
    81         }
       
    82 
       
    83         public override string Name
       
    84         {
       
    85             get { return "SYMBIAN OS IMAGE"; }
       
    86         }
       
    87         #endregion
       
    88 
       
    89         #region Properties
       
    90         #endregion
       
    91 
       
    92         #region Event handlers
       
    93 
       
    94         #endregion
       
    95 
       
    96         #region Internal constants
       
    97         #endregion
       
    98 
       
    99         #region Internal methods
       
   100         #endregion
       
   101 
       
   102         #region Data members
       
   103         #endregion
       
   104     }
       
   105 }