crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianDebugLib/Plugins/DbgEntCode/Entity/CodeEntity.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.Collections.Generic;
       
    19 using System.Text;
       
    20 using System.IO;
       
    21 using System.Drawing;
       
    22 using SymbianUtils;
       
    23 using SymbianUtils.Settings;
       
    24 using SymbianUtils.FileSystem;
       
    25 using SymbianDebugLib.Entity;
       
    26 using SymbianDebugLib.Engine;
       
    27 using SymbianDebugLib.Entity.Descriptors;
       
    28 using SymbianDebugLib.PluginAPI;
       
    29 using SymbianDebugLib.PluginAPI.Types;
       
    30 using DbgEntCode.Descriptor;
       
    31 
       
    32 namespace DbgEntCode.Entity
       
    33 {
       
    34     public class CodeEntity : DbgEntity
       
    35     {
       
    36         #region Static constructors
       
    37         public static CodeEntity New( CodeDescriptor aDescriptor, FSEntity aFSEntity )
       
    38         {
       
    39             CodeEntity ret = null;
       
    40 
       
    41             // Validate that it's a supported file
       
    42             if ( aFSEntity.Exists && aFSEntity.IsFile )
       
    43             {
       
    44                 string fileName = aFSEntity.FullName;
       
    45                 bool isCode = aDescriptor.Engine.Code.IsSupported( fileName );
       
    46                 if ( isCode )
       
    47                 {
       
    48                     ret = new CodeEntity( aDescriptor, aFSEntity );
       
    49                 }
       
    50             }
       
    51             //
       
    52             return ret;
       
    53         }
       
    54 
       
    55         public static CodeEntity New( CodeDescriptor aDescriptor, XmlSettingCategory aSettingsCategory )
       
    56         {
       
    57             CodeEntity ret = null;
       
    58             //
       
    59             if ( aSettingsCategory.Contains( KSettingsKeyFileName ) )
       
    60             {
       
    61                 string fileName = aSettingsCategory[ KSettingsKeyFileName ];
       
    62                 ret = New( aDescriptor, FSEntity.New( fileName ) );
       
    63             }
       
    64             //
       
    65             return ret;
       
    66         }
       
    67         #endregion
       
    68 
       
    69         #region Constants
       
    70         public const string KSettingsKeyFileName = "CodeFileName";
       
    71         #endregion
       
    72 
       
    73         #region Constructors
       
    74         private CodeEntity( DbgEntityDescriptor aDescriptor, FSEntity aFSEntity )
       
    75             : base( aDescriptor, aFSEntity )
       
    76         {
       
    77         }
       
    78         #endregion
       
    79 
       
    80         #region From DbgEntity
       
    81         public override void Save( XmlSettingCategory aCategory )
       
    82         {
       
    83             aCategory[ KSettingsKeyFileName ] = base.FSEntity.FullName;
       
    84         }
       
    85 
       
    86         public override DbgPluginEngine PluginEngine
       
    87         {
       
    88             get
       
    89             {
       
    90                 return base.Engine.Code;
       
    91             }
       
    92         }
       
    93         #endregion
       
    94 
       
    95         #region Properties
       
    96         #endregion
       
    97 
       
    98         #region Internal methods
       
    99         #endregion
       
   100 
       
   101         #region From DisposableObject
       
   102         #endregion
       
   103 
       
   104         #region Data members
       
   105         #endregion
       
   106     }
       
   107 }