/// <summary> /// Sets the configuration of a plugin. /// </summary> /// <param name="typeName">The Type name of the plugin.</param> /// <param name="config">The configuration.</param> /// <returns><c>true</c> if the configuration is stored, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">If <paramref name="typeName"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">If <paramref name="typeName"/> is empty.</exception> public bool SetPluginConfiguration(string typeName, string config) { if (typeName == null) { throw new ArgumentNullException("typeName"); } if (typeName.Length == 0) { throw new ArgumentException("Type Name cannot be empty", "typeName"); } _pluginsDictionary = null; config = config != null ? config : ""; PluginEntity pluginEntity = GetPluginEntity(_wiki, typeName); if (pluginEntity == null) { pluginEntity = new PluginEntity() { PartitionKey = _wiki, RowKey = typeName, Configuration = config }; _context.AddObject(PluginsTable, pluginEntity); } else { pluginEntity.Configuration = config; _context.UpdateObject(pluginEntity); } _context.SaveChangesStandard(); return(true); }
/// <summary> /// Sets the status of a plugin. /// </summary> /// <param name="typeName">The Type name of the plugin.</param> /// <param name="enabled">The plugin status.</param> /// <returns><c>true</c> if the status is stored, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">If <paramref name="typeName"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">If <paramref name="typeName"/> is empty.</exception> public bool SetPluginStatus(string typeName, bool enabled) { if (typeName == null) { throw new ArgumentNullException("typeName"); } if (typeName.Length == 0) { throw new ArgumentException("Type Name cannot be empty", "typeName"); } _pluginsDictionary = null; PluginEntity pluginEntity = GetPluginEntity(_wiki, typeName); if (pluginEntity == null) { pluginEntity = new PluginEntity() { PartitionKey = _wiki, RowKey = typeName, Status = enabled }; _context.AddObject(PluginsTable, pluginEntity); } else { pluginEntity.Status = enabled; _context.UpdateObject(pluginEntity); } _context.SaveChangesStandard(); return(true); }