|
1 | 1 | using System; |
2 | 2 | using JetBrains.Annotations; |
3 | | -using Microsoft.AspNetCore.Html; |
4 | 3 | using Microsoft.AspNetCore.Http; |
5 | 4 | using Microsoft.AspNetCore.Mvc; |
6 | | -using Microsoft.AspNetCore.Mvc.Razor; |
7 | | -using Microsoft.AspNetCore.Mvc.Rendering; |
8 | 5 | using Microsoft.AspNetCore.Routing; |
9 | | -using Newtonsoft.Json; |
10 | 6 |
|
11 | | -namespace StardewModdingAPI.Web.Framework; |
| 7 | +namespace StardewModdingAPI.Web.Framework.Extensions; |
12 | 8 |
|
13 | | -/// <summary>Provides extensions on ASP.NET Core types.</summary> |
14 | | -public static class Extensions |
| 9 | +/// <summary>Provides extensions for <see cref="IUrlHelper"/>.</summary> |
| 10 | +public static class UrlHelperExtensions |
15 | 11 | { |
16 | | - /********* |
17 | | - ** Public methods |
18 | | - *********/ |
19 | | - /**** |
20 | | - ** View helpers |
21 | | - ****/ |
22 | 12 | /// <param name="helper">The URL helper to extend.</param> |
23 | 13 | extension(IUrlHelper helper) |
24 | 14 | { |
@@ -60,18 +50,4 @@ public string ContentWithCacheBust(string url) |
60 | 50 | return helper.Content($"{url}{delimiter}v={Program.CacheBustValue}"); |
61 | 51 | } |
62 | 52 | } |
63 | | - |
64 | | - /// <param name="page">The page to extend.</param> |
65 | | - extension(RazorPageBase page) |
66 | | - { |
67 | | - /// <summary>Get a serialized JSON representation of the value.</summary> |
68 | | - /// <param name="value">The value to serialize.</param> |
69 | | - /// <returns>The serialized JSON.</returns> |
70 | | - /// <remarks>This bypasses unnecessary validation (e.g. not allowing null values) in <see cref="IJsonHelper.Serialize"/>.</remarks> |
71 | | - public IHtmlContent ForJson(object? value) |
72 | | - { |
73 | | - string json = JsonConvert.SerializeObject(value); |
74 | | - return new HtmlString(json); |
75 | | - } |
76 | | - } |
77 | 53 | } |
0 commit comments