diff --git a/MySolution/HttpStreamingApp/HttpStreamingApp.csproj b/MySolution/HttpStreamingApp/HttpStreamingApp.csproj
new file mode 100644
index 0000000..9ad2a07
--- /dev/null
+++ b/MySolution/HttpStreamingApp/HttpStreamingApp.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/MySolution/HttpStreamingApp/Program.cs b/MySolution/HttpStreamingApp/Program.cs
new file mode 100644
index 0000000..01749f7
--- /dev/null
+++ b/MySolution/HttpStreamingApp/Program.cs
@@ -0,0 +1,46 @@
+using System.Net;
+
+namespace HttpStreamingApp
+{
+ internal class Program
+ {
+ static void Main(string[] args)
+ {
+ Thread serverThread = new Thread(new ThreadStart(StartServer));
+ serverThread.Start();
+ Console.WriteLine("HTTP Server start.");
+
+ Console.ReadKey();
+ serverThread.Abort();
+ }
+
+ static void StartServer()
+ {
+ using (var listener = new HttpListener())
+ {
+ listener.Prefixes.Add("http://127.0.0.1:9879/");
+ listener.Start();
+
+ while (true)
+ {
+ var context = listener.GetContext();
+ var response = context.Response;
+
+ response.ContentType = "audio/mpeg";
+ using (var stream = new FileStream("./audio.mp3", FileMode.Open))
+ {
+ byte[] buffer = new byte[64 *1024];
+ int bytesRead = 0;
+ while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ response.OutputStream.Write(buffer, 0, bytesRead);
+ response.OutputStream.Flush();
+ }
+ }
+
+ response.Close();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/MySolution/MySolution.sln b/MySolution/MySolution.sln
index ec58baf..14ea030 100644
--- a/MySolution/MySolution.sln
+++ b/MySolution/MySolution.sln
@@ -7,11 +7,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\Co
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialCommApp", "SerialComApp\SerialCommApp.csproj", "{21CB97AA-1550-4C56-894D-76E6B75B91DC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TAPServer", "TAPServer\TAPServer.csproj", "{4CA4FF89-FA3A-42C0-8A66-D84F9C4F8EBC}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TAPServer", "TAPServer\TAPServer.csproj", "{4CA4FF89-FA3A-42C0-8A66-D84F9C4F8EBC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STcpHelper", "STcpHelper\STcpHelper.csproj", "{86B2F7FF-8D76-4C46-91E4-E83F7EED4A68}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "STcpHelper", "STcpHelper\STcpHelper.csproj", "{86B2F7FF-8D76-4C46-91E4-E83F7EED4A68}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TAPClient", "TAPClient\TAPClient.csproj", "{6F0DC5AC-D046-4506-A339-EC50C18C4CDB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TAPClient", "TAPClient\TAPClient.csproj", "{6F0DC5AC-D046-4506-A339-EC50C18C4CDB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SObject", "SObject\SObject.csproj", "{98E66698-89A2-49DF-A808-279C3FEFFABF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HttpStreamingApp", "HttpStreamingApp\HttpStreamingApp.csproj", "{3D549B90-D7ED-4771-8595-9147BBF221C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -39,6 +43,14 @@ Global
{6F0DC5AC-D046-4506-A339-EC50C18C4CDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F0DC5AC-D046-4506-A339-EC50C18C4CDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F0DC5AC-D046-4506-A339-EC50C18C4CDB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {98E66698-89A2-49DF-A808-279C3FEFFABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {98E66698-89A2-49DF-A808-279C3FEFFABF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {98E66698-89A2-49DF-A808-279C3FEFFABF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {98E66698-89A2-49DF-A808-279C3FEFFABF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3D549B90-D7ED-4771-8595-9147BBF221C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3D549B90-D7ED-4771-8595-9147BBF221C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3D549B90-D7ED-4771-8595-9147BBF221C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3D549B90-D7ED-4771-8595-9147BBF221C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/MySolution/SObject/Coyote.cs b/MySolution/SObject/Coyote.cs
new file mode 100644
index 0000000..dcb3e4a
--- /dev/null
+++ b/MySolution/SObject/Coyote.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SObject
+{
+ public class Coyote : DogFamily
+ {
+ public Coyote(string name, int age)
+ {
+ this.Name = name;
+ this.Age = age;
+ this.Crying = "Yip";
+ }
+ }
+}
diff --git a/MySolution/SObject/DogFamily.cs b/MySolution/SObject/DogFamily.cs
new file mode 100644
index 0000000..6be2c42
--- /dev/null
+++ b/MySolution/SObject/DogFamily.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SObject
+{
+ public class DogFamily
+ {
+ public string Name { get; set; }
+ public int Age { get; set; }
+ public string Crying { get; set; }
+
+ public string Cry()
+ {
+ return this.Crying;
+ }
+ }
+}
diff --git a/MySolution/SObject/SObject.csproj b/MySolution/SObject/SObject.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/MySolution/SObject/SObject.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/MySolution/SObject/Wolf.cs b/MySolution/SObject/Wolf.cs
new file mode 100644
index 0000000..fdc79af
--- /dev/null
+++ b/MySolution/SObject/Wolf.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SObject
+{
+ public class Wolf : DogFamily
+ {
+ public Wolf(string name, int age)
+ {
+ this.Name = name;
+ this.Age = age;
+ this.Crying = "Howl";
+ }
+ }
+}
diff --git a/MySolution/SObject/Zoo.cs b/MySolution/SObject/Zoo.cs
new file mode 100644
index 0000000..20b7a60
--- /dev/null
+++ b/MySolution/SObject/Zoo.cs
@@ -0,0 +1,39 @@
+namespace SObject
+{
+ public class Zoo
+ {
+ private Random _rand;
+ public List Dogs { get; set; }
+
+ public Zoo()
+ {
+ _rand = new Random();
+
+ this.Dogs = new List()
+ {
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ GetDog(),
+ };
+ }
+
+ public DogFamily GetDog()
+ {
+ DogFamily dog;
+ int seed = _rand.Next(0, 20);
+ if (seed % 2 == 0)
+ dog = new Wolf($"W{seed % 7}", seed);
+ else
+ dog = new Coyote($"C{seed % 7}", seed);
+
+ return dog;
+ }
+ }
+}
\ No newline at end of file
diff --git a/MySolution/STcpHelper/Packet/PacketType.cs b/MySolution/STcpHelper/Packet/PacketType.cs
index 720b1b6..6846a11 100644
--- a/MySolution/STcpHelper/Packet/PacketType.cs
+++ b/MySolution/STcpHelper/Packet/PacketType.cs
@@ -13,5 +13,7 @@ namespace STcpHelper.Packet
RES_CLIENT_LIST,
REQ_FILE,
RES_FILE,
+ REQ_ZOO,
+ RES_ZOO,
}
}
diff --git a/MySolution/STcpHelper/Packet/STcpClientListReqPacket.cs b/MySolution/STcpHelper/Packet/STcpClientListReqPacket.cs
index 038b44c..eed0294 100644
--- a/MySolution/STcpHelper/Packet/STcpClientListReqPacket.cs
+++ b/MySolution/STcpHelper/Packet/STcpClientListReqPacket.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using STcpHelper.Utility;
namespace STcpHelper.Packet
{
diff --git a/MySolution/STcpHelper/Packet/STcpClientListResPacket.cs b/MySolution/STcpHelper/Packet/STcpClientListResPacket.cs
index 475508b..f802ac9 100644
--- a/MySolution/STcpHelper/Packet/STcpClientListResPacket.cs
+++ b/MySolution/STcpHelper/Packet/STcpClientListResPacket.cs
@@ -1,4 +1,4 @@
-using STcpHelper.Packet;
+using STcpHelper.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,6 +12,8 @@ namespace STcpHelper.Packet
{
public class STcpClientListResPacket : ISTcpPacket
{
+ private ISSerializer _serializer = new SJsonSerializerHelper();
+
public List Clients { get; private set; }
public STcpClientListResPacket(List clinets)
@@ -29,16 +31,15 @@ namespace STcpHelper.Packet
int length = SBufferHelper.ConvertBufferToDataLength(dataBuffer, cursor);
cursor += sizeof(int);
- string jsonString = SEncoding.GetString(dataBuffer, cursor, length);
- List clients = JsonSerializer.Deserialize>(jsonString);
+ string serialized = SEncoding.GetString(dataBuffer, cursor, length);
- this.Clients = clients;
+ this.Clients = _serializer.Deserialize>(serialized);
}
public byte[] Serialize()
{
- string jsonString = JsonSerializer.Serialize(this.Clients);
- byte[] data = SEncoding.GetBytes(jsonString);
+ string serialized = _serializer.Serialize(this.Clients);
+ byte[] data = SEncoding.GetBytes(serialized);
byte[] dataLength = SBufferHelper.ConvertDataLengthToBuffer(data.Length);
int dataSize = STcpPacketHeader.GetDataSize(data, dataLength);
diff --git a/MySolution/STcpHelper/Packet/STcpFileReqPacket.cs b/MySolution/STcpHelper/Packet/STcpFileReqPacket.cs
index 208f10b..941502c 100644
--- a/MySolution/STcpHelper/Packet/STcpFileReqPacket.cs
+++ b/MySolution/STcpHelper/Packet/STcpFileReqPacket.cs
@@ -5,6 +5,7 @@ using System.Net;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
+using STcpHelper.Utility;
namespace STcpHelper.Packet
{
diff --git a/MySolution/STcpHelper/Packet/STcpFileResPacket.cs b/MySolution/STcpHelper/Packet/STcpFileResPacket.cs
index 9761e45..ae48ae1 100644
--- a/MySolution/STcpHelper/Packet/STcpFileResPacket.cs
+++ b/MySolution/STcpHelper/Packet/STcpFileResPacket.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using STcpHelper.Utility;
namespace STcpHelper.Packet
{
diff --git a/MySolution/STcpHelper/Packet/STcpPacketHeader.cs b/MySolution/STcpHelper/Packet/STcpPacketHeader.cs
index 87fe799..2d7de63 100644
--- a/MySolution/STcpHelper/Packet/STcpPacketHeader.cs
+++ b/MySolution/STcpHelper/Packet/STcpPacketHeader.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using STcpHelper.Utility;
namespace STcpHelper.Packet
{
diff --git a/MySolution/STcpHelper/Packet/STcpTextPacket.cs b/MySolution/STcpHelper/Packet/STcpTextPacket.cs
index 5c15d42..1f8bc5e 100644
--- a/MySolution/STcpHelper/Packet/STcpTextPacket.cs
+++ b/MySolution/STcpHelper/Packet/STcpTextPacket.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using STcpHelper.Utility;
namespace STcpHelper.Packet
{
diff --git a/MySolution/STcpHelper/Packet/STcpZooReqPacket.cs b/MySolution/STcpHelper/Packet/STcpZooReqPacket.cs
new file mode 100644
index 0000000..fdc644b
--- /dev/null
+++ b/MySolution/STcpHelper/Packet/STcpZooReqPacket.cs
@@ -0,0 +1,24 @@
+using STcpHelper.Utility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace STcpHelper.Packet
+{
+ public class STcpZooReqPacket : ISTcpPacket
+ {
+ public STcpZooReqPacket()
+ {
+
+ }
+
+ public byte[] Serialize()
+ {
+ STcpPacketHeader header = new STcpPacketHeader(PacketType.REQ_ZOO, 0);
+
+ return SBufferHelper.GetBuffer(STcpPacketHeader.HEADER_LENGTH, header.Serialize());
+ }
+ }
+}
diff --git a/MySolution/STcpHelper/Packet/STcpZooResPacket.cs b/MySolution/STcpHelper/Packet/STcpZooResPacket.cs
new file mode 100644
index 0000000..ba4fad6
--- /dev/null
+++ b/MySolution/STcpHelper/Packet/STcpZooResPacket.cs
@@ -0,0 +1,45 @@
+using SObject;
+using STcpHelper.Utility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace STcpHelper.Packet
+{
+ public class STcpZooResPacket : ISTcpPacket
+ {
+ private ISSerializer _serializer = new SJsonSerializerHelper();
+ public Zoo Zoo { get; private set; }
+
+ public STcpZooResPacket(Zoo zoo)
+ {
+ this.Zoo = zoo;
+ }
+
+ public STcpZooResPacket(byte[] dataBuffer)
+ {
+ int cursor = 0;
+ int length = SBufferHelper.ConvertBufferToDataLength(dataBuffer, cursor);
+ cursor += sizeof(int);
+
+ string serialized = SEncoding.GetString(dataBuffer, cursor, length);
+
+ this.Zoo = _serializer.Deserialize(serialized);
+ }
+
+ public byte[] Serialize()
+ {
+ string serialized = _serializer.Serialize(this.Zoo);
+ byte[] data = SEncoding.GetBytes(serialized);
+ byte[] dataLength = SBufferHelper.ConvertDataLengthToBuffer(data.Length);
+
+ int dataSize = STcpPacketHeader.GetDataSize(data, dataLength);
+
+ STcpPacketHeader header = new STcpPacketHeader(PacketType.RES_ZOO, dataSize);
+
+ return SBufferHelper.GetBuffer(STcpPacketHeader.HEADER_LENGTH + dataSize, header.Serialize(), dataLength, data);
+ }
+ }
+}
diff --git a/MySolution/STcpHelper/STcpClient.cs b/MySolution/STcpHelper/STcpClient.cs
index f8606e3..3d24e59 100644
--- a/MySolution/STcpHelper/STcpClient.cs
+++ b/MySolution/STcpHelper/STcpClient.cs
@@ -1,4 +1,5 @@
-using STcpHelper.Packet;
+using SObject;
+using STcpHelper.Packet;
using System;
using System.Collections.Generic;
using System.IO;
@@ -80,6 +81,14 @@ namespace STcpHelper
STcpFileResPacket packet = new STcpFileResPacket(dataBuffer, FILE_SAVE_FOLDER);
WriteMessage($"File({packet.FileName}) saved.");
}
+ else if (header.Type == PacketType.RES_ZOO)
+ {
+ STcpZooResPacket packet = new STcpZooResPacket(dataBuffer);
+ foreach (var dog in packet.Zoo.Dogs)
+ {
+ WriteMessage($"Name:{dog.Name} \tAge:{dog.Age} \tCrying:{dog.Cry()}");
+ }
+ }
}
}, _cts.Token);
}
@@ -134,6 +143,19 @@ namespace STcpHelper
}
}
+ public async void RequireZoo()
+ {
+ try
+ {
+ STcpZooReqPacket packet = new STcpZooReqPacket();
+ await _stream.WriteAsync(packet.Serialize());
+ }
+ catch (Exception ex)
+ {
+ WriteError(ex);
+ }
+ }
+
public void Close()
{
try
diff --git a/MySolution/STcpHelper/STcpHelper.csproj b/MySolution/STcpHelper/STcpHelper.csproj
index 27ac386..cf091df 100644
--- a/MySolution/STcpHelper/STcpHelper.csproj
+++ b/MySolution/STcpHelper/STcpHelper.csproj
@@ -6,4 +6,12 @@
enable
+
+
+
+
+
+
+
+
diff --git a/MySolution/STcpHelper/STcpServer.cs b/MySolution/STcpHelper/STcpServer.cs
index 3aae3fa..7cae890 100644
--- a/MySolution/STcpHelper/STcpServer.cs
+++ b/MySolution/STcpHelper/STcpServer.cs
@@ -1,4 +1,5 @@
-using STcpHelper.Packet;
+using SObject;
+using STcpHelper.Packet;
using System.Net;
using System.Net.Sockets;
using System.Text;
@@ -96,6 +97,25 @@ namespace STcpHelper
// Send async
SendAsyncPacket(packet, client);
}
+ else if (header.Type == PacketType.REQ_ZOO)
+ {
+ //Zoo zoo = new Zoo();
+ //Random rand = new Random();
+ //zoo.Dogs = new List()
+ //{
+ // new Wolf($"Wooolf-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Coyote($"Coyote-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Wolf($"Wooolf-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Coyote($"Coyote-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Coyote($"Coyote-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Wolf($"Wooolf-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ // new Wolf($"Wooolf-{rand.Next(1, 10)}", rand.Next(1, 10)),
+ //};
+
+ STcpZooResPacket packet = new STcpZooResPacket(new Zoo());
+
+ SendPacket(packet, client);
+ }
if (!IsClientConnected(client))
break;
diff --git a/MySolution/STcpHelper/Utility/ISSerializer.cs b/MySolution/STcpHelper/Utility/ISSerializer.cs
new file mode 100644
index 0000000..19b6898
--- /dev/null
+++ b/MySolution/STcpHelper/Utility/ISSerializer.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace STcpHelper.Utility
+{
+ internal interface ISSerializer
+ {
+ string Serialize(T obj);
+ T Deserialize(string str);
+ }
+}
diff --git a/MySolution/STcpHelper/Packet/SBufferHelper.cs b/MySolution/STcpHelper/Utility/SBufferHelper.cs
similarity index 88%
rename from MySolution/STcpHelper/Packet/SBufferHelper.cs
rename to MySolution/STcpHelper/Utility/SBufferHelper.cs
index 39d8b01..3e4183b 100644
--- a/MySolution/STcpHelper/Packet/SBufferHelper.cs
+++ b/MySolution/STcpHelper/Utility/SBufferHelper.cs
@@ -4,8 +4,9 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using STcpHelper.Packet;
-namespace STcpHelper.Packet
+namespace STcpHelper.Utility
{
internal class SBufferHelper
{
@@ -27,7 +28,7 @@ namespace STcpHelper.Packet
public static byte[] ConvertPacketTypeToBuffer(PacketType packetType)
{
- return BitConverter.GetBytes(IPAddress.HostToNetworkOrder((int)packetType));
+ return BitConverter.GetBytes(IPAddress.HostToNetworkOrder((int)packetType));
}
public static byte[] ConvertDataLengthToBuffer(int dataLength)
diff --git a/MySolution/STcpHelper/Packet/SEncoding.cs b/MySolution/STcpHelper/Utility/SEncoding.cs
similarity index 93%
rename from MySolution/STcpHelper/Packet/SEncoding.cs
rename to MySolution/STcpHelper/Utility/SEncoding.cs
index c251132..8d3d330 100644
--- a/MySolution/STcpHelper/Packet/SEncoding.cs
+++ b/MySolution/STcpHelper/Utility/SEncoding.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace STcpHelper.Packet
+namespace STcpHelper.Utility
{
internal class SEncoding
{
diff --git a/MySolution/STcpHelper/Utility/SJsonSerializerHelper.cs b/MySolution/STcpHelper/Utility/SJsonSerializerHelper.cs
new file mode 100644
index 0000000..61a2187
--- /dev/null
+++ b/MySolution/STcpHelper/Utility/SJsonSerializerHelper.cs
@@ -0,0 +1,22 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace STcpHelper.Utility
+{
+ public class SJsonSerializerHelper : ISSerializer
+ {
+ public string Serialize(T obj)
+ {
+ return JsonConvert.SerializeObject(obj);
+ }
+
+ public T Deserialize(string str)
+ {
+ return JsonConvert.DeserializeObject(str);
+ }
+ }
+}
diff --git a/MySolution/STcpHelper/Packet/SXmlSerializerHelper.cs b/MySolution/STcpHelper/Utility/SXmlSerializerHelper.cs
similarity index 79%
rename from MySolution/STcpHelper/Packet/SXmlSerializerHelper.cs
rename to MySolution/STcpHelper/Utility/SXmlSerializerHelper.cs
index cec02ec..ddf4ccc 100644
--- a/MySolution/STcpHelper/Packet/SXmlSerializerHelper.cs
+++ b/MySolution/STcpHelper/Utility/SXmlSerializerHelper.cs
@@ -5,11 +5,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
-namespace STcpHelper.Packet
+namespace STcpHelper.Utility
{
- static class SXmlSerializerHelper
+ public class SXmlSerializerHelper : ISSerializer
{
- public static string Serialize(T obj)
+ public string Serialize(T obj)
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
using (StringWriter sw = new StringWriter())
@@ -19,7 +19,7 @@ namespace STcpHelper.Packet
}
}
- public static T Deserialize(string str)
+ public T Deserialize(string str)
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
using (StringReader sr = new StringReader(str))
diff --git a/MySolution/TAPClient/Program.cs b/MySolution/TAPClient/Program.cs
index 9f5dbde..4a6fe62 100644
--- a/MySolution/TAPClient/Program.cs
+++ b/MySolution/TAPClient/Program.cs
@@ -26,6 +26,9 @@ namespace TAPClient
string path = Console.ReadLine();
client.RequireFile(path);
break;
+ case "zoo":
+ client.RequireZoo();
+ break;
default:
client.SendMessage(input);
break;
diff --git a/MySolution/TAPClient/TAPClient.csproj b/MySolution/TAPClient/TAPClient.csproj
index 8c59ce3..a7a7f8c 100644
--- a/MySolution/TAPClient/TAPClient.csproj
+++ b/MySolution/TAPClient/TAPClient.csproj
@@ -8,6 +8,7 @@
+
diff --git a/MySolution/TAPServer/TAPServer.csproj b/MySolution/TAPServer/TAPServer.csproj
index 8c59ce3..a7a7f8c 100644
--- a/MySolution/TAPServer/TAPServer.csproj
+++ b/MySolution/TAPServer/TAPServer.csproj
@@ -8,6 +8,7 @@
+