diff options
author | uzvkl <dennis.kobert@student.kit.edu> | 2019-05-20 00:54:14 +0200 |
---|---|---|
committer | uzvkl <dennis.kobert@student.kit.edu> | 2019-05-20 00:54:14 +0200 |
commit | ed26623e17e8dfcc036f88cca6de10d5a35697ec (patch) | |
tree | 26dae8b824631e6542c876c82ce0e15260c411bc /DSACore | |
parent | 2ab4051c6fe720dc47e99b0c305a0d779ee02d51 (diff) |
Reorganize Code delete ZoBotanica
Diffstat (limited to 'DSACore')
-rw-r--r-- | DSACore/Controllers/CommandsController.cs | 4 | ||||
-rw-r--r-- | DSACore/Controllers/LobbyController.cs | 4 | ||||
-rw-r--r-- | DSACore/DSACore.csproj | 2 | ||||
-rw-r--r-- | DSACore/Hubs/Login.cs | 28 | ||||
-rw-r--r-- | DSACore/Program.cs | 4 | ||||
-rw-r--r-- | DSACore/Startup.cs | 18 |
6 files changed, 18 insertions, 42 deletions
diff --git a/DSACore/Controllers/CommandsController.cs b/DSACore/Controllers/CommandsController.cs index 5addf82..2ab9c96 100644 --- a/DSACore/Controllers/CommandsController.cs +++ b/DSACore/Controllers/CommandsController.cs @@ -1,6 +1,6 @@ using System; -using DSACore.Commands; -using DSACore.Models.Network; +using DSALib.Commands; +using DSALib.Models.Network; using Microsoft.AspNetCore.Mvc; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 diff --git a/DSACore/Controllers/LobbyController.cs b/DSACore/Controllers/LobbyController.cs index df22607..c861eac 100644 --- a/DSACore/Controllers/LobbyController.cs +++ b/DSACore/Controllers/LobbyController.cs @@ -1,6 +1,6 @@ using System; -using DSACore.Commands; -using DSACore.Models.Network; +using DSALib.Models.Network; +using DSALib.Commands; using Microsoft.AspNetCore.Mvc; namespace DSACore.Controllers diff --git a/DSACore/DSACore.csproj b/DSACore/DSACore.csproj index 3d928e1..d730ea4 100644 --- a/DSACore/DSACore.csproj +++ b/DSACore/DSACore.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> - <TargetFramework>netcoreapp2.1</TargetFramework> + <TargetFramework>netcoreapp2.2</TargetFramework> <StartupObject>DSACore.Program</StartupObject> </PropertyGroup> diff --git a/DSACore/Hubs/Login.cs b/DSACore/Hubs/Login.cs index 1f6ca39..ebe0bae 100644 --- a/DSACore/Hubs/Login.cs +++ b/DSACore/Hubs/Login.cs @@ -4,11 +4,12 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using DSACore.Commands; -using DSACore.DSA_Game.Characters; -using DSACore.FireBase; -using DSACore.Models.Network; +using DSALib.Commands; +using DSALib.DSA_Game.Characters; +using DSALib.Models.Network; +using DSALib.FireBase; using Microsoft.AspNetCore.SignalR; +using Group = DSALib.Models.Network.Group; namespace DSACore.Hubs { @@ -30,25 +31,16 @@ namespace DSACore.Hubs public static List<Token> Tokens { get; } = new List<Token>(); - [Obsolete] - private static async void AddGroups() - { - await Database.AddGroup(new Models.Database.Groups.Group {Name = "HalloWelt", Password = "valid"}); - await Database.AddGroup(new Models.Database.Groups.Group {Name = "Die Krassen Gamer", Password = "valid"}); - await Database.AddGroup(new Models.Database.Groups.Group {Name = "DSA", Password = "valid"}); - await Database.AddGroup(new Models.Database.Groups.Group {Name = "Die Überhelden", Password = "valid"}); - } - public async Task SendMessage(string user, string message) { try { var group = getGroup(Context.ConnectionId).Name; } - catch (InvalidOperationException e) + catch (InvalidOperationException) { - //await Clients.Caller.SendCoreAsync(receiveMethod, - // new object[] { "Nutzer ist in keiner Gruppe. Erst joinen!" }); + await Clients.Caller.SendCoreAsync(ReceiveMethod, + new object[] { "Nutzer ist in keiner Gruppe. Erst joinen!" }); } if (message[0] == '/') @@ -93,7 +85,7 @@ namespace DSACore.Hubs return Clients.Group(group).SendCoreAsync(ReceiveMethod, new object[] {getUser(Context.ConnectionId).Name, message}); } - catch (InvalidOperationException e) + catch (InvalidOperationException) { return Clients.Caller.SendCoreAsync(ReceiveMethod, new object[] {"Nutzer ist in keiner Gruppe. Erst joinen!"}); @@ -126,7 +118,7 @@ namespace DSACore.Hubs public async Task AddGroup(string group, string password) { DsaGroups.Add(new Group(group, password)); - var Dgroup = new Models.Database.Groups.Group {Name = group, Id = DsaGroups.Count - 1}; + var Dgroup = new DSALib.Models.Database.Groups.Group {Name = group, Id = DsaGroups.Count - 1}; //Database.AddGroup(Dgroup); await Clients.Caller.SendCoreAsync(ReceiveMethod, new[] {$"group {group} sucessfully added"}); //throw new NotImplementedException("add database call to add groups"); diff --git a/DSACore/Program.cs b/DSACore/Program.cs index 46baf2d..8af0a74 100644 --- a/DSACore/Program.cs +++ b/DSACore/Program.cs @@ -1,5 +1,5 @@ -using DSACore.DSA_Game; -using DSACore.FireBase; +using DSALib.DSA_Game; +using DSALib.FireBase; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; diff --git a/DSACore/Startup.cs b/DSACore/Startup.cs index 372caca..ef22802 100644 --- a/DSACore/Startup.cs +++ b/DSACore/Startup.cs @@ -19,23 +19,7 @@ namespace DSACore // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - /*services.AddCors(options => options.AddPolicy("CorsPolicy", - builder => - { - builder.AllowAnyOrigin()//.WithOrigins("https://dsa.truekuehli.de", "127.0.0.1") - .WithHeaders("Access-Control-Allow-Origin") - .AllowAnyHeader() - .AllowAnyMethod() - .AllowCredentials(); - })); - /* - services.AddCors(options => - { - options.AddPolicy("AllowSpecificOrigin", - builder => builder.AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin().AllowCredentials()/*WithOrigins("https://dsa.truekuehli.de")#1#); - }); - -*/ + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSignalR(); |