internal virtual void ReadXml(XmlElement node) { switch (node.Attributes["type"].Value) { case "controller": _Type = ConfigurationSectionType.Controller; break; case "layout": _Type = ConfigurationSectionType.Layout; break; case "plugininstance": _Type = ConfigurationSectionType.PluginInstance; break; case "custom": _Type = ConfigurationSectionType.Custom; break; default: throw new Exception("Unknown configuration section type " + node.Attributes["type"] + "."); } _Id = node.Attributes["id"].Value; _Version = int.Parse(node.Attributes["Version"].Value); }
public static bool Encrypt(ConfigurationSectionType section) { bool result = false; Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (config == null) { throw new Exception("Cannot open the configuration file."); } if (section.HasFlag(ConfigurationSectionType.ConnectionStrings)) { result = result || EncryptSection(config, "connectionStrings"); } if (section.HasFlag(ConfigurationSectionType.ApplicationSettings)) { result = result || EncryptSection(config, "appSettings"); } return(result); }