bugfixes
This commit is contained in:
parent
1ab9a50019
commit
2d257200fe
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Dtsod</PackageId>
|
<PackageId>DTLib.Dtsod</PackageId>
|
||||||
<Version>1.0.3</Version>
|
<Version>1.0.4</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Definitely not json</Description>
|
<Description>Definitely not json</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.0.2" />
|
<PackageReference Include="DTLib" Version="1.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Logging</PackageId>
|
<PackageId>DTLib.Logging</PackageId>
|
||||||
<Version>1.0.7</Version>
|
<Version>1.0.8</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Loggers with dependency injection</Description>
|
<Description>Loggers with dependency injection</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.0.2" />
|
<PackageReference Include="DTLib" Version="1.0.4" />
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.2" />
|
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Network</PackageId>
|
<PackageId>DTLib.Network</PackageId>
|
||||||
<Version>1.0.3</Version>
|
<Version>1.0.4</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Some sick network protocols</Description>
|
<Description>Some sick network protocols</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -32,6 +32,6 @@
|
|||||||
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib.Dtsod" Version="1.0.3" />
|
<PackageReference Include="DTLib.Dtsod" Version="1.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -27,8 +27,10 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib.Network" Version="1.0.3" />
|
<PackageReference Include="DTLib" Version="1.0.4" />
|
||||||
<PackageReference Include="DTLib.Logging" Version="1.0.7" />
|
<PackageReference Include="DTLib.Dtsod" Version="1.0.4" />
|
||||||
|
<PackageReference Include="DTLib.Network" Version="1.0.4" />
|
||||||
|
<PackageReference Include="DTLib.Logging" Version="1.0.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
@ -10,6 +10,7 @@ global using DTLib.Filesystem;
|
|||||||
global using DTLib.Dtsod;
|
global using DTLib.Dtsod;
|
||||||
global using static DTLib.Tests.TesterLog;
|
global using static DTLib.Tests.TesterLog;
|
||||||
global using static DTLib.Tests.Program;
|
global using static DTLib.Tests.Program;
|
||||||
|
using DTLib.Console;
|
||||||
using DTLib.Logging.New;
|
using DTLib.Logging.New;
|
||||||
|
|
||||||
namespace DTLib.Tests;
|
namespace DTLib.Tests;
|
||||||
@ -18,7 +19,7 @@ public static class Program
|
|||||||
{
|
{
|
||||||
public static Logging.ConsoleLogger OldLogger = new("logs", "DTLib.Tests");
|
public static Logging.ConsoleLogger OldLogger = new("logs", "DTLib.Tests");
|
||||||
public static ILogger Logger;
|
public static ILogger Logger;
|
||||||
public static void Main()
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
System.Console.OutputEncoding = Encoding.UTF8;
|
System.Console.OutputEncoding = Encoding.UTF8;
|
||||||
System.Console.InputEncoding = Encoding.UTF8;
|
System.Console.InputEncoding = Encoding.UTF8;
|
||||||
@ -29,11 +30,14 @@ public static class Program
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
new LaunchArgumentParser().WithNoExit().ParseAndHandle(args);
|
||||||
TestPInvoke.TestAll();
|
TestPInvoke.TestAll();
|
||||||
TestAutoarr.TestAll();
|
TestAutoarr.TestAll();
|
||||||
TestDtsodV23.TestAll();
|
TestDtsodV23.TestAll();
|
||||||
TestDtsodV24.TestAll();
|
TestDtsodV24.TestAll();
|
||||||
}
|
}
|
||||||
|
catch(LaunchArgumentParser.ExitAfterHelpException)
|
||||||
|
{ }
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{ mainContext.LogError(ex); }
|
{ mainContext.LogError(ex); }
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class LaunchArgumentParser
|
|||||||
public string CreateHelpArgMessage(string argAlias)
|
public string CreateHelpArgMessage(string argAlias)
|
||||||
{
|
{
|
||||||
StringBuilder b = new();
|
StringBuilder b = new();
|
||||||
var arg = Get(argAlias);
|
var arg = Parse(argAlias);
|
||||||
arg.AppendHelpInfo(b);
|
arg.AppendHelpInfo(b);
|
||||||
return b.ToString();
|
return b.ToString();
|
||||||
}
|
}
|
||||||
@ -51,6 +51,12 @@ public class LaunchArgumentParser
|
|||||||
Add(helpArg);
|
Add(helpArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LaunchArgumentParser WithNoExit()
|
||||||
|
{
|
||||||
|
ExitIfNoArgs = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public LaunchArgumentParser(ICollection<LaunchArgument> arguments) : this()
|
public LaunchArgumentParser(ICollection<LaunchArgument> arguments) : this()
|
||||||
{
|
{
|
||||||
foreach (var arg in arguments)
|
foreach (var arg in arguments)
|
||||||
@ -69,7 +75,7 @@ public class LaunchArgumentParser
|
|||||||
argDict.Add(arg.Aliases[a], arg);
|
argDict.Add(arg.Aliases[a], arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LaunchArgument Get(string argAlias)
|
public LaunchArgument Parse(string argAlias)
|
||||||
{
|
{
|
||||||
// different argument providing patterns
|
// different argument providing patterns
|
||||||
if (!argDict.TryGetValue(argAlias, out var arg) && // arg
|
if (!argDict.TryGetValue(argAlias, out var arg) && // arg
|
||||||
@ -91,9 +97,11 @@ public class LaunchArgumentParser
|
|||||||
if (args.Length == 0 && ExitIfNoArgs)
|
if (args.Length == 0 && ExitIfNoArgs)
|
||||||
HelpHandler();
|
HelpHandler();
|
||||||
|
|
||||||
|
List<LaunchArgument> execQueue = new();
|
||||||
|
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
LaunchArgument arg = Get(args[i]);
|
LaunchArgument arg = Parse(args[i]);
|
||||||
|
|
||||||
if (arg.HandlerWithArg is not null)
|
if (arg.HandlerWithArg is not null)
|
||||||
{
|
{
|
||||||
@ -103,14 +111,14 @@ public class LaunchArgumentParser
|
|||||||
arg.Handler = () => arg.HandlerWithArg(args[i]);
|
arg.Handler = () => arg.HandlerWithArg(args[i]);
|
||||||
}
|
}
|
||||||
else if (arg.Handler is null) throw new NullReferenceException($"argument <{args[i]}> hasn't got any handlers");
|
else if (arg.Handler is null) throw new NullReferenceException($"argument <{args[i]}> hasn't got any handlers");
|
||||||
|
|
||||||
|
execQueue.Add(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ascending sort by priority
|
// ascending sort by priority
|
||||||
argList.Sort((a0, a1) => a0.Priority-a1.Priority);
|
execQueue.Sort((a0, a1) => a0.Priority-a1.Priority);
|
||||||
// finally executing handlers
|
// finally executing handlers
|
||||||
foreach (var a in argList)
|
foreach (var a in execQueue)
|
||||||
{
|
|
||||||
a.Handler!();
|
a.Handler!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib</PackageId>
|
<PackageId>DTLib</PackageId>
|
||||||
<Version>1.0.3</Version>
|
<Version>1.0.4</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Library for all my C# projects</Description>
|
<Description>Library for all my C# projects</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using DTLib.Console;
|
||||||
|
|
||||||
namespace DTLib.Experimental
|
namespace DTLib.Experimental
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user