crashanalysercmd/UI/Plugins/CAPluginCrashAnalyser/CommandLine/Files/CACmdLineFSEntity.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.Collections.Generic;
       
    21 using CrashAnalyserEngine.Plugins;
       
    22 using CrashItemLib.Crash.Messages;
       
    23 using CrashItemLib.Crash.Container;
       
    24 
       
    25 namespace CAPCrashAnalysis.CommandLine
       
    26 {
       
    27     internal class CACmdLineFSEntity : CACmdLineMessageList
       
    28 	{
       
    29         #region Constructors
       
    30         public CACmdLineFSEntity()
       
    31 		{
       
    32 		}
       
    33         #endregion
       
    34 
       
    35 		#region API
       
    36         #endregion
       
    37 
       
    38 		#region Properties
       
    39         public FileInfo File
       
    40         {
       
    41             get { return iFile; }
       
    42             set { iFile = value; }
       
    43         }
       
    44 
       
    45         public DirectoryInfo Directory
       
    46         {
       
    47             get { return iDirectory; }
       
    48             set { iDirectory = value; }
       
    49         }
       
    50 
       
    51         public bool IsFile
       
    52         {
       
    53             get { return ( iFile != null ); }
       
    54         }
       
    55 
       
    56         public bool IsDirectory
       
    57         {
       
    58             get { return ( iDirectory != null); }
       
    59         }
       
    60 
       
    61         public string Name
       
    62         {
       
    63             get
       
    64             {
       
    65                 StringBuilder ret = new StringBuilder();
       
    66                 //
       
    67                 if ( IsDirectory )
       
    68                 {
       
    69                     ret.Append( Directory.FullName );
       
    70                 }
       
    71                 else if ( IsFile )
       
    72                 {
       
    73                     ret.Append( File.FullName );
       
    74                 }
       
    75                 //
       
    76                 return ret.ToString(); 
       
    77             }
       
    78         }
       
    79 
       
    80         public bool Exists
       
    81         {
       
    82             get
       
    83             {
       
    84                 bool ret = false;
       
    85                 //
       
    86                 if ( IsDirectory )
       
    87                 {
       
    88                     ret = Directory.Exists;
       
    89                 }
       
    90                 else if ( IsFile )
       
    91                 {
       
    92                     ret = File.Exists;
       
    93                 }
       
    94                 //
       
    95                 return ret;
       
    96             }
       
    97         }
       
    98         
       
    99         public object Tag
       
   100         {
       
   101             get { return iTag; }
       
   102             set { iTag = value; }
       
   103         }
       
   104 
       
   105         internal string NameUC
       
   106         {
       
   107             get
       
   108             {
       
   109                 string ret = this.Name.ToUpper();
       
   110                 return ret;
       
   111             }
       
   112         }
       
   113         #endregion
       
   114 
       
   115         #region Operators
       
   116         public static implicit operator FileInfo( CACmdLineFSEntity aFile )
       
   117         {
       
   118             return aFile.iFile;
       
   119         }
       
   120         #endregion
       
   121 
       
   122         #region Internal methods
       
   123         #endregion
       
   124 
       
   125         #region From System.Object
       
   126         public override string ToString()
       
   127         {
       
   128             return Name;
       
   129         }
       
   130         #endregion
       
   131 
       
   132         #region Data members
       
   133         private object iTag = null;
       
   134         private FileInfo iFile = null;
       
   135         private DirectoryInfo iDirectory = null;
       
   136         #endregion
       
   137 	}
       
   138 }