diff --git a/DTLib.Dtsod/DTLib.Dtsod.csproj b/DTLib.Dtsod/DTLib.Dtsod.csproj index e6ddb2c..6ca8cd9 100644 --- a/DTLib.Dtsod/DTLib.Dtsod.csproj +++ b/DTLib.Dtsod/DTLib.Dtsod.csproj @@ -2,7 +2,7 @@ DTLib.Dtsod - 1.0.4 + 1.1.0 Timerix Definitely not json GIT @@ -33,7 +33,7 @@ - + diff --git a/DTLib.Logging/DTLib.Logging.csproj b/DTLib.Logging/DTLib.Logging.csproj index e1579c9..b686ebc 100644 --- a/DTLib.Logging/DTLib.Logging.csproj +++ b/DTLib.Logging/DTLib.Logging.csproj @@ -2,7 +2,7 @@ DTLib.Logging - 1.0.8 + 1.1.0 Timerix Loggers with dependency injection GIT @@ -30,7 +30,7 @@ - + diff --git a/DTLib.Network/DTLib.Network.csproj b/DTLib.Network/DTLib.Network.csproj index 96749b3..85e7ed2 100644 --- a/DTLib.Network/DTLib.Network.csproj +++ b/DTLib.Network/DTLib.Network.csproj @@ -2,7 +2,7 @@ DTLib.Network - 1.0.4 + 1.1.0 Timerix Some sick network protocols GIT @@ -32,6 +32,6 @@ - + diff --git a/DTLib.Tests/DTLib.Tests.csproj b/DTLib.Tests/DTLib.Tests.csproj index 7ab9453..142ea32 100644 --- a/DTLib.Tests/DTLib.Tests.csproj +++ b/DTLib.Tests/DTLib.Tests.csproj @@ -27,10 +27,10 @@ - - - - + + + + diff --git a/DTLib.Tests/Program.cs b/DTLib.Tests/Program.cs index 08c644e..d058ea8 100644 --- a/DTLib.Tests/Program.cs +++ b/DTLib.Tests/Program.cs @@ -30,15 +30,6 @@ public static class Program try { - IOPath path = "file"; - IOPath path2 = "dir/"+ path + "_temp"; - File.Create(path); - File.Copy(path, path2, true); - System.Console.WriteLine("{0} was copied to {1}.", path, path2); - Directory.Copy(path2.ParentDir(), "dir2/c/", true); - System.Console.WriteLine($"dir/c/:\n"+Directory.GetAllFiles("dir2\\c").MergeToString("\n\t")); - return; - new LaunchArgumentParser().WithNoExit().ParseAndHandle(args); TestPInvoke.TestAll(); TestAutoarr.TestAll(); diff --git a/DTLib.sln b/DTLib.sln index 4320498..d1638f1 100644 --- a/DTLib.sln +++ b/DTLib.sln @@ -30,32 +30,44 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Publish|Any CPU = Publish|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Release|Any CPU.Build.0 = Release|Any CPU + {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Publish|Any CPU.ActiveCfg = Release|Any CPU + {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Publish|Any CPU.Build.0 = Release|Any CPU {72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Debug|Any CPU.Build.0 = Debug|Any CPU {72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Release|Any CPU.ActiveCfg = Release|Any CPU {72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Release|Any CPU.Build.0 = Release|Any CPU + {72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Publish|Any CPU.ActiveCfg = Release|Any CPU {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Release|Any CPU.Build.0 = Release|Any CPU + {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Publish|Any CPU.ActiveCfg = Release|Any CPU + {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Publish|Any CPU.Build.0 = Release|Any CPU {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Debug|Any CPU.Build.0 = Debug|Any CPU {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Release|Any CPU.ActiveCfg = Release|Any CPU {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Release|Any CPU.Build.0 = Release|Any CPU + {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Publish|Any CPU.ActiveCfg = Release|Any CPU + {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Publish|Any CPU.Build.0 = Release|Any CPU {00B76172-32BB-4B72-9891-47FAEF63386C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {00B76172-32BB-4B72-9891-47FAEF63386C}.Debug|Any CPU.Build.0 = Debug|Any CPU {00B76172-32BB-4B72-9891-47FAEF63386C}.Release|Any CPU.ActiveCfg = Release|Any CPU {00B76172-32BB-4B72-9891-47FAEF63386C}.Release|Any CPU.Build.0 = Release|Any CPU + {00B76172-32BB-4B72-9891-47FAEF63386C}.Publish|Any CPU.ActiveCfg = Release|Any CPU + {00B76172-32BB-4B72-9891-47FAEF63386C}.Publish|Any CPU.Build.0 = Release|Any CPU {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Release|Any CPU.Build.0 = Release|Any CPU + {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Publish|Any CPU.ActiveCfg = Release|Any CPU + {AC7CB524-4D59-42E0-9F96-1C201A92494B}.Publish|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DTLib/DTLib.csproj b/DTLib/DTLib.csproj index 6519210..15405ef 100644 --- a/DTLib/DTLib.csproj +++ b/DTLib/DTLib.csproj @@ -2,7 +2,7 @@ DTLib - 1.0.5 + 1.1.1 Timerix Library for all my C# projects GIT diff --git a/DTLib/DependencyResolver.cs b/DTLib/DependencyResolver.cs index 21dd6b8..fe6d96e 100644 --- a/DTLib/DependencyResolver.cs +++ b/DTLib/DependencyResolver.cs @@ -36,7 +36,7 @@ public static class DependencyResolver Path.Concat("runtimes", $"{os}-{arch}"), Path.Concat("runtimes", $"{os}-{arch}", "native") }; - foreach (string dir in possibleLibDirs) + foreach (var dir in possibleLibDirs) if (Directory.Exists(dir)) foreach (var file in Directory.GetFiles(dir)) { diff --git a/DTLib/Filesystem/IOPath.cs b/DTLib/Filesystem/IOPath.cs index ed70edb..ffd3a7e 100644 --- a/DTLib/Filesystem/IOPath.cs +++ b/DTLib/Filesystem/IOPath.cs @@ -93,9 +93,8 @@ public readonly struct IOPath public IOPath Substring(int startIndex, int count) => new(Str.Substring(startIndex, count), true); [MethodImpl(MethodImplOptions.AggressiveInlining)] public IOPath Replace(char oldChar, char newChar) => new(Str.Replace(oldChar, newChar), true); - [Obsolete("use different replace methods")] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public IOPath Replace(string oldStr, string newStr) => new(Str.Replace(oldStr, newStr), true); + public IOPath ReplaceAnywhere(string oldStr, string newStr) => new(Str.Replace(oldStr, newStr), true); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/DTLib/Filesystem/Path.cs b/DTLib/Filesystem/Path.cs index e476998..19abc3b 100644 --- a/DTLib/Filesystem/Path.cs +++ b/DTLib/Filesystem/Path.cs @@ -103,9 +103,12 @@ public static class Path #endif } - public static IOPath FileName(this IOPath path) + /// returns just dir name or file name with extension + public static IOPath LastName(this IOPath path) { int i = path.LastIndexOf(Sep); + if (i == path.Length - 1) // ends with separator + i = path.LastIndexOf(Sep, i-1); if (i == -1) return path; return path.Substring(i+1); } @@ -113,7 +116,7 @@ public static class Path public static IOPath Extension(this IOPath path) { int i = path.LastIndexOf('.'); - if (i == -1) return FileName(path); + if (i == -1) return LastName(path); return path.Substring(i + 1); } @@ -133,4 +136,12 @@ public static class Path throw new Exception($"path <{path}> doesnt starts with <{baseDir}"); return Concat(otherDir, path.Substring(baseDir.Length)); } + + public static IOPath RemoveBase(this IOPath path, IOPath baseDir) + { + + if (!path.StartsWith(baseDir)) + throw new Exception($"path <{path}> doesnt starts with <{baseDir}"); + return path.Substring(baseDir.Length); + } } \ No newline at end of file diff --git a/DTLib/Hasher.cs b/DTLib/Hasher.cs index ac200da..b82c46c 100644 --- a/DTLib/Hasher.cs +++ b/DTLib/Hasher.cs @@ -42,7 +42,7 @@ public class Hasher } // хеш файла - public byte[] HashFile(string filename) + public byte[] HashFile(IOPath filename) { using System.IO.FileStream fileStream = File.OpenRead(filename); //var then = DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second; diff --git a/pack.sh b/pack.sh index 89a8927..1a31eff 100644 --- a/pack.sh +++ b/pack.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash set -ex -dotnet pack -c Release -o ./nuget_new/ -rm ./nuget_new/DTLib.Tests.* +rm -rf nuget_new +dotnet pack -c Publish -o ./nuget_new/ rm -rf nuget mv nuget_new nuget ls nuget