qol: interpolated strings

This commit is contained in:
Gary Sharp
2025-07-20 11:56:34 +10:00
parent 4e518d6684
commit 7faebe56a8
108 changed files with 342 additions and 350 deletions
+4 -4
View File
@@ -44,7 +44,7 @@ namespace Disco.Services.Web.Bundles
var bundle = GetBundleFor(BundleUrl);
if (bundle == null)
throw new ArgumentException(string.Format("Unknown Bundle Url: {0}", BundleUrl), "BundleUrl");
throw new ArgumentException($"Unknown Bundle Url: {BundleUrl}", "BundleUrl");
return VirtualPathUtility.ToAbsolute(bundle.VersionUrl);
}
@@ -53,16 +53,16 @@ namespace Disco.Services.Web.Bundles
var bundle = GetBundleFor(BundleUrl);
if (bundle == null)
throw new ArgumentException(string.Format("Unknown Bundle Url: {0}", BundleUrl), "BundleUrl");
throw new ArgumentException($"Unknown Bundle Url: {BundleUrl}", "BundleUrl");
var bundleUrl = VirtualPathUtility.ToAbsolute(bundle.VersionUrl);
switch (bundle.ContentType)
{
case "text/css":
return string.Format("<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" />", bundleUrl);
return $"<link href=\"{bundleUrl}\" rel=\"stylesheet\" type=\"text/css\" />";
case "text/javascript":
return string.Format("<script src=\"{0}\" type=\"text/javascript\"></script>", bundleUrl);
return $"<script src=\"{bundleUrl}\" type=\"text/javascript\"></script>";
default:
throw new ArgumentException("Unsupported Bundle Content Type", "BundleUrl");
}
+3 -3
View File
@@ -30,7 +30,7 @@ namespace Disco.Services.Web.Bundles
get
{
#if DEBUG
return string.Format("{0}?v={1}", Url, FileHash);
return $"{Url}?v={FileHash}";
#else
return _VersionUrl;
#endif
@@ -53,7 +53,7 @@ namespace Disco.Services.Web.Bundles
var fileInfo = new FileInfo(File);
if (!fileInfo.Exists)
throw new FileNotFoundException(string.Format("Not Found: {0}", File), File);
throw new FileNotFoundException($"Not Found: {File}", File);
this.Url = Url;
this.File = File;
@@ -78,7 +78,7 @@ namespace Disco.Services.Web.Bundles
//this.Version = fileInfo.LastWriteTimeUtc.Ticks;
_VersionUrl = string.Format("{0}?v={1}", this.Url, FileHash);
_VersionUrl = $"{this.Url}?v={FileHash}";
}
private void UpdateFileHash()
+1 -1
View File
@@ -53,7 +53,7 @@ namespace Disco.Services.Web
var resource = accessDeniedException.Resource;
var httpContext = HttpContext.Current;
if (httpContext != null && httpContext.Request != null)
resource = string.Format("{0} [{1}]", resource, httpContext.Request.RawUrl);
resource = $"{resource} [{httpContext.Request.RawUrl}]";
AuthorizationLog.LogAccessDenied(UserService.CurrentUserId ?? "[Anonymous]", resource, accessDeniedException.Message);
}