Fixed args

This commit is contained in:
tidusjar 2016-04-08 14:23:26 +01:00
parent 50022cb559
commit 35310d35ed

View file

@ -50,18 +50,20 @@ namespace PlexRequests.UI
var port = -1; var port = -1;
if (args.Length > 0) if (args.Length > 0)
{ {
foreach (var a in args) for (int i = 0; i < args.Length; i++)
{ {
if (a.StartsWith("-base", StringComparison.CurrentCultureIgnoreCase)) var arg = args[i].ToLowerInvariant().Substring(1);
switch (arg)
{ {
case "base":
i++;
var value = args[i];
Console.WriteLine("Settings URL Base"); Console.WriteLine("Settings URL Base");
assetLocation = args[0]; assetLocation = value;
} break;
else default:
{
Log.Info("We are going to use port {0} that was passed in", a);
int portResult; int portResult;
if (!int.TryParse(a, out portResult)) if (!int.TryParse(args[i], out portResult))
{ {
Console.WriteLine("Didn't pass in a valid port"); Console.WriteLine("Didn't pass in a valid port");
Console.ReadLine(); Console.ReadLine();
@ -71,9 +73,9 @@ namespace PlexRequests.UI
{ {
port = portResult; port = portResult;
} }
break;
} }
} }
} }
Log.Trace("Getting product version"); Log.Trace("Getting product version");
WriteOutVersion(); WriteOutVersion();