mlaumcherb/Mlaumcherb.Client.Avalonia/классы/Пролетариат/GameArguments.cs
2024-12-29 01:26:41 +05:00

42 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DTLib.Extensions;
namespace Mlaumcherb.Client.Avalonia.классы;
public class GameArguments : ArgumentsWithPlaceholders
{
private static readonly string[] _initial_arguments =
[
"--width", "${resolution_width}",
"--height", "${resolution_height}",
];
private static readonly string[] _enabled_features =
[
];
public GameArguments(GameVersionDescriptor d)
{
_raw_args.AddRange(_initial_arguments);
if (d.minecraftArguments is not null)
{
_raw_args.AddRange(d.minecraftArguments.SplitToList(' ', quot: '"'));
}
else if (d.arguments is not null)
{
foreach (var av in d.arguments.game)
{
if(Rules.Check(av.rules, _enabled_features))
{
foreach (var arg in av.value)
{
// if(!_raw_args.Contains(arg))
_raw_args.Add(arg);
}
}
}
}
else throw new Exception("no game arguments specified in descriptor");
}
}