Example #1
0
        public HubInfo Simplified()
        {
            var msg = new HubInfo();

            msg.Name             = Name;
            msg.Id               = Id;
            msg.ExternalEndpoint = ExternalEndpoint;
            msg.InternalEndpoint = InternalEndpoint;

            return(msg);
        }
Example #2
0
        public bool Update(HubInfo message)
        {
            if (Id == message.Id)
            {
                // It is very important to only set value if it is different than null,
                // we must ensure we don't loose previously set IP address that we have discovered and connected to.
                foreach (PropertyInfo P in message.GetType().GetProperties())
                {
                    if (P.GetValue(message) != null)
                    {
                        P.SetValue(this, P.GetValue(message));
                    }
                }

                if (message.InternalAddresses != null && message.InternalAddresses.Count > 0)
                {
                    InternalAddresses.Clear();
                    InternalAddresses.AddRange(message.InternalAddresses);
                }
            }

            return(Id == message.Id);
        }