diff --git a/.gitignore b/.gitignore index 72b2586..4e7b25a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ [Oo]ut/ [Ll]og/ [Ll]ogs/ +nuget/ # IDE files .vs/ @@ -16,6 +17,7 @@ .idea/ .editorconfig *.user +*.DotSettings #backups .old*/ diff --git a/DTLib.Dtsod/DTLib.Dtsod.csproj b/DTLib.Dtsod/DTLib.Dtsod.csproj index 2a69fb6..8d43b9f 100644 --- a/DTLib.Dtsod/DTLib.Dtsod.csproj +++ b/DTLib.Dtsod/DTLib.Dtsod.csproj @@ -1,44 +1,48 @@ - - net6.0;net48;netstandard2.0 - 10 - disable - disable - true - False + + DTLib.Dtsod + 1.0.0 + Timerix + Definitely not json + GIT + https://github.com/Timerix22/DTLib + Release + MIT + + net6.0;netstandard2.0;net48 embedded - Debug;Release - AnyCPU;x64;x86;arm64 + + 10 + disable + disable - - - - + + - - + + + + + - - - - - - Always - true - - - - - - - + + + + + Always + true + runtimes/ + + + + diff --git a/DTLib.Dtsod/DtsodConverter.cs b/DTLib.Dtsod/DtsodConverter.cs index c45cf56..76421e5 100644 --- a/DTLib.Dtsod/DtsodConverter.cs +++ b/DTLib.Dtsod/DtsodConverter.cs @@ -12,7 +12,7 @@ public static class DtsodConverter DtsodVersion.V23 => new DtsodV23(src.ToDictionary()), DtsodVersion.V24 => new DtsodV24(src.ToDictionary()), #if DEBUG - DtsodVersion.V30 => new DtsodV30(src.ToDictionary()), + //DtsodVersion.V30 => new DtsodV30(src.ToDictionary()), #endif _ => throw new Exception($"DtsodConverter.Convert() error: unknown target version <{targetVersion}>"), }; diff --git a/DTLib.Dtsod/Dependencies/windows/x64/kerep.dll b/DTLib.Dtsod/runtimes/win-x64/native/kerep.dll similarity index 100% rename from DTLib.Dtsod/Dependencies/windows/x64/kerep.dll rename to DTLib.Dtsod/runtimes/win-x64/native/kerep.dll diff --git a/DTLib.Logging/DTLib.Logging.csproj b/DTLib.Logging/DTLib.Logging.csproj index b89dade..c95967d 100644 --- a/DTLib.Logging/DTLib.Logging.csproj +++ b/DTLib.Logging/DTLib.Logging.csproj @@ -1,22 +1,35 @@ - - net6.0;net48;netstandard2.0 - 10 - disable - disable - true + + DTLib.Logging + 1.0.0 + Timerix + Loggers with dependency injection + GIT + https://github.com/Timerix22/DTLib + Release + MIT + + net6.0;netstandard2.0;net48 embedded - False - Debug;Release - AnyCPU;x64;x86;arm64 + + 10 + disable + disable + - - - + + + + + + + + + diff --git a/DTLib.Network/DTLib.Network.csproj b/DTLib.Network/DTLib.Network.csproj index 9b888be..ce10466 100644 --- a/DTLib.Network/DTLib.Network.csproj +++ b/DTLib.Network/DTLib.Network.csproj @@ -1,25 +1,36 @@ - - net6.0;net48;netstandard2.0 - preview - disable - disable - False + + DTLib.Network + 1.0.0 + Timerix + Some sick network protocols + GIT + https://github.com/Timerix22/DTLib + Release + MIT + + net6.0;netstandard2.0;net48 embedded - Debug;Release;Release-net48 - AnyCPU;x64;x86;arm64 + + 10 + disable + disable - - - - - - + + - + + + + + + + + + diff --git a/DTLib.Tests/DTLib.Tests.csproj b/DTLib.Tests/DTLib.Tests.csproj index 5b8c044..ace0360 100644 --- a/DTLib.Tests/DTLib.Tests.csproj +++ b/DTLib.Tests/DTLib.Tests.csproj @@ -1,18 +1,17 @@  + Exe - net6.0;net48;netstandard2.0 - 10 - false - disable - True - true - False + net6.0;netstandard2.0;net48 embedded - Debug;Release;Release-net48 - AnyCPU;x64;x86;arm64 + + 10 + disable + disable + true - + + @@ -20,15 +19,20 @@ - + + - - - + + + + + + + diff --git a/DTLib.Tests/Dtsod/TestPInvoke.cs b/DTLib.Tests/Dtsod/TestPInvoke.cs index 7ca57d2..b7ee175 100644 --- a/DTLib.Tests/Dtsod/TestPInvoke.cs +++ b/DTLib.Tests/Dtsod/TestPInvoke.cs @@ -14,7 +14,7 @@ public static class TestPInvoke TestMarshalling(); } - static public void TestUTF8() + public static void TestUTF8() { OldLogger.Log("c", "--------[TestPInvoke/TestUTF8]--------", "b", ""); IntPtr ptr; diff --git a/DTLib.sln b/DTLib.sln index 0ce9d3f..c3bec11 100644 --- a/DTLib.sln +++ b/DTLib.sln @@ -21,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .gitignore = .gitignore .gitmodules = .gitmodules LICENSE = LICENSE + nuget.config = nuget.config + pack.sh = pack.sh EndProjectSection EndProject Global diff --git a/DTLib/DTLib.csproj b/DTLib/DTLib.csproj index 288ef3e..b8ceccb 100644 --- a/DTLib/DTLib.csproj +++ b/DTLib/DTLib.csproj @@ -1,26 +1,36 @@  - net6.0;net48;netstandard2.0 - preview + + DTLib + 1.0.0 + Timerix + Library for all my C# projects + GIT + https://github.com/Timerix22/DTLib + Release + MIT + + net6.0;netstandard2.0;net48 + + + embedded + + 10 disable disable - DTLib - False true - embedded - False - Debug;Release - AnyCPU;x64;x86;arm64 - + + - + + diff --git a/DTLib/DependencyResolver.cs b/DTLib/DependencyResolver.cs index b9f5f63..6dc174f 100644 --- a/DTLib/DependencyResolver.cs +++ b/DTLib/DependencyResolver.cs @@ -1,36 +1,52 @@ using System.Runtime.InteropServices; +using System.Threading; namespace DTLib; public static class DependencyResolver { - private static bool DepsCopied=false; - + private static object locker = new object(); + + private static bool DepsCopied = false; + public static void CopyLibs() { - if(DepsCopied) return; - string depsdir = $"Dependencies{Path.Sep}"; - depsdir += Environment.OSVersion.Platform switch + lock (locker) { - PlatformID.Unix => "linux", - PlatformID.Win32NT => "windows", - _=> throw new Exception($"unsupported os {Environment.OSVersion.Platform}") - }; - depsdir += Path.Sep; - depsdir += RuntimeInformation.ProcessArchitecture switch - { - Architecture.X64 => "x64", - Architecture.X86 => "x86", - Architecture.Arm64 => "arm64", - Architecture.Arm => "arm", - _=> throw new Exception($"unsupported platform {RuntimeInformation.ProcessArchitecture}") - }; - foreach (var file in Directory.GetAllFiles(depsdir)) - { - var extracted = file.Substring(file.LastIndexOf(Path.Sep) + 1); - File.Copy(file,extracted, true); - Log("g",$"{extracted} copied"); + if (DepsCopied) return; + + var os = Environment.OSVersion.Platform switch + { + PlatformID.Unix => "linux", + PlatformID.Win32NT => "win", + _ => throw new Exception($"unsupported os {Environment.OSVersion.Platform}") + }; + var arch = RuntimeInformation.ProcessArchitecture switch + { + Architecture.X64 => "x64", + Architecture.X86 => "x86", + Architecture.Arm64 => "arm64", + Architecture.Arm => "arm", + _ => throw new Exception($"unsupported platform {RuntimeInformation.ProcessArchitecture}") + }; + + string[] possibleLibDirs = + { + Path.Concat("runtimes", $"{os}"), + Path.Concat("runtimes", $"{os}", "native"), + Path.Concat("runtimes", $"{os}-{arch}"), + Path.Concat("runtimes", $"{os}-{arch}", "native") + }; + foreach (string dir in possibleLibDirs) + if (Directory.Exists(dir)) + foreach (var file in Directory.GetFiles(dir)) + { + var extracted = file.Substring(file.LastIndexOf(Path.Sep) + 1); + File.Copy(file, extracted, true); + Log("g", $"{file} extracted"); + } + + DepsCopied = true; } - DepsCopied = true; } } \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..f480176 --- /dev/null +++ b/nuget.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/pack.sh b/pack.sh new file mode 100644 index 0000000..0045e88 --- /dev/null +++ b/pack.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash +set -ex +rm -rf nuget +dotnet pack -o ./nuget/ +rm ./nuget/DTLib.Tests.* +ls nuget