move backend to subfolder
|  | @ -1,48 +0,0 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <TargetFramework>net8.0</TargetFramework> | ||||
|         <Nullable>enable</Nullable> | ||||
|         <ImplicitUsings>disable</ImplicitUsings> | ||||
|         <InvariantGlobalization>true</InvariantGlobalization> | ||||
|         <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <AnalysisMode>Recommended</AnalysisMode> | ||||
|         <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||||
|         <NoWarn>CA1805,CA1848</NoWarn> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <IsAotCompatible>true</IsAotCompatible> | ||||
|         <PublishAot>true</PublishAot> | ||||
| 
 | ||||
|         <IlcDisableReflection>false</IlcDisableReflection> | ||||
|         <StaticExecutable>true</StaticExecutable> | ||||
|         <StripSymbols>true</StripSymbols> | ||||
|         <StaticallyLinked>true</StaticallyLinked> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0"/> | ||||
|         <PackageReference Include="SixLabors.ImageSharp" Version="3.1.3"/> | ||||
|         <ProjectReference Include="../DisplayCommands/DisplayCommands.csproj"/> | ||||
|     </ItemGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|         <None Include="./assets/tank.png" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always"/> | ||||
| 
 | ||||
|         <Content Include="../Dockerfile"> | ||||
|             <Link>Dockerfile</Link> | ||||
|         </Content> | ||||
|         <Content Include="../.dockerignore"> | ||||
|             <Link>Dockerfile</Link> | ||||
|         </Content> | ||||
|         <Content Include="../Makefile"/> | ||||
|         <Content Include="../.editorconfig"/> | ||||
|         <Content Include="../README.md"/> | ||||
|         <None Include="assets\maps\**" CopyToOutputDirectory="PreserveNewest"/> | ||||
|     </ItemGroup> | ||||
| 
 | ||||
| </Project> | ||||
|  | @ -1,18 +1,10 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <TargetFramework>net8.0</TargetFramework> | ||||
|         <ImplicitUsings>disable</ImplicitUsings> | ||||
|         <Nullable>enable</Nullable> | ||||
|         <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||
|         <IsAotCompatible>true</IsAotCompatible> | ||||
|         <EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator> | ||||
|     </PropertyGroup> | ||||
|     <Import Project="../shared.props" /> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <AnalysisMode>Recommended</AnalysisMode> | ||||
|         <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||||
|         <NoWarn>CA1805,CA1848</NoWarn> | ||||
|         <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||
|         <EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|  | @ -171,35 +171,36 @@ public class StructEndiannessSourceGenerator : ISourceGenerator | |||
|         return PropertyDeclaration(ParseTypeName(typeName), propertyName) | ||||
|             .WithModifiers(TokenList([Token(SyntaxKind.PublicKeyword)])) | ||||
|             .WithAccessorList(AccessorList(List<AccessorDeclarationSyntax>([ | ||||
|                 AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) | ||||
|                     .WithExpressionBody(ArrowExpressionClause(ConditionalExpression( | ||||
|                         condition: condition, | ||||
|                         whenTrue: fieldIdentifier, | ||||
|                         whenFalse: InvocationExpression( | ||||
|                             expression: reverseEndiannessMethod, | ||||
|                             argumentList: ArgumentList(SingletonSeparatedList( | ||||
|                                 Argument(fieldIdentifier) | ||||
|                             )) | ||||
|                         ) | ||||
|                     ))) | ||||
|                     .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)), | ||||
|                 AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) | ||||
|                     .WithExpressionBody(ArrowExpressionClause(AssignmentExpression( | ||||
|                         kind: SyntaxKind.SimpleAssignmentExpression, | ||||
|                         left: fieldIdentifier, | ||||
|                         right: ConditionalExpression( | ||||
|                     AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) | ||||
|                         .WithExpressionBody(ArrowExpressionClause(ConditionalExpression( | ||||
|                             condition: condition, | ||||
|                             whenTrue: valueIdentifier, | ||||
|                             whenTrue: fieldIdentifier, | ||||
|                             whenFalse: InvocationExpression( | ||||
|                                 expression: reverseEndiannessMethod, | ||||
|                                 argumentList: ArgumentList(SingletonSeparatedList( | ||||
|                                     Argument(valueIdentifier) | ||||
|                                     Argument(fieldIdentifier) | ||||
|                                 )) | ||||
|                             ) | ||||
|                         ) | ||||
|                     ))) | ||||
|                     .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) | ||||
|             ]))); | ||||
|                         ))) | ||||
|                         .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)), | ||||
|                     AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) | ||||
|                         .WithExpressionBody(ArrowExpressionClause(AssignmentExpression( | ||||
|                             kind: SyntaxKind.SimpleAssignmentExpression, | ||||
|                             left: fieldIdentifier, | ||||
|                             right: ConditionalExpression( | ||||
|                                 condition: condition, | ||||
|                                 whenTrue: valueIdentifier, | ||||
|                                 whenFalse: InvocationExpression( | ||||
|                                     expression: reverseEndiannessMethod, | ||||
|                                     argumentList: ArgumentList(SingletonSeparatedList( | ||||
|                                         Argument(valueIdentifier) | ||||
|                                     )) | ||||
|                                 ) | ||||
|                             ) | ||||
|                         ))) | ||||
|                         .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) | ||||
|                 ])) | ||||
|             ); | ||||
|     } | ||||
| 
 | ||||
|     private static SyntaxToken GeneratePropertyName(string fieldName) | ||||
|  | @ -1,5 +1,7 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
| 
 | ||||
