internal SubscriptionListChangedEventArgs(PeerEndPoint peerEndPoint, PeerContact peerContact, PeerChangeType peerChangeType) { m_peerEndPoint = peerEndPoint; m_peerContact = peerContact; m_peerChangeType = peerChangeType; }
public PeerInfo(int connectionId, PeerEndPoint endPoint, PeerEndPoint localEndPoint, byte[] randam) { ConnectionId = connectionId; EndPont = endPoint; LocalEndPont = localEndPoint; RandamSize = (byte)randam.Length; Randam = randam; }
public PeerInfo(int connectionId, PeerEndPoint endPoint, byte[] randam) : this() { ConnectionId = connectionId; EndPont = endPoint; LocalEndPont = new PeerEndPoint(null, 0); RandamSize = (byte)randam.Length; Randam = randam; }
public override bool Equals(object obj) { PeerEndPoint other = obj as PeerEndPoint; if (obj == null) { return(false); } return(this.EndPoint.Equals(other.EndPoint)); }
internal static bool TryUnpack(byte[] buf, ref int offset, out PeerInfo info) { var connectionId = BinaryUtil.ReadInt(buf, ref offset); var endPoint = PeerEndPoint.Unpack(buf, ref offset); var localEndPoint = PeerEndPoint.Unpack(buf, ref offset); var randamSize = buf[offset++]; var randam = BinaryUtil.ReadBytes(buf, randamSize, ref offset); info = new PeerInfo(connectionId, endPoint, localEndPoint, randam); return(true); }
// </Snippet7> //------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------ // <Snippet8> // Getting the presence info for the contacts in the Contact Collection. private static void GetPresenceInformation() { Console.WriteLine("Getting presence information..."); { PeerContactCollection peerContacts = PeerCollaboration.ContactManager.GetContacts(); if (null == peerContacts) { Console.WriteLine("Unable to enumerate contacts."); return; } // If there are no contacts available to watch, notify the console if (peerContacts.Count == 0) { Console.WriteLine("No contacts for which to obtain presence information."); return; } Console.WriteLine("Printing out all contacts in your contact store..."); PeerEndPoint peerEndPoint = null; foreach (PeerContact pc in peerContacts) { try { Console.WriteLine("The contact display name is: \"{0}\" and the peer name is \"{1}\".", pc.DisplayName, pc.PeerName); // In case there are multiple endpoints, pick an endpoint for this contact peerEndPoint = PickEndpointForContact(pc); Console.WriteLine("The presence information is: {0}.", pc.GetPresenceInfo(peerEndPoint).PresenceStatus.ToString()); } catch (ArgumentException argEx) { Console.WriteLine("The provided endpoint is null or is not valid: {0}", argEx.Message); } catch (PeerToPeerException p2pEx) { Console.WriteLine("The Peer Collaboration Infrastructure could not obtain presence data for the endpoint: {0}", p2pEx.Message); } catch (Exception ex) { Console.WriteLine("Error enumerating the contacts: {0}", ex); } } } return; }