Skip to content

Commit d658126

Browse files
WIP
1 parent 8818ded commit d658126

27 files changed

+694
-965
lines changed

DeveloperTools/Controllers/ContentTypeAnalyzerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Text;
4-
using System.Web.Mvc;
54
using DeveloperTools.Models;
65
using EPiServer.DataAbstraction;
76
using EPiServer.DataAbstraction.RuntimeModel;
87
using EPiServer.Security;
8+
using Microsoft.AspNetCore.Mvc;
99

1010
namespace DeveloperTools.Controllers
1111
{
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
using System;
2-
using System.Web.Mvc;
32
using EPiServer.Security;
3+
using Microsoft.AspNetCore.Mvc;
44

55
namespace DeveloperTools.Controllers
66
{
77
public class DeveloperToolsController : Controller
88
{
9-
protected override void OnAuthorization(AuthorizationContext filterContext)
10-
{
11-
if(!PrincipalInfo.HasAdminAccess)
12-
{
13-
throw new UnauthorizedAccessException();
14-
}
9+
//protected override void OnAuthorization(AuthorizationContext filterContext)
10+
//{
11+
// if(!PrincipalInfo.HasAdminAccess)
12+
// {
13+
// throw new UnauthorizedAccessException();
14+
// }
1515

16-
base.OnAuthorization(filterContext);
17-
}
16+
// base.OnAuthorization(filterContext);
17+
//}
1818
}
1919
}

DeveloperTools/Controllers/IOCController.cs

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using System.Reflection;
5-
using System.Web.Mvc;
64
using DeveloperTools.Models;
75
using EPiServer.Framework.Initialization;
8-
using EPiServer.ServiceLocation.Internal;
6+
using EPiServer.Web;
7+
using Microsoft.AspNetCore.Mvc;
98

109
namespace DeveloperTools.Controllers
1110
{
1211
public class IOCController : DeveloperToolsController
1312
{
1413
public ActionResult Index()
1514
{
16-
var ie = (InitializationEngine) typeof(InitializationModule).GetField("_engine", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
15+
//var ie = (InitializationEngine) typeof(InitializationModule).GetField("_engine", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
1716

18-
var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null) as StructureMapConfiguration;
17+
//var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null) as StructureMapConfiguration;
1918

20-
var iocEntries = new List<IOCEntry>();
21-
var typeErrors = new List<string>();
19+
//var iocEntries = new List<IOCEntry>();
20+
//var typeErrors = new List<string>();
2221

23-
if (services != null)
24-
{
25-
var container = services.Container;
22+
//if (services != null)
23+
//{
24+
// var container = services.Container;
2625

27-
foreach (var plugin in container.Model.PluginTypes)
28-
{
29-
try
30-
{
31-
var defaultType = plugin.Default?.ReturnedType;
32-
if (plugin.Default != null && defaultType == null)
33-
{
34-
defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType();
35-
}
26+
// foreach (var plugin in container.Model.PluginTypes)
27+
// {
28+
// try
29+
// {
30+
// var defaultType = plugin.Default?.ReturnedType;
31+
// if (plugin.Default != null && defaultType == null)
32+
// {
33+
// defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType();
34+
// }
3635

37-
foreach (var entry in plugin.Instances.Where(i => i != null))
38-
{
39-
var concreteType = entry.ReturnedType;
40-
if (concreteType == null && entry.PluginType.ContainsGenericParameters == false)
41-
{
42-
concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType();
43-
}
36+
// foreach (var entry in plugin.Instances.Where(i => i != null))
37+
// {
38+
// var concreteType = entry.ReturnedType;
39+
// if (concreteType == null && entry.PluginType.ContainsGenericParameters == false)
40+
// {
41+
// concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType();
42+
// }
4443

45-
iocEntries.Add(new IOCEntry
46-
{
47-
PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}",
48-
ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}",
44+
// iocEntries.Add(new IOCEntry
45+
// {
46+
// PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}",
47+
// ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}",
4948

50-
Scope = plugin.Lifecycle.ToString(),
51-
IsDefault = defaultType == concreteType
52-
});
53-
}
54-
}
55-
catch (Exception ex)
56-
{
57-
typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message);
58-
}
59-
}
60-
}
49+
// Scope = plugin.Lifecycle.ToString(),
50+
// IsDefault = defaultType == concreteType
51+
// });
52+
// }
53+
// }
54+
// catch (Exception ex)
55+
// {
56+
// typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message);
57+
// }
58+
// }
59+
//}
6160

62-
var model = new IOCModel { IOCEntries = iocEntries, LoadingErrors = typeErrors };
61+
var model = new IOCModel
62+
{
63+
//IOCEntries = iocEntries,
64+
//LoadingErrors = typeErrors
65+
};
6366

6467
return View(model);
6568
}

