Bladeren bron

enable qmonlib to use fnd nugets. add qmonlib console

Dalibor Votruba 2 jaren geleden
bovenliggende
commit
ae3a7a8f1c
54 gewijzigde bestanden met toevoegingen van 259 en 1486 verwijderingen
  1. 114 0
      Workbench/QMonitor/qmonlib.console/Commands/BaseCommand.cs
  2. 8 0
      Workbench/QMonitor/qmonlib.console/Constants.cs
  3. 18 0
      Workbench/QMonitor/qmonlib.console/Options/Configuration.cs
  4. 20 0
      Workbench/QMonitor/qmonlib.console/Program.cs
  5. 20 0
      Workbench/QMonitor/qmonlib.console/qmonlib.console.csproj
  6. 4 3
      Workbench/QMonitor/qmonlib.emit/Program.cs
  7. 2 2
      Workbench/QMonitor/qmonlib.emit/TestStructures/LoggedUser.cs
  8. 2 2
      Workbench/QMonitor/qmonlib.emit/TestStructures/ProcessItem.cs
  9. 3 3
      Workbench/QMonitor/qmonlib.emit/TestStructures/ServiceStatus.cs
  10. 3 1
      Workbench/QMonitor/qmonlib.emit/qmonlib.emit.csproj
  11. 6 0
      Workbench/QMonitor/qmonlib.sln
  12. 1 1
      Workbench/QMonitor/qmonlib/Attributes/MonitoredClassAttribute.cs
  13. 1 1
      Workbench/QMonitor/qmonlib/Attributes/MonitoredPropertyAttribute.cs
  14. 1 1
      Workbench/QMonitor/qmonlib/Attributes/MonitoredPropertyKeyAttribute.cs
  15. 9 0
      Workbench/QMonitor/qmonlib/Constants.cs
  16. 0 84
      Workbench/QMonitor/qmonlib/Dependencies/Console/ConsoleWriter.cs
  17. 0 113
      Workbench/QMonitor/qmonlib/Dependencies/Console/ProgressBar.cs
  18. 0 78
      Workbench/QMonitor/qmonlib/Dependencies/Console/ProgressConsoleWriter.cs
  19. 0 173
      Workbench/QMonitor/qmonlib/Dependencies/Json/Binder.cs
  20. 0 35
      Workbench/QMonitor/qmonlib/Dependencies/Json/IListConverterFactory.cs
  21. 0 18
      Workbench/QMonitor/qmonlib/Dependencies/Json/InterfaceConverter.cs
  22. 0 30
      Workbench/QMonitor/qmonlib/Dependencies/Json/InterfaceConverterFactory.cs
  23. 0 23
      Workbench/QMonitor/qmonlib/Dependencies/Json/ListConverter.cs
  24. 0 64
      Workbench/QMonitor/qmonlib/Dependencies/Logging/ConsoleLog.cs
  25. 0 16
      Workbench/QMonitor/qmonlib/Dependencies/Logging/ConsoleLogger.cs
  26. 0 12
      Workbench/QMonitor/qmonlib/Dependencies/Logging/ILog.cs
  27. 0 9
      Workbench/QMonitor/qmonlib/Dependencies/Logging/ILogHandler.cs
  28. 0 10
      Workbench/QMonitor/qmonlib/Dependencies/Logging/ILogger.cs
  29. 0 12
      Workbench/QMonitor/qmonlib/Dependencies/Logging/LogSeverityEnum.cs
  30. 0 19
      Workbench/QMonitor/qmonlib/Dependencies/Object/DisposableObject.cs
  31. 0 20
      Workbench/QMonitor/qmonlib/Dependencies/Object/Dynamic/Dyo.cs
  32. 0 139
      Workbench/QMonitor/qmonlib/Dependencies/Object/Dynamic/DyoMember.cs
  33. 0 41
      Workbench/QMonitor/qmonlib/Dependencies/Object/Extensions/ObjectExt.cs
  34. 0 71
      Workbench/QMonitor/qmonlib/Dependencies/Object/Singleton.cs
  35. 0 32
      Workbench/QMonitor/qmonlib/Dependencies/Object/WeakReference.cs
  36. 0 73
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/AttributeQuery.cs
  37. 0 33
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/ActivatorExt.cs
  38. 0 79
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/AssemblyExt.cs
  39. 0 26
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/AssemblyNameExt.cs
  40. 0 38
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/TypeExt.cs
  41. 0 126
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/QualifiedName.cs
  42. 0 54
      Workbench/QMonitor/qmonlib/Dependencies/Reflection/TypeUtils.cs
  43. 1 1
      Workbench/QMonitor/qmonlib/Interfaces/IMonitored.cs
  44. 1 1
      Workbench/QMonitor/qmonlib/MonData.cs
  45. 1 1
      Workbench/QMonitor/qmonlib/MonGeneral.cs
  46. 1 1
      Workbench/QMonitor/qmonlib/MonItemGeneral.cs
  47. 1 1
      Workbench/QMonitor/qmonlib/MonReceiverGeneralCahedItem.cs
  48. 9 9
      Workbench/QMonitor/qmonlib/QMonClient.cs
  49. 1 1
      Workbench/QMonitor/qmonlib/QMonClientConfiuration.cs
  50. 7 7
      Workbench/QMonitor/qmonlib/QMonHostBase.cs
  51. 1 1
      Workbench/QMonitor/qmonlib/QMonHostConfiguration.cs
  52. 14 14
      Workbench/QMonitor/qmonlib/QMonReceiver.cs
  53. 6 6
      Workbench/QMonitor/qmonlib/QMonReceiverConfiuration.cs
  54. 4 1
      Workbench/QMonitor/qmonlib/qmonlib.csproj

+ 114 - 0
Workbench/QMonitor/qmonlib.console/Commands/BaseCommand.cs

@@ -0,0 +1,114 @@
+using System.IO.Abstractions;
+using System.Text.Json;
+using Quadarax.Foundation.Core.Console;
+using Quadarax.Foundation.Core.Logging;
+using Quadarax.Foundation.Core.QConsole;
+using Quadarax.Foundation.Core.QConsole.Argument;
+using Quadarax.Foundation.Core.QConsole.Command.Base;
+using Quadarax.Foundation.Core.QMonitor.Console.Options;
+
+namespace Quadarax.Foundation.Core.QMonitor.Console.Commands
+{
+    internal abstract class BaseCommand : AbstractCommand, ILogHandler
+    {
+        #region *** Constants ***
+
+        protected const string CS_ARG_NAME_DUMP = "dump";
+        private const string CS_ARG_HINT_DUMP = "<is_dump_reponses>";
+        private const string CS_ARG_DESC_DUMP = "Flag if set dumps incomming json messages.";
+
+        protected const string CS_ARG_NAME_DEBUG = "dbg";
+        private const string CS_ARG_HINT_DEBUG = "<is_debug_mode>";
+        private const string CS_ARG_DESC_DEBUG = "Flag if set writes debug messages.";
+
+        protected const string CS_ARG_NAME_FORCE = "force";
+        private const string CS_ARG_HINT_FORCE = "<is_force>";
+        private const string CS_ARG_DESC_FORCE = "Flag if set, then overrite existing entity, otherwise cancel operation.";
+
+
+        #endregion
+
+        protected Configuration Configuration { get; private set; }
+
+        protected bool? IsForce { get; private set; }
+
+        protected bool IsDebug { get; private set; }
+
+        protected IFileSystem FileSystem { get; private set; }
+
+        protected BaseCommand(Engine engine) : base(engine)
+        {
+
+        }
+
+        protected override void OnInitialize()
+        {
+            base.OnInitialize();
+            var conf =JsonSerializer.Deserialize<Configuration>(FileSystem.File.ReadAllText(Constants.CS_CONFIGURATION_FILE));
+            if (conf == null)
+            {
+                conf = new Configuration();
+                WriteWarning($"Configuration file '{Constants.CS_CONFIGURATION_FILE}' not found. Use default.");
+            }
+                
+            Configuration = conf;
+        }
+
+        protected override void OnValidateArguments()
+        {
+            base.OnValidateArguments();
+
+            if (ContainsArgument(CS_ARG_NAME_FORCE))
+            {
+                IsForce = WasArgumentSpecified(CS_ARG_NAME_FORCE);
+                if (IsForce.GetValueOrDefault(false))
+                    WriteWarning("Force flag is set!");
+            }
+
+            IsDebug = WasArgumentSpecified(CS_ARG_NAME_DEBUG);
+
+            if (IsDebug)
+                DebugConsoleWriter.IsWriteDebugEnabled = true;
+        }
+
+        protected override IEnumerable<AbstractArgument> OnSetupArguments()
+        {
+            FileSystem = new FileSystem();
+            var args = base.OnSetupArguments().ToList();
+            args.Add(new FlagArgument(CS_ARG_NAME_DUMP, CS_ARG_DESC_DUMP, CS_ARG_HINT_DUMP, false));
+            args.Add(new FlagArgument(CS_ARG_NAME_DEBUG, CS_ARG_DESC_DEBUG, CS_ARG_HINT_DEBUG, false));
+            return args;
+        }
+
+
+        protected void AppendForceArgument(IList<AbstractArgument> args, string alternativeUserDescription = null)
+        {
+            args.Add(new FlagArgument(CS_ARG_NAME_FORCE, string.IsNullOrEmpty(alternativeUserDescription) ? CS_ARG_DESC_FORCE : alternativeUserDescription, CS_ARG_HINT_FORCE, false));
+        }
+
+        public void Log(LogSeverityEnum type, string message, Exception e = null)
+        {
+            if ((type == LogSeverityEnum.Trace || type == LogSeverityEnum.Debug) && !IsDebug)
+                return;
+            WriteInfo($"{type}: {message}" + (e == null ? "" : e.Message));
+        }
+
+        protected void WriteDtoToConsole(IDto dto)
+        {
+            var props = dto.GetAllPropertyValues();
+            using (var wName = new ConsoleWriter(ConsoleColor.White))
+            {
+                using (var wValue = new ConsoleWriter(ConsoleColor.Yellow))
+                {
+                    var maxKeyLength = props.Keys.Max(x => x.Length);
+                    foreach (var prop in props)
+                    {
+                        wName.Write(prop.Key);
+                        wName.Write(new string(' ', maxKeyLength - prop.Key.Length) + " :\t");
+                        wValue.WriteLine(prop.Value?.ToString());
+                    }
+                }
+            }
+        }
+    }
+}

