From 502d6798488a93515705ab77fdc6b46b55cccee7 Mon Sep 17 00:00:00 2001 From: Timerix Date: Sat, 9 Oct 2021 14:16:03 +0300 Subject: [PATCH] 028 --- DTLib.csproj | 2 +- Dtsod/DtsodV22.cs | 2 +- Reactive/ReactiveListener.cs | 2 ++ Reactive/ReactiveStream.cs | 7 ++++--- SimpleConverter.cs | 4 +++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/DTLib.csproj b/DTLib.csproj index 2bf5e37..3fe8d3d 100644 --- a/DTLib.csproj +++ b/DTLib.csproj @@ -33,8 +33,8 @@ - + diff --git a/Dtsod/DtsodV22.cs b/Dtsod/DtsodV22.cs index 1bdceb7..587968d 100644 --- a/Dtsod/DtsodV22.cs +++ b/Dtsod/DtsodV22.cs @@ -442,7 +442,7 @@ namespace DTLib.Dtsod break; case ValueTypes.ULong: outBuilder.Append(value.Value.ToString()); - outBuilder.Append("uk"); + outBuilder.Append("ul"); break; case ValueTypes.Double: outBuilder.Append(value.Value.ToString(System.Globalization.CultureInfo.InvariantCulture)); diff --git a/Reactive/ReactiveListener.cs b/Reactive/ReactiveListener.cs index 9b4732b..e1698ee 100644 --- a/Reactive/ReactiveListener.cs +++ b/Reactive/ReactiveListener.cs @@ -27,5 +27,7 @@ namespace DTLib.Reactive Streams.Remove(stream); stream.ElementAdded-=ElementAdded; }); + + //public T GetElement() } } diff --git a/Reactive/ReactiveStream.cs b/Reactive/ReactiveStream.cs index aec4098..cc301a0 100644 --- a/Reactive/ReactiveStream.cs +++ b/Reactive/ReactiveStream.cs @@ -1,10 +1,11 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace DTLib.Reactive { public class ReactiveStream { - List Storage = new(); + List<(long time, T value)> Storage = new(); public event EventHandlerAsync ElementAdded; SafeMutex StorageMutex = new(); public int Length => StorageMutex.Execute(() => Storage.Count); @@ -13,7 +14,7 @@ namespace DTLib.Reactive public void Add(T elem) { - StorageMutex.Execute(() => Storage.Add(elem)); + StorageMutex.Execute(() => Storage.Add((DateTime.Now.Ticks, elem))); ElementAdded?.Invoke(this, elem); } diff --git a/SimpleConverter.cs b/SimpleConverter.cs index 4723c6e..2fd9819 100644 --- a/SimpleConverter.cs +++ b/SimpleConverter.cs @@ -116,8 +116,10 @@ namespace DTLib builder.Append(parts[i].ToString()); return builder.ToString(); } - public static string MergeToString(this IEnumerable collection, string separator) + public static string MergeToString(this ICollection collection, string separator) { + if(collection.Count==0) + return ""; StringBuilder builder = new(); foreach(T elem in collection) {