123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Serialization;
- using System.IO;
- using System.Runtime.Serialization.Formatters.Binary;
- namespace SuperSocket.SocketBase
- {
-
-
-
- [Serializable]
- public class NodeStatus
- {
-
-
-
-
-
-
- public StatusInfoCollection BootstrapStatus { get; set; }
-
-
-
-
-
-
- public StatusInfoCollection[] InstancesStatus { get; set; }
-
-
-
-
- public void Save(string filePath)
- {
- var serializer = new BinaryFormatter();
- using (var stream = File.Create(filePath))
- {
- serializer.Serialize(stream, this);
- stream.Flush();
- stream.Close();
- }
- }
-
-
-
-
-
- public static NodeStatus LoadFrom(string filePath)
- {
- var serializer = new BinaryFormatter();
- using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read))
- {
- var status = serializer.Deserialize(stream) as NodeStatus;
- stream.Close();
- return status;
- }
- }
- }
- }
|