+ 8 - 0
Workbench/QMonitor/qmonlib.console/Constants.cs

@@ -0,0 +1,8 @@
+namespace Quadarax.Foundation.Core.QMonitor.Console
+{
+    // ReSharper disable  InconsistentNaming
+    internal class Constants
+    {
+        public const string CS_CONFIGURATION_FILE = "console.json";
+    }
+}

+ 18 - 0
Workbench/QMonitor/qmonlib.console/Options/Configuration.cs

@@ -0,0 +1,18 @@
+using System.Text.Json.Serialization;
+
+namespace Quadarax.Foundation.Core.QMonitor.Console.Options
+{
+    internal class Configuration
+    {
+        [JsonPropertyName("general-uri")]
+        public Uri GeneralUri { get; set; }
+        [JsonPropertyName("data-uri")]
+        public Uri DataUri { get; set; }
+
+        public Configuration()
+        {
+            GeneralUri = new Uri(Quadarax.Foundation.Core.QMonitor.Constants.DefaultUriGeneral);
+            DataUri = new Uri(Quadarax.Foundation.Core.QMonitor.Constants.DefaultUriData);
+        }
+    }
+}

+ 20 - 0
Workbench/QMonitor/qmonlib.console/Program.cs

@@ -0,0 +1,20 @@
+// See https://aka.ms/new-console-template for more information
+
+using System.Reflection;
+using Quadarax.Foundation.Core.QConsole;
+using Quadarax.Foundation.Core.QConsole.Configuration;
+using Quadarax.Foundation.Core.QConsole.Context;
+using Quadarax.Foundation.Core.Reflection.Extensions;
+
+var config = new StartupConfiguration("BO Console", Assembly.GetExecutingAssembly().GetName().Version);
+config.ConsoleCopyright = Assembly.GetExecutingAssembly().GetCopyright();
+config.AllowInteractive = false;
+config.WaitOnKeyInNonInteractiveMode = false;
+config.CommandDefinitionAssebmly = new[]{Assembly.GetEntryAssembly()};
+config.DisableDefaultCommands();
+config.ShowStatusOnEveryCommand = false;
+config.IsConsoleDebug = false;
+
+var console = new Engine(config, new DefualtEngineContext(), args);
+console.Start();
+

+ 20 - 0
Workbench/QMonitor/qmonlib.console/qmonlib.console.csproj

@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net7.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+    <RootNamespace>Quadarax.Foundation.Core.QMonitor.Console</RootNamespace>
+    <AssemblyName>qdr.fnd.core.qmonlib.console</AssemblyName>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="qdr.fnd.core.qconsole" Version="0.0.1-alpha" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\qmonlib\qmonlib.csproj" />
+  </ItemGroup>
+
+</Project>

+ 4 - 3
Workbench/QMonitor/qmonlib.emit/Program.cs

@@ -1,8 +1,9 @@
 using System.Diagnostics;
-using qmonlib.emit.TestStructures;
 using Quadarax.Foundation.Core.Logging;
+using Quadarax.Foundation.Core.QMonitor;
+using Quadarax.Foundation.Core.QMonitor.Emit.TestStructures;
 
