From c4d046858e0822b7c2c540ac2368b2c0e88e7a26 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 19 May 2019 17:00:02 +0200 Subject: general refectoring added 42 as dummy Token --- DSACore/Hubs/Login.cs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'DSACore/Hubs') diff --git a/DSACore/Hubs/Login.cs b/DSACore/Hubs/Login.cs index f589e49..1f6ca39 100644 --- a/DSACore/Hubs/Login.cs +++ b/DSACore/Hubs/Login.cs @@ -1,14 +1,14 @@ -using DSACore.DSA_Game.Characters; -using DSACore.FireBase; -using DSACore.Models.Network; -using Microsoft.AspNetCore.SignalR; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CSharp.Syntax; +using DSACore.Commands; +using DSACore.DSA_Game.Characters; +using DSACore.FireBase; +using DSACore.Models.Network; +using Microsoft.AspNetCore.SignalR; namespace DSACore.Hubs { @@ -18,9 +18,6 @@ namespace DSACore.Hubs private const string ReceiveMethod = "ReceiveMessage"; //receiveMethod; - private static List DsaGroups { get; set; } - public static List Tokens { get; } = new List(); - static Users() { DsaGroups = Database.GetGroups().Result; @@ -29,6 +26,9 @@ namespace DSACore.Hubs //AddGroups(); } + private static List DsaGroups { get; } + public static List Tokens { get; } = new List(); + [Obsolete] private static async void AddGroups() @@ -60,7 +60,7 @@ namespace DSACore.Hubs var ident = args.First().Replace("/", ""); if (args.Count > 0) args.RemoveAt(0); - var ret = Commands.CommandHandler.ExecuteCommand(new Command + var ret = CommandHandler.ExecuteCommand(new Command { CharId = 0, CmdIdentifier = ident, @@ -116,8 +116,8 @@ namespace DSACore.Hubs var test = await Database.GetGroups(); foreach (var group in test) - if (!DsaGroups.Exists(x => x.Name.Equals(@group.Name))) - DsaGroups.Add(@group); + if (!DsaGroups.Exists(x => x.Name.Equals(group.Name))) + DsaGroups.Add(group); await Clients.Caller.SendCoreAsync("ListGroups", new object[] {DsaGroups.Select(x => x.SendGroup())}); //throw new NotImplementedException("add database call to get groups"); @@ -128,7 +128,7 @@ namespace DSACore.Hubs DsaGroups.Add(new Group(group, password)); var Dgroup = new Models.Database.Groups.Group {Name = group, Id = DsaGroups.Count - 1}; //Database.AddGroup(Dgroup); - await Clients.Caller.SendCoreAsync(ReceiveMethod, new[] {$"group {@group} sucessfully added"}); + await Clients.Caller.SendCoreAsync(ReceiveMethod, new[] {$"group {group} sucessfully added"}); //throw new NotImplementedException("add database call to add groups"); } @@ -202,8 +202,8 @@ namespace DSACore.Hubs await Clients.Caller.SendAsync("PlayerStatusChanged", new[] {user.Name, "offline"}); //await SendToGroup(user.Name + " disconnected from the Server"); - @group.Users.Remove(user); - await Groups.RemoveFromGroupAsync(Context.ConnectionId, @group.Name); + group.Users.Remove(user); + await Groups.RemoveFromGroupAsync(Context.ConnectionId, group.Name); } catch (Exception e) { -- cgit v1.2.3-54-g00ecf