diff --git a/README.md b/README.md index e1c323a..a337414 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Options: --phaseLength The length of each phase in hours. [default: 4] --scheduleLength How long the schedule should be in days. [default: 30] --overridePhases The override phases file. [] + --randomSeed The seed for the random number generator. [] --version Show version information -?, -h, --help Show help and usage information ``` diff --git a/Rotationator/Program.cs b/Rotationator/Program.cs index 2c96093..8c1e774 100644 --- a/Rotationator/Program.cs +++ b/Rotationator/Program.cs @@ -1,4 +1,4 @@ -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; using System.Text.Json; using OatmealDome.BinaryData; @@ -71,13 +71,16 @@ Option scheduleLengthOption = new Option("--scheduleLength", () => def Option overridePhasesOption = new Option("--overridePhases", () => null, "The override phases file."); +Option seedOption = new Option("--randomSeed", () => null, "The seed for the random number generator."); + Command command = new RootCommand("Generates a new VSSetting BYAMl file.") { lastByamlArg, outputByamlArg, phaseLengthOption, scheduleLengthOption, - overridePhasesOption + overridePhasesOption, + seedOption }; command.SetHandler(context => Run(context)); @@ -95,8 +98,9 @@ void Run(InvocationContext context) int phaseLength = context.ParseResult.GetValueForOption(phaseLengthOption); int scheduleLength = context.ParseResult.GetValueForOption(scheduleLengthOption); string? overridePhasesPath = context.ParseResult.GetValueForOption(overridePhasesOption); + uint? specifiedSeed = context.ParseResult.GetValueForOption(seedOption); - uint seed = (uint)Environment.TickCount; + uint seed = specifiedSeed ?? (uint)Environment.TickCount; SeadRandom random = new SeadRandom(seed); Console.WriteLine("Random seed: " + seed);