crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianUtils/XRef/XRefSettings.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 SymbianUtils.Settings;
       
    21 
       
    22 namespace SymbianUtils.XRef
       
    23 {
       
    24     public class XRefSettings : DisposableObject
       
    25     {
       
    26         #region Constructors
       
    27         public XRefSettings()
       
    28         {
       
    29             iSettings = new XmlSettings( SettingsFileName );
       
    30             iSettings.Restore();
       
    31             //
       
    32             ValidateSettings();
       
    33         }
       
    34         #endregion
       
    35 
       
    36         #region API
       
    37         #endregion
       
    38 
       
    39         #region Properties
       
    40         public static string SettingsFileName
       
    41         {
       
    42             get { return "XRefSettings.xml"; }
       
    43         }
       
    44         
       
    45         public string ServerRootPath
       
    46         {
       
    47             get
       
    48             {
       
    49                 string ret = iSettings[ "XRef", "ServerRootPath" ];
       
    50                 if ( string.IsNullOrEmpty( ret ) )
       
    51                 {
       
    52                     ret = KDefaultXRefURL;
       
    53                 }
       
    54                 return ret;
       
    55             }
       
    56             set { iSettings[ "XRef", "ServerRootPath" ] = value; }
       
    57         }
       
    58         #endregion
       
    59 
       
    60         #region Internal methods
       
    61         private void ValidateSettings()
       
    62         {
       
    63             if ( !iSettings.Exists( "XRef", "ServerRootPath" ) )
       
    64             {
       
    65                 iSettings[ "XRef", "ServerRootPath" ] = KDefaultXRefURL;
       
    66             }
       
    67         }
       
    68         #endregion
       
    69 
       
    70         #region From DisposableObject - Cleanup Framework
       
    71         protected override void CleanupUnmanagedResources()
       
    72         {
       
    73             if ( iSettings != null )
       
    74             {
       
    75                 iSettings.Store();
       
    76                 iSettings = null;
       
    77             }
       
    78         }
       
    79         #endregion
       
    80 
       
    81         #region Internal constants
       
    82         private const string KDefaultXRefURL = "http://your-xref-server-name-goes-here/";
       
    83         #endregion
       
    84 
       
    85         #region Data members
       
    86         private XmlSettings iSettings;
       
    87         #endregion
       
    88     }
       
    89 }