static List<JsonPackage> GetWidgets()
{
var installedWidgets = new List<JsonPackage>();
var path = HttpContext.Current.Server.MapPath(string.Format("{0}widgets/", Utils.ApplicationRelativeWebRoot));
foreach (var p in from d in Directory.GetDirectories(path)
let index = d.LastIndexOf(Path.DirectorySeparatorChar) + 1
select d.Substring(index)
into widgetId select GetPackageManifest(widgetId, Constants.Widget) ??
new JsonPackage {Id = widgetId, PackageType = Constants.Widget, Location = "L"})
{
if (string.IsNullOrEmpty(p.IconUrl))
p.IconUrl = DefaultIconUrl(p);
installedWidgets.Add(p);
}
return installedWidgets;
}