public XmlSettingsValue this[string aKey]
 {
     get
     {
         XmlSettingsValue ret = new XmlSettingsValue(string.Empty);
         //
         if (Exists(aKey))
         {
             ret = iSettings[aKey];
         }
         else
         {
             iSettings.Add(aKey, ret);
         }
         //
         return(ret);
     }
     set
     {
         if (!Exists(aKey))
         {
             iSettings.Add(aKey, value);
         }
         else
         {
             // Item already exists
             iSettings[aKey] = value;
         }
     }
 }
        public static T Convert(XmlSettingsValue aValue, T aDefault, out bool aDefaultApplied)
        {
            T ret = aDefault;

            aDefaultApplied = true;
            //
            Type srcType  = aValue.Value.GetType();
            Type destType = aDefault.GetType();

            //
            try
            {
                // Don't need to convert if source and destination types are
                // identical.
                if (srcType == destType)
                {
                    ret = (T)aValue.Value;
                }
                else
                {
                    // Don't try to convert empty strings.
                    if (aValue.Value is string && destType != typeof(string))
                    {
                        string val = ((string)aValue.Value).Trim();
                        if (val == string.Empty)
                        {
                            return(aDefault);
                        }
                    }

                    // Try the type converter instead
                    TypeConverter converter = TypeDescriptor.GetConverter(destType);
                    if (converter.CanConvertFrom(srcType))
                    {
                        if (aValue.Value is string)
                        {
                            string text = (string)aValue.Value;
                            ret = (T)converter.ConvertFromInvariantString(text);
                        }
                        else
                        {
                            ret = (T)converter.ConvertFrom(aValue.Value);
                        }
                        aDefaultApplied = false;
                    }
                    else
                    {
                        SymbianUtils.SymDebug.SymDebugger.Break();
                    }
                }
            }
            catch (System.FormatException)
            {
                SymbianUtils.SymDebug.SymDebugger.Break();
            }
            //
            return(ret);
        }
 public XmlSettingsValue this[string aCategory, string aKey]
 {
     get
     {
         XmlSettingCategory category = this[aCategory];
         XmlSettingsValue   value    = category[aKey];
         return(value);
     }
     set
     {
         XmlSettingCategory category = this[aCategory];
         category[aKey] = value;
     }
 }
 internal void ReadSettings(XmlReader aReader)
 {
     while (!aReader.EOF && aReader.Name == "item")
     {
         if (aReader.NodeType != XmlNodeType.EndElement)
         {
             string key = XmlUtils.ReadAttributeValue(aReader, "key");
             //
             XmlSettingsValue value = new XmlSettingsValue(aReader);
             iSettings.Add(key, value);
         }
         aReader.Read();
     }
     //
     SymbianUtils.SymDebug.SymDebugger.Assert(aReader.Name == Name);
 }
        internal void Add(string aKey, string aValue)
        {
            XmlSettingsValue value = new XmlSettingsValue(aValue);

            iSettings.Add(aKey, value);
        }
        public static T Convert(XmlSettingsValue aValue, T aDefault)
        {
            bool defaultApplied = false;

            return(Convert(aValue, aDefault, out defaultApplied));
        }