/// <summary>
		/// 刷新UI服务信息列表
		/// </summary>
		public static void RefreshServerInfoList()
		{
			ServerList.Clear();

			var servers = Bootstrap.AppServers;

			foreach (var item in servers)
			{

				string listenerPort;
				string ipAddress;
				if (item.Config.Listeners == null)
				{
					listenerPort = item.Config.Port.ToString();
					ipAddress = item.Config.Ip;
				}
				else
				{
					List<string> ipList = new List<string>();

					List<string> portList = new List<string>();

					var query = item.Config.Listeners.ToList();

					foreach (var listener in query)
					{
						ipList.Add(listener.Ip);
						portList.Add(listener.Port.ToString());
					}


					if (ipList.Contains("Any"))
					{
						ipAddress = "Any";
					}
					else
					{
						ipAddress = string.Join(",", ipList);
					}

					listenerPort = string.Join(",", portList);

				}

				ServerInfo serInfo = new ServerInfo
				{
					Name = item.Name,
					IPAddress = ipAddress,
					ListenerPort = listenerPort,
					State = (int)item.State,
					Connections = item.SessionCount
				};
					ServerList.Add(serInfo);
			}
		}
Esempio n. 2
0
        private void GetServers(int selectedId = -1)
        {
            _dbServersList = StorageRepository.GetServersList();

            var items = _dbServersList?.FindAll() ?? new List <Server>();

            ServerList.Clear();
            ServerList.AddRange(items);

            ServerIndex = selectedId != -1 ? selectedId : 0;
        }
Esempio n. 3
0
 private void Cleanup()
 {
     foreach (var trigger in mTriggers)
     {
         LogicServerControl.Timer.DeleteTrigger(trigger);
     }
     mTriggers.Clear();
     DictRankData.Clear();
     hasRequested = false;
     ServerList.Clear();
 }
 private void ServerList_TextChanged(object sender, EventArgs e)
 {
     if (ServerList.Lines.Length >= 20000)
     {
         RepeatCreateFakePlayer.Stop();
         MessageBox.Show("Server list is maxim (max is 20000)", "CL_CreateFakePlayer", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ServerList.Clear();
         groupBoxServers.Text = "Servers : " + ServerList.Lines.Where(line => !String.IsNullOrEmpty(line)).Count().ToString();
         return;
     }
     groupBoxServers.Text = "Servers : " + ServerList.Lines.Where(line => !String.IsNullOrEmpty(line)).Count().ToString();
 }
Esempio n. 5
0
        public void ReadSqlServers()
        {
            ServerList.Clear();
            SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;

            System.Data.DataTable table = instance.GetDataSources();
            foreach (System.Data.DataRow oRow in table.Rows)
            {
                var ServerName   = oRow[0].GetType() == typeof(DBNull) ? "" : (string)oRow[0];
                var InstanceName = oRow[1].GetType() == typeof(DBNull) ? "" : (string)oRow[1];
                var Version      = oRow[3].GetType() == typeof(DBNull) ? "" : (string)oRow[3];
                ServerList.Add(ServerName + " (" + InstanceName + ") " + " / " + Version);
            }
        }
        /// <summary>
        /// Загрузить список доступных серверов.
        /// </summary>
        private void LoadServersAsync()
        {
            Task.Factory.StartNew(() =>
            {
                VisibleLoadingRing = Visibility.Visible;

                DataTable dt = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();
                ServerList.Clear();

                foreach (DataRow dr in dt.Rows)
                {
                    ServerList.Add(string.Concat(dr["ServerName"], "\\", dr["InstanceName"]));
                }

                VisibleLoadingRing = Visibility.Hidden;
            });
        }
Esempio n. 7
0
        private void ConfigLoaded()
        {
            var oldConfig = Config;

            Config = new Config();
            Configuration.Bind(Config);

            Logger.UpdateConfig(Config.LoggerConfig);

            // Handle reloading the config and updating the list visibility
            if (oldConfig == null || oldConfig.AuthListType == Config.AuthListType)
            {
                return;
            }

            lock (ServerList)
            {
                ServerList.Clear();
                SetupServerList();
                GenerateServerList();
            }
        }
Esempio n. 8
0
        private void OnTypeSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Profile profile = SelectedProfile;
            ConfigurationViewModel config = ConfigurationCb.SelectedItem as ConfigurationViewModel;

            if (config != null && profile != null)
            {
                if (config.IsWebAvailable)
                {
                    ComboBoxServer.SelectedIndex = -1;
                    ServerList.Clear();
                    if (config.Configuration.ServersProvider.ServerList.Count > 0)
                    {
                        // Construct new list to avoid plugin's transparent proxy issues
                        foreach (Server server in config.Configuration.ServersProvider.ServerList)
                        {
                            ServerList.Add(new Server(server));
                        }
                        ComboBoxServer.SelectedIndex = 0;
                    }
                }
            }
            ValidatePaths();
        }
Esempio n. 9
0
    /// <summary>
    /// Clear the list of known servers when the component is disabled.
    /// </summary>

    protected virtual void OnDisable()
    {
        errorString = "";
        knownServers.Clear();
    }
Esempio n. 10
0
 private void RefreshServerList()
 {
     serverList.Clear();
     networkDiscoverer.Discover();
 }
Esempio n. 11
0
    /// <summary>
    /// Clear the list of known servers when the component is disabled.
    /// </summary>

    protected virtual void OnDisable()
    {
        knownServers.Clear();
    }
