summaryrefslogtreecommitdiff
path: root/DSACore/Models/Network
diff options
context:
space:
mode:
authorTrueKuehli <rctcoaster2000@hotmail.de>2018-10-07 12:05:11 +0200
committerTrueKuehli <rctcoaster2000@hotmail.de>2018-10-07 12:05:11 +0200
commit97f19926ac2b02e976c1abf993525b519d68ffac (patch)
tree60fb48ecf30b70530d6132711b331d66e33b3893 /DSACore/Models/Network
parent3de6fb5d7bd28318d90975f016c9722a99ba2455 (diff)
parent373af0a9c563dcd6bfb5e136f75f23e48bfb961c (diff)
Merge branch 'WebApi' of https://github.com/TrueDoctor/DiscoBot into WebApi
Diffstat (limited to 'DSACore/Models/Network')
-rw-r--r--DSACore/Models/Network/CommandResponse.cs31
-rw-r--r--DSACore/Models/Network/Group.cs25
2 files changed, 46 insertions, 10 deletions
diff --git a/DSACore/Models/Network/CommandResponse.cs b/DSACore/Models/Network/CommandResponse.cs
new file mode 100644
index 0000000..ed4b7d0
--- /dev/null
+++ b/DSACore/Models/Network/CommandResponse.cs
@@ -0,0 +1,31 @@
+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 6e62dc8..76c3efb 100644
--- a/DSACore/Models/Network/Group.cs
+++ b/DSACore/Models/Network/Group.cs
@@ -7,18 +7,15 @@ namespace DSACore.Models.Network
{
public class Group
{
- private int _online;
-
public Group(string name, string password)
{
Name = name;
Password = password;
}
- public Group(string name, int userCount)
+ public Group(string name, int userOnline)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
- UserCount = userCount;
}
public string Name { get; set; }
@@ -27,18 +24,26 @@ namespace DSACore.Models.Network
public int UserCount
{
- get { return _online; RefreshOnline();}
- set { _online = value; RefreshOnline();}
+ get { return Users.Count; }
}
- private void RefreshOnline()
+ public SendGroup SendGroup()
{
- _online = Users.Count;
+ return new SendGroup( Name, UserCount);
}
+ }
- public Group SendGroup()
+ public class SendGroup
+ {
+ public SendGroup(string name, int userCount)
{
- return new Group( Name, UserCount);
+ Name = name ?? throw new ArgumentNullException(nameof(name));
+ UserCount = userCount;
}
+
+ public string Name { get; set; }
+
+ public int UserCount { get; set; }
+
}
}