0
0
mirror of https://github.com/sp-tarkov/patcher.git synced 2025-02-13 06:50:46 -05:00
patcher/Patcher/PatchGenerator/Models/GenStartupArgs.cs

70 lines
2.5 KiB
C#
Raw Normal View History

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; } = "";
public bool AutoClose { get; private set; } = false;
public bool AutoZip { get; private set; } = true;
protected GenStartupArgs(string outputFolderName, string sourceFolderPath, string targetFolderPath, bool autoZip, bool autoClose)
{
OutputFolderName = outputFolderName;
SourceFolderPath = sourceFolderPath;
TargetFolderPath = targetFolderPath;
AutoZip = autoZip;
AutoClose = autoClose;
}
public static GenStartupArgs Parse(string[] Args)
{
if (Args == null || Args.Length == 0) return null;
string outputFolderPath = "";
string sourceFolderPath = "";
string targetFolderPath = "";
bool autoZip = true;
bool autoClose = false;
foreach (string arg in Args)
{
if (arg.Split("::").Length != 2) return null;
var argSplit = arg.Split("::");
switch (argSplit[0])
{
case "OutputFolderName":
{
outputFolderPath = argSplit[1];
break;
}
case "SourceFolderPath":
{
sourceFolderPath = argSplit[1];
break;
}
case "TargetFolderPath":
{
targetFolderPath = argSplit[1];
break;
}
case "AutoZip":
{
autoZip = bool.Parse(argSplit[1]);
break;
}
case "AutoClose":
{
autoClose = bool.Parse(argSplit[1]);
break;
}
}
}
return new GenStartupArgs(outputFolderPath, sourceFolderPath, targetFolderPath, autoZip, autoClose);
}
}
}