Exemple #1
0
        public Server(IResourceOwner resourceOwner, IPEndPoint externalEndpoint, NBitcoin.Network network)
        {
            _Server = new NodeServer(network, internalPort: externalEndpoint.Port);
            resourceOwner.OwnResource(_Server);

            NodeConnectionParameters nodeConnectionParameters = new NodeConnectionParameters();

            NBitcoin.Protocol.AddressManager addressManager = AddressManager.Instance.GetBitcoinAddressManager();             // new NBitcoin.Protocol.AddressManager ();

            var addressManagerBehavior = new AddressManagerBehavior(addressManager);

            //	addressManagerBehavior.Mode = hasExternal ? AddressManagerBehaviorMode.AdvertizeDiscover : AddressManagerBehaviorMode.Discover;
            nodeConnectionParameters.TemplateBehaviors.Add(addressManagerBehavior);

            _Server.InboundNodeConnectionParameters = nodeConnectionParameters;
            _Server.AllowLocalPeers  = true;            //TODO
            _Server.ExternalEndpoint = externalEndpoint;

            Trace.Information($"Server setup at {externalEndpoint}");
        }
Exemple #2
0
        public ConsoleWindow(IResourceOwner resourceOwner) :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();

            textviewConsole.SizeAllocated += new SizeAllocatedHandler(ScrollToEnd);

            resourceOwner.OwnResource(MessageProducer <ConsoleMessage> .Instance.AddMessageListener(new EventLoopMessageListener <ConsoleMessage> (ConsoleMessage => {
                Gtk.Application.Invoke(delegate {
                    textviewConsole.Buffer.Insert(textviewConsole.Buffer.EndIter, ConsoleMessage.Text);
                });
            })));

            buttonConsoleSettings.Clicked += (sender, e) =>
            {
                if (OnSettingsClicked != null)
                {
                    OnSettingsClicked();
                }
            };
        }