DeveloperTools/Controllers/LoadedAssembliesController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using System.Diagnostics;
44
using System.Linq;
55
using System.Reflection;
6-
using System.Web.Mvc;
76
using DeveloperTools.Models;
7+
using Microsoft.AspNetCore.Mvc;
88

99
namespace DeveloperTools.Controllers
1010
{

DeveloperTools/Controllers/LocalObjectCacheController.cs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,35 @@
44
using System.IO;
55
using System.Linq;
66
using System.Runtime.Serialization.Formatters.Binary;
7-
using System.Web.Mvc;
8-
using System.Web.Routing;
97
using DeveloperTools.Core;
108
using DeveloperTools.Models;
119
using EPiServer.Core;
1210
using EPiServer.Framework.Cache;
11+
using Microsoft.AspNetCore.Http;
12+
using Microsoft.AspNetCore.Mvc;
13+
using Microsoft.AspNetCore.Mvc.Rendering;
14+
using Microsoft.AspNetCore.Routing;
15+
using Microsoft.Extensions.Caching.Memory;
1316

1417
namespace DeveloperTools.Controllers
1518
{
1619
public class LocalObjectCacheController : DeveloperToolsController
1720
{
1821
private readonly ISynchronizedObjectInstanceCache _cache;
22+
private readonly IMemoryCache _memoryCache;
1923

20-
public LocalObjectCacheController(ISynchronizedObjectInstanceCache cache)
24+
public LocalObjectCacheController(ISynchronizedObjectInstanceCache cache, IMemoryCache memoryCache)
2125
{
2226
_cache = cache;
27+
_memoryCache = memoryCache;
2328
}
2429

2530
public ActionResult Index(string FilteredBy, bool os = false)
2631
{
2732
return View(PrepareViewModel(FilteredBy, os));
2833
}
2934

30-
[HttpParamAction]
35+
//[HttpParamAction]
3136
[HttpPost]
3237
public ActionResult RemoveLocalCache(string[] cacheKeys, bool os)
3338
{
@@ -42,7 +47,7 @@ public ActionResult RemoveLocalCache(string[] cacheKeys, bool os)
4247
return RedirectToAction(nameof(Index), new RouteValueDictionary(new { os }));
4348
}
4449

45-
[HttpParamAction]
50+
//[HttpParamAction]
4651
[HttpPost]
4752
public ActionResult RemoveLocalRemoteCache(string[] cacheKeys, bool os)
4853
{
@@ -58,7 +63,7 @@ public ActionResult RemoveLocalRemoteCache(string[] cacheKeys, bool os)
5863
return RedirectToAction(nameof(Index), new RouteValueDictionary(new { os }));
5964
}
6065

61-
[HttpParamAction]
66+
//[HttpParamAction]
6267
[HttpPost]
6368
public ActionResult ViewObjectSize()
6469
{
@@ -69,20 +74,20 @@ private LocalObjectCache PrepareViewModel(string FilteredBy, bool viewObjectSize
6974
{
7075
var model = new LocalObjectCache();
7176

72-
var cachedEntries = HttpContext.Cache.Cast<DictionaryEntry>().Take(10_000);
73-
74-
switch (FilteredBy)
75-
{
76-
case "pages":
77-
model.CachedItems = ConvertToListItem(cachedEntries.Where(item => item.Value is PageData), viewObjectSize);
78-
break;
79-
case "content":
80-
model.CachedItems = ConvertToListItem(cachedEntries.Where(item => item.Value is IContent), viewObjectSize);
81-
break;
82-
default:
83-
model.CachedItems = ConvertToListItem(cachedEntries, viewObjectSize);
84-
break;
85-
}
77+
//var cachedEntries = _memoryCache.Cast<DictionaryEntry>().Take(10_000);
78+
79+
//switch (FilteredBy)
80+
//{
81+
// case "pages":
82+
// model.CachedItems = ConvertToListItem(cachedEntries.Where(item => item.Value is PageData), viewObjectSize);
83+
// break;
84+
// case "content":
85+
// model.CachedItems = ConvertToListItem(cachedEntries.Where(item => item.Value is IContent), viewObjectSize);
86+
// break;
87+
// default:
88+
// model.CachedItems = ConvertToListItem(cachedEntries, viewObjectSize);
89+
// break;
90+
//}
8691

8792
model.FilteredBy = FilteredBy;
8893
model.Choices = new[]

0 commit comments

Comments
 (0)