spllitted DTLib to 3 projects
This commit is contained in:
parent
7f653adfd2
commit
e7b7069138
29
DTLib.Dtsod/DTLib.Dtsod.csproj
Normal file
29
DTLib.Dtsod/DTLib.Dtsod.csproj
Normal 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>
|
||||
@ -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()),
|
||||
16
DTLib.Dtsod/IDtsod.cs
Normal file
16
DTLib.Dtsod/IDtsod.cs
Normal 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; }
|
||||
}
|
||||
28
DTLib.Network/DTLib.Network.csproj
Normal file
28
DTLib.Network/DTLib.Network.csproj
Normal 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>
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Net.Sockets;
|
||||
using DTLib.Dtsod;
|
||||
using DTLib.Dtsod;
|
||||
|
||||
namespace DTLib.Network;
|
||||
|
||||
7
DTLib.Network/FrameworkFix.cs
Normal file
7
DTLib.Network/FrameworkFix.cs
Normal file
@ -0,0 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
// включает init и record из c# 9.0
|
||||
namespace System.Runtime.CompilerServices;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public class IsExternalInit { }
|
||||
@ -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;
|
||||
@ -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}");
|
||||
}
|
||||
@ -2,17 +2,21 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>false</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<DebugType>portable</DebugType>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<StartupObject>TestProgram.Program</StartupObject>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<RootNamespace>DTLib.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DTLib.Dtsod\DTLib.Dtsod.csproj" />
|
||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="DtsodV2X\*">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
@ -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<string,long> dict=new();
|
||||
LogOperationTime("fill",1,()=>Fill(dict));
|
||||
@ -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);
|
||||
@ -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();
|
||||
}
|
||||
22
DTLib.sln
22
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
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net48</TargetFrameworks>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<ImplicitUsings>false</ImplicitUsings>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<DebugType>portable</DebugType>
|
||||
<AssemblyName>DTLib</AssemblyName>
|
||||
@ -12,6 +12,7 @@
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<Configurations>Debug;Release;Release-net48</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-net48' ">
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
@ -21,15 +22,11 @@
|
||||
<Reference Include="System.Dynamic" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||
<Compile Remove="Experimental\**" />
|
||||
<EmbeddedResource Remove="Experimental\**" />
|
||||
<None Remove="Experimental\**" />
|
||||
<Compile Remove="Dtsod\V30\**" />
|
||||
<EmbeddedResource Remove="Dtsod\V30\**" />
|
||||
<None Remove="Dtsod\V30\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Experimental\Tester.cs" />
|
||||
<Compile Remove="Experimental\ConsoleGUI\**" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -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; }
|
||||
}
|
||||
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
|
||||
namespace DTLib
|
||||
namespace DTLib.Experimental
|
||||
{
|
||||
public class CompressedArray
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace DTLib;
|
||||
namespace DTLib.Experimental;
|
||||
|
||||
// по идее это нужно, чтоб делать так: SomeEvent?.Invoke().Wait()
|
||||
public delegate Task EventHandlerAsyncDelegate();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTLib.Reactive
|
||||
namespace DTLib.Experimental.Reactive
|
||||
{
|
||||
public class ReactiveListener<T> : ReactiveProvider<T>
|
||||
{
|
||||
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DTLib.Reactive
|
||||
namespace DTLib.Experimental.Reactive
|
||||
{
|
||||
public abstract class ReactiveProvider<T>
|
||||
{
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DTLib.Reactive
|
||||
namespace DTLib.Experimental.Reactive
|
||||
{
|
||||
public class ReactiveSender<T> : ReactiveProvider<T>
|
||||
{
|
||||
|
||||
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DTLib.Reactive
|
||||
namespace DTLib.Experimental.Reactive
|
||||
{
|
||||
public class ReactiveStream<T> : IEnumerable<TimeSignedObject<T>>, IList<TimeSignedObject<T>>
|
||||
{
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace DTLib.Reactive
|
||||
namespace DTLib.Experimental.Reactive
|
||||
{
|
||||
public class TimeSignedObject<T>
|
||||
{
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace DTLib
|
||||
namespace DTLib.Experimental
|
||||
{
|
||||
//
|
||||
// Вычисление псевдослучайного числа из множества параметров.
|
||||
@ -8,7 +6,7 @@ namespace DTLib
|
||||
//
|
||||
public class SecureRandom
|
||||
{
|
||||
private RNGCryptoServiceProvider crypt = new();
|
||||
/*private RNGCryptoServiceProvider crypt = new();
|
||||
|
||||
// получение массива случайных байтов
|
||||
public byte[] GenBytes(uint length)
|
||||
@ -19,7 +17,7 @@ namespace DTLib
|
||||
}
|
||||
|
||||
// получение случайного числа от 0 до 2147483647
|
||||
/*public int NextInt(uint from, int to)
|
||||
public int NextInt(uint from, int to)
|
||||
{
|
||||
int output = 0;
|
||||
int rez = 0;
|
||||
|
||||
@ -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<T>(this IEnumerable<T> 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();
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -57,7 +57,7 @@ sealed class XXHash32 : HashAlgorithm
|
||||
|
||||
/// Creates an instance of <see cref="XXHash32"/> class by default seed(0).
|
||||
/// <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).
|
||||
public XXHash32() => Initialize(0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user