static SettingsProperty CreateSettingsProperty (ProfileGroupSettings pgs, ProfilePropertySettings pps)
{
string name = ((pgs == null) ? String.Empty : pgs.Name + ".") + pps.Name;
SettingsProperty sp = new SettingsProperty (name);
sp.Attributes.Add ("AllowAnonymous", pps.AllowAnonymous);
sp.DefaultValue = pps.DefaultValue;
sp.IsReadOnly = pps.ReadOnly;
sp.Provider = ProfileManager.Provider;
sp.ThrowOnErrorDeserializing = false;
sp.ThrowOnErrorSerializing = true;
if (pps.Type.Length == 0 || pps.Type == "string")
sp.PropertyType = typeof (string);
else
sp.PropertyType = GetPropertyType (pgs, pps);
switch (pps.SerializeAs) {
case SerializationMode.Binary:
sp.SerializeAs = SettingsSerializeAs.Binary;
break;
case SerializationMode.ProviderSpecific:
sp.SerializeAs = SettingsSerializeAs.ProviderSpecific;
break;
case SerializationMode.String:
sp.SerializeAs = SettingsSerializeAs.String;
break;
case SerializationMode.Xml:
sp.SerializeAs = SettingsSerializeAs.Xml;
break;
}
return sp;
}