-namespace qmonlib.emit // Note: actual namespace depends on the project name.
+namespace Quadarax.Foundation.Core.QMonitor.Emit // Note: actual namespace depends on the project name.
 {
     internal class Program
     {
@@ -113,7 +114,7 @@ namespace qmonlib.emit // Note: actual namespace depends on the project name.
         public class Context
         {
             public QMonClient Client { get; set; }
-            
+
             public ServiceStatus Status { get; set; }
 
             public LoggedUser[] AvailableUsers { get; set; }

+ 2 - 2
Workbench/QMonitor/qmonlib.emit/TestStructures/LoggedUser.cs

@@ -1,6 +1,6 @@
-using qmonlib.Attributes;
+using Quadarax.Foundation.Core.QMonitor.Attributes;
 
-namespace qmonlib.emit.TestStructures
+namespace Quadarax.Foundation.Core.QMonitor.Emit.TestStructures
 {
     [MonitoredClass(Caption = "Logged User", Description = "Shows current logged user", ViewType = MonItemGeneral.MonViewType.List, TTL = 5000)]
     public class LoggedUser

+ 2 - 2
Workbench/QMonitor/qmonlib.emit/TestStructures/ProcessItem.cs

@@ -1,6 +1,6 @@
-using qmonlib.Attributes;
+using Quadarax.Foundation.Core.QMonitor.Attributes;
 
-namespace qmonlib.emit.TestStructures
+namespace Quadarax.Foundation.Core.QMonitor.Emit.TestStructures
 {
     [MonitoredClass(Caption = "Processes", Description = "Shows current processes status", ViewType = MonItemGeneral.MonViewType.List, TTL = 10000)]
     public class ProcessItem

+ 3 - 3
Workbench/QMonitor/qmonlib.emit/TestStructures/ServiceStatus.cs

@@ -1,6 +1,6 @@
-using qmonlib.Attributes;
+using Quadarax.Foundation.Core.QMonitor.Attributes;
 
-namespace qmonlib.emit.TestStructures
+namespace Quadarax.Foundation.Core.QMonitor.Emit.TestStructures
 {
     [MonitoredClass(Caption = "Service Status", Description = "Shows current service status", ViewType = MonItemGeneral.MonViewType.Item)]
     public class ServiceStatus
@@ -20,6 +20,6 @@ namespace qmonlib.emit.TestStructures
         {
             Online,
             Offline,
-        } 
+        }
     }
 }

+ 3 - 1
Workbench/QMonitor/qmonlib.emit/qmonlib.emit.csproj

@@ -2,9 +2,11 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
+    <RootNamespace>Quadarax.Foundation.Core.QMonitor.Emit</RootNamespace>
+    <AssemblyName>qdr.fnd.core.qmonlib.emit</AssemblyName>
   </PropertyGroup>
 
   <ItemGroup>

+ 6 - 0
Workbench/QMonitor/qmonlib.sln

@@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "qmonlib.ui", "qmonlib.ui\qm
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "qmonlib.ui.Desktop", "qmonlib.ui.Desktop\qmonlib.ui.Desktop.csproj", "{67EDD759-CD0B-482F-93BD-98E9C33E220F}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "qmonlib.console", "qmonlib.console\qmonlib.console.csproj", "{0D4E6D14-11B9-4631-B54A-9EC5F6B16ADE}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
 		{67EDD759-CD0B-482F-93BD-98E9C33E220F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{67EDD759-CD0B-482F-93BD-98E9C33E220F}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{67EDD759-CD0B-482F-93BD-98E9C33E220F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{0D4E6D14-11B9-4631-B54A-9EC5F6B16ADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0D4E6D14-11B9-4631-B54A-9EC5F6B16ADE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0D4E6D14-11B9-4631-B54A-9EC5F6B16ADE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0D4E6D14-11B9-4631-B54A-9EC5F6B16ADE}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 1 - 1
Workbench/QMonitor/qmonlib/Attributes/MonitoredClassAttribute.cs

@@ -1,4 +1,4 @@
-namespace qmonlib.Attributes
+namespace Quadarax.Foundation.Core.QMonitor.Attributes
 {
     [AttributeUsage(AttributeTargets.Class)]
     public class MonitoredClassAttribute : Attribute

+ 1 - 1
Workbench/QMonitor/qmonlib/Attributes/MonitoredPropertyAttribute.cs

@@ -1,4 +1,4 @@
-namespace qmonlib.Attributes
+namespace Quadarax.Foundation.Core.QMonitor.Attributes
 {
     [AttributeUsage(AttributeTargets.Property)]
     public class MonitoredPropertyAttribute : Attribute

+ 1 - 1
Workbench/QMonitor/qmonlib/Attributes/MonitoredPropertyKeyAttribute.cs

@@ -1,4 +1,4 @@
-namespace qmonlib.Attributes
+namespace Quadarax.Foundation.Core.QMonitor.Attributes
 {
     public class MonitoredPropertyKeyAttribute : Attribute
     {

+ 9 - 0
Workbench/QMonitor/qmonlib/Constants.cs

@@ -0,0 +1,9 @@
+namespace Quadarax.Foundation.Core.QMonitor
+{
+    public class Constants
+    {
+        public const string DefaultUriGeneral = "udp://0.0.0.0:5100";
+        public const string DefaultUriData = "udp://0.0.0.0:5101";
+
+    }
+}

+ 0 - 84
Workbench/QMonitor/qmonlib/Dependencies/Console/ConsoleWriter.cs

@@ -1,84 +0,0 @@
-using System;
-using Quadarax.Foundation.Core.Object;
-
-namespace Quadarax.Foundation.Core.Console
-{
-    public class ConsoleWriter : DisposableObject
-    {
-        private readonly ConsoleColor _oldBackColor;
-        private readonly ConsoleColor _oldForeColor;
-        private readonly ConsoleColor _backColor;
-        private readonly ConsoleColor _foreColor;
-
-
-        public ConsoleWriter(ConsoleColor foreColor,ConsoleColor backColor)
-        {
-            _oldBackColor = System.Console.BackgroundColor;
-            _oldForeColor = System.Console.ForegroundColor;
-            _backColor = backColor;
-            _foreColor = foreColor;
-        }
-
-        public ConsoleWriter(ConsoleColor foreColor)
-        {
-            _oldBackColor = System.Console.BackgroundColor;
-            _oldForeColor = System.Console.ForegroundColor;
-            _backColor = _oldBackColor;
-            _foreColor = foreColor;
-        }
-
-
-        public ConsoleWriter WriteLine(string text)
-        {
-            SetColor();
-            WriteInternal(text);
-            WriteLineInternal();
-            return this;
-        }
-
-        public string ReadLine()
-        {
-            SetColor();
-            return System.Console.ReadLine();
-        }
-
-        public ConsoleWriter WriteLine()
-        {
-            WriteLineInternal();
-            return this;
-        }
-        public ConsoleWriter Write(string text)
-        {
-            SetColor();
-            WriteInternal(text);
-            return this;
-        }
-
-        public static void Clear()
-        {
-            System.Console.Clear();
-        }
-
-        protected virtual void WriteInternal(string text)
-        {
-            System.Console.Write(text);
-        }
-        protected virtual void WriteLineInternal()
-        {
-            System.Console.WriteLine();
-        }
-
-        protected override void OnDisposing()
-        {
-            System.Console.ForegroundColor = _oldForeColor;
-            System.Console.BackgroundColor = _oldBackColor;
-        }
-
-        private void SetColor()
-        {
-            System.Console.ForegroundColor = _foreColor;
-            System.Console.BackgroundColor = _backColor;
-        }
-
-    }
-}

+ 0 - 113
Workbench/QMonitor/qmonlib/Dependencies/Console/ProgressBar.cs

@@ -1,113 +0,0 @@
-using System;
-using System.Text;
-using System.Threading;
-using Quadarax.Foundation.Core.Object;
-// ReSharper disable InconsistentNaming
-
-namespace Quadarax.Foundation.Core.Console
-{
-    public class ProgressBar : DisposableObject, IProgress<double>
-    {
-
-        #region *** Constants ***
-        private const int CN_BLOCK_COUNT = 10;
-        private const string CS_ANIMATION = @"|/-\";
-        #endregion
-        #region *** Private fields ***
-        private readonly TimeSpan _animationInterval = TimeSpan.FromSeconds(1.0 / 8);
-        private readonly Timer _timer;
-        private double _currentProgress;
-        private string _currentText = string.Empty;
-        private int _animationIndex;
-        private ConsoleWriter _writer;
-        #endregion
-
-        #region *** Constructors ***
-        public ProgressBar(ConsoleWriter writer)
-        {
-            _writer = writer ?? throw new ArgumentNullException(nameof(writer));
-            _timer = new Timer(TimerHandler);
-
-            // A progress bar is only for temporary display in a console window.
-            // If the console output is redirected to a file, draw nothing.
-            // Otherwise, we'll end up with a lot of garbage in the target file.
-            if (!System.Console.IsOutputRedirected)
-            {
-                ResetTimer();
-            }
-        }
-        #endregion
-
-        #region *** Public Operations ***
-        /// <summary>
-        /// Update progress status.
-        /// </summary>
-        /// <param name="value">Status value between 0 - 1. Represents percentage.</param>
-        public void Report(double value)
-        {
-            // Make sure value is in [0..1] range
-            value = Math.Max(0, Math.Min(1, value));
-            Interlocked.Exchange(ref _currentProgress, value);
-        }
-        #endregion
-
-        #region *** Private Operations ***
-        private void TimerHandler(object state)
-        {
-            lock (_timer)
-            {
-                var progressBlockCount = (int)(_currentProgress * CN_BLOCK_COUNT);
-                var percent = (int)(_currentProgress * 100);
-                var text = $"[{new string('#', progressBlockCount)}{new string('-', CN_BLOCK_COUNT - progressBlockCount)}] {percent,3}% {CS_ANIMATION[_animationIndex++ % CS_ANIMATION.Length]}";
-                UpdateText(text);
-                ResetTimer();
-            }
-        }
-
-        private void UpdateText(string text)
-        {
-            // Get length of common portion
-            var commonPrefixLength = 0;
-            var commonLength = Math.Min(_currentText.Length, text.Length);
-            while (commonPrefixLength < commonLength && text[commonPrefixLength] == _currentText[commonPrefixLength])
-            {
-                commonPrefixLength++;
-            }
-
-            // Backtrack to the first differing character
-            var outputBuilder = new StringBuilder();
-            outputBuilder.Append('\b', _currentText.Length - commonPrefixLength);
-
-            // Output new suffix
-            outputBuilder.Append(text.Substring(commonPrefixLength));
-
-            // If the new text is shorter than the old one: delete overlapping characters
-            var overlapCount = _currentText.Length - text.Length;
-            if (overlapCount > 0)
-            {
-                outputBuilder.Append(' ', overlapCount);
-                outputBuilder.Append('\b', overlapCount);
-            }
-
-            _writer.Write(outputBuilder.ToString());
-            _currentText = text;
-        }
-
-        private void ResetTimer()
-        {
-            _timer.Change(_animationInterval, TimeSpan.FromMilliseconds(-1));
-        }
-        #endregion
-
-        #region *** Private Overrides ***
-        protected override void OnDisposing()
-        {
-            lock (_timer)
-            {
-                UpdateText(string.Empty);
-                _writer = null;
-            }
-        }
-        #endregion
-    }
-}

+ 0 - 78
Workbench/QMonitor/qmonlib/Dependencies/Console/ProgressConsoleWriter.cs

@@ -1,78 +0,0 @@
-using System;
-using System.Text;
-
-namespace Quadarax.Foundation.Core.Console
-{
-    public class ProgressConsoleWriter : ConsoleWriter
-    {
-        #region *** Private Fields ***
-        private int _maxProgress;
-        private int _curProgress = 0;
-        private string _lastText;
-        #endregion
-
-        #region *** Constructors ***
-        public ProgressConsoleWriter(ConsoleColor foreColor, ConsoleColor backColor, int maxProgress) : base(foreColor, backColor)
-        {
-            _maxProgress = maxProgress;
-        }
-
-        public ProgressConsoleWriter(ConsoleColor foreColor, int maxProgress) : base(foreColor)
-        {
-            _maxProgress = maxProgress;
-        }
-        #endregion
-
-        #region *** Public Operations ***
-
-        public void SetProgress(int progress)
-        {
-            _curProgress = progress;
-            OnRefreshProgress();
-        }
-        public void IncProgress()
-        {
-            _curProgress++;
-            OnRefreshProgress();
-        }
-        public void DecProgress()
-        {
-            _curProgress--;
-            OnRefreshProgress();
-        }
-        
-        #endregion
-
-        #region *** Internal Operations ***
-
-        protected override void WriteLineInternal()
-        {
-            base.WriteLineInternal();
-            OnRefreshProgress();
-        }
-
-        protected override void WriteInternal(string text)
-        {
-            _lastText = text;
-            OnRefreshProgress();
-        }
-
-        private void OnRefreshProgress()
-        {
-            base.WriteInternal("\r");
-            base.WriteInternal(new string(' ', System.Console.BufferWidth - 1));
-            base.WriteInternal("\r");
-            var sb = new StringBuilder();
-            sb.Append("[").Append(_curProgress).Append("/").Append(_maxProgress).Append("] ").Append(_lastText);
-            base.WriteInternal(sb.ToString());
-        }
-        protected override void OnDisposing()
-        {
-            System.Console.WriteLine();
-            base.OnDisposing();
-        }
-
-        #endregion
-
-    }
-}

+ 0 - 173
Workbench/QMonitor/qmonlib/Dependencies/Json/Binder.cs

@@ -1,173 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO.Abstractions;
-using System.Linq;
-using System.Reflection;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Quadarax.Foundation.Core.Json
-{
-    public class Binder
-    {
-        private IFileSystem _fileSystem;
-
-        public JsonSerializerOptions SerializerOptions {get;private set;}
-
-        public Binder(JsonSerializerOptions options): this(new FileSystem(), options)
-        {
-        }
-        public Binder(IFileSystem fileSystemAbstraction, JsonSerializerOptions options)
-        {
-            _fileSystem = fileSystemAbstraction ?? throw new ArgumentNullException(nameof(fileSystemAbstraction));
-            SerializerOptions = options;
-        }
-
-        public Binder(IFileSystem fileSystemAbstraction, bool isPrettyPrint = true, bool isIgnoringNullValues = true, int maxDepth = 100)
-        {
-            _fileSystem = fileSystemAbstraction ?? throw new ArgumentNullException(nameof(fileSystemAbstraction));
-            var jsonOpt = new JsonSerializerOptions
-            {
-                IgnoreNullValues = isIgnoringNullValues,
-                WriteIndented = isPrettyPrint,
-                PropertyNameCaseInsensitive = true,
-                PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
-                MaxDepth = maxDepth
-            };
-            jsonOpt.Converters.Add(new JsonStringEnumConverter());
-            SerializerOptions = jsonOpt;
-        }
-
-        public TObject Load<TObject>(string fileName)
-        {
-            return (TObject) Load(fileName, typeof(TObject));
-        }
-        public object Load(string fileName, Type targetType)
-        {
-            if (targetType == null)
-                throw new ArgumentNullException(nameof(targetType));
-
-            if (string.IsNullOrEmpty(fileName))
-                throw new ArgumentNullException(nameof(fileName));
-
-            using (var reader = _fileSystem.File.OpenText(fileName))
-            {
-                var result = JsonSerializer.Deserialize(reader.ReadToEnd(),targetType, SerializerOptions);
-                return result;
-            }
-        }
-
-        public object LoadFromString(string jsonString, Type targetType)
-        {
-            if (targetType == null)
-                throw new ArgumentNullException(nameof(targetType));
-
-            if (string.IsNullOrEmpty(jsonString))
-                throw new ArgumentNullException(nameof(jsonString));
-
-            
-            var result = JsonSerializer.Deserialize(jsonString,targetType, SerializerOptions);
-            return result;
-        }
-
-        public void LoadTo(string fileName, object target, Type targetType)
-        {
-            if (targetType == null)
-                throw new ArgumentNullException(nameof(targetType));
-     
-            if (target == null)
-                throw new ArgumentNullException(nameof(target));
-            var shadow = Load(fileName, targetType);
-            
-            foreach (var property in shadow.GetType().GetProperties())
-            {
-                if (target.GetType().GetProperties().Any(x => x.Name == property.Name && property.GetValue(shadow) != null))
-                {
-                    if (property.GetType().IsClass && property.PropertyType.Assembly.FullName == targetType.Assembly.FullName)
-                    {
-                        var mapMethod = typeof(Binder).GetMethod("LoadTo");
-                        var genericMethod = mapMethod.MakeGenericMethod(property.GetValue(shadow).GetType());
-                        var obj2 = genericMethod.Invoke(null, new object[] { property.GetValue(shadow), JsonSerializer.Serialize(property.GetValue(shadow)) });
-
-                        foreach (var property2 in obj2.GetType().GetProperties())
-                        {
-                            if (property2.GetValue(obj2) != null)
-                            {
-                                property.GetValue(target).GetType().GetProperty(property2.Name).SetValue(property.GetValue(target), property2.GetValue(obj2));
-                            }
-                        }
-                    }
-                    else if (property.CanWrite)
-                    {
-                        property.SetValue(target, property.GetValue(shadow));
-                    }
-                }
-            }
-
-        }
-
-        public void LoadFromStringTo(string jsonString, object target, Type targetType)
-        {
-            if (targetType == null)
-                throw new ArgumentNullException(nameof(targetType));
-     
-            if (target == null)
-                throw new ArgumentNullException(nameof(target));
-            var shadow = LoadFromString(jsonString, targetType);
-            
-            foreach (var property in shadow.GetType().GetProperties())
-            {
-                if (target.GetType().GetProperties().Any(x => x.Name == property.Name && property.GetValue(shadow) != null))
-                {
-                    if (property.GetType().IsClass && property.PropertyType.Assembly.FullName == targetType.Assembly.FullName)
-                    {
-                        var mapMethod = typeof(Binder).GetMethod("LoadFromStringTo");
-                        var genericMethod = mapMethod.MakeGenericMethod(property.GetValue(shadow).GetType());
-                        var obj2 = genericMethod.Invoke(null, new object[] { property.GetValue(shadow), JsonSerializer.Serialize(property.GetValue(shadow)) });
-
-                        foreach (var property2 in obj2.GetType().GetProperties())
-                        {
-                            if (property2.GetValue(obj2) != null)
-                            {
-                                property.GetValue(target).GetType().GetProperty(property2.Name).SetValue(property.GetValue(target), property2.GetValue(obj2));
-                            }
-                        }
-                    }
-                    else if (property.CanWrite)
-                    {
-                        property.SetValue(target, property.GetValue(shadow));
-                    }
-                }
-            }
-
-        }
-
-        public void LoadTo<TObject>(string fileName, TObject target)
-        {
-            LoadTo(fileName, target, typeof(TObject));
-        }
-
-        public void Save<TObject>(string fileName, TObject bindingObject)
-        {
-            if (string.IsNullOrEmpty(fileName))
-                throw new ArgumentNullException(nameof(fileName));
-            if (bindingObject==null)
-                throw new ArgumentNullException(nameof(bindingObject));
-
-            var configuration = JsonSerializer.SerializeToUtf8Bytes(bindingObject,SerializerOptions);
-            using (var writer = _fileSystem.File.Create(fileName))
-            {
-                writer.Write(configuration);
-                writer.Flush();
-            }
-        }
-
-        public string SaveToString<TObject>(TObject bindingObject)
-        {
-            if (bindingObject==null)
-                throw new ArgumentNullException(nameof(bindingObject));
-
-            return JsonSerializer.Serialize(bindingObject,bindingObject.GetType());
-        }
-    }
-}

+ 0 - 35
Workbench/QMonitor/qmonlib/Dependencies/Json/IListConverterFactory.cs

@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Quadarax.Foundation.Core.Json
-{
-    public class IListInterfaceConverterFactory : JsonConverterFactory
-    {
-        public IListInterfaceConverterFactory(Type interfaceType)
-        {
-            this.InterfaceType = interfaceType;
-        }
-
-        public Type InterfaceType { get; }
-
-        public override bool CanConvert(Type typeToConvert)
-        {
-            if (typeToConvert == typeof(IList<>).MakeGenericType(this.InterfaceType)
-                && typeToConvert.GenericTypeArguments[0] == this.InterfaceType)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
-        {
-            return (JsonConverter)Activator.CreateInstance(
-                typeof(ListConverter<>).MakeGenericType(this.InterfaceType));
-        }
-    }
-
-}

+ 0 - 18
Workbench/QMonitor/qmonlib/Dependencies/Json/InterfaceConverter.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Quadarax.Foundation.Core.Json
-{
-    public class InterfaceConverter<M, I> : JsonConverter<I> where M : class, I
-    {
-        public override I Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
-        {
-            return JsonSerializer.Deserialize<M>(ref reader, options);
-        }
-
-        public override void Write(Utf8JsonWriter writer, I value, JsonSerializerOptions options)
-        {
-        }
-    }
-}

+ 0 - 30
Workbench/QMonitor/qmonlib/Dependencies/Json/InterfaceConverterFactory.cs

@@ -1,30 +0,0 @@
-using System;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Quadarax.Foundation.Core.Json
-{
-    public class InterfaceConverterFactory : JsonConverterFactory
-    {
-        public InterfaceConverterFactory(Type concrete, Type interfaceType)
-        {
-            this.ConcreteType = concrete;
-            this.InterfaceType = interfaceType;
-        }
-
-        public Type ConcreteType { get; }
-        public Type InterfaceType { get; }
-
-        public override bool CanConvert(Type typeToConvert)
-        {
-            return typeToConvert == this.InterfaceType;
-        }
-
-        public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
-        {
-            var converterType = typeof(InterfaceConverter<,>).MakeGenericType(this.ConcreteType, this.InterfaceType);
-
-            return (JsonConverter)Activator.CreateInstance(converterType);
-        }
-    }
-}

+ 0 - 23
Workbench/QMonitor/qmonlib/Dependencies/Json/ListConverter.cs

@@ -1,23 +0,0 @@
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Quadarax.Foundation.Core.Json
-{
-    public class ListConverter<M> : JsonConverter<IList<M>>
-    {
-        public override IList<M> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
-        {
-            return JsonSerializer.Deserialize<List<M>>(ref reader, options);
-        }
-
-        public override bool CanConvert(Type typeToConvert)
-        {
-            return base.CanConvert(typeToConvert);
-        }
-
-        public override void Write(Utf8JsonWriter writer, IList<M> value, JsonSerializerOptions options)
-        {
-            throw new NotImplementedException();
-        }
-    }
-}

+ 0 - 64
Workbench/QMonitor/qmonlib/Dependencies/Logging/ConsoleLog.cs

@@ -1,64 +0,0 @@
-using Quadarax.Foundation.Core.Console;
-
-namespace Quadarax.Foundation.Core.Logging
-{
-    public class ConsoleLog : ILog
-    {
-        private string _typeName;
-
-		private ConsoleWriter _infoWriter = new ConsoleWriter(ConsoleColor.White);
-        private ConsoleWriter _debugWriter = new ConsoleWriter(ConsoleColor.Green);
-        private ConsoleWriter _warnWriter = new ConsoleWriter(ConsoleColor.Yellow);
-        private ConsoleWriter _errorWriter = new ConsoleWriter(ConsoleColor.Red);
-        private ConsoleWriter _traceWriter = new ConsoleWriter(ConsoleColor.DarkGray);
-        public ConsoleLog(Type owningType)
-        {
-            _typeName = owningType.Name;
-        }
-
-        public ConsoleLog(string owningTypeName)
-        {
-            _typeName = owningTypeName;
-        }
-
-        public void Log(LogSeverityEnum severity, int code, string message)
-        {
-			Log(severity, $"Code:{code}, {message}");            
-        }
-
-        public void Log(LogSeverityEnum severity, string message)
-        {
-            var now = DateTime.Now;
-            var thNum = Thread.CurrentThread.ManagedThreadId;
-
-            var final = $"[{severity}:{now.ToLongTimeString()}:{thNum}]#{_typeName}: {message}";
-
-            switch (severity)
-            {
-                case LogSeverityEnum.Info:
-                    _infoWriter.WriteLine(final);
-                    break;
-                case LogSeverityEnum.Debug:
-                    _debugWriter.WriteLine(final);
-                    break;
-                case LogSeverityEnum.Warn:
-                    _warnWriter.WriteLine(final);
-                    break;
-                case LogSeverityEnum.Fatal:
-                case LogSeverityEnum.Error:
-                    _errorWriter.WriteLine(final);
-                    break;
-            }
-        }
-
-        public void Log(LogSeverityEnum severity, string message, Exception? exception)
-        {
-            Log(severity, $"{message}\n{exception}");
-        }
-
-        public void Log(LogSeverityEnum severity, int code, string message, Exception? exception)
-        {
-            Log(severity, string.Format("{2} - {0}\n{1}", message,exception, code));
-        }
-    }
-}

+ 0 - 16
Workbench/QMonitor/qmonlib/Dependencies/Logging/ConsoleLogger.cs

@@ -1,16 +0,0 @@
-
-namespace Quadarax.Foundation.Core.Logging
-{
-    public class ConsoleLogger : ILogger
-    {
-        public ILog GetLogger(string loggerName)
-        {
-            return new ConsoleLog(loggerName);
-        }
-
-        public ILog GetLogger(Type loggerForType)
-        {
-            return new ConsoleLog(loggerForType);
-        }
-    }
-}

+ 0 - 12
Workbench/QMonitor/qmonlib/Dependencies/Logging/ILog.cs

@@ -1,12 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Logging
-{
-    public interface ILog
-    {
-        void Log(LogSeverityEnum severity, int code, string message);
-        void Log(LogSeverityEnum severity, string message);
-        void Log(LogSeverityEnum severity, string message, Exception? exception);
-        void Log(LogSeverityEnum severity, int code, string message, Exception? exception);
-    }
-}

+ 0 - 9
Workbench/QMonitor/qmonlib/Dependencies/Logging/ILogHandler.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Logging
-{
-    public interface ILogHandler
-    {
-        void Log(LogSeverityEnum type, string message, Exception? e = null);
-    }
-}

+ 0 - 10
Workbench/QMonitor/qmonlib/Dependencies/Logging/ILogger.cs

@@ -1,10 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Logging
-{
-    public interface ILogger
-    {
-        ILog GetLogger(string loggerName);
-        ILog GetLogger(Type loggerForType);
-    }
-}

+ 0 - 12
Workbench/QMonitor/qmonlib/Dependencies/Logging/LogSeverityEnum.cs

@@ -1,12 +0,0 @@
-namespace Quadarax.Foundation.Core.Logging
-{
-    public enum LogSeverityEnum
-    {
-        Trace,
-        Debug,
-        Info,
-        Warn,
-        Error,
-        Fatal
-    }
-}

+ 0 - 19
Workbench/QMonitor/qmonlib/Dependencies/Object/DisposableObject.cs

@@ -1,19 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Object
-{
-    public abstract class DisposableObject : IDisposable
-    {
-        private bool _isDisposing;
-
-        public void Dispose()
-        {
-            if (_isDisposing)
-                return;
-            _isDisposing = true;
-            OnDisposing();
-        }
-
-        protected abstract void OnDisposing();
-    }
-}

+ 0 - 20
Workbench/QMonitor/qmonlib/Dependencies/Object/Dynamic/Dyo.cs

@@ -1,20 +0,0 @@
-namespace qmonlib.Dependencies.Object.Dynamic
-{
-    public class Dyo : DyoMember
-    {
-        #region *** Fields ***
-
-        #endregion
-
-        #region *** Constructors ***
-
-        public Dyo(string name) : base(null, ElementType.Root, null, name)
-        {
-        }
-        #endregion
-
-        #region *** Operations ***
-
-        #endregion
-    }
-}

+ 0 - 139
Workbench/QMonitor/qmonlib/Dependencies/Object/Dynamic/DyoMember.cs

@@ -1,139 +0,0 @@
-using System.Collections;
-using System.Text;
-
-namespace qmonlib.Dependencies.Object.Dynamic
-{
-    public class DyoMember
-    {
-         #region *** Constants ***
-
-            public const string PathSeparator = "/";
-            public const string PathRoot = ".";
-            #endregion
-
-            #region *** Properties ***
-            private long Id { get; }
-            public ElementType Type { get; }
-            private Dyo? Root { get; }
-            private DyoMember? Parent { get; }
-            public string Name { get; }
-            public object? Value { get; private set; }
-            public DyoMember[] Members => _members.ToArray();
-            #endregion
-            #region *** Fields ***
-            private static long _idCnt;
-            private IList<DyoMember> _members = new List<DyoMember>();
-            #endregion
-
-            #region *** Indexer ***
-            public DyoMember this[string name] => Get(name);
-            public DyoMember this[int ordinal] => _members.Skip(ordinal).First();
-            #endregion
-
-            #region *** Constructors ***
-            public DyoMember(Dyo? root, ElementType type, DyoMember? parent, string name, object? value = null)
-            {
-                Id = root?.GetNextId() ?? -1;
-                Type = type;
-                Parent = parent;
-                Root = root;
-                Name = name;
-                Value = value;
-            }
-            #endregion
-
-            #region *** Operations ***
-            public DyoMember Add(string name, ElementType elementType, object? value = null)
-            {
-                ThrowIfExists(name);
-                var item = new DyoMember(Root ?? (Dyo)this, elementType, this, name, value);
-                _members.Add(item);
-                return item;
-            }
-
-            public void Remove(string name)
-            {
-                var item = Get(name);
-                item.Clear();
-                _members.Remove(item);
-            }
-            public void Clear()
-            {
-                foreach (var member in _members)
-                    member.Clear();
-                _members.Clear();
-            }
-
-            public DyoMember Get(string name)
-            {
-                ThrowIfNotExists(name);
-                var item = _members.First(x => x.Name == name);
-                return item;
-            }
-
-            public void Set(string name, object? value)
-            {
-                var item = Get(name);
-                item.Value = value;
-            }
-            public void Reset()
-            {
-                foreach (var member in _members)
-                    member.Reset();
-                Value = null;
-            }
-            public bool Exists(string name, Dyo.ElementType? elementType = null)
-            {
-                if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
-                var exists = elementType!=null ? _members.Any(x => x.Name == name && x.Type == elementType) : _members.Any(x => x.Name == name);
-                return exists;
-            }
-            public string GetPath()
-            {
-                if (Parent == null) return Dyo.PathRoot;
-                var path = Parent.GetPath() + Dyo.PathSeparator + Name;
-                return path;
-            }
-
-            public string Dump()
-            {
-                var sb = new StringBuilder();
-                sb.Append(Name).Append(" [#").Append(Id).Append(";").Append(Type).Append("] ").Append(_members.Count).Append(" members").AppendLine();
-                sb.Append("\t").Append("Path:").Append(GetPath()).AppendLine();
-                if (Type == ElementType.Value)
-                    sb.Append("\t").Append("Value:").Append(Value == null ? "NULL" : Value.ToString()).AppendLine();
-                foreach (var member in _members)
-                    sb.Append("\t* ").Append(member.Dump());
-                return sb.ToString();
-            }
-            #endregion
-
-            #region *** Private Operations ***
-
-            private void ThrowIfNotExists(string name)
-            {
-                if (!Exists(name)) throw new Exception($"Dyo member with name '{name}' does not exist.");
-            }
-            private void ThrowIfExists(string name)
-            {
-                if (Exists(name)) throw new Exception($"Dyo member with name '{name}' already exists.");
-            }
-            private long GetNextId()
-            {
-                _idCnt++;
-                return _idCnt;
-            }
-            #endregion
-            #region *** Nested Types ***
-            public enum ElementType
-            {
-                Value,
-                Object,
-                Collection,
-                Root
-            }
-
-            #endregion
-        }
-    
-}

+ 0 - 41
Workbench/QMonitor/qmonlib/Dependencies/Object/Extensions/ObjectExt.cs

@@ -1,41 +0,0 @@
-using System.Collections;
-using Quadarax.Foundation.Core.Reflection.Extensions;
-
-namespace Quadarax.Foundation.Core.Object.Extensions
-{
-    public static class ObjectExt
-    {
-        public static IDictionary<string, object?> GetAllPropertyValues(this object? obj,string? indentPrefix = null)
-        {
-            var props = new Dictionary<string, object?>();
-            if (obj == null)
-                return props;
-
-            if (string.IsNullOrEmpty(indentPrefix))
-                indentPrefix = string.Empty;
-
-            var type = obj.GetType();
-            var propList = type.GetAllProperties();
-            foreach (var prop in propList)
-            {
-                var val = prop.GetValue(obj, new object[] { });
-                if (val is IEnumerable enumerable)
-                {
-                    var cnt = 0;
-                    foreach (var item in enumerable)
-                    {
-                        var itemProps = item.GetAllPropertyValues(prop.Name + $"[{cnt}].");
-                        foreach (var ip in itemProps)
-                            props.Add(ip.Key, ip.Value);
-                        cnt++;
-                    }
-                }
-                else
-                    props.Add(indentPrefix + prop.Name, val);
-            }
- 
-            return props;
-        }
-
-    }
-}

+ 0 - 71
Workbench/QMonitor/qmonlib/Dependencies/Object/Singleton.cs

@@ -1,71 +0,0 @@
-namespace Quadarax.Foundation.Core.Object
-{
-  
-        /// <summary>
-        /// Well-known singleton pattern implementation.
-        /// </summary>
-        /// <remarks>
-        /// The singleton type must inherit this class. The actual instance type is determined
-        /// by the only type parameter. The singleton type must implement a default constructor.
-        /// </remarks>
-        /// <typeparam name="TInstance"></typeparam>
-        public class Singleton<TInstance> where TInstance : new()
-        {
-            private static TInstance? _instance;
-            private static readonly object _syncRoot = new object();
-
-            /// <summary>
-            /// Singleton instance
-            /// </summary>
-            public static TInstance Instance
-            {
-                get
-                {
-                    if (_instance == null)
-                    {
-                        lock (_syncRoot)
-                        {
-                            if (_instance == null)
-                                _instance = new TInstance();
-                        }
-                    }
-
-                    return _instance;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Well-known singleton pattern implementation.
-        /// </summary>
-        /// <remarks>
-        /// The singleton type must inherit this class. The actual instance type is determined
-        /// by the only type parameter. The singleton type must implement a default constructor.
-        /// </remarks>
-        /// <typeparam name="TInstance"></typeparam>
-        /// <typeparam name="TInterface"></typeparam>
-        public class Singleton<TInterface, TInstance>
-            where TInstance : TInterface, new()
-            where TInterface : class
-        {
-            private static volatile TInterface? _instance;
-            private static readonly object _syncRoot = new object();
-
-            public static TInterface Instance
-            {
-                get
-                {
-                    if (_instance == null)
-                    {
-                        lock (_syncRoot)
-                        {
-                            if (_instance == null)
-                                _instance = new TInstance();
-                        }
-                    }
-
-                    return _instance;
-                }
-            }
-        }
-}

+ 0 - 32
Workbench/QMonitor/qmonlib/Dependencies/Object/WeakReference.cs

@@ -1,32 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Object
-{
-    /// <summary>
-    /// Strongly typed version of <see cref="WeakReference"/>.
-    /// </summary>
-    /// <typeparam name="TReference"></typeparam>
-    public class WeakReference<TReference> : WeakReference 
-        where TReference : class
-    {
-        public WeakReference(TReference target)
-            : base(target)
-        {
-        }
-
-        public WeakReference(TReference target, bool trackResurrection)
-            : base(target, trackResurrection)
-        {
-        }
-
-        /// <summary>
-        /// Strongly typed version of <see cref="WeakReference.Target"/>.
-        /// </summary>
-        public new TReference? Target
-        {
-            get { return base.Target as TReference; }
-            set { base.Target = value; }
-        }
-    }
-
-}

+ 0 - 73
Workbench/QMonitor/qmonlib/Dependencies/Reflection/AttributeQuery.cs

@@ -1,73 +0,0 @@
-using System.Reflection;
-
-namespace Quadarax.Foundation.Core.Reflection
-{
-    public static class AttributeQuery<TAttributeType> where TAttributeType : Attribute
-    {
-        public static TAttributeType Get<TAttributeProvider>(TAttributeProvider oProvider)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            return Get(oProvider, true);
-        }
-
-        public static TAttributeType Get<TAttributeProvider>(TAttributeProvider oProvider, bool bInherit)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            var attribute = Find(oProvider, bInherit);
-            if (attribute == null)
-            {
-                throw new Exception($"Cannot find attribute '{typeof(TAttributeType).Name}' inside class '{oProvider.GetType().AssemblyQualifiedName}'");
-            }
-            return attribute;
-        }
-
-        public static TAttributeType? Find<TAttributeProvider>(TAttributeProvider oProvider, bool bInherit)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            var attributes = FindAll(oProvider, bInherit);
-            return attributes.Length > 0 ? attributes[0] : null;
-        }
-
-        public static TAttributeType?[] FindAll<TAttributeProvider>(TAttributeProvider oProvider)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            return FindAll(oProvider, true);
-        }
-
-        public static TAttributeType?[] FindAll<TAttributeProvider>(TAttributeProvider oProvider, bool bInherit)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            return (TAttributeType?[])oProvider.GetCustomAttributes(typeof(TAttributeType), bInherit);
-        }
-
-        public static MemberInfo[] GetMembers(Type oSource, BindingFlags eFlags)
-        {
-            var oResult = new List<MemberInfo>();
-            if (oSource.IsEnum)
-            {
-                var oMembers = oSource.GetEnumValues();
-                foreach (var oMember in oMembers)
-                {
-                    var oMemberInfo = oSource.GetMember(oMember.ToString() ?? string.Empty);                                        
-                    if (Has(oMemberInfo[0]))
-                        oResult.Add(oMemberInfo[0]);                    
-                }
-                return oResult.ToArray();
-            }
-            throw new NotSupportedException(
-                $"Attribute query in GetMembers does't support type object '{oSource.AssemblyQualifiedName}");
-        }
-
-        public static bool Has<TAttributeProvider>(TAttributeProvider oProvider)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            return oProvider.IsDefined(typeof(TAttributeType), true);
-        }
-
-        public static bool Has<TAttributeProvider>(TAttributeProvider oProvider, bool bInherit)
-            where TAttributeProvider : ICustomAttributeProvider
-        {
-            return Find(oProvider, bInherit) != null;
-        }
-    }
-}

+ 0 - 33
Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/ActivatorExt.cs

@@ -1,33 +0,0 @@
-using System;
-
-namespace Quadarax.Foundation.Core.Reflection.Extensions
-{
-    public static class ActivatorExt
-    {
-        #region *** Private Fields ***
-        #endregion
-        #region *** Public Properties ***
-        #endregion
-        #region *** Constructors ***
-        #endregion
-        #region *** Public operations & overrides ***
-        public static object? CreateInstance(string sClassOrInterfaceQualifiedName, bool bLoadAssemblyIfNeeded, params object[] aConstructorParams)
-        {
-            var oType = Type.GetType(sClassOrInterfaceQualifiedName, false) ?? TypeUtils.GetRemoteType(sClassOrInterfaceQualifiedName);
-            if (oType == null) return null;
-
-            if (oType.IsInterface)
-            {
-                throw new ArgumentException($"Input class name '{sClassOrInterfaceQualifiedName}' cannot be an interface.",nameof(sClassOrInterfaceQualifiedName));
-            }
-            return Activator.CreateInstance(oType, aConstructorParams);
-        }
-        public static T CreateInstance<T>(string sClassOrInterfaceQualifiedName, bool bLoadAssemblyIfNeeded, params object[] aConstructorParams)
-        {
-            return (T) CreateInstance(sClassOrInterfaceQualifiedName, bLoadAssemblyIfNeeded, aConstructorParams)!;
-        }
-        #endregion
-        #region *** Private operations & overrides ***
-        #endregion        
-    }
-}

+ 0 - 79
Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/AssemblyExt.cs

@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-namespace Quadarax.Foundation.Core.Reflection.Extensions
-{
-    public static class AssemblyExt
-    {
-        #region *** Private Fields ***
-        #endregion
-        #region *** Public Properties ***
-        #endregion
-        #region *** Constructors ***
-        #endregion
-        #region *** Public operations & overrides ***
-        public static Version? GetVersion(this Assembly oAssembly)
-        {
-            if (oAssembly == null)
-                throw new ArgumentNullException(nameof(oAssembly));
-
-            return oAssembly.GetName().Version;
-        }
-        public static string GetDescription(this Assembly oAssembly)
-        {
-            var oAttribute = oAssembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), true).FirstOrDefault();
-            if (oAttribute == null)
-                return string.Empty;
-            return ((AssemblyDescriptionAttribute)oAttribute).Description;
-        }
-        public static string GetProduct(this Assembly oAssembly)
-        {
-            var oAttribute = oAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), true).FirstOrDefault();
-            if (oAttribute == null)
-                return string.Empty;
-            return ((AssemblyProductAttribute)oAttribute).Product;
-        }
-        public static string GetCompany(this Assembly oAssembly)
-        {
-            var oAttribute = oAssembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true).FirstOrDefault();
-            if (oAttribute == null)
-                return string.Empty;
-            return ((AssemblyCompanyAttribute)oAttribute).Company;
-        }
-        public static string GetCopyright(this Assembly oAssembly)
-        {
-            var oAttribute = oAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true).FirstOrDefault();
-            if (oAttribute == null)
-                return string.Empty;
-            return ((AssemblyCopyrightAttribute)oAttribute).Copyright;
-        }
-        public static string GetTrademark(this Assembly oAssembly)
-        {
-            var oAttribute = oAssembly.GetCustomAttributes(typeof(AssemblyTrademarkAttribute), true).FirstOrDefault();
-            if (oAttribute == null)
-                return string.Empty;
-            return ((AssemblyTrademarkAttribute)oAttribute).Trademark;
-        }
-        public static string GetAssemblyPath(this Assembly oAssembly)
-        {
-            if (oAssembly == null)
-                throw new ArgumentNullException(nameof(oAssembly));
-
-            return Path.GetDirectoryName(new Uri(oAssembly.Location)?.LocalPath) + Path.DirectorySeparatorChar;
-        }
-        public static IEnumerable<Type> GetTypesWithAttribute<TAttribute>(this Assembly oAssembly, bool bInherit)where TAttribute : System.Attribute
-        {
-            var types = oAssembly.GetTypes();
-            return types.Where(x => x.IsDefined(typeof(TAttribute), bInherit)).ToArray();
-        }
-
-        #endregion
-        #region *** Private operations & overrides ***
-        #endregion
-
-
-    }
-}

+ 0 - 26
Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/AssemblyNameExt.cs

@@ -1,26 +0,0 @@
-using System.Reflection;
-using System.Text;
-
-namespace Quadarax.Foundation.Core.Reflection.Extensions
-{
-    public static class AssemblyNameExt
-    {
-        #region *** Private Fields ***
-		#endregion
-		
-		#region *** Public operations & overrides ***
-        public static string GetPublicKeyTokenString(this AssemblyName oOwner)
-        {            
-            var aPkToken = oOwner.GetPublicKeyToken();
-            if (aPkToken == null)
-                return string.Empty;
-            var oSb = new StringBuilder();
-            foreach (var nPk in aPkToken)
-                oSb.AppendFormat("{0:x2}", nPk);
-            return oSb.ToString();
-        }
-		#endregion
-		#region *** Private operations & overrides ***
-		#endregion        
-    }
-}

+ 0 - 38
Workbench/QMonitor/qmonlib/Dependencies/Reflection/Extensions/TypeExt.cs

@@ -1,38 +0,0 @@
-using System.Reflection;
-
-namespace Quadarax.Foundation.Core.Reflection.Extensions
-{
-    public static class TypeExt
-    {
-        public static IEnumerable<MethodInfo> GetMethodsWithAttribute<TAttribute>(this Type type, bool bInherit)where TAttribute : System.Attribute
-        {
-            var methods = type.GetMethods();
-            return methods.Where(x => x.IsDefined(typeof(TAttribute), bInherit)).ToArray();
-        }
-
-        public static IEnumerable<PropertyInfo> GetPropertiesWithAttribute<TAttribute>(this Type type, bool bInherit)where TAttribute : System.Attribute
-        {
-            var properties = type.GetProperties();
-            return properties.Where(x => x.IsDefined(typeof(TAttribute), bInherit)).ToArray();
-        }
-
-        public static IList<PropertyInfo> GetAllProperties(this Type? type)
-        {
-            if (type == null)
-                return new List<PropertyInfo>();
-
-            var propList = new List<PropertyInfo>(type.GetProperties(BindingFlags.Instance | BindingFlags.Public)); //type.GetTypeInfo().DeclaredProperties;
-            if (type.GetTypeInfo().BaseType != null)
-            {
-                var nestedProps = GetAllProperties(type.GetTypeInfo().BaseType);
-                foreach (var prop in nestedProps)
-                {
-                    if (propList.Any(x=>x.Name == prop.Name)) continue;
-                    propList.Add(prop);
-                }
-            }
-            return propList;
-        }
-
-    }
-}

+ 0 - 126
Workbench/QMonitor/qmonlib/Dependencies/Reflection/QualifiedName.cs

@@ -1,126 +0,0 @@
-using System.Reflection;
-using Quadarax.Foundation.Core.Reflection.Extensions;
-
-namespace Quadarax.Foundation.Core.Reflection
-{
-    public class QualifiedName
-    {
-        #region *** Constants ***
-        private const char CC_SEPARATOR = ',';
-        #endregion
-
-        #region *** Public Properties ***
-        // ReSharper disable MemberCanBePrivate.Global
-        // ReSharper disable UnusedAutoPropertyAccessor.Global
-        public string Name { get; private set; }
-        public string? Assembly { get; private set; }
-        public string? Culture { get; private set; }
-        public string Token { get; private set; }
-        public string Version { get; private set; }
-        public string AssemblyFullName { get; private set; }
-        // ReSharper restore UnusedAutoPropertyAccessor.Global
-        // ReSharper restore MemberCanBePrivate.Global
-        #endregion
-        #region *** Constructors ***
-        public QualifiedName(string sReflectionQualifiedName)
-        {
-            Name = string.Empty;
-            Token = string.Empty;
-            Version = string.Empty;
-            AssemblyFullName = string.Empty;
-            var aParts = sReflectionQualifiedName.Split(CC_SEPARATOR)
-                            .Select(x => x.Trim())
-                            .ToList();
-
-            if (aParts.Count==0)
-                return;
-            if (aParts.Count==1)
-            {
-                //jedna se o bud o codebase nebo assembly
-                bool bCodebase = false;
-                try
-                {
-                    var oType = Type.GetType(aParts[0].Trim(), true);
-                    if (oType == null)
-                        throw new Exception("Type is null");
-                    SetupProperties(oType.Assembly.GetName());
-                    bCodebase = true;
-                }
-                catch{}
-                if (bCodebase)
-                {
-                    //codebase
-                    Name = aParts[0].Trim();
-                }
-                else
-                {
-                    //assembly
-                    try
-                    {                        
-                        SetupProperties(new AssemblyName(aParts[0].Trim()));
-                    }
-                    catch (System.Exception e)
-                    {
-                        ThrowCannotParse(sReflectionQualifiedName, e);
-                    }
-                }
-
-            }
-            if (aParts.Count > 1)
-            {
-                //jedna se bud o codebase, assembly nebo assembly
-                try
-                {
-                    if (aParts[1].IndexOf('=') > 0)
-                    {
-                        //assembly
-                        SetupProperties(new AssemblyName(string.Join(CC_SEPARATOR.ToString() , aParts)));
-                    }
-                    else
-                    {
-                        //codebase, assembly
-                        SetupProperties(new AssemblyName(string.Join(CC_SEPARATOR.ToString(), aParts.Skip(1))));
-                        Name = aParts[0].Trim();
-                    }
-                }
-                catch (System.Exception e)
-                {
-                    ThrowCannotParse(sReflectionQualifiedName, e);
-                }                
-            }
-            
-
-            
-        }
-        #endregion
-        #region *** Public Operations ***
-        public string GetQualifiedNameWithoutVersion()
-        {
-            return Name + CC_SEPARATOR + " " + Assembly;
-        }
-
-        public bool LiteEquals(QualifiedName oCompareObject)
-        {
-            return oCompareObject.Assembly == Assembly && oCompareObject.Name == Name;
-        }
-        #endregion
-        #region *** Private Operations ***
-        private void SetupProperties(AssemblyName? oName)
-        {
-            if (oName == null)
-                throw new ArgumentNullException(nameof(oName));
-
-            Assembly = oName.Name;
-            AssemblyFullName = oName.FullName;
-            Culture = oName.CultureName;
-            Token = oName.GetPublicKeyTokenString();
-            Version = oName.Version!=null ? oName.Version.ToString() : string.Empty;            
-        
-        }
-        private void ThrowCannotParse(string sReflectionQualifiedName, System.Exception oInnerException)
-        {
-            throw new ArgumentException($"Cannot parse QualifiedName '{sReflectionQualifiedName}'!", oInnerException);
-        }
-        #endregion
-    }
-}

+ 0 - 54
Workbench/QMonitor/qmonlib/Dependencies/Reflection/TypeUtils.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace Quadarax.Foundation.Core.Reflection
-{
-    public static class TypeUtils
-    {
-
-        #region *** Private Fields ***
-        private static readonly IDictionary<string, Type?> m_oRemTypeCache = new Dictionary<string, Type?>();
-        // ReSharper disable InconsistentNaming
-        private static readonly object @lock;
-        // ReSharper restore InconsistentNaming
-        #endregion
-        #region *** Public Properties ***
-        #endregion
-        #region *** Constructors ***
-        static TypeUtils()
-        {
-            @lock = new object();
-        }
-        #endregion
-        #region *** Public operations & overrides ***
-        public static Type? GetRemoteType(string sReflectionQualifiedName)
-        {
-            if (m_oRemTypeCache.TryGetValue(sReflectionQualifiedName, out var type))
-                lock (@lock)
-                {
-                    return type;
-                }
-
-            var oName = new QualifiedName(sReflectionQualifiedName);
-            Type? oType;
-            if (oName.Assembly == null)
-            {
-                oType = Type.GetType(oName.Name, true);
-            }
-            else
-            {
-                var oAssembly = Assembly.Load(oName.Assembly);
-                oType = oAssembly.GetType(oName.Name, true);
-            }
-            lock (@lock)
-            {
-                m_oRemTypeCache.Add(sReflectionQualifiedName, oType);
-            }
-            return oType;
-        }
-        #endregion
-        #region *** Private operations & overrides ***
-        #endregion               
-    }
-}

+ 1 - 1
Workbench/QMonitor/qmonlib/Interfaces/IMonitored.cs

@@ -1,4 +1,4 @@
-namespace qmonlib.Interfaces
+namespace Quadarax.Foundation.Core.QMonitor.Interfaces
 {
     public interface IMonitored
     {

+ 1 - 1
Workbench/QMonitor/qmonlib/MonData.cs

@@ -1,6 +1,6 @@
 using System.Text.Json.Serialization;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public class MonData
     {

+ 1 - 1
Workbench/QMonitor/qmonlib/MonGeneral.cs

@@ -1,6 +1,6 @@
 using System.Text.Json.Serialization;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     [Serializable]
     public class MonGeneral

+ 1 - 1
Workbench/QMonitor/qmonlib/MonItemGeneral.cs

@@ -1,7 +1,7 @@
 using System.Reflection;
 using System.Text.Json.Serialization;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     [Serializable]
     public class MonItemGeneral

+ 1 - 1
Workbench/QMonitor/qmonlib/MonReceiverGeneralCahedItem.cs

@@ -1,6 +1,6 @@
 using System.Net;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public class MonReceiverGeneralCahedItem
     {

+ 9 - 9
Workbench/QMonitor/qmonlib/QMonClient.cs

@@ -4,11 +4,11 @@ using System.Net;
 using System.Net.Sockets;
 using System.Reflection;
 using System.Text;
-using qmonlib.Attributes;
 using Quadarax.Foundation.Core.Logging;
+using Quadarax.Foundation.Core.QMonitor.Attributes;
 using Quadarax.Foundation.Core.Reflection.Extensions;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public class QMonClient : QMonHostBase<QMonClientConfiuration>
     {
@@ -50,7 +50,7 @@ namespace qmonlib
                     };
 
                     var properties = type.GetPropertiesWithAttribute<MonitoredPropertyAttribute>(true);
-                    var keys = new List<Tuple<string,int>>();
+                    var keys = new List<Tuple<string, int>>();
 
                     foreach (var property in properties)
                     {
@@ -73,7 +73,7 @@ namespace qmonlib
                     foreach (var key in keys.OrderBy(x => x.Item2))
                     {
                         var ord = monItemGeneral.Items.FindIndex(x => x.Name == key.Item1);
-                        if (ord>=0)
+                        if (ord >= 0)
                             monItemGeneral.KeyOrdinals.Add(ord);
                     }
                     _generalCache.Add(type.FullName!, monItemGeneral);
@@ -89,7 +89,7 @@ namespace qmonlib
             if (monitoredItem == null) return;
             var fullName = monitoredItem.GetType().FullName;
             if (fullName != null && !_generalCache.ContainsKey(fullName)) throw new NotSupportedException($"Type {monitoredItem.GetType().FullName} is not flagged by MonitoredClassAttribute as monitored");
-            
+
             var data = new MonData()
             {
                 InstanceIdentifier = InstanceIdentifier,
@@ -128,9 +128,9 @@ namespace qmonlib
                     _dataCache.Remove(data);
                     itmCnt++;
                 }
-                Log(LogSeverityEnum.Trace, $"[{InstanceIdentifier}] Sent data blocks = {itmCnt} of delared {declaredSize} bytes/sent {sentSize} bytes @ {(DateTime.Now.Subtract(start).TotalMilliseconds)} ms.");
+                Log(LogSeverityEnum.Trace, $"[{InstanceIdentifier}] Sent data blocks = {itmCnt} of delared {declaredSize} bytes/sent {sentSize} bytes @ {DateTime.Now.Subtract(start).TotalMilliseconds} ms.");
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 Log(LogSeverityEnum.Error, $"[{InstanceIdentifier}] Error sending general data", ex);
             }
@@ -142,7 +142,7 @@ namespace qmonlib
             var owner = (QMonClient)state;
             try
             {
-              
+
                 var data = new MonGeneral()
                 {
                     InstanceIdentifier = owner.InstanceIdentifier,
@@ -153,7 +153,7 @@ namespace qmonlib
                 UdpClientGeneral.Send(dataOut);
                 Log(LogSeverityEnum.Trace, $"[{InstanceIdentifier}] Sent General packet size = {dataOut.Length} bytes");
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 Log(LogSeverityEnum.Error, $"[{InstanceIdentifier}] Error sending general data", ex);
             }

+ 1 - 1
Workbench/QMonitor/qmonlib/QMonClientConfiuration.cs

@@ -1,4 +1,4 @@
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public class QMonClientConfiuration : QMonHostConfiguration
     {

+ 7 - 7
Workbench/QMonitor/qmonlib/QMonHostBase.cs

@@ -4,9 +4,9 @@ using System.Net.Sockets;
 using Quadarax.Foundation.Core.Logging;
 using Quadarax.Foundation.Core.Object;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
-    public abstract class QMonHostBase<TConfiguration> : DisposableObject 
+    public abstract class QMonHostBase<TConfiguration> : DisposableObject
         where TConfiguration : QMonHostConfiguration
     {
 
@@ -26,7 +26,7 @@ namespace qmonlib
         protected TConfiguration Configuration { get; }
         protected abstract Uri UriGeneral { get; }
         protected abstract Uri UriData { get; }
-        protected abstract TimeSpan IntervalGeneral {get; }
+        protected abstract TimeSpan IntervalGeneral { get; }
         protected abstract TimeSpan? IntervalData { get; }
 
         protected UdpClient UdpClientGeneral => _udpClientGeneral ?? throw new InvalidOperationException("UDP client channel General not open.");
@@ -36,7 +36,7 @@ namespace qmonlib
             get => _isEnabled;
             set => SetEnabled(value);
         }
-        protected Quadarax.Foundation.Core.Json.Binder Binder { get; } = new Quadarax.Foundation.Core.Json.Binder(new FileSystem(),false,true,100);
+        protected Json.Binder Binder { get; } = new Json.Binder(new FileSystem(), false, true, 100);
 
         #endregion
 
@@ -60,7 +60,7 @@ namespace qmonlib
 
             _udpClientGeneral = CreateUdpClient(UriGeneral);
             _udpClientData = CreateUdpClient(UriData);
-            
+
             _timerGeneral = new Timer(OnTimerGeneral, this, IntervalGeneral, IntervalGeneral);
             Log(LogSeverityEnum.Debug, $"General timer started with interval '{IntervalGeneral}'");
             if (IntervalData.HasValue)
@@ -74,7 +74,7 @@ namespace qmonlib
         protected void Close()
         {
             if (!_isEnabled) return;
-         
+
             if (_udpClientGeneral != null)
             {
                 _timerGeneral?.Dispose();
@@ -102,7 +102,7 @@ namespace qmonlib
         #endregion
 
         protected void SetEnabled(bool value)
-        {  
+        {
             if (value == _isEnabled)
                 return;
             _isEnabled = value;

+ 1 - 1
Workbench/QMonitor/qmonlib/QMonHostConfiguration.cs

@@ -1,4 +1,4 @@
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public abstract class QMonHostConfiguration
     {

+ 14 - 14
Workbench/QMonitor/qmonlib/QMonReceiver.cs

@@ -7,18 +7,18 @@ using System.Text.Json;
 using System.Text.Json.Serialization;
 using Quadarax.Foundation.Core.Logging;
 
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public delegate void GeneralDataReceivedDelegate(MonGeneral general);
     public delegate void DataReceivedDelegate(MonData[] data);
-    public class QMonReceiver : QMonHostBase<QMonReceiverConfiguration> 
+    public class QMonReceiver : QMonHostBase<QMonReceiverConfiguration>
     {
         #region *** Properties ***
         protected override Uri UriGeneral => Configuration.SourceUriGeneral;
         protected override Uri UriData => Configuration.SourceUriData;
         protected override TimeSpan IntervalGeneral => Configuration.GeneralReceiverInterval;
         protected override TimeSpan? IntervalData => Configuration.DataCache.FlushCacheInterval;
-        public MonGeneral[] AvailableGeneral => _generalCache.Values.Select(x=>x.Data).ToArray();
+        public MonGeneral[] AvailableGeneral => _generalCache.Values.Select(x => x.Data).ToArray();
         #endregion
         #region *** Fields ***
         private GeneralDataReceivedDelegate _generalReceivedCallback;
@@ -52,19 +52,19 @@ namespace qmonlib
             if (!_fileSystem.Directory.Exists(Configuration.DataCache.Path))
             {
                 _fileSystem.Directory.CreateDirectory(Configuration.DataCache.Path);
-                Log(LogSeverityEnum.Debug,$"Data receiver created data cache directory '{Configuration.DataCache.Path}'");
+                Log(LogSeverityEnum.Debug, $"Data receiver created data cache directory '{Configuration.DataCache.Path}'");
 
             }
         }
         #endregion
-        
+
 
         #region *** Private overrides ***
 
         protected override void OnOpen()
         {
             var _dataReceiverCancel = new CancellationTokenSource();
-            new Thread(() =>
+            new System.Threading.Thread(() =>
             {
                 try
                 {
@@ -99,10 +99,10 @@ namespace qmonlib
                 if (!_fileSystem.Directory.Exists(dirName))
                 {
                     _fileSystem.Directory.CreateDirectory(dirName);
-                    Log(LogSeverityEnum.Debug,$"Data receiver created data cache directory '{dirName}'");
+                    Log(LogSeverityEnum.Debug, $"Data receiver created data cache directory '{dirName}'");
                 }
 
-                var batchData = itemsToSave.Where(x => x.InstanceIdentifier == instance).OrderBy(x=>x.Timestamp).ToArray();
+                var batchData = itemsToSave.Where(x => x.InstanceIdentifier == instance).OrderBy(x => x.Timestamp).ToArray();
                 _dataReceivedCallback?.Invoke(batchData);
 
                 var dfrom = batchData.Min(x => x.Timestamp).ToFileTimeUtc();
@@ -117,7 +117,7 @@ namespace qmonlib
                 }
                 Log(LogSeverityEnum.Trace, $"Data receiver created dump data file '{fileName}'");
             }
-            
+
             foreach (var item in itemsToSave)
                 _dataCache.Remove(item);
         }
@@ -132,7 +132,7 @@ namespace qmonlib
             {
                 var remoteEndPoint = new IPEndPoint(IPAddress.Parse(owner.UriGeneral.DnsSafeHost), owner.UriGeneral.Port);
                 var data = UdpClientGeneral.Receive(ref remoteEndPoint);
-                var general = (MonGeneral) Binder.LoadFromString(Encoding.UTF8.GetString(data), typeof(MonGeneral));
+                var general = (MonGeneral)Binder.LoadFromString(Encoding.UTF8.GetString(data), typeof(MonGeneral));
                 Log(LogSeverityEnum.Debug,
                     $"[ReceiverGeneral] receive general data from '{remoteEndPoint}' [{general.InstanceIdentifier}] size={data.Length} bytes.");
 
@@ -160,8 +160,8 @@ namespace qmonlib
             }
             try
             {
-                if (UdpClientData.Available==0) return;
-                var remoteEndPoint = new IPEndPoint(IPAddress.Parse(this.UriData.DnsSafeHost), this.UriData.Port);
+                if (UdpClientData.Available == 0) return;
+                var remoteEndPoint = new IPEndPoint(IPAddress.Parse(UriData.DnsSafeHost), UriData.Port);
                 Log(LogSeverityEnum.Debug, $"[ReceiverData] Waiting for data on '{UriData}'...");
                 var data = UdpClientData.Receive(ref remoteEndPoint);
                 var monData = JsonSerializer.Deserialize<MonData>(data, _jsonSerializerOptions);
@@ -193,9 +193,9 @@ namespace qmonlib
             base.OnDisposing();
         }
 
-        
+
         #endregion
 
-        
+
     }
 }

+ 6 - 6
Workbench/QMonitor/qmonlib/QMonReceiverConfiuration.cs

@@ -1,4 +1,4 @@
-namespace qmonlib
+namespace Quadarax.Foundation.Core.QMonitor
 {
     public class QMonReceiverConfiguration : QMonHostConfiguration
     {
@@ -14,15 +14,15 @@ namespace qmonlib
             return new QMonReceiverConfiguration()
             {
                 Enabled = true,
-                SourceUriGeneral = new Uri("udp://0.0.0.0:5100"),
-                SourceUriData = new Uri("udp://0.0.0.0:5101"),
+                SourceUriGeneral = new Uri(Constants.DefaultUriGeneral),
+                SourceUriData = new Uri(Constants.DefaultUriData),
                 GeneralReceiverInterval = TimeSpan.FromSeconds(5),
                 DataCache = new DataCacheConfiguration()
                 {
-					Path = "%AppData%\\.qmon",
-					RecordRetentionTimeSpan = TimeSpan.FromHours(5),
+                    Path = "%AppData%\\.qmon",
+                    RecordRetentionTimeSpan = TimeSpan.FromHours(5),
                     FlushCacheInterval = TimeSpan.FromSeconds(5)
-				}
+                }
             };
         }
 

+ 4 - 1
Workbench/QMonitor/qmonlib/qmonlib.csproj

@@ -2,12 +2,15 @@
 
   <PropertyGroup>
     <OutputType>Library</OutputType>
-    <TargetFramework>net6.0</TargetFramework>
+    <TargetFramework>net7.0</TargetFramework>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
+    <RootNamespace>Quadarax.Foundation.Core.QMonitor</RootNamespace>
+    <AssemblyName>qdr.fnd.core.qmonlib</AssemblyName>
   </PropertyGroup>
 
   <ItemGroup>
+    <PackageReference Include="qdr.fnd.core" Version="0.0.1-alpha" />
     <PackageReference Include="System.IO.Abstractions" Version="19.2.69" />
   </ItemGroup>