diff --git a/DTLib.Dtsod/DTLib.Dtsod.csproj b/DTLib.Dtsod/DTLib.Dtsod.csproj new file mode 100644 index 0000000..c2278f5 --- /dev/null +++ b/DTLib.Dtsod/DTLib.Dtsod.csproj @@ -0,0 +1,29 @@ + + + + net6.0;net48 + 10 + disable + disable + False + portable + Debug;Release;Release-net48 + + + + + + + + net48 + + + + + + + + + + + diff --git a/DTLib/Dtsod/DtsodBuilder.cs b/DTLib.Dtsod/DtsodBuilder.cs similarity index 100% rename from DTLib/Dtsod/DtsodBuilder.cs rename to DTLib.Dtsod/DtsodBuilder.cs diff --git a/DTLib/Dtsod/DtsodDict.cs b/DTLib.Dtsod/DtsodDict.cs similarity index 100% rename from DTLib/Dtsod/DtsodDict.cs rename to DTLib.Dtsod/DtsodDict.cs diff --git a/DTLib/Dtsod/DtsodFunctions.cs b/DTLib.Dtsod/DtsodFunctions.cs similarity index 91% rename from DTLib/Dtsod/DtsodFunctions.cs rename to DTLib.Dtsod/DtsodFunctions.cs index 4c302b8..75deffd 100644 --- a/DTLib/Dtsod/DtsodFunctions.cs +++ b/DTLib.Dtsod/DtsodFunctions.cs @@ -6,7 +6,7 @@ public static class DtsodFunctions => targetVersion switch { DtsodVersion.V21 => new DtsodV21(src.ToDictionary()), - DtsodVersion.V22 => throw new NotImplementedException("DtsodV22 is deprecated"), + DtsodVersion.V22 => throw new Exception("DtsodV22 is deprecated"), DtsodVersion.V23 => new DtsodV23(src.ToDictionary()), #if DEBUG DtsodVersion.V30 => new DtsodV30(src.ToDictionary()), diff --git a/DTLib/Dtsod/DtsodV21.cs b/DTLib.Dtsod/DtsodV21.cs similarity index 100% rename from DTLib/Dtsod/DtsodV21.cs rename to DTLib.Dtsod/DtsodV21.cs diff --git a/DTLib/Dtsod/DtsodV23.cs b/DTLib.Dtsod/DtsodV23.cs similarity index 100% rename from DTLib/Dtsod/DtsodV23.cs rename to DTLib.Dtsod/DtsodV23.cs diff --git a/DTLib/Dtsod/DtsodVersion.cs b/DTLib.Dtsod/DtsodVersion.cs similarity index 100% rename from DTLib/Dtsod/DtsodVersion.cs rename to DTLib.Dtsod/DtsodVersion.cs diff --git a/DTLib.Dtsod/IDtsod.cs b/DTLib.Dtsod/IDtsod.cs new file mode 100644 index 0000000..6a88a50 --- /dev/null +++ b/DTLib.Dtsod/IDtsod.cs @@ -0,0 +1,16 @@ +global using System; +global using System.Collections; +global using System.Collections.Generic; +global using System.Linq; +global using System.Text; +global using DTLib.Extensions; +global using static DTLib.PublicLog; + +namespace DTLib.Dtsod; + +public interface IDtsod +{ + public DtsodVersion Version { get; } + public IDictionary ToDictionary(); + public dynamic this[string s] { get; set; } +} diff --git a/DTLib/Dtsod/V30/DtsodSerializableAttribute.cs b/DTLib.Dtsod/V30/DtsodSerializableAttribute.cs similarity index 100% rename from DTLib/Dtsod/V30/DtsodSerializableAttribute.cs rename to DTLib.Dtsod/V30/DtsodSerializableAttribute.cs diff --git a/DTLib/Dtsod/V30/DtsodV30.cs b/DTLib.Dtsod/V30/DtsodV30.cs similarity index 100% rename from DTLib/Dtsod/V30/DtsodV30.cs rename to DTLib.Dtsod/V30/DtsodV30.cs diff --git a/DTLib/Dtsod/V30/TypeHelper.cs b/DTLib.Dtsod/V30/TypeHelper.cs similarity index 100% rename from DTLib/Dtsod/V30/TypeHelper.cs rename to DTLib.Dtsod/V30/TypeHelper.cs diff --git a/DTLib.Network/DTLib.Network.csproj b/DTLib.Network/DTLib.Network.csproj new file mode 100644 index 0000000..e932378 --- /dev/null +++ b/DTLib.Network/DTLib.Network.csproj @@ -0,0 +1,28 @@ + + + + net6.0;net48 + 10 + disable + disable + False + portable + Debug;Release;Release-net48 + + + + + + + + + net48 + + + + + + + + + diff --git a/DTLib/Network/FSP.cs b/DTLib.Network/FSP.cs similarity index 96% rename from DTLib/Network/FSP.cs rename to DTLib.Network/FSP.cs index 4c48d60..85cf5a0 100644 --- a/DTLib/Network/FSP.cs +++ b/DTLib.Network/FSP.cs @@ -1,5 +1,4 @@ -using System.Net.Sockets; -using DTLib.Dtsod; +using DTLib.Dtsod; namespace DTLib.Network; diff --git a/DTLib.Network/FrameworkFix.cs b/DTLib.Network/FrameworkFix.cs new file mode 100644 index 0000000..95c361c --- /dev/null +++ b/DTLib.Network/FrameworkFix.cs @@ -0,0 +1,7 @@ +using System.ComponentModel; + +// включает init и record из c# 9.0 +namespace System.Runtime.CompilerServices; + +[EditorBrowsable(EditorBrowsableState.Never)] +public class IsExternalInit { } diff --git a/DTLib/Network/OldNetwork.cs b/DTLib.Network/OldNetwork.cs similarity index 77% rename from DTLib/Network/OldNetwork.cs rename to DTLib.Network/OldNetwork.cs index 681ce64..19a34db 100644 --- a/DTLib/Network/OldNetwork.cs +++ b/DTLib.Network/OldNetwork.cs @@ -1,4 +1,12 @@ -using System.Diagnostics; +global using System.Net.Sockets; +global using System; +global using System.Threading; +global using System.Collections.Generic; +global using System.Text; +global using DTLib.Extensions; +global using DTLib.Filesystem; +global using static DTLib.PublicLog; +using System.Diagnostics; using System.Net.Http; namespace DTLib.Network; diff --git a/DTLib/Network/Package.cs b/DTLib.Network/Package.cs similarity index 92% rename from DTLib/Network/Package.cs rename to DTLib.Network/Package.cs index 92d132d..7c94e6e 100644 --- a/DTLib/Network/Package.cs +++ b/DTLib.Network/Package.cs @@ -1,7 +1,4 @@ -using System.Net.Sockets; -using System.Threading; - -namespace DTLib.Network; +namespace DTLib.Network; // // отправка/получение пакетов @@ -27,8 +24,7 @@ public static class Package socket.Receive(data, data.Length, 0); return data; } - else - Thread.Sleep(5); + else Thread.Sleep(5); } throw new Exception($"GetPackage() error: timeout. socket.Available={socket.Available}"); } diff --git a/TestProgram/TestProgram.csproj b/DTLib.Tests/DTLib.Tests.csproj similarity index 75% rename from TestProgram/TestProgram.csproj rename to DTLib.Tests/DTLib.Tests.csproj index 1b23c27..4550f9a 100644 --- a/TestProgram/TestProgram.csproj +++ b/DTLib.Tests/DTLib.Tests.csproj @@ -2,17 +2,21 @@ Exe net6.0 + 10 false disable portable True true - TestProgram.Program False + DTLib.Tests + - + + + Always diff --git a/TestProgram/DtsodC/DictTest.cs b/DTLib.Tests/DtsodC/DictTest.cs similarity index 85% rename from TestProgram/DtsodC/DictTest.cs rename to DTLib.Tests/DtsodC/DictTest.cs index 38c3ca4..e100b62 100644 --- a/TestProgram/DtsodC/DictTest.cs +++ b/DTLib.Tests/DtsodC/DictTest.cs @@ -1,6 +1,4 @@ -using static TestProgram.Program; - -namespace TestProgram; +namespace DTLib.Tests; static class DictTest { @@ -15,7 +13,7 @@ static class DictTest return r; } - static public void Test(){ + public static void Test(){ Info.Log("c","--------------[DictTest]---------------"); Dictionary dict=new(); LogOperationTime("fill",1,()=>Fill(dict)); diff --git a/TestProgram/DtsodV2X/TestDtsodV23.cs b/DTLib.Tests/DtsodV2X/TestDtsodV23.cs similarity index 82% rename from TestProgram/DtsodV2X/TestDtsodV23.cs rename to DTLib.Tests/DtsodV2X/TestDtsodV23.cs index 7b05d23..6e32cb7 100644 --- a/TestProgram/DtsodV2X/TestDtsodV23.cs +++ b/DTLib.Tests/DtsodV2X/TestDtsodV23.cs @@ -1,6 +1,4 @@ -using static TestProgram.Program; - -namespace TestProgram.DtsodV2X; +namespace DTLib.Tests; public static class TestDtsodV23 { @@ -52,7 +50,7 @@ public static class TestDtsodV23 public static void TestReSerialization() { Info.Log("c", "---[TestDtsodV23/TestReSerialization]--"); - DtsodV23 dtsod = new DtsodV23(new DtsodV23(new DtsodV23( + var dtsod = new DtsodV23(new DtsodV23(new DtsodV23( new DtsodV23(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString()); Info.Log("y", dtsod.ToString()); Info.Log("g", "test completed"); @@ -63,10 +61,10 @@ public static class TestDtsodV23 Info.Log("c", "--------[TestDtsodV23/TestSpeed]-------"); IDtsod dtsod=null; string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod"); - Tester.LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text)); - Tester.LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString()); - Tester.LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text)); - Tester.LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString()); + LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text)); + LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString()); + LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text)); + LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString()); Info.Log("g", "test completed"); } @@ -75,7 +73,7 @@ public static class TestDtsodV23 Info.Log("c", "-----[TestDtsodV23/TestMemConsumpt]----"); string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod"); var a = GC.GetTotalMemory(true); - DtsodV23[] dtsods = new DtsodV23[100]; + var dtsods = new DtsodV23[100]; for (int i = 0; i < dtsods.Length; i++) dtsods[i] = new(text); var b = GC.GetTotalMemory(true); diff --git a/TestProgram/DtsodV2X/base_types.dtsod b/DTLib.Tests/DtsodV2X/base_types.dtsod similarity index 100% rename from TestProgram/DtsodV2X/base_types.dtsod rename to DTLib.Tests/DtsodV2X/base_types.dtsod diff --git a/TestProgram/DtsodV2X/complexes.dtsod b/DTLib.Tests/DtsodV2X/complexes.dtsod similarity index 100% rename from TestProgram/DtsodV2X/complexes.dtsod rename to DTLib.Tests/DtsodV2X/complexes.dtsod diff --git a/TestProgram/DtsodV2X/lists.dtsod b/DTLib.Tests/DtsodV2X/lists.dtsod similarity index 100% rename from TestProgram/DtsodV2X/lists.dtsod rename to DTLib.Tests/DtsodV2X/lists.dtsod diff --git a/TestProgram/DtsodV2X/messages.dtsod b/DTLib.Tests/DtsodV2X/messages.dtsod similarity index 100% rename from TestProgram/DtsodV2X/messages.dtsod rename to DTLib.Tests/DtsodV2X/messages.dtsod diff --git a/TestProgram/DtsodV2X/null.dtsod b/DTLib.Tests/DtsodV2X/null.dtsod similarity index 100% rename from TestProgram/DtsodV2X/null.dtsod rename to DTLib.Tests/DtsodV2X/null.dtsod diff --git a/TestProgram/DtsodV30/base_types.dtsod b/DTLib.Tests/DtsodV30/base_types.dtsod similarity index 100% rename from TestProgram/DtsodV30/base_types.dtsod rename to DTLib.Tests/DtsodV30/base_types.dtsod diff --git a/TestProgram/DtsodV30/enumerables.dtsod b/DTLib.Tests/DtsodV30/enumerables.dtsod similarity index 100% rename from TestProgram/DtsodV30/enumerables.dtsod rename to DTLib.Tests/DtsodV30/enumerables.dtsod diff --git a/TestProgram/Program.cs b/DTLib.Tests/Program.cs similarity index 70% rename from TestProgram/Program.cs rename to DTLib.Tests/Program.cs index 90579ac..4887f8d 100644 --- a/TestProgram/Program.cs +++ b/DTLib.Tests/Program.cs @@ -7,20 +7,19 @@ global using System.Threading; global using System.Threading.Tasks; global using DTLib; global using DTLib.Extensions; -global using DTLib.Experimental; -global using static DTLib.Experimental.Tester; +global using static DTLib.Loggers.LogFunctions; global using DTLib.Filesystem; global using DTLib.Dtsod; +global using static DTLib.Tests.Program; using DTLib.Loggers; -using TestProgram.DtsodV2X; -namespace TestProgram; +namespace DTLib.Tests; -static class Program +public static class Program { - public static DefaultLogger Info = new(); - static public void Main() + public static readonly DefaultLogger Info = new(); + public static void Main() { Info.Enable(); @@ -31,7 +30,7 @@ static class Program Console.Title="tester"; try { - Info.Log("c", "-------------[TestProgram]-------------"); + Info.Log("c", "-------------[DTLib.Tests]-------------"); //TestDtsodV23.TestAll(); DictTest.Test(); } diff --git a/DTLib.sln b/DTLib.sln index 0784b85..ac2e42d 100644 --- a/DTLib.sln +++ b/DTLib.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib", "DTLib\DTLib.csproj", "{B620E5E9-800F-4B2D-B4A5-062E05DB704F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProgram", "TestProgram\TestProgram.csproj", "{72BA37EF-07EC-4D34-966A-20D5E83ADB32}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib.Tests", "DTLib.Tests\DTLib.Tests.csproj", "{72BA37EF-07EC-4D34-966A-20D5E83ADB32}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6308F24E-A4FF-46B3-B72F-30E05DDCB1D5}" ProjectSection(SolutionItems) = preProject @@ -14,20 +14,40 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib.Dtsod", "DTLib.Dtsod\DTLib.Dtsod.csproj", "{ADE425F5-8645-47F0-9AA8-33FA748D36BE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DTLib.Network", "DTLib.Network\DTLib.Network.csproj", "{24B7D0A2-0462-424D-B3F5-29A6655FE472}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Release-net48|Any CPU = Release-net48|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}.Release-net48|Any CPU.ActiveCfg = Release-net48|Any CPU + {B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Release-net48|Any CPU.Build.0 = Release-net48|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}.Release-net48|Any CPU.ActiveCfg = Debug|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}.Release-net48|Any CPU.ActiveCfg = Release-net48|Any CPU + {ADE425F5-8645-47F0-9AA8-33FA748D36BE}.Release-net48|Any CPU.Build.0 = Release-net48|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}.Release-net48|Any CPU.ActiveCfg = Release-net48|Any CPU + {24B7D0A2-0462-424D-B3F5-29A6655FE472}.Release-net48|Any CPU.Build.0 = Release-net48|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DTLib/DTLib.csproj b/DTLib/DTLib.csproj index b094ab3..0bba69d 100644 --- a/DTLib/DTLib.csproj +++ b/DTLib/DTLib.csproj @@ -2,7 +2,7 @@ net6.0;net48 preview - false + disable disable portable DTLib @@ -12,6 +12,7 @@ False Debug;Release;Release-net48 + net48 @@ -21,15 +22,11 @@ + - - - - - - + diff --git a/DTLib/Dtsod/IDtsod.cs b/DTLib/Dtsod/IDtsod.cs deleted file mode 100644 index 3c4058c..0000000 --- a/DTLib/Dtsod/IDtsod.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DTLib.Dtsod; - -public interface IDtsod -{ - public DtsodVersion Version { get; } - public IDictionary ToDictionary(); - public dynamic this[string s] { get; set; } -} diff --git a/DTLib/Experimental/CompressedArray.cs b/DTLib/Experimental/CompressedArray.cs index dea3515..878e022 100644 --- a/DTLib/Experimental/CompressedArray.cs +++ b/DTLib/Experimental/CompressedArray.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Threading; +using System.Threading; -namespace DTLib +namespace DTLib.Experimental { public class CompressedArray { diff --git a/DTLib/Experimental/EventHandlerAsync.cs b/DTLib/Experimental/EventHandlerAsync.cs index eb254f0..af60f00 100644 --- a/DTLib/Experimental/EventHandlerAsync.cs +++ b/DTLib/Experimental/EventHandlerAsync.cs @@ -1,4 +1,4 @@ -namespace DTLib; +namespace DTLib.Experimental; // по идее это нужно, чтоб делать так: SomeEvent?.Invoke().Wait() public delegate Task EventHandlerAsyncDelegate(); diff --git a/DTLib/Experimental/MyDict.cs b/DTLib/Experimental/MyDict.cs deleted file mode 100644 index 7d97182..0000000 --- a/DTLib/Experimental/MyDict.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace DTLib -{ - public class MyDict - { - object locker = new object(); - List values; - List keys; - List hashes; - int count; - - public int Count - { - get - { - // lock (count) - lock (locker) return count; - } - } - - public ReadOnlyCollection Values - { - get - { - ReadOnlyCollectionBuilder b; - lock (locker) b = new(values); - return b.ToReadOnlyCollection(); - } - } - - public ReadOnlyCollection Keys - { - get - { - ReadOnlyCollectionBuilder b; - lock (locker) b = new(keys); - return b.ToReadOnlyCollection(); - } - } - - public MyDict() - { - - values = new(); - keys = new(); - hashes = new(); - count = 0; - } - - public MyDict(IList _keys, IList _values) - { - if (_keys.Count != _values.Count) throw new Exception("_keys.Count != _values.Count"); - keys = (List)_keys; - values = (List)_values; - count = _keys.Count; - hashes = new(); - for (int i = 0; i < count; i++) - hashes.Add(keys[i].GetHashCode()); - } - - public TVal this[TKey key] - { - get - { - lock (locker) return values[hashes.IndexOf(key.GetHashCode())]; - } - set - { - lock (locker) values[hashes.IndexOf(key.GetHashCode())] = value; - } - } - - public (TKey, TVal) GetByIndex(int index) - { - (TKey k, TVal v) output; - lock (locker) - { - output.k = keys[index]; - output.v = values[index]; - } - return output; - } - - public void Add(TKey key, TVal val) - { - // lock (keys) lock (values) lock (count) - lock (locker) - { - keys.Add(key); - values.Add(val); - hashes.Add(key.GetHashCode()); - count++; - } - } - - public void Remove(TKey key) - { - var hash = key.GetHashCode(); - lock (locker) - { - var num = hashes.IndexOf(hash); - keys.RemoveAt(num); - values.RemoveAt(num); - hashes.RemoveAt(num); - count--; - } - } - - public void Clear() - { - lock (locker) - { - hashes.Clear(); - keys.Clear(); - values.Clear(); - count = 0; - } - } - } -} diff --git a/DTLib/Experimental/Reactive/ReactiveListener.cs b/DTLib/Experimental/Reactive/ReactiveListener.cs index 160585d..4bd8c16 100644 --- a/DTLib/Experimental/Reactive/ReactiveListener.cs +++ b/DTLib/Experimental/Reactive/ReactiveListener.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace DTLib.Reactive +namespace DTLib.Experimental.Reactive { public class ReactiveListener : ReactiveProvider { diff --git a/DTLib/Experimental/Reactive/ReactiveProvider.cs b/DTLib/Experimental/Reactive/ReactiveProvider.cs index c620eeb..df872a2 100644 --- a/DTLib/Experimental/Reactive/ReactiveProvider.cs +++ b/DTLib/Experimental/Reactive/ReactiveProvider.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace DTLib.Reactive +namespace DTLib.Experimental.Reactive { public abstract class ReactiveProvider { diff --git a/DTLib/Experimental/Reactive/ReactiveSender.cs b/DTLib/Experimental/Reactive/ReactiveSender.cs index e8fdded..2620ba2 100644 --- a/DTLib/Experimental/Reactive/ReactiveSender.cs +++ b/DTLib/Experimental/Reactive/ReactiveSender.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace DTLib.Reactive +namespace DTLib.Experimental.Reactive { public class ReactiveSender : ReactiveProvider { diff --git a/DTLib/Experimental/Reactive/ReactiveStream.cs b/DTLib/Experimental/Reactive/ReactiveStream.cs index 6796b5b..0c95923 100644 --- a/DTLib/Experimental/Reactive/ReactiveStream.cs +++ b/DTLib/Experimental/Reactive/ReactiveStream.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace DTLib.Reactive +namespace DTLib.Experimental.Reactive { public class ReactiveStream : IEnumerable>, IList> { diff --git a/DTLib/Experimental/Reactive/TimeSignedObject.cs b/DTLib/Experimental/Reactive/TimeSignedObject.cs index 0315116..36ab88d 100644 --- a/DTLib/Experimental/Reactive/TimeSignedObject.cs +++ b/DTLib/Experimental/Reactive/TimeSignedObject.cs @@ -1,6 +1,4 @@ -using System; - -namespace DTLib.Reactive +namespace DTLib.Experimental.Reactive { public class TimeSignedObject { diff --git a/DTLib/Experimental/SecureRandom.cs b/DTLib/Experimental/SecureRandom.cs index 6513646..87999ee 100644 --- a/DTLib/Experimental/SecureRandom.cs +++ b/DTLib/Experimental/SecureRandom.cs @@ -1,6 +1,4 @@ -using System.Security.Cryptography; - -namespace DTLib +namespace DTLib.Experimental { // // Вычисление псевдослучайного числа из множества параметров. @@ -8,30 +6,30 @@ namespace DTLib // public class SecureRandom { - private RNGCryptoServiceProvider crypt = new(); + /*private RNGCryptoServiceProvider crypt = new(); - // получение массива случайных байтов - public byte[] GenBytes(uint length) - { - byte[] output = new byte[length]; - crypt.GetNonZeroBytes(output); - return output; - } + // получение массива случайных байтов + public byte[] GenBytes(uint length) + { + byte[] output = new byte[length]; + crypt.GetNonZeroBytes(output); + return output; + } - // получение случайного числа от 0 до 2147483647 - /*public int NextInt(uint from, int to) - { - int output = 0; - int rez = 0; - while (true) - { - rez = output * 10 + NextBytes(1)[0]; - if (rez < to && rez > from) - { - output = rez; - return output; - } - } - }*/ + // получение случайного числа от 0 до 2147483647 + public int NextInt(uint from, int to) + { + int output = 0; + int rez = 0; + while (true) + { + rez = output * 10 + NextBytes(1)[0]; + if (rez < to && rez > from) + { + output = rez; + return output; + } + } + }*/ } } diff --git a/DTLib/Extensions/StringConverter.cs b/DTLib/Extensions/StringConverter.cs index 64ede50..b849962 100644 --- a/DTLib/Extensions/StringConverter.cs +++ b/DTLib/Extensions/StringConverter.cs @@ -46,7 +46,7 @@ public static class StringConverter { StringBuilder builder = new(); for (int i = 0; i < parts.Length; i++) - builder.Append(parts[i].ToString()); + builder.Append(parts[i]); return builder.ToString(); } public static string MergeToString(this IEnumerable collection, string separator) @@ -54,7 +54,7 @@ public static class StringConverter StringBuilder builder = new(); foreach (T elem in collection) { - builder.Append(elem.ToString()); + builder.Append(elem); builder.Append(separator); } if (builder.Length == 0) @@ -66,7 +66,7 @@ public static class StringConverter { StringBuilder builder = new(); foreach (T elem in collection) - builder.Append(elem.ToString()); + builder.Append(elem); return builder.ToString(); } diff --git a/DTLib/Experimental/Tester.cs b/DTLib/Loggers/Tester.cs similarity index 87% rename from DTLib/Experimental/Tester.cs rename to DTLib/Loggers/Tester.cs index cb5ba78..9bb2bef 100644 --- a/DTLib/Experimental/Tester.cs +++ b/DTLib/Loggers/Tester.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using System.Globalization; -namespace DTLib.Experimental; +namespace DTLib.Loggers; -public static class Tester +public static class LogFunctions { public static void LogOperationTime(string op_name, int repeats, Action operation) { diff --git a/DTLib/XXHash.cs b/DTLib/XXHash.cs index 6c72dbf..c232ffd 100644 --- a/DTLib/XXHash.cs +++ b/DTLib/XXHash.cs @@ -57,7 +57,7 @@ sealed class XXHash32 : HashAlgorithm /// Creates an instance of class by default seed(0). /// - public static new XXHash32 Create() => new(); + public new static XXHash32 Create() => new(); /// Initializes a new instance of the class by default seed(0). public XXHash32() => Initialize(0);