private static void HandleSettings(ApiRequest request)
{
if(request.HttpMethod != HttpMethods.Get)
throw new ApplicationException(request.LocalPath()+" only implements 'get'");
var settings = new Dictionary<string, object>
{
{"current", request.CurrentBook.BookInfo.CurrentTool}
};
foreach (var tool in GetToolsToDisplay(request.CurrentBook, IdsOfToolsThisVersionKnowsAbout))
{
if (!String.IsNullOrEmpty(tool.State))
settings.Add(tool.StateName, tool.State);
}
request.ReplyWithJson(settings);
}