Esempio n. 12
0
        private void SetupCallbacks()
        {
            BackupButton.Click += (e, a) => Backup.BackupConfigs(this);

            FormClosing += (e, a) =>
            {
                Worker.DestroyAll();
                Registry.SaveRegConfig(this);
            };

            checkAutoServerUpdate.CheckedChanged += (e, a) =>
            {
                if (!checkAutoServerUpdate.Checked)
                {
                    ServerUpdater.Updating = false;
                }
            };

            ServerList.MouseDoubleClick     += (e, a) => EditServer();
            ServerList.SelectedIndexChanged += (e, a) =>
            {
                if (ServerList.FocusedItem != null)
                {
                    ArkServerListViewItem ASLVI = (ArkServerListViewItem)ServerList.FocusedItem;
                    StartButton.Enabled = true;
                    if (ASLVI.GetServerData().IsRunning())
                    {
                        StartButton.BackColor = System.Drawing.Color.Red;
                        StartButton.ForeColor = System.Drawing.Color.White;
                        StartButton.Text      = "Stop";
                    }
                    else
                    {
                        StartButton.BackColor = System.Drawing.Color.Green;
                        StartButton.ForeColor = System.Drawing.Color.White;
                        StartButton.Text      = "Start";
                    }
                }
                else
                {
                    StartButton.BackColor = System.Drawing.Color.DarkGray;
                    StartButton.ForeColor = System.Drawing.Color.DimGray;
                    StartButton.Enabled   = false;
                }
            };

            StartButton.Click += (e, a) =>
            {
                if (ServerList.FocusedItem != null)
                {
                    ArkServerListViewItem ASLVI = (ArkServerListViewItem)ServerList.FocusedItem;
                    if (StartButton.Text == "Start")
                    {
                        ASLVI.GetServerData().StartServer();
                    }
                    else
                    {
                        ASLVI.GetServerData().StopServer();
                    }
                    ASLVI.UpdateStatus();
                }
            };

            addToolStripMenuItem.Click          += (e, a) => AddServer();
            removeToolStripMenuItem.Click       += (e, a) => RemoveServer();
            editSettingsToolStripMenuItem.Click += (e, a) => EditServer();

            addToolStripMenuItem1.Click          += (e, a) => AddServer();
            removeToolStripMenuItem1.Click       += (e, a) => RemoveServer();
            editSettingsToolStripMenuItem1.Click += (e, a) => EditServer();

            startToolStripMenuItem.Click += (e, a) => StartServer();
            stopToolStripMenuItem.Click  += (e, a) => StopServer();

            startToolStripMenuItem1.Click += (e, a) => StartServer();
            stopToolStripMenuItem1.Click  += (e, a) => StopServer();

            button1.Click += (e, a) =>
            {
                if (ServerUpdater.Updating)
                {
                    MessageBox.Show("Already Updating", "Update in progress", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                Log("[Atlas] Forcing Update");
                ServerUpdater.ForcedUpdate = true;
                Worker.ForceUpdaterRestart(this);
            };

            ClearConfigButton.Click += (e, a) =>
            {
                if (MessageBox.Show("Are you sure you want to erase all your configurations?", "Configuration Reset", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Registry.ClearAll();
                    ServerList.Clear();
                }
            };

            broadcastToolStripMenuItem.Click      += (e, a) => RconBroadcast(false);
            saveWorldToolStripMenuItem.Click      += (e, a) => RconSaveWorld(false);
            closeSaveWorldToolStripMenuItem.Click += (e, a) => RconCloseSaveWorld(false);
            customCommandToolStripMenuItem.Click  += (e, a) => RconCustomCommand(false);
            loadPluginToolStripMenuItem.Click     += (e, a) => RconPlugin(false, true);
            unloadPluginToolStripMenuItem.Click   += (e, a) => RconPlugin(false, false);

            broadcastToolStripMenuItem1.Click      += (e, a) => RconBroadcast(true);
            saveWorldToolStripMenuItem1.Click      += (e, a) => RconSaveWorld(true);
            closeSaveWorldToolStripMenuItem1.Click += (e, a) => RconCloseSaveWorld(true);
            customCommandToolStripMenuItem1.Click  += (e, a) => RconCustomCommand(true);
            loadPluginToolStripMenuItem1.Click     += (e, a) => RconPlugin(true, true);
            unloadPluginToolStripMenuItem1.Click   += (e, a) => RconPlugin(true, false);


            broadcastToolStripMenuItem2.Click      += (e, a) => RconBroadcast(false);
            saveWorldToolStripMenuItem2.Click      += (e, a) => RconSaveWorld(false);
            closeSaveWorldToolStripMenuItem2.Click += (e, a) => RconCloseSaveWorld(false);
            customCommandToolStripMenuItem2.Click  += (e, a) => RconCustomCommand(false);
            loadPluginToolStripMenuItem2.Click     += (e, a) => RconPlugin(false, true);
            unloadPluginToolStripMenuItem2.Click   += (e, a) => RconPlugin(false, false);

            broadcastToolStripMenuItem3.Click      += (e, a) => RconBroadcast(true);
            saveWorldToolStripMenuItem3.Click      += (e, a) => RconSaveWorld(true);
            closeSaveWorldToolStripMenuItem3.Click += (e, a) => RconCloseSaveWorld(true);
            customCommandToolStripMenuItem3.Click  += (e, a) => RconCustomCommand(true);
            loadPluginToolStripMenuItem3.Click     += (e, a) => RconPlugin(true, true);
            unloadPluginToolStripMenuItem3.Click   += (e, a) => RconPlugin(true, false);
        }