Removes deprecated API calls

This commit is contained in:
Cyberboss
2017-10-24 14:54:12 -04:00
parent c67b597d08
commit df663d8eb1
3 changed files with 13 additions and 144 deletions
+1 -79
View File
@@ -10,7 +10,7 @@ namespace TGCommandLine
public AdminCommand()
{
Keyword = "admin";
Children = new Command[] { new AdminViewGroupCommand(), new AdminSetGroupCommand(), new AdminClearGroupCommand(), new AdminViewPortCommand(), new AdminSetPortCommand(), new AdminMoveServerCommand(), new AdminRecreateStaticCommand() };
Children = new Command[] { new AdminViewGroupCommand(), new AdminSetGroupCommand(), new AdminClearGroupCommand(), new AdminRecreateStaticCommand() };
}
public override string GetHelpText()
{
@@ -18,31 +18,6 @@ namespace TGCommandLine
}
}
class AdminMoveServerCommand : Command
{
public AdminMoveServerCommand()
{
Keyword = "move-server";
RequiredParameters = 1;
}
protected override ExitCode Run(IList<string> parameters)
{
var res = Interface.GetComponent<ITGAdministration>().MoveServer(parameters[0]);
OutputProc(res ?? "Success");
return res == null ? ExitCode.Normal : ExitCode.ServerError;
}
public override string GetArgumentString()
{
return "<new path>";
}
public override string GetHelpText()
{
return "Move the server installation (BYOND, Repo, Game) to a new location. Nothing else may be running for this task to complete";
}
}
class AdminRecreateStaticCommand : Command
{
public AdminRecreateStaticCommand()
@@ -63,59 +38,6 @@ namespace TGCommandLine
}
}
class AdminSetPortCommand : Command
{
public AdminSetPortCommand()
{
Keyword = "set-port";
RequiredParameters = 1;
}
public override string GetHelpText()
{
return "Set the port used for remote access. Requires a service restart to take effect";
}
public override string GetArgumentString()
{
return "<port>";
}
protected override ExitCode Run(IList<string> parameters)
{
ushort port;
try
{
port = Convert.ToUInt16(parameters[0]);
}
catch
{
OutputProc("Invalid port number!");
return ExitCode.BadCommand;
}
var res = Interface.GetComponent<ITGAdministration>().SetRemoteAccessPort(port);
OutputProc(res ?? "Success!");
return ExitCode.Normal;
}
}
class AdminViewPortCommand : Command {
public AdminViewPortCommand()
{
Keyword = "view-port";
}
public override string GetHelpText()
{
return "Print the port currently designated for remote access";
}
protected override ExitCode Run(IList<string> parameters)
{
var port = Interface.GetComponent<ITGAdministration>().RemoteAccessPort();
OutputProc(String.Format("{0}", port));
return ExitCode.Normal;
}
}
class AdminViewGroupCommand : Command
{
public AdminViewGroupCommand()
+10 -21
View File
@@ -78,8 +78,6 @@
this.WebclientCheckBox = new System.Windows.Forms.CheckBox();
this.WorldAnnounceButton = new System.Windows.Forms.Button();
this.WorldAnnounceField = new System.Windows.Forms.TextBox();
this.ServerPathTextbox = new System.Windows.Forms.TextBox();
this.projectNameText = new System.Windows.Forms.TextBox();
this.WorldAnnounceLabel = new System.Windows.Forms.Label();
this.SecuritySelector = new System.Windows.Forms.ComboBox();
this.SecurityTitle = new System.Windows.Forms.Label();
@@ -158,6 +156,7 @@
this.StaticFileCreateButton = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.StaticFileListBox = new System.Windows.Forms.ListBox();
this.projectNameText = new System.Windows.Forms.TextBox();
this.ChatPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ChatPortSelector)).BeginInit();
this.ChatProviderSelectorPanel.SuspendLayout();
@@ -643,7 +642,6 @@
this.ServerPanel.Controls.Add(this.WebclientCheckBox);
this.ServerPanel.Controls.Add(this.WorldAnnounceButton);
this.ServerPanel.Controls.Add(this.WorldAnnounceField);
this.ServerPanel.Controls.Add(this.ServerPathTextbox);
this.ServerPanel.Controls.Add(this.projectNameText);
this.ServerPanel.Controls.Add(this.WorldAnnounceLabel);
this.ServerPanel.Controls.Add(this.SecuritySelector);
@@ -790,22 +788,6 @@
this.WorldAnnounceField.Size = new System.Drawing.Size(213, 20);
this.WorldAnnounceField.TabIndex = 40;
//
// ServerPathTextbox
//
this.ServerPathTextbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ServerPathTextbox.Location = new System.Drawing.Point(136, 163);
this.ServerPathTextbox.Name = "ServerPathTextbox";
this.ServerPathTextbox.Size = new System.Drawing.Size(296, 20);
this.ServerPathTextbox.TabIndex = 32;
//
// projectNameText
//
this.projectNameText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.projectNameText.Location = new System.Drawing.Point(566, 163);
this.projectNameText.Name = "projectNameText";
this.projectNameText.Size = new System.Drawing.Size(296, 20);
this.projectNameText.TabIndex = 29;
//
// WorldAnnounceLabel
//
this.WorldAnnounceLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1799,6 +1781,14 @@
this.StaticFileListBox.TabIndex = 0;
this.StaticFileListBox.SelectedIndexChanged += new System.EventHandler(this.StaticFileListBox_SelectedIndexChanged);
//
// projectNameText
//
this.projectNameText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.projectNameText.Location = new System.Drawing.Point(566, 163);
this.projectNameText.Name = "projectNameText";
this.projectNameText.Size = new System.Drawing.Size(296, 20);
this.projectNameText.TabIndex = 29;
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1882,8 +1872,6 @@
private System.Windows.Forms.CheckBox WebclientCheckBox;
private System.Windows.Forms.Button WorldAnnounceButton;
private System.Windows.Forms.TextBox WorldAnnounceField;
private System.Windows.Forms.TextBox ServerPathTextbox;
private System.Windows.Forms.TextBox projectNameText;
private System.Windows.Forms.Label WorldAnnounceLabel;
private System.Windows.Forms.ComboBox SecuritySelector;
private System.Windows.Forms.Label SecurityTitle;
@@ -1966,5 +1954,6 @@
private System.Windows.Forms.NumericUpDown AutoUpdateInterval;
private System.Windows.Forms.CheckBox AutoUpdateCheckbox;
private System.Windows.Forms.Label AutoUpdateMLabel;
private System.Windows.Forms.TextBox projectNameText;
}
}
+2 -44
View File
@@ -25,14 +25,7 @@ namespace TGControlPanel
void InitServerPage()
{
LoadServerPage();
if (!Interface.AuthenticateAdmin())
{
ServerPathTextbox.Enabled = false;
ServerPathTextbox.ReadOnly = true;
}
FullUpdateWorker.RunWorkerCompleted += FullUpdateWorker_RunWorkerCompleted;
ServerPathTextbox.LostFocus += ServerPathTextbox_LostFocus;
ServerPathTextbox.KeyDown += ServerPathTextbox_KeyDown;
projectNameText.LostFocus += ProjectNameText_LostFocus;
projectNameText.KeyDown += ProjectNameText_KeyDown;
ServerStartBGW.RunWorkerCompleted += ServerStartBGW_RunWorkerCompleted;
@@ -51,12 +44,6 @@ namespace TGControlPanel
UpdateProjectName();
}
private void ServerPathTextbox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
UpdateServerPath();
}
private void FullUpdateWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (updateError != null)
@@ -76,34 +63,6 @@ namespace TGControlPanel
LoadServerPage();
}
private void ServerPathTextbox_LostFocus(object sender, EventArgs e)
{
UpdateServerPath();
}
void UpdateServerPath()
{
if (!Program.CheckAdminWithWarning())
{
ServerPathTextbox.Enabled = false;
ServerPathTextbox.ReadOnly = true;
return;
}
if (updatingFields || ServerPathTextbox.Text.Trim() == Interface.GetComponent<ITGConfig>().ServerDirectory())
return;
var DialogResult = MessageBox.Show("This will move the entire server installation.", "Confim", MessageBoxButtons.YesNo);
if (DialogResult != DialogResult.Yes)
return;
if (!Program.CheckAdminWithWarning())
{
ServerPathTextbox.Enabled = false;
ServerPathTextbox.ReadOnly = true;
return;
}
MessageBox.Show(Interface.GetComponent<ITGAdministration>().MoveServer(ServerPathTextbox.Text) ?? "Success!");
}
void LoadServerPage()
{
var RepoExists = Interface.GetComponent<ITGRepository>().Exists();
@@ -146,9 +105,8 @@ namespace TGControlPanel
try
{
updatingFields = true;
if (!ServerPathTextbox.Focused)
ServerPathTextbox.Text = Config.ServerDirectory();
ServerPathLabel.Text = "Server Path: " + Config.ServerDirectory();
SecuritySelector.SelectedIndex = (int)DD.SecurityLevel();