summaryrefslogtreecommitdiff
path: root/DSACore/Models/Network
diff options
context:
space:
mode:
Diffstat (limited to 'DSACore/Models/Network')
-rw-r--r--DSACore/Models/Network/Command.cs20
-rw-r--r--DSACore/Models/Network/CommandResponse.cs31
-rw-r--r--DSACore/Models/Network/Group.cs12
-rw-r--r--DSACore/Models/Network/Token.cs21
-rw-r--r--DSACore/Models/Network/User.cs9
5 files changed, 26 insertions, 67 deletions
diff --git a/DSACore/Models/Network/Command.cs b/DSACore/Models/Network/Command.cs
deleted file mode 100644
index 456a896..0000000
--- a/DSACore/Models/Network/Command.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace DSACore.Models.Network
-{
- public class Command
- {
- public ulong GroupId { get; set; } = 0;
- public ulong CharId { get; set; }
- public string Name { get; set; }
- public string CmdIdentifier { get; set; }
- 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 bool IsDm { get; set; } = false;
- }
-}
diff --git a/DSACore/Models/Network/CommandResponse.cs b/DSACore/Models/Network/CommandResponse.cs
deleted file mode 100644
index ed4b7d0..0000000
--- a/DSACore/Models/Network/CommandResponse.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-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)
- {
- this.message = message ?? throw new ArgumentNullException(nameof(message));
- ResponseType = responseType;
- }
-
- public string message { get; private set; }
- public ResponseType ResponseType { get; private set;}
-
- public override string ToString()
- {
- return message;
- }
- }
-
- public enum ResponseType
- {
- Broadcast,
- Caller,
- Error
- }
-}
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
new file mode 100644
index 0000000..451cafc
--- /dev/null
+++ b/DSACore/Models/Network/Token.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace DSACore.Models.Network
+{
+ public class Token
+ {
+ private readonly DateTime creation = DateTime.Now;
+
+ public Token(string group)
+ {
+ Group = group;
+ }
+
+ public string Group { get; set; }
+
+ public bool IsValid()
+ {
+ return DateTime.Now - creation < TimeSpan.FromMinutes(1);
+ }
+ }
+} \ No newline at end of file
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