crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/Environment/EnvLocator.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.IO;
       
    20 using System.Text;
       
    21 
       
    22 namespace SymbianUtils.Environment
       
    23 {
       
    24 	public class EnvLocator
       
    25 	{
       
    26 		#region Constructors
       
    27 		public EnvLocator()
       
    28 		{
       
    29 			LocateEnvironmentDrives();
       
    30 		}
       
    31 		#endregion
       
    32 
       
    33 		#region Properties
       
    34 		public int Count
       
    35 		{
       
    36 			get { return iEnvironments.Count; }
       
    37 		}
       
    38 
       
    39         public EnvEntryBase this[ int aIndex ]
       
    40 		{
       
    41 			get { return iEnvironments[ aIndex ]; }
       
    42 		}
       
    43 		#endregion
       
    44 
       
    45 		#region Internal methods
       
    46 		private void LocateEnvironmentDrives()
       
    47 		{
       
    48             DriveInfo[] drives = DriveInfo.GetDrives();
       
    49             foreach ( DriveInfo drive in drives )
       
    50             {
       
    51                 if ( drive.DriveType == DriveType.Fixed )
       
    52                 {
       
    53                     EnvEntryBase environment = EnvEntryBase.New( drive );
       
    54                     bool valid = environment.IsValid;
       
    55                     if ( valid )
       
    56                     {
       
    57                         iEnvironments.Add( environment );
       
    58                     }
       
    59                 }
       
    60             }
       
    61 		}
       
    62 		#endregion
       
    63 
       
    64 		#region Internal constants
       
    65 		private const int Removable = 2; 
       
    66 		private const int LocalDisk = 3; 
       
    67 		private const int Network = 4; 
       
    68 		private const int CD = 5; 
       
    69 		private const int RAMDrive = 6;
       
    70 		#endregion
       
    71 
       
    72 		#region Data members
       
    73         private List<EnvEntryBase> iEnvironments = new List<EnvEntryBase>( 3 );
       
    74 		#endregion
       
    75 	}
       
    76 }