public Message(AgentUri Sender, string Body, List <ScopeUri> Recievers, string Session = null) { _body = Body; _nonce = Guid.NewGuid().ToString(); _session = Session ?? Guid.NewGuid().ToString(); _sender = Sender; _type = MessageType.Broadcast; _recieverScopes = Recievers; }
public Message(string Nonce, string Session, string Body, MessageType Type, List <ScopeUri> RecieverScopes, List <AgentUri> RecieverAgents, AgentUri Sender) { _nonce = Nonce; _session = Session; _body = Body; _type = Type; _recieverScopes = RecieverScopes; _recieverAgents = RecieverAgents; _sender = Sender; }
public Message(string Body, AgentUri Reciever, Socket Socket = null, AgentUri Sender = null) { _body = Body; _recieverAgents = new List <AgentUri>() { Reciever }; this.Socket = Socket; _sender = Sender; _type = MessageType.Revelation; }
public Message CreateReply(AgentUri Sender, string Body) { if (_type == MessageType.Revelation) { return(new Message(Body, _sender, Socket, Sender)); } else { return(new Message(Sender, Body, _sender, Session)); } }
public Message(AgentUri Sender, string Body, AgentUri Reciever, string Session = null) { _body = Body; _nonce = Guid.NewGuid().ToString(); _session = Session ?? Guid.NewGuid().ToString(); _sender = Sender; _type = MessageType.Unicast; _recieverAgents = new List <AgentUri>() { Reciever }; }
public void Say(string sentence, AgentUri reciever) { try { new Message(Uri, sentence, reciever).Send(); } catch (Exception e) { if (OnExceptionThrown != null) { OnExceptionThrown(this, e); } else { throw e; } } }
public Message Ask(string question, AgentUri reciever, uint timeOut = 0) { try { var m = new Message(Uri, question, reciever); m.Send(); var r = Recieve(m.Session, timeOut); return(r); } catch (Exception e) { if (OnExceptionThrown != null) { OnExceptionThrown(this, e); return(null); } else { throw e; } } }
public Message Reavel(string sentence, AgentUri reciever) { try { var m = new Message(sentence, reciever, Sender: Uri); m.Reveal(); var reply = m.RecieveRevelation(); return(reply); } catch (Exception e) { if (OnExceptionThrown != null) { OnExceptionThrown(this, e); } else { throw e; } } return(null); }