Beispiel #1
0
 private void stopToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ServerList.FocusedItem != null)
     {
         ArkServerListViewItem ASLVI = (ArkServerListViewItem)ServerList.FocusedItem;
         ASLVI.GetServerData().StopServer();
         ASLVI.UpdateStatus();
     }
 }
Beispiel #2
0
 private void StopServer()
 {
     if (ServerList.FocusedItem != null)
     {
         ArkServerListViewItem ASLVI = (ArkServerListViewItem)ServerList.FocusedItem;
         ASLVI.GetServerData().StopServer();
         ASLVI.UpdateStatus();
         Registry.SaveRegConfig(this);
         Log(ASLVI.GetServerData().AltSaveDirectory + " Stopped!");
     }
 }
Beispiel #3
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);
        }