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