Пример #1
0
 internal Message(Node to, string content)
 {
     Id = Guid.NewGuid().ToString();
     To = to.GUID.ToString();
     From = "anonymous";
     Content = content;
     TTL = 255;
 }
Пример #2
0
 internal Message(Node to, Node from, string content)
 {
     Id = Guid.NewGuid().ToString();
     To = to.GUID.ToString();
     From = from.GUID.ToString();
     TTL = 255;
     Content = content;
 }
Пример #3
0
 public QuickLinkService()
 {
     ReceivedMessages = new List<Message>();
     local = new Node();
     local.MessageReceived += Local_MessageReceived;
     service = new Service(local);
     service.FoundAddress += Service_FoundAddress;
     service.FoundServer += Service_FoundServer;
     service.LostServer += Service_LostServer;
 }
Пример #4
0
        /* ==== CONSTRUCTORS ===== */
        internal Service(Node _local, ServiceType _type = ServiceType.Full)
        {
            Type = _type;
            _local.Local = true;
            Nodes = new List<Node> { _local };
            Connections = new List<ServiceConnection>();

            Thread thread = new Thread(ReconnectServers);
            thread.Start();
        }
Пример #5
0
 private void AnnounceOneNodeToServer(Node node, ServiceConnection service)
 {
     service.Send(node.ToString());
 }
Пример #6
0
 private void AnnounceOneNodeToAllServers(Node node)
 {
     foreach (ServiceConnection connection in Connections.Where(i => i.Client.Connected))
     {
         connection.Send(node.ToString());
     }
 }
Пример #7
0
 internal string MakeNode()
 {
     var node = new Node();
     node.Local = true;
     Nodes.Add(node);
     return node.GUID.ToString();
 }