|     <Import Project="../shared.props" /> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <TargetFramework>netstandard2.0</TargetFramework> | ||||
|         <IsPackable>false</IsPackable> | ||||
|  | @ -9,6 +11,7 @@ | |||
|         <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||||
|         <IsRoslynComponent>true</IsRoslynComponent> | ||||
|         <PackageId>EndiannessSourceGenerator</PackageId> | ||||
|         <IsAotCompatible>false</IsAotCompatible> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|  | @ -17,7 +20,6 @@ | |||
|             <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||
|         </PackageReference> | ||||
|         <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" /> | ||||
|         <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2"/> | ||||
|     </ItemGroup> | ||||
| 
 | ||||
| </Project> | ||||
|  | @ -0,0 +1,9 @@ | |||
| { | ||||
|     "$schema": "http://json.schemastore.org/launchsettings.json", | ||||
|     "profiles": { | ||||
|         "Generators": { | ||||
|             "commandName": "DebugRoslynComponent", | ||||
|             "targetProject": "../DisplayCommands/DisplayCommands.csproj" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -6,6 +6,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisplayCommands", "DisplayC | |||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EndiannessSourceGenerator", "EndiannessSourceGenerator\EndiannessSourceGenerator.csproj", "{D77FE880-F2B8-43B6-8B33-B6FA089CC337}" | ||||
| EndProject | ||||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{12DB7D48-1BB2-488B-B4D9-4126087D2F8C}" | ||||
| 	ProjectSection(SolutionItems) = preProject | ||||
| 		global.json = global.json | ||||
| 		shared.props = shared.props | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
|  | @ -75,5 +75,4 @@ internal static class Endpoints | |||
|             return Results.Ok(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -20,7 +20,7 @@ internal sealed class TankSpawnQueue( | |||
|         _spawnTimes.AddOrUpdate(player, DateTime.MinValue, (_, _) => DateTime.Now + _spawnDelay); | ||||
|     } | ||||
| 
 | ||||
|     public bool TryDequeueNext([MaybeNullWhen(false)] out Player player) | ||||
|     private bool TryDequeueNext([MaybeNullWhen(false)] out Player player) | ||||
|     { | ||||
|         if (!_queue.TryDequeue(out player)) | ||||
|             return false; // no one on queue | ||||
|  | @ -14,7 +14,7 @@ internal sealed record class NameId(string Name, Guid Id); | |||
| 
 | ||||
| public static class Program | ||||
| { | ||||
|     public static void Main(string[] args) | ||||
|     public static async Task Main(string[] args) | ||||
|     { | ||||
|         var app = Configure(args); | ||||
| 
 | ||||
|  | @ -24,7 +24,7 @@ public static class Program | |||
| 
 | ||||
|         Endpoints.MapEndpoints(app); | ||||
| 
 | ||||
|         app.Run(); | ||||
|         await app.RunAsync(); | ||||
|     } | ||||
| 
 | ||||
|     private static WebApplication Configure(string[] args) | ||||
							
								
								
									
										26
									
								
								tanks-backend/TanksServer/TanksServer.csproj
									
										
									
									
									
										Normal file
									
								
							
							
						
						|  | @ -0,0 +1,26 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| 
 | ||||
|     <Import Project="../shared.props" /> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <PublishAot>true</PublishAot> | ||||
| 
 | ||||
|         <IlcDisableReflection>false</IlcDisableReflection> | ||||
|         <StaticExecutable>true</StaticExecutable> | ||||
|         <StripSymbols>true</StripSymbols> | ||||
|         <StaticallyLinked>true</StaticallyLinked> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0"/> | ||||
|         <PackageReference Include="SixLabors.ImageSharp" Version="3.1.4"/> | ||||
|         <ProjectReference Include="../DisplayCommands/DisplayCommands.csproj"/> | ||||
|     </ItemGroup> | ||||
| 
 | ||||
|     <ItemGroup> | ||||
|         <None Include="./assets/tank.png" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always"/> | ||||
|         <!-- TODO include maps in release --> | ||||
|         <None Include="./assets/maps/**" CopyToOutputDirectory="PreserveNewest"/> | ||||
|     </ItemGroup> | ||||
| 
 | ||||
| </Project> | ||||
							
								
								
									
										
											BIN
										
									
								
								tanks-backend/TanksServer/assets/maps/chaosknoten.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 2.2 KiB | 
| Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB | 
| Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 112 B | 
| Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B | 
|  | @ -10,5 +10,8 @@ GET localhost/map | |||
| 
 | ||||
| ### | ||||
| 
 | ||||
| POST localhost/map?index=0 | ||||
| POST localhost/map?name=chaosknoten.png | ||||
| 
 | ||||
| ### | ||||
| 
 | ||||
| POST localhost/map?name=tanks.txt | ||||
							
								
								
									
										20
									
								
								tanks-backend/shared.props
									
										
									
									
									
										Normal file
									
								
							
							
						
						|  | @ -0,0 +1,20 @@ | |||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <TargetFramework>net8.0</TargetFramework> | ||||
|         <ImplicitUsings>disable</ImplicitUsings> | ||||
|         <Nullable>enable</Nullable> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <IsAotCompatible>true</IsAotCompatible> | ||||
|         <InvariantGlobalization>true</InvariantGlobalization> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
|     <PropertyGroup> | ||||
|         <AnalysisMode>Recommended</AnalysisMode> | ||||
|         <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||||
|         <NoWarn>CA1805,CA1848</NoWarn> | ||||
|     </PropertyGroup> | ||||
| 
 | ||||
| </Project> | ||||
 Vinzenz Schroeter
						Vinzenz Schroeter