From 6205648e53dc1d2dbae1ef16b2780f05b2320afa Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 5 Aug 2023 23:27:50 +0100 Subject: [PATCH] refactor: rename project to OliverBooth --- Gulpfile.js | 2 +- oliverbooth.dev.sln => OliverBooth.sln | 2 +- ...DotSettings => OliverBooth.sln.DotSettings | 0 .../Middleware/CultureRedirectExtensions.cs | 0 .../Middleware/CultureRedirectMiddleware.cs | 0 .../OliverBooth.csproj | 1 - .../Pages/Contact/Index.cshtml | 0 .../Pages/Contact/JobOpportunity.cshtml | 0 .../Pages/Contact/OpenSource.cshtml | 0 .../Pages/Contact/Other.cshtml | 4 +- .../Pages/Contact/Privacy.cshtml | 0 .../Pages/Contact/Privacy.cshtml.cs | 0 .../Pages/Contact/ProjectIdea.cshtml | 0 .../Pages/Contact/TechnicalHelp.cshtml | 0 .../Pages/Error.cshtml | 4 +- .../Pages/Error.cshtml.cs | 19 +++-- .../Pages/Index.cshtml | 7 +- .../Pages/Privacy/GooglePlay.cshtml | 0 .../Pages/Privacy/GooglePlay.cshtml.cs | 0 .../Pages/Privacy/Index.cshtml | 0 .../Pages/Privacy/Index.cshtml.cs | 0 OliverBooth/Pages/Shared/_Layout.cshtml | 75 +++++++++++++++++++ .../Pages/Shared/_Layout.cshtml.css | 0 .../Shared/_ValidationScriptsPartial.cshtml | 0 .../Pages/_ViewImports.cshtml | 0 .../Pages/_ViewStart.cshtml | 0 {oliverbooth.dev => OliverBooth}/Program.cs | 4 + OliverBooth/Resources/Pages/Index.en.resx | 12 +++ OliverBooth/Resources/Pages/Index.fr.resx | 12 +++ .../RouteCultureProvider.cs | 0 oliverbooth.dev/Pages/Shared/_Layout.cshtml | 58 -------------- oliverbooth.dev/Resources/Pages/Index.en.resx | 9 --- oliverbooth.dev/Resources/Pages/Index.fr.resx | 9 --- 33 files changed, 124 insertions(+), 94 deletions(-) rename oliverbooth.dev.sln => OliverBooth.sln (91%) rename oliverbooth.dev.sln.DotSettings => OliverBooth.sln.DotSettings (100%) rename {oliverbooth.dev => OliverBooth}/Middleware/CultureRedirectExtensions.cs (100%) rename {oliverbooth.dev => OliverBooth}/Middleware/CultureRedirectMiddleware.cs (100%) rename oliverbooth.dev/oliverbooth.dev.csproj => OliverBooth/OliverBooth.csproj (93%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/Index.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/JobOpportunity.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/OpenSource.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/Other.cshtml (93%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/Privacy.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/Privacy.cshtml.cs (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/ProjectIdea.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Contact/TechnicalHelp.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Error.cshtml (85%) rename {oliverbooth.dev => OliverBooth}/Pages/Error.cshtml.cs (65%) rename {oliverbooth.dev => OliverBooth}/Pages/Index.cshtml (59%) rename {oliverbooth.dev => OliverBooth}/Pages/Privacy/GooglePlay.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Privacy/GooglePlay.cshtml.cs (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Privacy/Index.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Privacy/Index.cshtml.cs (100%) create mode 100644 OliverBooth/Pages/Shared/_Layout.cshtml rename {oliverbooth.dev => OliverBooth}/Pages/Shared/_Layout.cshtml.css (100%) rename {oliverbooth.dev => OliverBooth}/Pages/Shared/_ValidationScriptsPartial.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/_ViewImports.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Pages/_ViewStart.cshtml (100%) rename {oliverbooth.dev => OliverBooth}/Program.cs (92%) create mode 100644 OliverBooth/Resources/Pages/Index.en.resx create mode 100644 OliverBooth/Resources/Pages/Index.fr.resx rename {oliverbooth.dev => OliverBooth}/RouteCultureProvider.cs (100%) delete mode 100644 oliverbooth.dev/Pages/Shared/_Layout.cshtml delete mode 100644 oliverbooth.dev/Resources/Pages/Index.en.resx delete mode 100644 oliverbooth.dev/Resources/Pages/Index.fr.resx diff --git a/Gulpfile.js b/Gulpfile.js index 0848d35..593a648 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -6,7 +6,7 @@ const ts = require('gulp-typescript'); const terser = require('gulp-terser'); const srcDir = 'src'; -const destDir = 'oliverbooth.dev/wwwroot'; +const destDir = 'OliverBooth/wwwroot'; function compileSCSS() { return gulp.src(`${srcDir}/scss/**/*.scss`) diff --git a/oliverbooth.dev.sln b/OliverBooth.sln similarity index 91% rename from oliverbooth.dev.sln rename to OliverBooth.sln index 9c2ea01..4ecbb24 100644 --- a/oliverbooth.dev.sln +++ b/OliverBooth.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "oliverbooth.dev", "oliverbooth.dev\oliverbooth.dev.csproj", "{A58A6FA3-480C-400B-822A-3786741BF39C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OliverBooth", "OliverBooth\OliverBooth.csproj", "{A58A6FA3-480C-400B-822A-3786741BF39C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{06B0C27F-3432-41D7-B103-47B8D0EE28CC}" ProjectSection(SolutionItems) = preProject diff --git a/oliverbooth.dev.sln.DotSettings b/OliverBooth.sln.DotSettings similarity index 100% rename from oliverbooth.dev.sln.DotSettings rename to OliverBooth.sln.DotSettings diff --git a/oliverbooth.dev/Middleware/CultureRedirectExtensions.cs b/OliverBooth/Middleware/CultureRedirectExtensions.cs similarity index 100% rename from oliverbooth.dev/Middleware/CultureRedirectExtensions.cs rename to OliverBooth/Middleware/CultureRedirectExtensions.cs diff --git a/oliverbooth.dev/Middleware/CultureRedirectMiddleware.cs b/OliverBooth/Middleware/CultureRedirectMiddleware.cs similarity index 100% rename from oliverbooth.dev/Middleware/CultureRedirectMiddleware.cs rename to OliverBooth/Middleware/CultureRedirectMiddleware.cs diff --git a/oliverbooth.dev/oliverbooth.dev.csproj b/OliverBooth/OliverBooth.csproj similarity index 93% rename from oliverbooth.dev/oliverbooth.dev.csproj rename to OliverBooth/OliverBooth.csproj index f4d6cee..2ff8882 100644 --- a/oliverbooth.dev/oliverbooth.dev.csproj +++ b/OliverBooth/OliverBooth.csproj @@ -5,7 +5,6 @@ enable enable Linux - OliverBooth en en diff --git a/oliverbooth.dev/Pages/Contact/Index.cshtml b/OliverBooth/Pages/Contact/Index.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/Index.cshtml rename to OliverBooth/Pages/Contact/Index.cshtml diff --git a/oliverbooth.dev/Pages/Contact/JobOpportunity.cshtml b/OliverBooth/Pages/Contact/JobOpportunity.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/JobOpportunity.cshtml rename to OliverBooth/Pages/Contact/JobOpportunity.cshtml diff --git a/oliverbooth.dev/Pages/Contact/OpenSource.cshtml b/OliverBooth/Pages/Contact/OpenSource.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/OpenSource.cshtml rename to OliverBooth/Pages/Contact/OpenSource.cshtml diff --git a/oliverbooth.dev/Pages/Contact/Other.cshtml b/OliverBooth/Pages/Contact/Other.cshtml similarity index 93% rename from oliverbooth.dev/Pages/Contact/Other.cshtml rename to OliverBooth/Pages/Contact/Other.cshtml index a9e4e31..b787adf 100644 --- a/oliverbooth.dev/Pages/Contact/Other.cshtml +++ b/OliverBooth/Pages/Contact/Other.cshtml @@ -35,5 +35,5 @@ - - + + \ No newline at end of file diff --git a/oliverbooth.dev/Pages/Contact/Privacy.cshtml b/OliverBooth/Pages/Contact/Privacy.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/Privacy.cshtml rename to OliverBooth/Pages/Contact/Privacy.cshtml diff --git a/oliverbooth.dev/Pages/Contact/Privacy.cshtml.cs b/OliverBooth/Pages/Contact/Privacy.cshtml.cs similarity index 100% rename from oliverbooth.dev/Pages/Contact/Privacy.cshtml.cs rename to OliverBooth/Pages/Contact/Privacy.cshtml.cs diff --git a/oliverbooth.dev/Pages/Contact/ProjectIdea.cshtml b/OliverBooth/Pages/Contact/ProjectIdea.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/ProjectIdea.cshtml rename to OliverBooth/Pages/Contact/ProjectIdea.cshtml diff --git a/oliverbooth.dev/Pages/Contact/TechnicalHelp.cshtml b/OliverBooth/Pages/Contact/TechnicalHelp.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Contact/TechnicalHelp.cshtml rename to OliverBooth/Pages/Contact/TechnicalHelp.cshtml diff --git a/oliverbooth.dev/Pages/Error.cshtml b/OliverBooth/Pages/Error.cshtml similarity index 85% rename from oliverbooth.dev/Pages/Error.cshtml rename to OliverBooth/Pages/Error.cshtml index 6c7fe5f..bd8c5cb 100644 --- a/oliverbooth.dev/Pages/Error.cshtml +++ b/OliverBooth/Pages/Error.cshtml @@ -1,10 +1,10 @@ -@page "/{culture=en}/error/{code:int?}" +@page "/{culture=en}/error/{code:int?}" @model OliverBooth.Pages.ErrorModel @{ ViewData["Title"] = "Error"; } -

Error.

+

Error @(Model.StatusCode != 200 ? Model.StatusCode.ToString() : "")

An error occurred while processing your request.

@if (Model.ShowRequestId) diff --git a/oliverbooth.dev/Pages/Error.cshtml.cs b/OliverBooth/Pages/Error.cshtml.cs similarity index 65% rename from oliverbooth.dev/Pages/Error.cshtml.cs rename to OliverBooth/Pages/Error.cshtml.cs index 699bf09..7ffda5c 100644 --- a/oliverbooth.dev/Pages/Error.cshtml.cs +++ b/OliverBooth/Pages/Error.cshtml.cs @@ -8,10 +8,6 @@ namespace OliverBooth.Pages; [IgnoreAntiforgeryToken] public class ErrorModel : PageModel { - public string? RequestId { get; set; } - - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - private readonly ILogger _logger; public ErrorModel(ILogger logger) @@ -19,8 +15,21 @@ public class ErrorModel : PageModel _logger = logger; } - public void OnGet() + public string? RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + public int StatusCode { get; private set; } + + public void OnGet(int? code = null) { + StatusCode = code ?? HttpContext.Response.StatusCode; RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; + + var originalPath = "unknown"; + if (HttpContext.Items.TryGetValue("originalPath", out object? value)) + { + originalPath = value as string; + } } } diff --git a/oliverbooth.dev/Pages/Index.cshtml b/OliverBooth/Pages/Index.cshtml similarity index 59% rename from oliverbooth.dev/Pages/Index.cshtml rename to OliverBooth/Pages/Index.cshtml index 10ee484..69bfd9d 100644 --- a/oliverbooth.dev/Pages/Index.cshtml +++ b/OliverBooth/Pages/Index.cshtml @@ -5,12 +5,7 @@

@Localizer["HomeTitle"]

@Localizer["HomeSubtitle"]

-

- My primary focus is C#, though I have dabbled in several other languages such as Java, Kotlin, VB, C/C++, - Python, and others. Over the years I've built up a collection of projects. Some of which I'm extremely proud of, - and others I've quietly abandoned and buried. I'm currently working on a few projects that I hope to release in - the near future, but in the meantime, feel free to check out some of my previous work. -

+

@Localizer.GetHtml("Intro1")

I've also written a few tutorials on various topics, usually involving diff --git a/oliverbooth.dev/Pages/Privacy/GooglePlay.cshtml b/OliverBooth/Pages/Privacy/GooglePlay.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Privacy/GooglePlay.cshtml rename to OliverBooth/Pages/Privacy/GooglePlay.cshtml diff --git a/oliverbooth.dev/Pages/Privacy/GooglePlay.cshtml.cs b/OliverBooth/Pages/Privacy/GooglePlay.cshtml.cs similarity index 100% rename from oliverbooth.dev/Pages/Privacy/GooglePlay.cshtml.cs rename to OliverBooth/Pages/Privacy/GooglePlay.cshtml.cs diff --git a/oliverbooth.dev/Pages/Privacy/Index.cshtml b/OliverBooth/Pages/Privacy/Index.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Privacy/Index.cshtml rename to OliverBooth/Pages/Privacy/Index.cshtml diff --git a/oliverbooth.dev/Pages/Privacy/Index.cshtml.cs b/OliverBooth/Pages/Privacy/Index.cshtml.cs similarity index 100% rename from oliverbooth.dev/Pages/Privacy/Index.cshtml.cs rename to OliverBooth/Pages/Privacy/Index.cshtml.cs diff --git a/OliverBooth/Pages/Shared/_Layout.cshtml b/OliverBooth/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..b04e4a2 --- /dev/null +++ b/OliverBooth/Pages/Shared/_Layout.cshtml @@ -0,0 +1,75 @@ +@using System.Globalization +@using Microsoft.AspNetCore.Localization +@using Microsoft.AspNetCore.Mvc.Localization +@inject IViewLocalizer Localizer +@{ + CultureInfo? requestCulture = Context.Features.Get()?.RequestCulture.Culture; + string culture = (requestCulture ?? CultureInfo.CurrentCulture).TwoLetterISOLanguageName; +} + + + + + + Oliver Booth + + + + + + + + + + + +

+
+

+ Oliver Booth Oliver Booth +

+
+
+ +
+
+
+ @RenderBody() +
+
+ + + + + + + + +@await RenderSectionAsync("Scripts", required: false) + + \ No newline at end of file diff --git a/oliverbooth.dev/Pages/Shared/_Layout.cshtml.css b/OliverBooth/Pages/Shared/_Layout.cshtml.css similarity index 100% rename from oliverbooth.dev/Pages/Shared/_Layout.cshtml.css rename to OliverBooth/Pages/Shared/_Layout.cshtml.css diff --git a/oliverbooth.dev/Pages/Shared/_ValidationScriptsPartial.cshtml b/OliverBooth/Pages/Shared/_ValidationScriptsPartial.cshtml similarity index 100% rename from oliverbooth.dev/Pages/Shared/_ValidationScriptsPartial.cshtml rename to OliverBooth/Pages/Shared/_ValidationScriptsPartial.cshtml diff --git a/oliverbooth.dev/Pages/_ViewImports.cshtml b/OliverBooth/Pages/_ViewImports.cshtml similarity index 100% rename from oliverbooth.dev/Pages/_ViewImports.cshtml rename to OliverBooth/Pages/_ViewImports.cshtml diff --git a/oliverbooth.dev/Pages/_ViewStart.cshtml b/OliverBooth/Pages/_ViewStart.cshtml similarity index 100% rename from oliverbooth.dev/Pages/_ViewStart.cshtml rename to OliverBooth/Pages/_ViewStart.cshtml diff --git a/oliverbooth.dev/Program.cs b/OliverBooth/Program.cs similarity index 92% rename from oliverbooth.dev/Program.cs rename to OliverBooth/Program.cs index 13ead3c..ab3ce54 100644 --- a/oliverbooth.dev/Program.cs +++ b/OliverBooth/Program.cs @@ -1,7 +1,9 @@ using System.Globalization; using Microsoft.AspNetCore.Localization; +using Microsoft.Extensions.Localization; using OliverBooth; using OliverBooth.Middleware; + WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); @@ -23,6 +25,8 @@ builder.Services.Configure(options => options.SupportedUICultures = supportedCultures; }); +builder.Services.Configure(options => options.ResourcesPath = "Resources"); + WebApplication app = builder.Build(); if (!app.Environment.IsDevelopment()) diff --git a/OliverBooth/Resources/Pages/Index.en.resx b/OliverBooth/Resources/Pages/Index.en.resx new file mode 100644 index 0000000..981b991 --- /dev/null +++ b/OliverBooth/Resources/Pages/Index.en.resx @@ -0,0 +1,12 @@ + + + + Hi, I'm Oliver. + + + I'm a tech enthusiast, coffee drinker, and software developer. + + + My primary focus is C#, though I have dabbled in several other languages such as Java, Kotlin, VB, C/C++, Python, and others. Over the years I've built up a collection of projects. Some of which I'm extremely proud of, and others I've quietly abandoned and buried. I'm currently working on a few projects that I hope to release in the near future, but in the meantime, feel free to check out some of my <a asp-page="/Projects/Index">previous work.</a> + + \ No newline at end of file diff --git a/OliverBooth/Resources/Pages/Index.fr.resx b/OliverBooth/Resources/Pages/Index.fr.resx new file mode 100644 index 0000000..41b455a --- /dev/null +++ b/OliverBooth/Resources/Pages/Index.fr.resx @@ -0,0 +1,12 @@ + + + + Salut, je suis Oliver. + + + Je suis un passionné de technologie, un buveur de café, et un developpeur de logiciels. + + + Je me concentre principalement sur C#, bien que j'ai également expérimenté plusieurs autres langues telles que Java, Kotlin, VB, C / C++, Python et d'autres. Au fil des ans, j'ai constitué une collection de projets. Certains dont je suis extrêmement fier, et d'autres que j'ai tranquillement abandonnés et enterrés. Je travaille actuellement sur quelques projets que j'espère publier dans un proche avenir, mais en attendant, n'hésitez pas à consulter certains de mes <a asp-page="/Projects/Index">travaux précédents.</a> + + \ No newline at end of file diff --git a/oliverbooth.dev/RouteCultureProvider.cs b/OliverBooth/RouteCultureProvider.cs similarity index 100% rename from oliverbooth.dev/RouteCultureProvider.cs rename to OliverBooth/RouteCultureProvider.cs diff --git a/oliverbooth.dev/Pages/Shared/_Layout.cshtml b/oliverbooth.dev/Pages/Shared/_Layout.cshtml deleted file mode 100644 index 329fd35..0000000 --- a/oliverbooth.dev/Pages/Shared/_Layout.cshtml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - Oliver Booth - - - - - - - - - - - -
- -
-
-
- @RenderBody() -
-
- -
-
- © 2023 - oliverbooth.dev - Privacy -
-
- - - - - - -@await RenderSectionAsync("Scripts", required: false) - - \ No newline at end of file diff --git a/oliverbooth.dev/Resources/Pages/Index.en.resx b/oliverbooth.dev/Resources/Pages/Index.en.resx deleted file mode 100644 index 732f087..0000000 --- a/oliverbooth.dev/Resources/Pages/Index.en.resx +++ /dev/null @@ -1,9 +0,0 @@ - - - - Hi, I'm Oliver. - - - I'm a tech enthusiast, coffee drinker, and software developer. - - \ No newline at end of file diff --git a/oliverbooth.dev/Resources/Pages/Index.fr.resx b/oliverbooth.dev/Resources/Pages/Index.fr.resx deleted file mode 100644 index 59ab7d3..0000000 --- a/oliverbooth.dev/Resources/Pages/Index.fr.resx +++ /dev/null @@ -1,9 +0,0 @@ - - - - Salut, je suis Oliver. - - - Je suis un passionné de technologie, un buveur de café, et un developpeur de logiciels. - - \ No newline at end of file