spllitted DTLib to 3 projects

This commit is contained in:
Timerix22 2022-03-20 12:01:17 +03:00
parent 7f653adfd2
commit e7b7069138
42 changed files with 178 additions and 234 deletions

View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net48</TargetFrameworks>
<LangVersion>10</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<DebugType>portable</DebugType>
<Configurations>Debug;Release;Release-net48</Configurations>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DTLib\DTLib.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release-net48' ">
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<Reference Include="System.Dynamic" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
<Compile Remove="V30\**" />
</ItemGroup>
</Project>

View File

@ -6,7 +6,7 @@ public static class DtsodFunctions
=> targetVersion switch => targetVersion switch
{ {
DtsodVersion.V21 => new DtsodV21(src.ToDictionary()), 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()), DtsodVersion.V23 => new DtsodV23(src.ToDictionary()),
#if DEBUG #if DEBUG
DtsodVersion.V30 => new DtsodV30(src.ToDictionary()), DtsodVersion.V30 => new DtsodV30(src.ToDictionary()),

16
DTLib.Dtsod/IDtsod.cs Normal file
View File

@ -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<string, dynamic> ToDictionary();
public dynamic this[string s] { get; set; }
}

View File

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net48</TargetFrameworks>
<LangVersion>10</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<DebugType>portable</DebugType>
<Configurations>Debug;Release;Release-net48</Configurations>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
<ProjectReference Include="..\DTLib\DTLib.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release-net48' ">
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Dynamic" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>

View File

@ -1,5 +1,4 @@
using System.Net.Sockets; using DTLib.Dtsod;
using DTLib.Dtsod;
namespace DTLib.Network; namespace DTLib.Network;

View File

@ -0,0 +1,7 @@
using System.ComponentModel;
// включает init и record из c# 9.0
namespace System.Runtime.CompilerServices;
[EditorBrowsable(EditorBrowsableState.Never)]
public class IsExternalInit { }

View File

@ -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; using System.Net.Http;
namespace DTLib.Network; namespace DTLib.Network;

View File

@ -1,7 +1,4 @@
using System.Net.Sockets; namespace DTLib.Network;
using System.Threading;
namespace DTLib.Network;
// //
// отправка/получение пакетов // отправка/получение пакетов
@ -27,8 +24,7 @@ public static class Package
socket.Receive(data, data.Length, 0); socket.Receive(data, data.Length, 0);
return data; return data;
} }
else else Thread.Sleep(5);
Thread.Sleep(5);
} }
throw new Exception($"GetPackage() error: timeout. socket.Available={socket.Available}"); throw new Exception($"GetPackage() error: timeout. socket.Available={socket.Available}");
} }

View File

@ -2,17 +2,21 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<ImplicitUsings>false</ImplicitUsings> <ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<DebugType>portable</DebugType> <DebugType>portable</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<StartupObject>TestProgram.Program</StartupObject>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<RootNamespace>DTLib.Tests</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
<ProjectReference Include="..\DTLib\DTLib.csproj" /> <ProjectReference Include="..\DTLib\DTLib.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="DtsodV2X\*"> <None Include="DtsodV2X\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>

View File

@ -1,6 +1,4 @@
using static TestProgram.Program; namespace DTLib.Tests;
namespace TestProgram;
static class DictTest static class DictTest
{ {
@ -15,7 +13,7 @@ static class DictTest
return r; return r;
} }
static public void Test(){ public static void Test(){
Info.Log("c","--------------[DictTest]---------------"); Info.Log("c","--------------[DictTest]---------------");
Dictionary<string,long> dict=new(); Dictionary<string,long> dict=new();
LogOperationTime("fill",1,()=>Fill(dict)); LogOperationTime("fill",1,()=>Fill(dict));

View File

@ -1,6 +1,4 @@
using static TestProgram.Program; namespace DTLib.Tests;
namespace TestProgram.DtsodV2X;
public static class TestDtsodV23 public static class TestDtsodV23
{ {
@ -52,7 +50,7 @@ public static class TestDtsodV23
public static void TestReSerialization() public static void TestReSerialization()
{ {
Info.Log("c", "---[TestDtsodV23/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()); new DtsodV23(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
Info.Log("y", dtsod.ToString()); Info.Log("y", dtsod.ToString());
Info.Log("g", "test completed"); Info.Log("g", "test completed");
@ -63,10 +61,10 @@ public static class TestDtsodV23
Info.Log("c", "--------[TestDtsodV23/TestSpeed]-------"); Info.Log("c", "--------[TestDtsodV23/TestSpeed]-------");
IDtsod dtsod=null; IDtsod dtsod=null;
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod"); string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
Tester.LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text)); LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text));
Tester.LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString()); LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString());
Tester.LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text)); LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text));
Tester.LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString()); LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString());
Info.Log("g", "test completed"); Info.Log("g", "test completed");
} }
@ -75,7 +73,7 @@ public static class TestDtsodV23
Info.Log("c", "-----[TestDtsodV23/TestMemConsumpt]----"); Info.Log("c", "-----[TestDtsodV23/TestMemConsumpt]----");
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod"); string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
var a = GC.GetTotalMemory(true); var a = GC.GetTotalMemory(true);
DtsodV23[] dtsods = new DtsodV23[100]; var dtsods = new DtsodV23[100];
for (int i = 0; i < dtsods.Length; i++) for (int i = 0; i < dtsods.Length; i++)
dtsods[i] = new(text); dtsods[i] = new(text);
var b = GC.GetTotalMemory(true); var b = GC.GetTotalMemory(true);

