dotnet 8
This commit is contained in:
parent
7fe79f0300
commit
0c2670f55a
@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiffMatchPatch;
|
using DiffMatchPatch;
|
||||||
using DTLib.Ben.Demystifier;
|
|
||||||
using DTLib.Console;
|
using DTLib.Console;
|
||||||
using DTLib.Filesystem;
|
using DTLib.Filesystem;
|
||||||
|
|
||||||
@ -26,17 +25,17 @@ public static class DiffText
|
|||||||
List<Diff>? diff = null;
|
List<Diff>? diff = null;
|
||||||
bool noColors = false;
|
bool noColors = false;
|
||||||
new LaunchArgumentParser(
|
new LaunchArgumentParser(
|
||||||
new LaunchArgument(new[] { "s", "string" },
|
new LaunchArgument(["s", "string"],
|
||||||
"shows difference of two strings",
|
"shows difference of two strings",
|
||||||
(s0, s1) => diff=TextDiff(s0, s1),
|
(s0, s1) => diff=TextDiff(s0, s1),
|
||||||
"string0", "string1",
|
"string0", "string1",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "f", "file" },
|
new LaunchArgument(["f", "file"],
|
||||||
"shows difference of two text files",
|
"shows difference of two text files",
|
||||||
(f0,f1) => diff=FileDiff(f0, f1),
|
(f0,f1) => diff=FileDiff(f0, f1),
|
||||||
"file0", "file1",
|
"file0", "file1",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new []{"p", "plain-text","no-colors"},
|
new LaunchArgument(["p", "plain-text","no-colors"],
|
||||||
"print diff in plain text format",
|
"print diff in plain text format",
|
||||||
()=> noColors=true,
|
()=> noColors=true,
|
||||||
0)
|
0)
|
||||||
@ -49,7 +48,7 @@ public static class DiffText
|
|||||||
{ }
|
{ }
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ColoredConsole.WriteLine("r", ex.ToStringDemystified());
|
ColoredConsole.WriteLine("r", $"{ex.Message} at {ex.Source}");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<RootNamespace>diff_text</RootNamespace>
|
<LangVersion>12</LangVersion>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<RootNamespace>diff_text</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
<PackageReference Include="google-diff-match-patch" Version="1.3.98" />
|
||||||
<PackageReference Include="google-diff-match-patch" Version="1.3.74" />
|
|
||||||
<PackageReference Include="DTLib" Version="1.3.0" />
|
<PackageReference Include="DTLib" Version="1.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -177,7 +177,7 @@ static class Diff
|
|||||||
var file = _file.RemoveBase(modp);
|
var file = _file.RemoveBase(modp);
|
||||||
if (all_files.TryGetValue(file.Str, out var associated_mods))
|
if (all_files.TryGetValue(file.Str, out var associated_mods))
|
||||||
associated_mods.Add(modp.Str);
|
associated_mods.Add(modp.Str);
|
||||||
else all_files.Add(file.Str, new List<string>(1) { modp.Str });
|
else all_files.Add(file.Str, [modp.Str]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ static class Merge
|
|||||||
|
|
||||||
public static void MergeInto(IOPath moddir, IOPath outDir)
|
public static void MergeInto(IOPath moddir, IOPath outDir)
|
||||||
{
|
{
|
||||||
HandleConflicts(new[] { moddir, outDir });
|
HandleConflicts([moddir, outDir]);
|
||||||
IOPath out_modlist_file = Path.Concat(outDir, modlist_filename);
|
IOPath out_modlist_file = Path.Concat(outDir, modlist_filename);
|
||||||
File.AppendAllText(out_modlist_file, $"{moddir.LastName()}\n");
|
File.AppendAllText(out_modlist_file, $"{moddir.LastName()}\n");
|
||||||
ModDirCopy(moddir, outDir, out_modlist_file);
|
ModDirCopy(moddir, outDir, out_modlist_file);
|
||||||
@ -102,9 +102,9 @@ static class Merge
|
|||||||
public static void UpdateMods(IOPath updated_mods_dir, IOPath[] outdated_dirs, IOPath backup_dir)
|
public static void UpdateMods(IOPath updated_mods_dir, IOPath[] outdated_dirs, IOPath backup_dir)
|
||||||
{
|
{
|
||||||
var src_dir_mods = Directory.GetDirectories(updated_mods_dir).ToList();
|
var src_dir_mods = Directory.GetDirectories(updated_mods_dir).ToList();
|
||||||
List<IOPath> not_found_mods = new List<IOPath>();
|
List<IOPath> not_found_mods = [];
|
||||||
List<IOPath> changed_mods = new List<IOPath>();
|
List<IOPath> changed_mods = [];
|
||||||
List<IOPath> unchanged_mods = new List<IOPath>();
|
List<IOPath> unchanged_mods = [];
|
||||||
|
|
||||||
foreach (IOPath outdated_mods_dir in outdated_dirs)
|
foreach (IOPath outdated_mods_dir in outdated_dirs)
|
||||||
foreach (var mod in Directory.GetDirectories(outdated_mods_dir))
|
foreach (var mod in Directory.GetDirectories(outdated_mods_dir))
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public static class Program
|
|||||||
_logger.LogInfo(b.ToString());
|
_logger.LogInfo(b.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool YesAll = false;
|
public static bool YesAll;
|
||||||
|
|
||||||
static int Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
@ -42,67 +42,67 @@ public static class Program
|
|||||||
string outPath = "" ;
|
string outPath = "" ;
|
||||||
|
|
||||||
new LaunchArgumentParser(
|
new LaunchArgumentParser(
|
||||||
new LaunchArgument(new[] { "o", "out" },
|
new LaunchArgument(["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" },
|
new LaunchArgument(["y", "yes-all"],
|
||||||
"Automatically answers [Y] to all questions",
|
"Automatically answers [Y] to all questions",
|
||||||
() => YesAll = true,
|
() => YesAll = true,
|
||||||
0),
|
0),
|
||||||
new LaunchArgument(new[] { "clear" },
|
new LaunchArgument(["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),
|
||||||
"workshop_dir",
|
"workshop_dir",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "diff" },
|
new LaunchArgument(["diff"],
|
||||||
"Compares mod files by hash",
|
"Compares mod files by hash",
|
||||||
p => Diff.DiffCommandHandler(p),
|
p => Diff.DiffCommandHandler(p),
|
||||||
"first_mod_directory:second_mod_directory:...",
|
"first_mod_directory:second_mod_directory:...",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "diff-detailed" },
|
new LaunchArgument(["diff-detailed"],
|
||||||
"reads conflicts_XXX.dtsod file and shows text diff for each file",
|
"reads conflicts_XXX.dtsod file and shows text diff for each file",
|
||||||
p => Diff.DiffDetailedCommandHandler(p),
|
p => Diff.DiffDetailedCommandHandler(p),
|
||||||
"conflicts_dtsod_path",
|
"conflicts_dtsod_path",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "merge-subdirs" },
|
new LaunchArgument(["merge-subdirs"],
|
||||||
"Merges mods and shows conflicts. Requires -o",
|
"Merges mods and shows conflicts. Requires -o",
|
||||||
d => Merge.MergeAll(Directory.GetDirectories(d), outPath),
|
d => Merge.MergeAll(Directory.GetDirectories(d), outPath),
|
||||||
"dir_with_mods",
|
"dir_with_mods",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "merge-into", "merge-single" },
|
new LaunchArgument(["merge-into", "merge-single"],
|
||||||
"Merges one mod into output dir and shows conflicts. Requires -o",
|
"Merges one mod into output dir and shows conflicts. Requires -o",
|
||||||
mod => Merge.MergeInto(mod, outPath),
|
mod => Merge.MergeInto(mod, outPath),
|
||||||
"mod_dir",
|
"mod_dir",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "gen-rus-locale" },
|
new LaunchArgument(["gen-rus-locale"],
|
||||||
"Creates l_russian copy of english locale in output directory. Requires -o",
|
"Creates l_russian copy of english locale in output directory. Requires -o",
|
||||||
eng => Localisation.GenerateRussian(eng, outPath),
|
eng => Localisation.GenerateRussian(eng, outPath),
|
||||||
"english_locale_path",
|
"english_locale_path",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "desc" },
|
new LaunchArgument(["desc"],
|
||||||
"Downloads mod description from steam to new file in outDir. Requires -o",
|
"Downloads mod description from steam to new file in outDir. Requires -o",
|
||||||
id => Workshop.CreateDescFile(id, outPath).GetAwaiter().GetResult(),
|
id => Workshop.CreateDescFile(id, outPath).GetAwaiter().GetResult(),
|
||||||
"mod_id",
|
"mod_id",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "rename" },
|
new LaunchArgument(["rename"],
|
||||||
"Renames mods in directory",
|
"Renames mods in directory",
|
||||||
(modsdir, replace_pairs) => Merge.RenameModsCommandHandler(modsdir, replace_pairs),
|
(modsdir, replace_pairs) => Merge.RenameModsCommandHandler(modsdir, replace_pairs),
|
||||||
"dir_with_mods", "replace_pairs (old_name:new_name:...)",
|
"dir_with_mods", "replace_pairs (old_name:new_name:...)",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "update-mods" },
|
new LaunchArgument(["update-mods"],
|
||||||
"Updates mods in [outdated_dir0...outdated_dirN] to new versions if found in updated_mods_dir. " +
|
"Updates mods in [outdated_dir0...outdated_dirN] to new versions if found in updated_mods_dir. " +
|
||||||
"Moves old mods to backup_dir defined by -o.",
|
"Moves old mods to backup_dir defined by -o.",
|
||||||
(updated, outdated) => Merge.UpdateMods(updated, SplitArgToPaths(outdated, true), outPath),
|
(updated, outdated) => Merge.UpdateMods(updated, SplitArgToPaths(outdated, true), outPath),
|
||||||
"updated_mods_dir", "outdated_dir OR outdated_dir0:...:outdated_dirN",
|
"updated_mods_dir", "outdated_dir OR outdated_dir0:...:outdated_dirN",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "clean-locales" },
|
new LaunchArgument(["clean-locales"],
|
||||||
"Deletes all localisations except l_russian and l_english.",
|
"Deletes all localisations except l_russian and l_english.",
|
||||||
locdir => Localisation.Clean(locdir),
|
locdir => Localisation.Clean(locdir),
|
||||||
"localisation_dir",
|
"localisation_dir",
|
||||||
1),
|
1),
|
||||||
new LaunchArgument(new[] { "gen-collection-json" },
|
new LaunchArgument(["gen-collection-json"],
|
||||||
"Generates json file representing mod collection in format readable by pdx launcher and IronyModManager." +
|
"Generates json file representing mod collection in format readable by pdx launcher and IronyModManager." +
|
||||||
"Requires -o",
|
"Requires -o",
|
||||||
(connected_dirs) => IronyIntegration.GenerateIronyCollection(connected_dirs, outPath),
|
(connected_dirs) => IronyIntegration.GenerateIronyCollection(connected_dirs, outPath),
|
||||||
@ -130,7 +130,7 @@ public static class Program
|
|||||||
else if (connected_parts.Contains(';'))
|
else if (connected_parts.Contains(';'))
|
||||||
part_sep = ';';
|
part_sep = ';';
|
||||||
else if (allow_one_part)
|
else if (allow_one_part)
|
||||||
return new []{connected_parts};
|
return [connected_parts];
|
||||||
else throw new Exception($"<{connected_parts}> doesn't contain any separators (:/;)");
|
else throw new Exception($"<{connected_parts}> doesn't contain any separators (:/;)");
|
||||||
|
|
||||||
return connected_parts.Split(part_sep);
|
return connected_parts.Split(part_sep);
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
<Project Sdk="Microsoft.Net.Sdk">
|
<Project Sdk="Microsoft.Net.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<LangVersion>12</LangVersion>
|
||||||
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>ParadoxModMerger</RootNamespace>
|
<RootNamespace>ParadoxModMerger</RootNamespace>
|
||||||
<AssemblyName>paradox-mod-merger</AssemblyName>
|
<AssemblyName>paradox-mod-merger</AssemblyName>
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -rf publish
|
rm -rf publish
|
||||||
mkdir publish
|
mkdir publish
|
||||||
dotnet publish -c debug -o publish -f net7.0
|
dotnet publish -c debug -o publish
|
||||||
|
|||||||
@ -6,13 +6,16 @@ function publish_aot() {
|
|||||||
echo "---------[$1]---------"
|
echo "---------[$1]---------"
|
||||||
cd "$1"
|
cd "$1"
|
||||||
rm -rf bin/publish
|
rm -rf bin/publish
|
||||||
dotnet publish -c Release -o bin/publish -p:PublishAot=true
|
dotnet publish -c Release -o bin/publish -p:PublishAot=true --self-contained
|
||||||
|
sleep 0.1
|
||||||
|
rm bin/publish/*.pdb
|
||||||
mkdir -p ../publish
|
mkdir -p ../publish
|
||||||
cp -r bin/publish/* ../publish/
|
cp -r bin/publish/* ../publish/
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -rf publish
|
rm -rf publish
|
||||||
|
# paradox-mod-merger publishes diff-text as dotnet executable
|
||||||
|
#publish_aot diff-text
|
||||||
publish_aot paradox-mod-merger
|
publish_aot paradox-mod-merger
|
||||||
publish_aot diff-text
|
|
||||||
ls -lh publish
|
ls -lh publish
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user