Esempio n. 1
0
        private bool Bootstrap(ToxConfigNode node)
        {
            var  toxNode = new ToxNode(node.Address, node.Port, new ToxKey(ToxKeyType.Public, node.PublicKey));
            var  error   = ToxErrorBootstrap.Ok;
            bool success = this.tox.Bootstrap(toxNode, out error);

            if (success)
            {
                Logger.Log(LogLevel.Info, string.Format("Bootstrapped off of {0}:{1}", node.Address, node.Port));
            }
            else
            {
                Logger.Log(LogLevel.Error, string.Format("Could not bootstrap off of {0}:{1}, error: {2}", node.Address, node.Port, error));
            }

            // even if adding the tcp relay fails for some reason (while it shouldn't...), we'll consider this successful.
            if (this.tox.AddTcpRelay(toxNode, out error))
            {
                Logger.Log(LogLevel.Info, string.Format("Added TCP relay:    {0}:{1}", node.Address, node.Port));
            }
            else
            {
                Logger.Log(LogLevel.Error, string.Format("Could not add TCP relay {0}:{1}, error: {2}", node.Address, node.Port, error));
            }

            return(success);
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            ToxNode node = obj as ToxNode;

            if ((object)node == null)
            {
                return(false);
            }

            return(this == node);
        }