View File

@ -7,20 +7,19 @@ global using System.Threading;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using DTLib; global using DTLib;
global using DTLib.Extensions; global using DTLib.Extensions;
global using DTLib.Experimental; global using static DTLib.Loggers.LogFunctions;
global using static DTLib.Experimental.Tester;
global using DTLib.Filesystem; global using DTLib.Filesystem;
global using DTLib.Dtsod; global using DTLib.Dtsod;
global using static DTLib.Tests.Program;
using DTLib.Loggers; using DTLib.Loggers;
using TestProgram.DtsodV2X;
namespace TestProgram; namespace DTLib.Tests;
static class Program public static class Program
{ {
public static DefaultLogger Info = new(); public static readonly DefaultLogger Info = new();
static public void Main() public static void Main()
{ {
Info.Enable(); Info.Enable();
@ -31,7 +30,7 @@ static class Program
Console.Title="tester"; Console.Title="tester";
try try
{ {
Info.Log("c", "-------------[TestProgram]-------------"); Info.Log("c", "-------------[DTLib.Tests]-------------");
//TestDtsodV23.TestAll(); //TestDtsodV23.TestAll();
DictTest.Test(); DictTest.Test();
} }

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib", "DTLib\DTLib.csproj", "{B620E5E9-800F-4B2D-B4A5-062E05DB704F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTLib", "DTLib\DTLib.csproj", "{B620E5E9-800F-4B2D-B4A5-062E05DB704F}"
EndProject 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 EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6308F24E-A4FF-46B3-B72F-30E05DDCB1D5}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6308F24E-A4FF-46B3-B72F-30E05DDCB1D5}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
@ -14,20 +14,40 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md README.md = README.md
EndProjectSection EndProjectSection
EndProject 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 Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release-net48|Any CPU = Release-net48|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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}.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.ActiveCfg = Release|Any CPU
{B620E5E9-800F-4B2D-B4A5-062E05DB704F}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{72BA37EF-07EC-4D34-966A-20D5E83ADB32}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net48</TargetFrameworks> <TargetFrameworks>net6.0;net48</TargetFrameworks>
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
<ImplicitUsings>false</ImplicitUsings> <ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<DebugType>portable</DebugType> <DebugType>portable</DebugType>
<AssemblyName>DTLib</AssemblyName> <AssemblyName>DTLib</AssemblyName>
@ -12,6 +12,7 @@
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<Configurations>Debug;Release;Release-net48</Configurations> <Configurations>Debug;Release;Release-net48</Configurations>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release-net48' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release-net48' ">
<TargetFramework>net48</TargetFramework> <TargetFramework>net48</TargetFramework>
</PropertyGroup> </PropertyGroup>
@ -21,15 +22,11 @@
<Reference Include="System.Dynamic" /> <Reference Include="System.Dynamic" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'Debug' "> <ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
<Compile Remove="Experimental\**" /> <Compile Remove="Experimental\**" />
<EmbeddedResource Remove="Experimental\**" />
<None Remove="Experimental\**" />
<Compile Remove="Dtsod\V30\**" />
<EmbeddedResource Remove="Dtsod\V30\**" />
<None Remove="Dtsod\V30\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Experimental\Tester.cs" /> <Compile Remove="Experimental\ConsoleGUI\**" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,8 +0,0 @@
namespace DTLib.Dtsod;
public interface IDtsod
{
public DtsodVersion Version { get; }
public IDictionary<string, dynamic> ToDictionary();
public dynamic this[string s] { get; set; }
}

View File

@ -1,8 +1,6 @@
using System; using System.Threading;
using System.Collections.Generic;
using System.Threading;
namespace DTLib namespace DTLib.Experimental
{ {
public class CompressedArray public class CompressedArray
{ {

View File

@ -1,4 +1,4 @@
namespace DTLib; namespace DTLib.Experimental;
// по идее это нужно, чтоб делать так: SomeEvent?.Invoke().Wait() // по идее это нужно, чтоб делать так: SomeEvent?.Invoke().Wait()
public delegate Task EventHandlerAsyncDelegate(); public delegate Task EventHandlerAsyncDelegate();

View File

@ -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<TKey, TVal>
{
object locker = new object();
List<TVal> values;
List<TKey> keys;
List<int> hashes;
int count;
public int Count
{
get
{
// lock (count)
lock (locker) return count;
}
}
public ReadOnlyCollection<TVal> Values
{
get
{
ReadOnlyCollectionBuilder<TVal> b;
lock (locker) b = new(values);
return b.ToReadOnlyCollection();
}
}
public ReadOnlyCollection<TKey> Keys
{
get
{
ReadOnlyCollectionBuilder<TKey> b;
lock (locker) b = new(keys);
return b.ToReadOnlyCollection();
}
}
public MyDict()
{
values = new();
keys = new();
hashes = new();
count = 0;
}
public MyDict(IList<TKey> _keys, IList<TVal> _values)
{
if (_keys.Count != _values.Count) throw new Exception("_keys.Count != _values.Count");
keys = (List<TKey>)_keys;
values = (List<TVal>)_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;
}
}
}
}

View File

@ -1,8 +1,4 @@
using System; namespace DTLib.Experimental.Reactive
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DTLib.Reactive
{ {
public class ReactiveListener<T> : ReactiveProvider<T> public class ReactiveListener<T> : ReactiveProvider<T>
{ {

View File

@ -1,8 +1,4 @@
using System; namespace DTLib.Experimental.Reactive
using System.Collections.Generic;
using System.Linq;
namespace DTLib.Reactive
{ {
public abstract class ReactiveProvider<T> public abstract class ReactiveProvider<T>
{ {

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace DTLib.Experimental.Reactive
namespace DTLib.Reactive
{ {
public class ReactiveSender<T> : ReactiveProvider<T> public class ReactiveSender<T> : ReactiveProvider<T>
{ {

View File

@ -1,8 +1,4 @@
using System; namespace DTLib.Experimental.Reactive
using System.Collections;
using System.Collections.Generic;
namespace DTLib.Reactive
{ {
public class ReactiveStream<T> : IEnumerable<TimeSignedObject<T>>, IList<TimeSignedObject<T>> public class ReactiveStream<T> : IEnumerable<TimeSignedObject<T>>, IList<TimeSignedObject<T>>
{ {

View File

@ -1,6 +1,4 @@
using System; namespace DTLib.Experimental.Reactive
namespace DTLib.Reactive
{ {
public class TimeSignedObject<T> public class TimeSignedObject<T>
{ {

View File

@ -1,6 +1,4 @@
using System.Security.Cryptography; namespace DTLib.Experimental
namespace DTLib
{ {
// //
// Вычисление псевдослучайного числа из множества параметров. // Вычисление псевдослучайного числа из множества параметров.
@ -8,7 +6,7 @@ namespace DTLib
// //
public class SecureRandom public class SecureRandom
{ {
private RNGCryptoServiceProvider crypt = new(); /*private RNGCryptoServiceProvider crypt = new();
// получение массива случайных байтов // получение массива случайных байтов
public byte[] GenBytes(uint length) public byte[] GenBytes(uint length)
@ -19,7 +17,7 @@ namespace DTLib
} }
// получение случайного числа от 0 до 2147483647 // получение случайного числа от 0 до 2147483647
/*public int NextInt(uint from, int to) public int NextInt(uint from, int to)
{ {
int output = 0; int output = 0;
int rez = 0; int rez = 0;

View File

@ -46,7 +46,7 @@ public static class StringConverter
{ {
StringBuilder builder = new(); StringBuilder builder = new();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
builder.Append(parts[i].ToString()); builder.Append(parts[i]);
return builder.ToString(); return builder.ToString();
} }
public static string MergeToString<T>(this IEnumerable<T> collection, string separator) public static string MergeToString<T>(this IEnumerable<T> collection, string separator)
@ -54,7 +54,7 @@ public static class StringConverter
StringBuilder builder = new(); StringBuilder builder = new();
foreach (T elem in collection) foreach (T elem in collection)
{ {
builder.Append(elem.ToString()); builder.Append(elem);
builder.Append(separator); builder.Append(separator);
} }
if (builder.Length == 0) if (builder.Length == 0)
@ -66,7 +66,7 @@ public static class StringConverter
{ {
StringBuilder builder = new(); StringBuilder builder = new();
foreach (T elem in collection) foreach (T elem in collection)
builder.Append(elem.ToString()); builder.Append(elem);
return builder.ToString(); return builder.ToString();
} }

View File

@ -1,9 +1,9 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; 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) public static void LogOperationTime(string op_name, int repeats, Action operation)
{ {

View File

@ -57,7 +57,7 @@ sealed class XXHash32 : HashAlgorithm
/// Creates an instance of <see cref="XXHash32"/> class by default seed(0). /// Creates an instance of <see cref="XXHash32"/> class by default seed(0).
/// <returns></returns> /// <returns></returns>
public static new XXHash32 Create() => new(); public new static XXHash32 Create() => new();
/// Initializes a new instance of the <see cref="XXHash32"/> class by default seed(0). /// Initializes a new instance of the <see cref="XXHash32"/> class by default seed(0).
public XXHash32() => Initialize(0); public XXHash32() => Initialize(0);