Exemple #1
0
        public static ActiveModelData GetDefaults2(NetworkTypes networkType = NetworkTypes.LSTMRecurrent)
        {
            ActiveModelData data = new ActiveModelData();

            //
            data.IterType      = 0;
            data.IterValue     = 10000;
            data.MinibatchSize = 125;

            //
            data.LearnerType   = 0;
            data.LearningRate  = 0.000005f;
            data.Momentum      = 5f;
            data.L1Regularizer = 0;
            data.L2Regularizer = 0;

            //
            data.NetworkType      = (int)networkType;
            data.Neurons          = 2500;
            data.HLayers          = 10;
            data.Embeding         = 100;
            data.DropRate         = 10;
            data.UseStabilisation = false;
            data.UseDropRate      = false;

            //
            data.ActivationHidden = Activation.Softmax;
            data.ActivationOutput = Activation.None;

            //Los and Evaluation functions
            data.LossFunction       = LossFunctions.SquaredError;
            data.EvaluationFunction = LossFunctions.SquaredError;
            return(data);
        }
Exemple #2
0
        protected override void FinishWizard()
        {
            NetworkTypes network_type = pageNetworkType.SelectedNetworkType;

            switch (network_type)
            {
            case NetworkTypes.Bonded:
                if (!CreateBonded())
                {
                    FinishCanceled();
                    return;
                }
                break;

            case NetworkTypes.CHIN:
                CreateCHIN();
                break;

            case NetworkTypes.SRIOV:
                CreateSRIOV();
                break;

            default:
                CreateNonBonded();
                break;
            }

            base.FinishWizard();
        }
Exemple #3
0
 public static IEnumerable <Network> GetNetworks(NetworkTypes types)
 {
     foreach (NativeInterfaces.INetwork network in _manager.GetNetworks(types))
     {
         yield return(new Network(network));
     }
 }
Exemple #4
0
        public DataSocket(NetworkTypes type)
        {
            this.type = type;

            receiveBuffer  = new byte[1024];
            sendBuffer     = new byte[1024];
            metaDataSize   = Marshal.SizeOf <MetaData>();
            metaDataBuffer = new byte[metaDataSize];
        }
Exemple #5
0
        private string GetNetworkName(NetworkTypes network_type)
        {
            switch (network_type)
            {
            case NetworkTypes.External:
                return(Messages.NEWNETWORK_NAME);

            case NetworkTypes.Internal:
            case NetworkTypes.CHIN:
                return(Messages.NEWNETWORK_VNAME);

            default:
                return("");
            }
        }
        public SoundDataSocket(NetworkTypes type)
        {
            this.type = type;

            receiveBuffer = new byte[BUF_SIZE];
            sendBuffer    = new byte[BUF_SIZE];
            //BinaryFormatter bf = new BinaryFormatter();
            //MemoryStream ms = new MemoryStream();
            //bf.Serialize(ms, new PacketHeader()); // for get Binary Seriazed data size
            //pktHdrSize = (int) ms.Length;
            //Console.WriteLine("Serialized PacketHeader Class object binary size is berow");
            pktHdrSize = Marshal.SizeOf(new PacketHeader());
            Console.WriteLine(pktHdrSize);
            Console.WriteLine(type);
            pktHdrBuffer = new byte[1024];
        }
        /// <summary>
        ///     根据KAE网络资源来构建一个网络宿主信道
        /// </summary>
        /// <param name="network">网络通信类型</param>
        /// <param name="uri">返回的网络通信资源对象</param>
        /// <returns>返回构建后的宿主信道</returns>
        /// <exception cref="NotSupportedException">不支持的网络类型</exception>
        public static IHostTransportChannel BuildHostChannel(NetworkTypes network, out Uri uri)
        {
            IHostTransportChannel channel;

            switch (network)
            {
            case NetworkTypes.TCP:
                int port = GetDynamicTCPPort();
                channel = new TcpHostTransportChannel(port);
                uri     = new TcpUri(string.Format("tcp://{0}:{1}", GetCurrentMachineIP(), port));
                break;

            default: throw new NotSupportedException("#Sadly, current network type wasn't supported yet! #Network Type: " + network);
            }
            return(channel);
        }
