예제 #1
0
        private int GetFreePort(NetSettings netSettings)
        {
            int defaultPort = 8123;

            try
            {
                // TCP stack please do me a favor
                TcpListener l = new TcpListener(IPAddress.Parse(netSettings.Socks5ListeningAddress), 0);
                l.Start();
                var port = ((IPEndPoint)l.LocalEndpoint).Port;
                l.Stop();
                return(port);
            }
            catch (Exception e)
            {
                // in case access denied
                this.Log().Error(e, "");
                return(defaultPort);
            }
        }
예제 #2
0
 public ApplicationSettings()
 {
     Queue = new QueueSettings(this);
     BitTorrent = new BitTorrentSettings(this);
     DiskIO = new DiskIOSettings(this);
     Seed = new SeedSettings(this);
     Peer = new PeerSettings(this);
     Net = new NetSettings(this);
     Statistics = new StatsSettings(this);
     Gui = new GuiSettings(this);
     Isp = new IspSettings(this);
     Scheduling = new SchedulingSettings(this);
     Show = new ShowSettings(this);
     Webui = new WebuiSettings(this);
     Streaming = new StreamingSettings(this);
     Directory = new DirectorySettings(this);
     Transfer = new MultidayTransferSettings(this);
     Proxy = new ProxySettings(this);
     Cache = new CacheSettings(this);
 }
예제 #3
0
 public NotificationEngine(IHubContext <NodeHub> nodeHub,
                           IHubContext <BlockHub> blockHub,
                           IHubContext <TransactionCountHub> transCountHub,
                           IHubContext <TransactionAverageCountHub> transAvgCountHub,
                           NodeCache nodeCache,
                           NodeSynchronizer nodeSynchronizer,
                           RPCNodeCaller rPCNodeCaller,
                           StateOfNeoContext ctx,
                           IOptions <NetSettings> netSettings)
 {
     _ctx              = ctx;
     _nodeHub          = nodeHub;
     _nodeCache        = nodeCache;
     _transCountHub    = transCountHub;
     _transAvgCountHub = transAvgCountHub;
     _nodeSynchronizer = nodeSynchronizer;
     _rPCNodeCaller    = rPCNodeCaller;
     _netSettings      = netSettings.Value;
     this.blockHub     = blockHub;
 }
예제 #4
0
        private void ServerState_Click(object sender, EventArgs e)
        {
            int    State = 0;
            object Host, NetSettings;
            IntPtr devHandle = (IntPtr)TreeViewServer.SelectedNode.Tag;

            u2ec.ServerGetUsbDevStatus(HandleServer, devHandle, out State, out Host);
            u2ec.ServerGetSharedUsbDevNetSettings(HandleServer, devHandle, out NetSettings);

            string result = "";

            if (State == u2ec.STATE_CONNECTED)
            {
                result = "connected / " + NetSettings.ToString() + " / " + Host.ToString();
            }
            else if (State == u2ec.STATE_WAITING)
            {
                result = "waiting for connection / " + NetSettings.ToString();
            }

            MessageBox.Show(result);
        }
예제 #5
0
파일: IOManager.cs 프로젝트: awsker/a-link
        public static NetSettings ReadNetSettings(string filename = null)
        {
            NetSettings settings = null;

            try
            {
                if (File.Exists(filename ?? netSettingsFileFullPath))
                {
                    using (var sr = new StreamReader(filename ?? netSettingsFileFullPath))
                    {
                        string row = sr.ReadLine();
                        settings = new NetSettings(row);
                        sr.BaseStream.Close();
                        sr.Close();
                    }
                }
                return(settings);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public NetSettings[] GetSettings()
        {
            if (DocumentAngelNet.Net == null)
            {
                return(null);
            }

            var settings = new NetSettings[DocumentAngelNet.Net.Layers.Length];

            for (var i = 0; i < DocumentAngelNet.Net.Layers.Length; i++)
            {
                var layer = DocumentAngelNet.Net.Layers[i];

                switch (layer.Type)
                {
                case LayerType.Convolution:
                    var convLayer = (IConvolutionLayer)layer;
                    settings[i] = new NetSettings(layer.Type, convLayer.ActivationFunctionType, convLayer.NeuronsCount, convLayer.KernelSize);
                    break;

                case LayerType.MaxPoolingLayer:
                    var poolLayer = (IMaxPoolingLayer)layer;
                    settings[i] = new NetSettings(layer.Type, ActivationType.None, null, poolLayer.KernelSize);
                    break;

                case LayerType.FullyConnected:
                    var fullLayer = (IFullyConnectedLayer)layer;
                    settings[i] = new NetSettings(layer.Type, fullLayer.ActivationFunctionType, fullLayer.NeuronsCount, null);
                    break;

                default:
                    throw new ArgumentException();
                }
            }

            return(settings);
        }
        public NotificationEngine(
            IHubContext <NodeHub> nodeHub,
            IHubContext <BlockHub> blockHub,
            IHubContext <TransactionCountHub> transCountHub,
            IHubContext <TransactionAverageCountHub> transAvgCountHub,
            IHubContext <FailedP2PHub> failP2PHub,
            NodeCache nodeCache,
            PeersEngine peersEngine,
            NodeSynchronizer nodeSynchronizer,
            RPCNodeCaller rPCNodeCaller,
            IOptions <NetSettings> netSettings)
        {
            this.nodeHub          = nodeHub;
            this.nodeCache        = nodeCache;
            this.transCountHub    = transCountHub;
            this.failP2PHub       = failP2PHub;
            this.transAvgCountHub = transAvgCountHub;
            this.nodeSynchronizer = nodeSynchronizer;
            this.rPCNodeCaller    = rPCNodeCaller;
            this.netSettings      = netSettings.Value;
            this.peersEngine      = peersEngine;

            this.blockHub = blockHub;
        }
 public RPCNodeCaller(IOptions <NetSettings> netSettings)
 {
     this.netSettings = netSettings.Value;
 }
예제 #9
0
 public NodeService(StateOfNeoContext db, IOptions <NetSettings> netSettings) : base(db)
 {
     this.netSettings = netSettings.Value;
 }
예제 #10
0
 public LobbyContainer()
 {
     InitializeComponent();
     NetSettings = new NetSettings(string.Empty, 44544, 44544, string.Empty);
 }