public void TryToReach(MessageEndpoint m) { if (m.Nickname.Trim() == "") { return; } var r = default(RemoteUserInfo); foreach (var k in Remotes) { if (k.EndPoints[0].Nickname == m.Nickname) { r = k; // okay we already have a known endpoint. break; } } if (r == null) { r = new RemoteUserInfo { EndPoints = new [] { m }, Node = treeView1.Nodes.Add(m.Nickname) }; Remotes = Remotes.Concat(r); } }
public void TryToReach(MessageEndpoint[] m) { foreach (var k in m) { TryToReach(k); } }
public void TryToReach(MessageEndpoint m) { if (m.Nickname.Trim() == "") return; var r = default(RemoteUserInfo); foreach (var k in Remotes) { if (k.EndPoints[0].Nickname == m.Nickname) { r = k; // okay we already have a known endpoint. break; } } if (r == null) { r = new RemoteUserInfo { EndPoints = new [] { m }, Node = treeView1.Nodes.Add(m.Nickname) }; Remotes = Remotes.Concat(r); } }
public void SendCommand(MessageEndpoint Target, object Command) { Action TrySend = delegate { var Host = Target.Host; if (string.IsNullOrEmpty( Host )) { // name does not embed host name // do we have a discovery service? RaiseNotFound(Target); return; } var TargetUri = "http://" + Host + ":" + Target.Port + this.PathPrefix + "/" + CommandToString(Command); new TrivialWebRequest { Port = Target.Port, Referer = "http://example.com", Target = new Uri(TargetUri) }.Invoke(); }; TrySend.TryInvokeInBackground(); }
public void SendCommand(MessageEndpoint Target, object Command) { Action TrySend = delegate { var Host = Target.Host; if (string.IsNullOrEmpty(Host)) { // name does not embed host name // do we have a discovery service? RaiseNotFound(Target); return; } var TargetUri = "http://" + Host + ":" + Target.Port + this.PathPrefix + "/" + CommandToString(Command); new TrivialWebRequest { Port = Target.Port, Referer = "http://example.com", Target = new Uri(TargetUri) }.Invoke(); }; TrySend.TryInvokeInBackground(); }
public void RaiseNotFound(MessageEndpoint Target) { if (NotFound != null) { NotFound(Target); } }
private void outgoingMessages1_NotFound(MessageEndpoint e) { this.PrimaryThreadQueue.Enqueue( delegate { this.History.AppendLine("not found: " + e.ToString()); this.UpdateText(); } ); }
public void SendCommand(MessageEndpoint[] Targets, object Command) { // we defenetly need a peer2peer name to ip discovery // component foreach (var item in Targets) { // can we find this name? // if not we could fire an event // that this target was not found SendCommand(item, Command); } }
public static MessageEndpoint[] Concat(this MessageEndpoint[] f, MessageEndpoint v) { if (f == null) { return new[] { v } } ; var a = new MessageEndpoint[f.Length + 1]; Array.Copy(f, a, f.Length); a[f.Length] = v; return(a); }
public static MessageEndpoint[] Concat(this MessageEndpoint[] f, MessageEndpoint v) { if (f == null) return new[] { v }; var a = new MessageEndpoint[f.Length + 1]; Array.Copy(f, a, f.Length); a[f.Length] = v; return a; }
public void RaiseNotFound(MessageEndpoint Target) { if (NotFound != null) NotFound(Target); }