From 0d5cabe7ab94ca46084ab329d433facf1499cf2e Mon Sep 17 00:00:00 2001 From: BreadDEV Date: Sun, 21 Jan 2024 11:18:08 +0700 Subject: [PATCH] Upload server files --- .../Handlers/EnvironmentHandler.cs | 20 +++++++++++++++ .../Models/Environment/EnvironmentSettings.cs | 24 ++++++++++++++++++ Supercell.Soil.SDK/Program.cs | 21 ++++++++++++++++ .../Properties/launchSettings.json | 12 +++++++++ Supercell.Soil.SDK/Supercell.Soil.SDK.csproj | 9 +++++++ .../appsettings.Development.json | 8 ++++++ Supercell.Soil.SDK/appsettings.json | 1 + Supercell.Soil.sln | 25 +++++++++++++++++++ 8 files changed, 120 insertions(+) create mode 100644 Supercell.Soil.SDK/Handlers/EnvironmentHandler.cs create mode 100644 Supercell.Soil.SDK/Models/Environment/EnvironmentSettings.cs create mode 100644 Supercell.Soil.SDK/Program.cs create mode 100644 Supercell.Soil.SDK/Properties/launchSettings.json create mode 100644 Supercell.Soil.SDK/Supercell.Soil.SDK.csproj create mode 100644 Supercell.Soil.SDK/appsettings.Development.json create mode 100644 Supercell.Soil.SDK/appsettings.json create mode 100644 Supercell.Soil.sln diff --git a/Supercell.Soil.SDK/Handlers/EnvironmentHandler.cs b/Supercell.Soil.SDK/Handlers/EnvironmentHandler.cs new file mode 100644 index 0000000..9c6285a --- /dev/null +++ b/Supercell.Soil.SDK/Handlers/EnvironmentHandler.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Http.HttpResults; +using Supercell.Soil.SDK.Models.Environment; + +namespace Supercell.Soil.SDK.Handlers; + +public static class EnvironmentHandler +{ + public static JsonHttpResult OnEnvironmentSettings() + { + return TypedResults.Json(new EnvironmentSettings() + { + Environment = "production", + AssetUrl = "", + ServerHost = "", + UpdateUrl = "", + Status = "", + Update = "" + }); + } +} diff --git a/Supercell.Soil.SDK/Models/Environment/EnvironmentSettings.cs b/Supercell.Soil.SDK/Models/Environment/EnvironmentSettings.cs new file mode 100644 index 0000000..b928f4a --- /dev/null +++ b/Supercell.Soil.SDK/Models/Environment/EnvironmentSettings.cs @@ -0,0 +1,24 @@ +using System.Text.Json.Serialization; + +namespace Supercell.Soil.SDK.Models.Environment; + +public record EnvironmentSettings +{ + [JsonPropertyName("environment")] + public required string Environment { get; set; } + + [JsonPropertyName("assetUrl")] + public string? AssetUrl { get; set; } + + [JsonPropertyName("serverHost")] + public string? ServerHost { get; set; } + + [JsonPropertyName("updateUrl")] + public string? UpdateUrl { get; set; } + + [JsonPropertyName("status")] + public string? Status { get; set; } + + [JsonPropertyName("update")] + public required string Update { get; set; } +} diff --git a/Supercell.Soil.SDK/Program.cs b/Supercell.Soil.SDK/Program.cs new file mode 100644 index 0000000..bdafd54 --- /dev/null +++ b/Supercell.Soil.SDK/Program.cs @@ -0,0 +1,21 @@ +using Supercell.Soil.SDK.Handlers; + +namespace Supercell.Soil.SDK; + +internal static class Program +{ + private static async Task Main(string[] args) + { + Console.Title = "Supercell.Soil | SDK"; + + WebApplicationBuilder builder = WebApplication.CreateBuilder(args); + + builder.WebHost.UseUrls("http://*:8080"); + + WebApplication app = builder.Build(); + + app.MapGet("/env_settings", EnvironmentHandler.OnEnvironmentSettings); + + await app.RunAsync(); + } +} \ No newline at end of file diff --git a/Supercell.Soil.SDK/Properties/launchSettings.json b/Supercell.Soil.SDK/Properties/launchSettings.json new file mode 100644 index 0000000..391c04a --- /dev/null +++ b/Supercell.Soil.SDK/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Supercell.Soil.SDK": { + "commandName": "Project", + "applicationUrl": "http://*:8080", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/Supercell.Soil.SDK/Supercell.Soil.SDK.csproj b/Supercell.Soil.SDK/Supercell.Soil.SDK.csproj new file mode 100644 index 0000000..1b28a01 --- /dev/null +++ b/Supercell.Soil.SDK/Supercell.Soil.SDK.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/Supercell.Soil.SDK/appsettings.Development.json b/Supercell.Soil.SDK/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Supercell.Soil.SDK/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Supercell.Soil.SDK/appsettings.json b/Supercell.Soil.SDK/appsettings.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/Supercell.Soil.SDK/appsettings.json @@ -0,0 +1 @@ +{} diff --git a/Supercell.Soil.sln b/Supercell.Soil.sln new file mode 100644 index 0000000..b1d0933 --- /dev/null +++ b/Supercell.Soil.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34316.72 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Supercell.Soil.SDK", "Supercell.Soil.SDK\Supercell.Soil.SDK.csproj", "{D7836B7D-C192-4824-94AC-79EF57FB4AC2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D7836B7D-C192-4824-94AC-79EF57FB4AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7836B7D-C192-4824-94AC-79EF57FB4AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7836B7D-C192-4824-94AC-79EF57FB4AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7836B7D-C192-4824-94AC-79EF57FB4AC2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AFC5BCA6-AA78-4B23-9DAC-4FFFE7A9873F} + EndGlobalSection +EndGlobal