This commit is contained in:
timerix 2023-04-05 21:56:41 +06:00
parent 16d37990c0
commit 810a4fa8fc
3 changed files with 27 additions and 7 deletions

View File

@ -58,10 +58,23 @@ static class Merge
public static void ConsoleAskYN(string question, Action? yes, Action? no) public static void ConsoleAskYN(string question, Action? yes, Action? no)
{ {
Log("y", question + " [y/n]"); while (true)
string answ = ColoredConsole.Read("w").ToLower(); {
if (answ == "y") yes?.Invoke(); Log("y", question + " [y/n]");
else no?.Invoke(); string answ = Program.YesAll ? "y" : ColoredConsole.Read("w").ToLower();
if (answ == "y")
{
Log("c",$"answer: {answ}");
yes?.Invoke();
break;
}
if (answ == "n") {
Log("c",$"answer: {answ}");
no?.Invoke();
break;
}
Log("r", $"incorrect answer: {answ}");
}
} }
static void HandleConflicts(IOPath[] moddirs) static void HandleConflicts(IOPath[] moddirs)

View File

@ -16,6 +16,8 @@ public static class Program
{ {
static ConsoleLogger logger = new($"logs", "main"); static ConsoleLogger logger = new($"logs", "main");
static void Log(params string[] msg) => logger.Log(msg); static void Log(params string[] msg) => logger.Log(msg);
public static bool YesAll = false;
static int Main(string[] args) static int Main(string[] args)
{ {
@ -28,10 +30,14 @@ public static class Program
new LaunchArgumentParser( new LaunchArgumentParser(
new LaunchArgument(new []{"o", "out"}, new LaunchArgument(new []{"o", "out"},
"sets output path", "Sets output path",
p => outPath=p, p => outPath=p,
"out_path", "out_path",
0), 0),
new LaunchArgument(new []{"y", "yes-all"},
"Automatically answers [Y] to all questions",
()=> YesAll=true,
0),
new LaunchArgument(new []{"clear"}, new LaunchArgument(new []{"clear"},
"Clear mod files and put them into separate dirs in output dir. Requires -o", "Clear mod files and put them into separate dirs in output dir. Requires -o",
wdir=>Workshop.ClearWorkshop(wdir, outPath), wdir=>Workshop.ClearWorkshop(wdir, outPath),

View File

@ -6,20 +6,21 @@
<RootNamespace>ParadoxModMerger</RootNamespace> <RootNamespace>ParadoxModMerger</RootNamespace>
<AssemblyName>paradox-mod-merger</AssemblyName> <AssemblyName>paradox-mod-merger</AssemblyName>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="7z\**" CopyToOutputDirectory="PreserveNewest" /> <None Include="7z\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" /> <PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
<PackageReference Include="DTLib.Dtsod" Version="1.2.0" /> <PackageReference Include="DTLib.Dtsod" Version="1.2.1" />
<PackageReference Include="Fizzler.Systems.HtmlAgilityPack" Version="1.2.1" /> <PackageReference Include="Fizzler.Systems.HtmlAgilityPack" Version="1.2.1" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj" /> <ProjectReference Include="..\..\DTLib\DTLib\DTLib.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'Debug' "> <ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
<PackageReference Include="DTLib" Version="1.2.0" /> <PackageReference Include="DTLib" Version="1.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\diff-text\diff-text.csproj" /> <ProjectReference Include="..\diff-text\diff-text.csproj" />