From 6bd47a4e337395bb85f776d459112e8a2c2696f2 Mon Sep 17 00:00:00 2001 From: cheshire Date: Fri, 25 Aug 2023 17:18:14 +0200 Subject: [PATCH] Initial commit --- .gitignore | 134 ++++++++++++++++++ .../Controllers/WeatherForecastController.cs | 32 +++++ Game.API/Game.API.csproj | 14 ++ Game.API/Program.cs | 25 ++++ Game.API/Properties/launchSettings.json | 41 ++++++ Game.API/WeatherForecast.cs | 12 ++ Game.API/appsettings.Development.json | 8 ++ Game.API/appsettings.json | 9 ++ Game.Library/Class1.cs | 5 + Game.Library/Game.Library.csproj | 9 ++ Game.Tests/Game.Tests.csproj | 20 +++ Game.Tests/UnitTest1.cs | 15 ++ Game.Tests/Usings.cs | 1 + README.md | 3 + nuget.config | 8 ++ 15 files changed, 336 insertions(+) create mode 100644 .gitignore create mode 100644 Game.API/Controllers/WeatherForecastController.cs create mode 100644 Game.API/Game.API.csproj create mode 100644 Game.API/Program.cs create mode 100644 Game.API/Properties/launchSettings.json create mode 100644 Game.API/WeatherForecast.cs create mode 100644 Game.API/appsettings.Development.json create mode 100644 Game.API/appsettings.json create mode 100644 Game.Library/Class1.cs create mode 100644 Game.Library/Game.Library.csproj create mode 100644 Game.Tests/Game.Tests.csproj create mode 100644 Game.Tests/UnitTest1.cs create mode 100644 Game.Tests/Usings.cs create mode 100644 README.md create mode 100644 nuget.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71f8943 --- /dev/null +++ b/.gitignore @@ -0,0 +1,134 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.svclog +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.azurePubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +packages/ +## TODO: If the tool you use requires repositories.config, also uncomment the next line +!packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +![Ss]tyle[Cc]op.targets +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml + +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +_NCrunch* +.vs \ No newline at end of file diff --git a/Game.API/Controllers/WeatherForecastController.cs b/Game.API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..99af45c --- /dev/null +++ b/Game.API/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Game.API.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} diff --git a/Game.API/Game.API.csproj b/Game.API/Game.API.csproj new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/Game.API/Game.API.csproj @@ -0,0 +1,14 @@ + + + + net7.0 + enable + enable + + + + + + + + diff --git a/Game.API/Program.cs b/Game.API/Program.cs new file mode 100644 index 0000000..15eacee --- /dev/null +++ b/Game.API/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Game.API/Properties/launchSettings.json b/Game.API/Properties/launchSettings.json new file mode 100644 index 0000000..8db1fb3 --- /dev/null +++ b/Game.API/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:14269", + "sslPort": 44356 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5024", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7119;http://localhost:5024", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Game.API/WeatherForecast.cs b/Game.API/WeatherForecast.cs new file mode 100644 index 0000000..388d45c --- /dev/null +++ b/Game.API/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace Game.API; + +public class WeatherForecast +{ + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} diff --git a/Game.API/appsettings.Development.json b/Game.API/appsettings.Development.json new file mode 100644 index 0000000..ff66ba6 --- /dev/null +++ b/Game.API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Game.API/appsettings.json b/Game.API/appsettings.json new file mode 100644 index 0000000..4d56694 --- /dev/null +++ b/Game.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Game.Library/Class1.cs b/Game.Library/Class1.cs new file mode 100644 index 0000000..918d8e7 --- /dev/null +++ b/Game.Library/Class1.cs @@ -0,0 +1,5 @@ +namespace Game.Library; +public class Class1 +{ + +} diff --git a/Game.Library/Game.Library.csproj b/Game.Library/Game.Library.csproj new file mode 100644 index 0000000..4658cbf --- /dev/null +++ b/Game.Library/Game.Library.csproj @@ -0,0 +1,9 @@ + + + + net7.0 + enable + enable + + + diff --git a/Game.Tests/Game.Tests.csproj b/Game.Tests/Game.Tests.csproj new file mode 100644 index 0000000..02678d1 --- /dev/null +++ b/Game.Tests/Game.Tests.csproj @@ -0,0 +1,20 @@ + + + + net7.0 + enable + enable + + false + true + + + + + + + + + + + diff --git a/Game.Tests/UnitTest1.cs b/Game.Tests/UnitTest1.cs new file mode 100644 index 0000000..160c59f --- /dev/null +++ b/Game.Tests/UnitTest1.cs @@ -0,0 +1,15 @@ +namespace Game.Tests; + +public class Tests +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } +} \ No newline at end of file diff --git a/Game.Tests/Usings.cs b/Game.Tests/Usings.cs new file mode 100644 index 0000000..cefced4 --- /dev/null +++ b/Game.Tests/Usings.cs @@ -0,0 +1 @@ +global using NUnit.Framework; \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..33b45ac --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# The Game + +Projekt wewnętrznej gry spejsowej. \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..bb42c33 --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + +