crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/FileSystem/FSDeletableResource.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 
       
    22 namespace SymbianUtils.FileSystem
       
    23 {
       
    24     public class FSDeletableResource : DisposableObject
       
    25     {
       
    26         #region Constructors
       
    27         public FSDeletableResource( string aFileName )
       
    28             : this( new FileInfo( aFileName ) )
       
    29         {
       
    30         }
       
    31 
       
    32         public FSDeletableResource( FileInfo aFile )
       
    33         {
       
    34             iFile = aFile;
       
    35         }
       
    36         #endregion
       
    37 
       
    38         #region Properties
       
    39         public FileInfo File
       
    40         {
       
    41             get { return iFile; }
       
    42         }
       
    43 
       
    44         public string FileName
       
    45         {
       
    46             get { return iFile.FullName; }
       
    47         }
       
    48         #endregion
       
    49 
       
    50         #region DisposableObject
       
    51         protected override void CleanupManagedResources()
       
    52         {
       
    53             try
       
    54             {
       
    55                 base.CleanupManagedResources();
       
    56             }
       
    57             finally
       
    58             {
       
    59                 if ( iFile != null )
       
    60                 {
       
    61                     Utilities.FSUtilities.DeleteFile( iFile.FullName );
       
    62                 }
       
    63                 iFile = null;
       
    64             }
       
    65         }
       
    66         #endregion
       
    67 
       
    68         #region Data members
       
    69         private FileInfo iFile = null;
       
    70         #endregion
       
    71     }
       
    72 }