diff options
Diffstat (limited to 'DSACore/Models/Network')
-rw-r--r-- | DSACore/Models/Network/Command.cs | 8 | ||||
-rw-r--r-- | DSACore/Models/Network/CommandResponse.cs | 11 | ||||
-rw-r--r-- | DSACore/Models/Network/Group.cs | 12 | ||||
-rw-r--r-- | DSACore/Models/Network/Token.cs | 10 | ||||
-rw-r--r-- | DSACore/Models/Network/User.cs | 9 |
5 files changed, 17 insertions, 33 deletions
diff --git a/DSACore/Models/Network/Command.cs b/DSACore/Models/Network/Command.cs index 456a896..00b00a6 100644 --- a/DSACore/Models/Network/Command.cs +++ b/DSACore/Models/Network/Command.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace DSACore.Models.Network { @@ -14,7 +12,7 @@ namespace DSACore.Models.Network public List<string> CmdTexts { get; set; } public string CmdText => CmdTexts.Count != 0 ? CmdTexts.First() : ""; - public int Cmdmodifier => CmdTexts.Count != 0 && int.TryParse(CmdTexts.Last(), out int mod) ? mod : 0; + public int Cmdmodifier => CmdTexts.Count != 0 && int.TryParse(CmdTexts.Last(), out var mod) ? mod : 0; public bool IsDm { get; set; } = false; } -} +}
\ No newline at end of file diff --git a/DSACore/Models/Network/CommandResponse.cs b/DSACore/Models/Network/CommandResponse.cs index ed4b7d0..c7a410a 100644 --- a/DSACore/Models/Network/CommandResponse.cs +++ b/DSACore/Models/Network/CommandResponse.cs @@ -1,20 +1,17 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace DSACore.Models.Network { public class CommandResponse { - public CommandResponse(string message, ResponseType responseType= ResponseType.Broadcast) + public CommandResponse(string message, ResponseType responseType = ResponseType.Broadcast) { this.message = message ?? throw new ArgumentNullException(nameof(message)); ResponseType = responseType; } - public string message { get; private set; } - public ResponseType ResponseType { get; private set;} + public string message { get; } + public ResponseType ResponseType { get; } public override string ToString() { @@ -28,4 +25,4 @@ namespace DSACore.Models.Network Caller, Error } -} +}
\ No newline at end of file diff --git a/DSACore/Models/Network/Group.cs b/DSACore/Models/Network/Group.cs index 76c3efb..efe12ee 100644 --- a/DSACore/Models/Network/Group.cs +++ b/DSACore/Models/Network/Group.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace DSACore.Models.Network { @@ -22,14 +20,11 @@ namespace DSACore.Models.Network public string Password { get; set; } public List<User> Users { get; set; } = new List<User>(); - public int UserCount - { - get { return Users.Count; } - } + public int UserCount => Users.Count; public SendGroup SendGroup() { - return new SendGroup( Name, UserCount); + return new SendGroup(Name, UserCount); } } @@ -44,6 +39,5 @@ namespace DSACore.Models.Network public string Name { get; set; } public int UserCount { get; set; } - } -} +}
\ No newline at end of file diff --git a/DSACore/Models/Network/Token.cs b/DSACore/Models/Network/Token.cs index 0021317..451cafc 100644 --- a/DSACore/Models/Network/Token.cs +++ b/DSACore/Models/Network/Token.cs @@ -1,18 +1,18 @@ using System; -using Microsoft.EntityFrameworkCore; namespace DSACore.Models.Network { public class Token { - public string Group { get; set; } - private DateTime creation = DateTime.Now; + private readonly DateTime creation = DateTime.Now; - public Token(string @group) + public Token(string group) { - Group = @group; + Group = group; } + public string Group { get; set; } + public bool IsValid() { return DateTime.Now - creation < TimeSpan.FromMinutes(1); diff --git a/DSACore/Models/Network/User.cs b/DSACore/Models/Network/User.cs index 04ef0a9..8b8008c 100644 --- a/DSACore/Models/Network/User.cs +++ b/DSACore/Models/Network/User.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace DSACore.Models.Network +namespace DSACore.Models.Network { public class User { @@ -11,4 +6,4 @@ namespace DSACore.Models.Network public string ConnectionId { get; set; } public int Char { get; set; } } -} +}
\ No newline at end of file |