public void Setup(NetworkSettings networkPars) { logger.Debug("ScreenReceiver::Setup(...)"); h264Session = new H264Session(); if (networkPars.TransportMode == TransportMode.Tcp) { rtpReceiver = new RtpTcpReceiver(h264Session); } else if (networkPars.TransportMode == TransportMode.Udp) { rtpReceiver = new RtpUdpReceiver(h264Session); } else { throw new Exception("networkPars.TransportMode"); } h264Session.SSRC = networkPars.SSRC; rtpReceiver.Open(networkPars); rtpReceiver.RtpPacketReceived += RtpReceiver_RtpPacketReceived; }
public static void OnPostProcessBuild(BuildTarget target, string path) { Debug.Log("PostProcessing Build..."); var buildname = Path.GetFileNameWithoutExtension(path); var targetdir = Directory.GetParent(path); var dataDir = targetdir.FullName + Path.DirectorySeparatorChar + buildname + "_Data" + Path.DirectorySeparatorChar; File.WriteAllText(dataDir + "build_type", buildName.ToString()); Debug.Log("Build number set: " + buildName.ToString()); //write settings file var ser = new XmlSerializer(typeof(DefaultAppSettings)); TextWriter writer = new StreamWriter(dataDir + "build_settings"); ser.Serialize(writer, customSettings); writer.Close(); //write network settings NetworkSettings settings = new NetworkSettings(); settings.SaveSettings(dataDir + "network_settings"); File.WriteAllText(dataDir + "/BUILD_COMPLETE", "COMPLETE"); }
public ListedNetworkSettingsGUI(SnakeAISettings snakeAISettings, bool canEdit) : base(canEdit) { this.snakeAISettings = snakeAISettings; networkSettings = snakeAISettings.NetworkSettings; CreateItems(); AddSettingItems(); }
public virtual Cluster CreateNewCluster(string resourceGroupName, string clusterName, OSType osType, ClusterCreateParameters parameters, string minSupportedTlsVersion = default(string), string cloudAadAuthority = default(string), string cloudDataLakeAudience = default(string), string PublicNetworkAccessType = default(string), string OutboundOnlyNetworkAccessType = default(string), bool?EnableEncryptionInTransit = default(bool?)) { var createParams = CreateParametersConverter.GetExtendedClusterCreateParameters(clusterName, parameters); createParams.Properties.OsType = osType; createParams.Properties.MinSupportedTlsVersion = minSupportedTlsVersion; ResetClusterIdentity(createParams, cloudAadAuthority, cloudDataLakeAudience); if (EnableEncryptionInTransit.HasValue) { createParams.Properties.EncryptionInTransitProperties = new EncryptionInTransitProperties() { IsEncryptionInTransitEnabled = EnableEncryptionInTransit }; } if (!string.IsNullOrEmpty(PublicNetworkAccessType) || !string.IsNullOrEmpty(OutboundOnlyNetworkAccessType)) { NetworkSettings networkSettings = new NetworkSettings() { PublicNetworkAccess = PublicNetworkAccessType, OutboundOnlyPublicNetworkAccessType = OutboundOnlyNetworkAccessType }; createParams.Properties.NetworkSettings = networkSettings; } return(HdInsightManagementClient.Clusters.Create(resourceGroupName, clusterName, createParams)); }
public HiddenNeuronControlGUI(NetworkSettings networkSettings) { this.networkSettings = networkSettings; container = new TableLayoutPanel(); container.ColumnCount = 2; container.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); container.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); container.AutoSize = true; container.AutoSizeMode = AutoSizeMode.GrowAndShrink; container.Dock = DockStyle.Fill; container.ControlAdded += OnControlAdded; container.ControlRemoved += OnControlDeleted; AutoSize = true; Dock = DockStyle.Fill; hiddenNeurons = new List <NumericUpDown>(); for (int i = 0; i < networkSettings.numberOfHiddenNeurons.Length; i++) { AddLayer(i, networkSettings.numberOfHiddenNeurons[i]); } Controls.Add(container); }
static void Main(string[] args) { //variable set up settings = new NetworkSettings(); topologies = new Dictionary <string, NetworkTopology>(); objectFactory = new Dictionary <string, IUserObjectFactory>(); objectFactory.Add("standard", new StandLibFactory()); loadTool = new LoadTool(ref settings, ref topologies, ref objectFactory); updateTool = new UpdateTool(ref settings, ref topologies); saveTool = new SaveTool(ref settings, ref topologies); //start up display information Console.WriteLine("ENN Copyright (C) 2012 Tim Eck II"); Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY."); Console.WriteLine("This is free software, and you are welcome to redistribute it"); Console.WriteLine( "under certain conditions; which can be found in the COPYING.LESSER.txt file"); Console.WriteLine("that was provided with the program.\n"); Console.WriteLine( "The ENN runtime has been succesfully started. You may now enter commands"); Console.WriteLine("If you are not sure where to start enter -h."); //command line processing loop Command command = RetrieveCommand(Console.ReadLine()); while (command.BaseType != CommandType.Exit) { ProcessCommand(command); command = RetrieveCommand(Console.ReadLine()); } }
public void TestInitialize() { inputStructure = 2; hiddenStructure = new int[] { 3 }; outputStructure = new int[] { 1, 2 }; weights = new double[17]; networkSettings = new NetworkSettings(inputStructure, hiddenStructure, outputStructure); weights[0] = -1.5; weights[1] = 2; weights[2] = 5.5; weights[3] = 2; weights[4] = -3.5; weights[5] = 1; weights[6] = 2.5; weights[7] = -3; weights[8] = 2.5; weights[9] = 1.5; weights[10] = 2.5; weights[11] = 3; weights[12] = -1.5; weights[13] = 1; weights[14] = -2; weights[15] = 5.5; weights[16] = -2; }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Initializes the panels. /// </summary> private void InitPanels() { var _gs = new GeneralSettings(); var _ns = new NetworkSettings(); var _ds = new DatabaseSettings(); var _is = new ImportSettings(); var _es = new ExportSettings(); this.Panels = new ObservableCollection <SettingsPanelViewModel> { new SettingsPanelViewModel(_gs, _gs), new SettingsPanelViewModel(_ns, _ns) { IsEnabled = false }, new SettingsPanelViewModel(_ds, _ds) { IsEnabled = false }, new SettingsPanelViewModel(_is, _is) { IsEnabled = false }, new SettingsPanelViewModel(_es, _es) { IsEnabled = false } }; }
/// <summary> /// Initializes a new instance of the <see cref="PlaytestRecording"/> class. After instantiation /// the class is ready for taking snapshots of a playtest simulation. /// </summary> /// <param name="agent"></param> /// <param name="networkSettings"></param> /// <param name="snakeSettings"></param> public PlaytestRecording(Agent agent, NetworkSettings networkSettings, SnakeSettings snakeSettings) { Agent = agent; NetworkSettings = networkSettings; SnakeSettings = snakeSettings; PlaytestRoundInfoList = new List <PlaytestRoundInfo>(); }
public void SetUp() { basePath = "C:\\Development Projects\\ENN\\TestSuite\\TestFiles\\"; testSetting = new NetworkSettings(); target = new NetworkSettings(); SetBaseSetting(); }
protected override void QuerySettings() { NetworkSettings section = (NetworkSettings)ConfigurationManager.GetSection("Saga.Manager.NetworkSettings"); if (section != null) { NetworkElement Element = section.Connections["public"]; if (Element != null) { _host_1 = Element.Host; _port_1 = Element.Port; } NetworkElement Element2 = section.Connections["internal"]; if (Element2 != null) { _host_2 = Element2.Host; _port_2 = Element2.Port; } _worldid = section.WorldId; _playerlimit = section.PlayerLimit; _requiredage = (byte)section.Agelimit; _proof = section.Proof; } }
public override void Initialize(ContentManager content) { base.Initialize(content); networkSettings = new NetworkSettings(); generationSettings = new GenerationSettings(); mainPanel = BuildMainPanel(); worldSelectPanel = BuildWorldSelectPanel(); newWorldPanel = BuildNewWorldPanel(); multiplayerPanel = BuildMultiplayerPanel(); joinGamePanel = BuildJoinPanel(); if (!startFromWorldSelect) { mainPanel.Visible = true; worldSelectPanel.Visible = false; newWorldPanel.Visible = false; multiplayerPanel.Visible = false; joinGamePanel.Visible = false; } else { mainPanel.Visible = false; worldSelectPanel.Visible = true; newWorldPanel.Visible = false; multiplayerPanel.Visible = false; joinGamePanel.Visible = false; RefreshWorldSelectList(); } }
/// <summary> /// Sets up bot instance /// </summary> public void Setup() { // Set logging level LogLevels logLevel; Enum.TryParse <LogLevels>(CoreSettings.Get("LogLevel", "Production"), out logLevel); Log.Level = logLevel; // Load instance Bot = new Instance(CoreSettings.Get("Name", defaultName)); userName = NetworkSettings.Get("Username"); password = NetworkSettings.Get("Password"); World = NetworkSettings.Get("World"); Owner = userName; // Connect to network ConnectToUniverse(); Log.Info("Network", "Connected to universe"); // Set up subsystems SetupDatabase(); SetupWeb(); SetupCommands(); SetupEvents(); LoadServices(); // Set up services ConnectToWorld(); PerformMigrations(); InitServices(); Log.Info("Network", "Connected to {0}", World); CoreSettings.Set("Version", MigrationVersion); Bot.ConsoleBroadcast(ChatEffect.None, ColorInfo, "", "Services is now online; say !help for information"); }
public void Setup(NetworkSettings networkSettings) { var localAddr = networkSettings.LocalAddr; var localPort = networkSettings.LocalPort; var localIp = IPAddress.Any; if (!string.IsNullOrEmpty(localAddr)) { if (IPAddress.TryParse(localAddr, out IPAddress _localIp)) { localIp = _localIp; } } var localEndpoint = new IPEndPoint(localIp, localPort); //var remoteIp = IPAddress.Parse(streamingParams.RemoteAddr); //var remoteEndpoint = new IPEndPoint(remoteIp, streamingParams.RemotePort); logger.Debug("RtpStreamer::Open(...) " + localEndpoint); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(localEndpoint); socket.Listen(10); this.LocalEndpoint = (IPEndPoint)socket.LocalEndPoint; //this.RemoteEndpoint = (IPEndPoint)socket.RemoteEndPoint; networkSettings.LocalPort = LocalEndpoint.Port; networkSettings.LocalAddr = LocalEndpoint.Address.ToString(); }
public NetworkClientFactory( UsersService userService, NetworkSettings networkSettings) { _userService = userService; _networkSettings = networkSettings; }
protected override void Awake() { base.Awake(); if (_instance != this) { return; } settings = NetworkSettings.LoadSettings(Application.dataPath + Path.DirectorySeparatorChar + "network_settings"); if (ShowBuild.GetBuildType() == "CONSOLE") { isMaster = false; } isMaster = false; if (isMaster) { Network.InitializeServer(1, 25552, false); } else { Debug.Log("connecting: " + Network.Connect(NetworkController.settings.hostIp, 25552)); Debug.Log("Sono fuori dalla connect"); } }
/// <summary> /// Saves the NetworkSettings object to a text file. /// </summary> /// <param name="settings">The NetworkSettings object to save to disk.</param> /// <param name="filePath">The location to save the file to.</param> /// <exception cref="IOException">System.IO.IOException</exception> private static void SaveText(ref NetworkSettings settings, string filePath) { StreamWriter writer = new StreamWriter(filePath); writer.WriteLine("version:1.0\n"); writer.WriteLine("networkmode:{0}", settings.Mode); writer.WriteLine("networktype:{0}", settings.NetworkType); writer.WriteLine("\n#User Defined Binary settings"); writer.WriteLine("\n#Default data types"); writer.WriteLine("inputlayer:{0}", settings.DefaultInputLayer); writer.WriteLine("node:{0}", settings.DefaultNode); writer.WriteLine("nodelayer:{0}", settings.DefaultHiddenLayer); writer.WriteLine("outputlayer:{0}", settings.DefaultOutputLayer); writer.WriteLine("factory:{0}", settings.DefaultFactory); writer.WriteLine("\n#Debugging"); writer.WriteLine("enabletiming:{0}", settings.EnableTiming); writer.WriteLine("\nTraining Settings"); writer.WriteLine("trainingiterations:{0}", settings.TrainingIterations); writer.WriteLine("trainingaccuracy:{0}", settings.TrainingAccuracy); writer.WriteLine("trainingpool:{0}", settings.TraininPool); writer.WriteLine("\n#User Defined Settings"); //Writes all the key-value pairs that couldn't be matched to a settings //field to disk. foreach (KeyValuePair <string, string> key in settings.Other) { writer.WriteLine("{0}:{1}", key.Key, key.Value); } writer.Close(); }
private void audioPlayButton_Click(object sender, EventArgs e) { audioReceiver = new AudioReceiver(); var addr = audioAddrTextBox.Text; var port = (int)audioPortNumeric.Value; var transport = (TransportMode)transportComboBox.SelectedItem; var sampleRate = (int)sampleRateNumeric.Value; var channels = (int)channelsNumeric.Value; var networkPars = new NetworkSettings { LocalAddr = addr, LocalPort = port, TransportMode = transport, }; var audioPars = new AudioEncoderSettings { SampleRate = sampleRate, Channels = channels, Encoding = "ulaw", DeviceId = currentDirectSoundDeviceInfo?.Guid.ToString() ?? "", }; audioReceiver.SetWaveformPainter(this.waveformPainter1); audioReceiver.Setup(audioPars, networkPars); audioReceiver.Play(); }
public void TestCreateClusterWithPrivateLink() { TestInitialize(); string clusterName = TestUtilities.GenerateName("hdisdk-privatelink"); var createParams = CommonData.PrepareClusterCreateParamsForWasb(); createParams.Location = "South Central US"; var networkSetting = new NetworkSettings(PublicNetworkAccess.OutboundOnly, OutboundOnlyPublicNetworkAccessType.PublicLoadBalancer); createParams.Properties.NetworkSettings = networkSetting; //Create Virturl Network string virtualNetworkName = TestUtilities.GenerateName("hdisdkvnet"); var vnet = CreateVnetForPrivateLink(createParams.Location, virtualNetworkName); foreach (var role in createParams.Properties.ComputeProfile.Roles) { role.VirtualNetworkProfile = new VirtualNetworkProfile(vnet.Id, vnet.Subnets.First().Id); } var cluster = HDInsightClient.Clusters.Create(CommonData.ResourceGroupName, clusterName, createParams); var result = HDInsightClient.Clusters.Get(CommonData.ResourceGroupName, clusterName); ValidateCluster(clusterName, createParams, result); }
protected override void Establish_context() { base.Establish_context(); contentToDownloadPath = Path.Combine(contentDirectoryName, checkingFileName); NetworkSettings.SetupGet(setting => setting.BlockSize).Returns(10000); NetworkSettings.SetupGet(setting => setting.ProxyIP).Returns(""); NetworkSettings.SetupGet(setting => setting.ProxyPort).Returns(1043); NetworkSettings.SetupGet(settng => settng.UseProxy).Returns(false); string downloadUri = Path.Combine(httpServiceEndpoint, contentDirectoryName, checkingFileName).Replace("\\", "/"); UriSource.Setup(source => source.Uri).Returns(downloadUri); this.createDirectoryIfNotExists(); this.createFileToDownloadInDirectory(); webServiceManager = new WebServiceManager(contentDirectoryName, ""); saveDownloadedContentStream = new MemoryStream(); string errorMessage = ""; if (!webServiceManager.TryStart(httpServiceEndpoint, out errorMessage)) { throw new InvalidOperationException(errorMessage); } NetworkClient.OnBlockDownloaded += new Action <byte[], int>(NetworkClient_OnBlockDownloaded); }
/// <summary> /// Loads a topology from a file into the gui. /// </summary> private void LoadTopology(object sender, EventArgs e) { openTopology.ShowDialog(); Dictionary <string, IUserObjectFactory> factories = metaData.GetFactories(); NetworkSettings settings = new NetworkSettings(); NetworkTopology topology = Topology.Load(openTopology.FileName, ref factories, ref settings, openTopology.FileName.EndsWith(".nntc", true, null)); topologyMetaData = topology.MetaData; AddPreProcessor(null, null); GetLayer(0).SetMetaData(topology.PreProcessor.MetaData); AddInputLayer(null, null); GetLayer(1).SetMetaData(topology.InputLayer.MetaData); int row = 2; for (int i = 0; i < topology.HiddenLayers.Length; i++) { AddHiddenLayer(null, null); HiddenLayerView layer = (HiddenLayerView)GetLayer(row); layer.SetMetaData(topology.HiddenLayers[i].MetaData); currentSelectedLayer = layer; row++; } AddOutputLayer(null, null); AddPostProcessor(null, null); }
///<exception cref = "SnifferAppDBConnectionException">Eccezione lanciata in caso di errore nell'apertura della connessione al DB</exception> ///<exception cref = "SnifferAppThreadException">Eccezione lanciata in caso di errore nell'apertura di un nuovo thread</exception> private ThreadGestioneWifi(NetworkSettings settings) { this.settings = settings; stopThreadElaboration = false; //instanzio il db manager dbManager = DatabaseManager.getInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="SyncConnection"/> class. /// </summary> public SyncConnection(IOptions <IndexerSettings> config, IOptions <ChainSettings> chainConfig, IOptions <NetworkSettings> networkConfig) { IndexerSettings configuration = config.Value; ChainSettings chainConfiguration = chainConfig.Value; NetworkSettings networkConfiguration = networkConfig.Value; Symbol = chainConfiguration.Symbol; Password = configuration.RpcPassword; // Take the RPC Port from the Indexer configuration, if it is specified. Otherwise we'll use the default for this chain. RpcAccessPort = configuration.RpcAccessPort != 0 ? configuration.RpcAccessPort : networkConfiguration.RPCPort; ApiAccessPort = networkConfiguration.APIPort; ServerDomain = configuration.RpcDomain.Replace("{Symbol}", chainConfiguration.Symbol.ToLower()); User = configuration.RpcUser; Secure = configuration.RpcSecure; if (string.IsNullOrWhiteSpace(networkConfiguration.NetworkType)) { Network = new NetworkConfig(configuration, chainConfiguration, networkConfiguration); HasNetworkType = false; } else { Network = (Network)Activator.CreateInstance(Type.GetType(networkConfiguration.NetworkType)); HasNetworkType = true; } RecentItems = new Buffer <(DateTime Inserted, TimeSpan Duration, long Size)>(5000); }
/// <summary> /// Removes the first HttpServer from the list with a Request Uri thata matches the parameter /// </summary> /// <param name="param">HttpServer items Request property</param> private void RemoveConfigCommandAction(object param) { // Get string var str = (string)param; if (str != null && str.Length > 0) { // Remove first matching HttpServer from list and update UI var config = NetworkSettings.FirstOrDefault(x => x.Name == str); NetworkSettings.Remove(config); OnPropertyChanged(nameof(NetworkSettings)); } else { // Remove all blank HttpServers from the list and update UI var list = new List <NetworkConfig>(); foreach (NetworkConfig item in NetworkSettings) { if (item.Name == null || item.Name.Length < 3) { list.Add(item); } } foreach (NetworkConfig item in list) { NetworkSettings.Remove(item); } OnPropertyChanged(nameof(NetworkSettings)); } // If the list is empty add one new blank HttpServer if (NetworkSettings.Count == 0) { NewConfigCommandAction(); } }
public async Task UpdateSettings(ServerSettings server, NetworkSettings network, DeskViewSettings deskview) { _sharedViewModel.ApplicationConfiguration.DeskViewSettings = new DeskViewSettings(deskview); _sharedViewModel.ApplicationConfiguration.ServerSettings = new ServerSettings(server); _sharedViewModel.ApplicationConfiguration.NetworkSettings = new NetworkSettings(network); await SaveToPCL(); }
private void CreateDefaultNLogListener(NLogOptions verbOptions, ISessionManager sessionManager) { var name = $"Using nlog listener on {(verbOptions.IsUdp ? "Udp" : "Tcp")} port {verbOptions.Port}"; var info = NLogViewerProvider.ProviderRegistrationInformation.Info; Log.Debug(name); var providerSettings = new NetworkSettings { Protocol = verbOptions.IsUdp ? NetworkProtocol.Udp : NetworkProtocol.Tcp, Port = verbOptions.Port, Name = name, Info = info, }; var providers = Enumerable.Repeat( new PendingProviderRecord { Info = info, Settings = providerSettings }, 1); sessionManager.LoadProviders(providers); }
/// <summary> /// Closes the window /// </summary> private void CloseCommandAction() { // Servers to remove before saving var list = new List <NetworkConfig>(); // Loop through servers and stop and store unused for removing foreach (NetworkConfig config in NetworkSettings) { // Add to removal list if (config.Name == null || config.Name?.Length == 0) { list.Add(config); } } // Remove blank servers foreach (NetworkConfig item in list) { NetworkSettings.Remove(item); } Refresh(); // Store user settings var jsonObject = ObjectToJsonString(NetworkSettings, false); Properties.Settings.Default["Servers"] = jsonObject; Properties.Settings.Default["Theme"] = CurrentTheme; Properties.Settings.Default["SelectedTab"] = SelectedTab; Properties.Settings.Default.Save(); _window.Close(); }
/// <summary> /// Loads a settings file and then populates the form fields. /// </summary> private void loadMenuItem_Click(object sender, EventArgs e) { openSettings.ShowDialog(); try { settings = Settings.Load(openSettings.FileName, openSettings.FileName.EndsWith(".nnsc", true, null)); if (settings.Mode == NetworkMode.Computational) { networkMode.SelectedIndex = 1; } else { networkMode.SelectedIndex = 0; } if (settings.NetworkType == NetworkType.Traditional) { networkType.SelectedIndex = 0; } else { networkType.SelectedIndex = 1; } defaultInput.Text = settings.DefaultInputLayer; defaultNode.Text = settings.DefaultNode; defaultHidden.Text = settings.DefaultHiddenLayer; defaultOutput.Text = settings.DefaultOutputLayer; enableTiming.Checked = settings.EnableTiming; trainingAccuracy.Text = settings.TrainingAccuracy.ToString(); trainingIterations.Text = settings.TrainingIterations.ToString(); trainingPool.Text = settings.TraininPool.ToString(); customParameters.Text = ""; int i = 0; string[] lines = new string[settings.Other.Count]; foreach (KeyValuePair <string, string> key in settings.Other) { lines[i] = key.Key + ":" + key.Value; i++; } customParameters.Lines = lines; } catch (IOException ex) { MessageBox.Show("The file could not be loaded."); } catch (IndexOutOfRangeException ex) { MessageBox.Show("The settings file was not properly formated."); } catch (Exception ex) { MessageBox.Show("There was some unknown error that occured while loading the file."); } }
public Network(NetworkSettings settings) { this.MinValue = settings.MinNetworkValue; this.MaxValue = settings.MaxNetworkValue; this.ShouldNormalize = settings.ShouldNormalize; this.InputNeurons = new List <IInputNeuron>(); this.OutputNeurons = new List <IOutputNeuron>(); }
private static void InitializeNetworking(string dataDir = null) { _networkSettings = NetworkSettings.Get(dataDir); _connectionManager = new ClientManager(_networkSettings); _connectionManager.OnConnected += OnConnected; _connectionManager.OnDisconnected += OnDisconnected; _connectionManager.OnMessage += OnMessageReceived; }
public SystemMulticastClient(NetworkSettings settings) { _settings = settings; _client = new UdpClient(new IPEndPoint(IPAddress.Any, settings.MulticastPort)) {Ttl = ((short) settings.TTL)}; _client.MulticastLoopback = true; //_client.EnableBroadcast = true; }
/// <summary> /// Save the NetworkSettings object to a binary file. /// </summary> /// <param name="settings">The NetworkSettings object that will be saved to /// disk in a binary file.</param> /// <param name="filePath">The location to save the file.</param> /// <exception cref="IOException">System.IO.IOException</exception> private static void SaveBinary(ref NetworkSettings settings, string filePath) { Stream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write); BinaryFormatter binary = new BinaryFormatter(); binary.Serialize(fs, settings); fs.Close(); }
void Awake() { instance = this; if (httpUseSSL) { httpPrefix = "https://"; } else { httpPrefix = "http://"; } }
private static NetworkSettings GetNetworkSettings(string localip) { var settings = new NetworkSettings(); settings.dhcp = (AskQuestion(Questions.DHCP, "n").ToLower().StartsWith("y")); if (!settings.dhcp) { settings.nameserver = AskQuestion(Questions.NameServer, IpToNewIp(localip, "1")); settings.gateway = AskQuestion(Questions.Gateway, IpToNewIp(localip, "1")); settings.netmask = AskQuestion(Questions.Netmask, "255.255.255.0"); settings.ip = AskQuestion(Questions.StaticIp, IpToNewIp(localip, "130")); } return settings; }
/// <summary> /// Loads the networks setinngs into a new IrcNetwork instance. /// </summary> /// <param name="settings">The settings to load.</param> /// <returns>The IrcNetwork instance as an INetwork.</returns> /// <exception cref="UnsupportedProtocolExteption"> /// An UnsupportedProtocolExteption is thrown, if the given settings object is for /// another protocol. /// </exception> public IrcShark.Chatting.INetwork LoadNetwork(NetworkSettings settings) { if (!settings.Protocol.Equals(Protocol.Name)) { throw new UnsupportedProtocolException(); } IrcNetwork result = new IrcNetwork(IrcProtocol.GetInstance(), settings.Name); foreach (ServerSettings server in settings.Servers) { IrcServerEndPoint ircsrv = result.AddServer(server.Name, server.Address); if (server.Parameters.ContainsKey("password")) { ircsrv.Password = server.Parameters["password"]; } } return result; }
public SystemTcpListener(NetworkSettings settings) { _settings = settings; _listener = new TcpListener(settings.ListenPort); }
/// <summary> /// Saves an IrcNetwork to a NetworkSettings instance. /// </summary> /// <param name="network">The IrcNetwork to save.</param> /// <returns>The generated NetworkSettings instance.</returns> public NetworkSettings SaveNetwork(IrcShark.Chatting.INetwork network) { IrcNetwork net = network as IrcNetwork; if (net == null) { throw new ArgumentException("The given network is not an irc network"); } NetworkSettings settings = new NetworkSettings(); settings.Protocol = net.Protocol.Name; settings.Name = net.Name; foreach (IrcServerEndPoint server in net) { ServerSettings servSet = new ServerSettings(); servSet.Name = server.Name; servSet.Address = string.Format("{0}:{1}", server.Address, server.Port); if (!string.IsNullOrEmpty(server.Password)) { servSet.Parameters.Add("Password", server.Password); } settings.Servers.Add(servSet); } return settings; }
public bool RemoveNetwork(NetworkSettings network) { return Networks.Remove(network); }
public ConfigurationData() { Strings = new StringsSettings(); Network = new NetworkSettings(); DefaultChannels = new DefaultChannelSettings(); NamingRules = new NamingRulesSettings(); Timers = new TimerSettings(); FloodConditions = new FloodConditionsSettings(); }
public NetworkSettingsTreeNode(NetworkSettings settings, ContextMenuStrip menu) { Text = settings.Name; Settings = settings; ContextMenuStrip = menu; }