Skip to content

Commit

Permalink
-Updated command-line args to accept arg to specify common instance name
Browse files Browse the repository at this point in the history
  • Loading branch information
chessmaster42 committed Jul 12, 2014
1 parent 8c53f64 commit 2f2cfc6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
26 changes: 21 additions & 5 deletions SEServerExtender/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,37 @@ static void Main(string[] args)
{
bool autoStart = false;
bool autoStop = false;
string instanceName = "";
foreach (string arg in args)
{
if (arg.ToLower().Equals("autostart"))
if (arg.Split('=').Length > 1)
{
autoStart = true;
string argName = arg.Split('=')[0];
string argValue = arg.Split('=')[1];

Console.WriteLine("Name-Value Arg: name='" + argName + "' value='" + argValue + "'");

if (argName.ToLower().Equals("instance"))
{
instanceName = argValue;
}
}
if (arg.ToLower().Equals("autostop"))
else
{
autoStop = true;
if (arg.ToLower().Equals("autostart"))
{
autoStart = true;
}
if (arg.ToLower().Equals("autostop"))
{
autoStop = true;
}
}
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SEServerExtender(autoStart, autoStop));
Application.Run(new SEServerExtender(autoStart, autoStop, instanceName));
}
catch (AutoException eEx)
{
Expand Down
4 changes: 2 additions & 2 deletions SEServerExtender/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.2.3.4")]
[assembly: AssemblyFileVersion("0.2.3.4")]
[assembly: AssemblyVersion("0.2.3.5")]
[assembly: AssemblyFileVersion("0.2.3.5")]
20 changes: 18 additions & 2 deletions SEServerExtender/SEServerExtender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public partial class SEServerExtender : Form

#region "Constructors and Initializers"

public SEServerExtender(bool autoStart = false, bool autoStop = false)
public SEServerExtender(bool autoStart = false, bool autoStop = false, string instanceName = "")
{
m_instance = this;

Expand Down Expand Up @@ -132,11 +132,27 @@ public SEServerExtender(bool autoStart = false, bool autoStop = false)

m_autoStart = autoStart;
m_autoStop = autoStop;
m_instanceName = instanceName;

if (m_autoStart)
{
Console.WriteLine("Auto-Start enabled");
BTN_ServerControl_Start_Click(this, null);

if(m_instanceName != "")
{
Console.WriteLine("Auto-starting common instance '" + m_instanceName + "'");

CHK_Control_CommonDataPath.Checked = true;
foreach (var item in CMB_Control_CommonInstanceList.Items)
{
if (item.ToString().Equals(m_instanceName))
{
CMB_Control_CommonInstanceList.SelectedItem = item;
break;
}
}
}
BTN_ServerControl_Start.PerformClick();
}
if (m_autoStop)
{
Expand Down

0 comments on commit 2f2cfc6

Please sign in to comment.