2021-12-25 01:17:01 -05:00
|
|
|
|
namespace PatchGenerator.Models
|
|
|
|
|
{
|
|
|
|
|
public class GenStartupArgs
|
|
|
|
|
{
|
|
|
|
|
public bool ReadyToRun => OutputFolderName != "" && SourceFolderPath != "" && TargetFolderPath != "";
|
|
|
|
|
public string OutputFolderName { get; private set; } = "";
|
|
|
|
|
public string SourceFolderPath { get; private set; } = "";
|
|
|
|
|
public string TargetFolderPath { get; private set; } = "";
|
2022-05-16 17:33:37 -04:00
|
|
|
|
public bool AutoClose { get; private set; } = false;
|
2021-12-25 01:17:01 -05:00
|
|
|
|
public bool AutoZip { get; private set; } = true;
|
2022-05-16 17:33:37 -04:00
|
|
|
|
protected GenStartupArgs(string outputFolderName, string sourceFolderPath, string targetFolderPath, bool autoZip, bool autoClose)
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
2022-05-16 17:33:37 -04:00
|
|
|
|
OutputFolderName = outputFolderName;
|
|
|
|
|
SourceFolderPath = sourceFolderPath;
|
|
|
|
|
TargetFolderPath = targetFolderPath;
|
|
|
|
|
AutoZip = autoZip;
|
|
|
|
|
AutoClose = autoClose;
|
2021-12-25 01:17:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static GenStartupArgs Parse(string[] Args)
|
|
|
|
|
{
|
|
|
|
|
if (Args == null || Args.Length == 0) return null;
|
|
|
|
|
|
|
|
|
|
string outputFolderPath = "";
|
|
|
|
|
string sourceFolderPath = "";
|
|
|
|
|
string targetFolderPath = "";
|
|
|
|
|
bool autoZip = true;
|
2022-05-16 17:33:37 -04:00
|
|
|
|
bool autoClose = false;
|
2021-12-25 01:17:01 -05:00
|
|
|
|
|
|
|
|
|
foreach (string arg in Args)
|
|
|
|
|
{
|
|
|
|
|
if (arg.Split("::").Length != 2) return null;
|
|
|
|
|
|
|
|
|
|
var argSplit = arg.Split("::");
|
|
|
|
|
|
2022-05-17 12:12:51 +00:00
|
|
|
|
switch (argSplit[0].ToLower())
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
2022-05-17 12:12:51 +00:00
|
|
|
|
case "OutputFolderName".ToLower():
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
|
|
|
|
outputFolderPath = argSplit[1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-17 12:12:51 +00:00
|
|
|
|
case "SourceFolderPath".ToLower():
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
|
|
|
|
sourceFolderPath = argSplit[1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-17 12:12:51 +00:00
|
|
|
|
case "TargetFolderPath".ToLower():
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
|
|
|
|
targetFolderPath = argSplit[1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-17 12:12:51 +00:00
|
|
|
|
case "AutoZip".ToLower():
|
2021-12-25 01:17:01 -05:00
|
|
|
|
{
|
|
|
|
|
autoZip = bool.Parse(argSplit[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-17 12:12:51 +00:00
|
|
|
|
case "AutoClose".ToLower():
|
2022-05-16 17:33:37 -04:00
|
|
|
|
{
|
|
|
|
|
autoClose = bool.Parse(argSplit[1]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-12-25 01:17:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-16 17:33:37 -04:00
|
|
|
|
return new GenStartupArgs(outputFolderPath, sourceFolderPath, targetFolderPath, autoZip, autoClose);
|
2021-12-25 01:17:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|