028
This commit is contained in:
parent
2e1726af75
commit
502d679848
@ -33,8 +33,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Color.cs" />
|
<Compile Include="Color.cs" />
|
||||||
<Compile Include="CompressedArray.cs" />
|
<Compile Include="CompressedArray.cs" />
|
||||||
<Compile Include="Dtsod\DtsodV22.cs" />
|
|
||||||
<Compile Include="Dtsod\DtsodV21.cs" />
|
<Compile Include="Dtsod\DtsodV21.cs" />
|
||||||
|
<Compile Include="Dtsod\DtsodV22.cs" />
|
||||||
<Compile Include="cs9somefix.cs" />
|
<Compile Include="cs9somefix.cs" />
|
||||||
<Compile Include="Dtsod\ValueTypes.cs" />
|
<Compile Include="Dtsod\ValueTypes.cs" />
|
||||||
<Compile Include="EventHandlerAsync.cs" />
|
<Compile Include="EventHandlerAsync.cs" />
|
||||||
|
|||||||
@ -442,7 +442,7 @@ namespace DTLib.Dtsod
|
|||||||
break;
|
break;
|
||||||
case ValueTypes.ULong:
|
case ValueTypes.ULong:
|
||||||
outBuilder.Append(value.Value.ToString());
|
outBuilder.Append(value.Value.ToString());
|
||||||
outBuilder.Append("uk");
|
outBuilder.Append("ul");
|
||||||
break;
|
break;
|
||||||
case ValueTypes.Double:
|
case ValueTypes.Double:
|
||||||
outBuilder.Append(value.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
outBuilder.Append(value.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||||
|
|||||||
@ -27,5 +27,7 @@ namespace DTLib.Reactive
|
|||||||
Streams.Remove(stream);
|
Streams.Remove(stream);
|
||||||
stream.ElementAdded-=ElementAdded;
|
stream.ElementAdded-=ElementAdded;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//public T GetElement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DTLib.Reactive
|
namespace DTLib.Reactive
|
||||||
{
|
{
|
||||||
public class ReactiveStream<T>
|
public class ReactiveStream<T>
|
||||||
{
|
{
|
||||||
List<T> Storage = new();
|
List<(long time, T value)> Storage = new();
|
||||||
public event EventHandlerAsync<T> ElementAdded;
|
public event EventHandlerAsync<T> ElementAdded;
|
||||||
SafeMutex StorageMutex = new();
|
SafeMutex StorageMutex = new();
|
||||||
public int Length => StorageMutex.Execute(() => Storage.Count);
|
public int Length => StorageMutex.Execute(() => Storage.Count);
|
||||||
@ -13,7 +14,7 @@ namespace DTLib.Reactive
|
|||||||
|
|
||||||
public void Add(T elem)
|
public void Add(T elem)
|
||||||
{
|
{
|
||||||
StorageMutex.Execute(() => Storage.Add(elem));
|
StorageMutex.Execute(() => Storage.Add((DateTime.Now.Ticks, elem)));
|
||||||
ElementAdded?.Invoke(this, elem);
|
ElementAdded?.Invoke(this, elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -116,8 +116,10 @@ namespace DTLib
|
|||||||
builder.Append(parts[i].ToString());
|
builder.Append(parts[i].ToString());
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
public static string MergeToString<T>(this IEnumerable<T> collection, string separator)
|
public static string MergeToString<T>(this ICollection<T> collection, string separator)
|
||||||
{
|
{
|
||||||
|
if(collection.Count==0)
|
||||||
|
return "";
|
||||||
StringBuilder builder = new();
|
StringBuilder builder = new();
|
||||||
foreach(T elem in collection)
|
foreach(T elem in collection)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user