Exemple #8
0
        private void RefreshNetworkList()
        {
            ISet <IPAddress> networkAddresses = Networks.GetAllIPv4Addresses();

            if (null != loadedNetworkAddress)
            {
                networkAddresses.Add(loadedNetworkAddress);
            }
            List <ForeFlightNetworkOption> toAdd = new List <ForeFlightNetworkOption>(networkAddresses.Count);

            foreach (IPAddress a in networkAddresses)
            {
                toAdd.Add(new ForeFlightNetworkOption(ForeFlightNetworkOption.NetworkTypes.IPv4NetworkBroadcast, a));
            }

            foreFlightNetworkOptions.RemoveAll((match) => match.NetworkType == ForeFlightNetworkOption.NetworkTypes.IPv4NetworkBroadcast);
            foreFlightNetworkOptions.AddRange(toAdd);
            foreFlightNetworkOptions.Sort();
            foreflightNetBs.ResetBindings(true);

            NetworkTypes savedFFNetworkType = SimConnectForeflightSettings.ParseForeFlightNetworkTypeSetting(settings.ForeflightNetworkType);

            int selectedOption = -1;

            if (savedFFNetworkType == NetworkTypes.IPv4NetworkBroadcast)
            {
                IPAddress broadcastIp = IPAddress.Loopback;
                IPAddress.TryParse(settings.ForeFlightLastIPv4BroadcastIp, out broadcastIp);
                selectedOption = foreFlightNetworkOptions.FindIndex(
                    (ForeFlightNetworkOption ffno) => ffno.NetworkType == NetworkTypes.IPv4NetworkBroadcast && ffno.Address.Equals(broadcastIp)
                    );
            }
            else
            {
                selectedOption = foreFlightNetworkOptions.FindIndex(
                    (ForeFlightNetworkOption ffno) => ffno.NetworkType == savedFFNetworkType
                    );
            }
            tbForeflightIP.Enabled = savedFFNetworkType == NetworkTypes.DirectIPv4;
            tbForeflightIP.Visible = savedFFNetworkType == NetworkTypes.DirectIPv4;

            cbForeflightConnectType.SelectedIndex = selectedOption == -1 ? 0 : selectedOption;
            cbForeflightConnectType.Invalidate();
        }
 public ForeFlightNetworkOption(NetworkTypes networkType, IPAddress address = null)
 {
     NetworkType = networkType;
     if (networkType == NetworkTypes.IPv6LinkLocal)
     {
         Address = IPAddress.IPv6Any;
     }
     else if (networkType == NetworkTypes.DirectIPv4)
     {
         Address = IPAddress.Loopback;
     }
     else
     {
         if (null == address)
         {
             throw new ArgumentException("Broadcast address must be specified for IPv4 Netowrk Broadcasts");
         }
         Address = address;
     }
 }
Exemple #10
0
        protected override void FinishWizard()
        {
            NetworkTypes network_type = pageNetworkType.SelectedNetworkType;

            if (network_type == NetworkTypes.Bonded)
            {
                if (!CreateBonded())
                {
                    FinishCanceled();
                    return;
                }
            }
            else if (network_type == NetworkTypes.CHIN)
            {
                CreateCHIN();
            }
            else
            {
                CreateNonBonded();
            }

            base.FinishWizard();
        }
 // change network type
 public void ChangeNetworkType(NetworkTypes networkType)
 {
     _trClient.ChangeNetworkType(networkType);
     _wallet.ChangeNetworkType(networkType);
     _networkType = networkType == NetworkTypes.TestNet ? Network.TestNet : Network.Main;
 }
Exemple #12
0
        private void Listener_Packet(object sender)
        {
            NetworkPacket packet = (NetworkPacket)sender;

            // TODO: Make two fields instead.
            int          lsb  = ((ushort)packet.Type) & 0xFF;
            NetworkTypes type = (NetworkTypes)((ushort)packet.Type & 0xFF00);

            switch (type)
            {
            case NetworkTypes.SIMULATOR:
                NetworkStateReport report = (NetworkStateReport)ByteMethods.DeserializeFromBytes(packet.Data);

                switch (report.State)
                {
                case NetworkAppState.RUNNING:
                    Attached     = true;
                    _name        = report.SimRunning;
                    _processname = report.ProcessRunning;
                    break;

                case NetworkAppState.WAITING_SIM:
                    Attached = false;
                    break;

                case NetworkAppState.WAITING_SESSION:
                    Attached     = true;
                    _name        = report.SimRunning;
                    _processname = report.ProcessRunning;
                    break;
                }

                break;

            case NetworkTypes.DRIVER:
                Drivers = (IDriverCollection)ByteMethods.DeserializeFromBytes(packet.Data);
                break;

            case NetworkTypes.PLAYER:
                Player = (IDriverPlayer)ByteMethods.DeserializeFromBytes(packet.Data);
                break;

            case NetworkTypes.SESSION:
                Session = (ISession)ByteMethods.DeserializeFromBytes(packet.Data);
                break;

            case NetworkTypes.HEADER:
                break;

            case NetworkTypes.TRACKMAP:
                Telemetry.m.NetworkTrack_LoadRoute((RouteCollection)ByteMethods.DeserializeFromBytes(packet.Data));
                break;

            case NetworkTypes.TRACK:
                Telemetry.m.NetworkTrack_LoadInfo(
                    (NetworkTrackInformation)ByteMethods.DeserializeFromBytes(packet.Data));
                break;

                // Others.. do later
            }
        }
 /// <summary>
 /// Initializes as Client
 /// </summary>
 /// <param name="port">Port to connect on. Trusted to be valid.</param>
 /// <param name="ip">IP (TRUSTED!! To be valid)</param>
 public void InitManager(int port, string password, string ip)
 {
     NetworkType = NetworkTypes.Client;
     Password = password;
     Listener = new UdpClient(port); //Todo: Add checks
     ListenEP = new IPEndPoint(IPAddress.Parse(ip), port); //Todo: Add checks
     SingleConnection = new Connection(Listener, ListenEP, GenerateCID());
     Connections = new Dictionary<UInt32, Connection>();
     Connections.Add(0, SingleConnection);
     Players = new List<NetworkEntity>();
     InitializeHandlers();
     LevelManager.OnLevelPostLoad += new LevelEvent(OnLevelPostLoad);
 }
Exemple #14
0
 // changing network type for client
 public void ChangeNetworkType(NetworkTypes networkType)
 {
     _client      = networkType == NetworkTypes.TestNet ? new QBitNinjaClient(Network.TestNet) : new QBitNinjaClient(Network.Main);
     _networkType = networkType == NetworkTypes.TestNet ? Network.TestNet : Network.Main;
 }
Exemple #15
0
 protected virtual void OnNetworkTypeChanged_Listener(NetworkTypes networkType)
 {
     base.TrySetIsShadown(RSNetworkObject.IsNetworkPeer);
 }
Exemple #16
0
 // changing network type for wallet
 public void ChangeNetworkType(NetworkTypes networkType)
 {
     _networkType = networkType == NetworkTypes.TestNet ? Network.TestNet : Network.Main;
 }
Exemple #17
0
        public static List<Network> GetNetworks(Core core, NetworkTypes type)
        {
            List<Network> networks = new List<Network>();

            string typeString = "";
            switch (type)
            {
                case NetworkTypes.Country:
                    typeString = "COUNTRY";
                    break;
                case NetworkTypes.Global:
                    typeString = "GLOBAL";
                    break;
                case NetworkTypes.School:
                    typeString = "SCHOOL";
                    break;
                case NetworkTypes.University:
                    typeString = "UNIVERSITY";
                    break;
                case NetworkTypes.Workplace:
                    typeString = "WORKPLACE";
                    break;
            }

            SelectQuery query = Network.GetSelectQueryStub(core, NetworkLoadOptions.All);
            query.AddCondition("network_type", typeString);

            DataTable networksTable = core.Db.Query(query);

            foreach (DataRow dr in networksTable.Rows)
            {
                networks.Add(new Network(core, dr, NetworkLoadOptions.Common));
            }

            return networks;
        }
 /// <summary>
 /// Initializes as Host
 /// </summary>
 /// <param name="port">Port to listen on</param>
 /// <param name="password">string password</param>
 public void InitManager(int port, string password)
 {
     NetworkType = NetworkTypes.Host;
     Password = password;
     Listener = new UdpClient(port);
     ListenEP = new IPEndPoint(IPAddress.Any, port);
     Connections = new Dictionary<UInt32,Connection>();
     Players = new List<NetworkEntity>();
     InitializeHandlers();
     Players.Add(new NetworkEntity());
     ReadyConnections = new List<Connection>();
     LevelManager.OnLevelPostLoad += new LevelEvent(OnLevelPostLoad);
 }
Exemple #19
0
 private string GetNetworkName(NetworkTypes network_type)
 {
     switch (network_type)
     {
         case NetworkTypes.External:
             return Messages.NEWNETWORK_NAME;
         case NetworkTypes.Internal:
         case NetworkTypes.CHIN:
             return Messages.NEWNETWORK_VNAME;
         default:
             return "";
     }
 }
Exemple #20
0
 public NetworkDiscovery(NetworkTypes type)
 {
     this.type = type;
 }