diff --git a/AppBroker.Core/AppBroker.Core.csproj b/AppBroker.Core/AppBroker.Core.csproj index 7db5d6d..bc94d74 100644 --- a/AppBroker.Core/AppBroker.Core.csproj +++ b/AppBroker.Core/AppBroker.Core.csproj @@ -7,29 +7,14 @@ True preview False - - + - - - - - diff --git a/AppBroker.Core/Devices/Device.cs b/AppBroker.Core/Devices/Device.cs index 8edaa27..6332501 100644 --- a/AppBroker.Core/Devices/Device.cs +++ b/AppBroker.Core/Devices/Device.cs @@ -1,15 +1,15 @@ -using AppBroker.Core.DynamicUI; +using CommunityToolkit.Mvvm.ComponentModel; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; namespace AppBroker.Core.Devices; -public abstract class ConnectionDevice : Device +public abstract partial class ConnectionDevice : Device { + [ObservableProperty] + private bool isConnected; - public abstract bool IsConnected { get; set; } protected ConnectionDevice(long nodeId) : base(nodeId) { IsConnected = true; @@ -18,21 +18,25 @@ protected ConnectionDevice(long nodeId) : base(nodeId) public override void Reconnect(ByteLengthList parameter) => IsConnected = true; } -public abstract class Device +public abstract partial class Device : ObservableObject { public IReadOnlyCollection TypeNames { get; } [JsonIgnore] public List Subscribers { get; } = new List(); - public abstract long Id { get; set; } + [ObservableProperty] + private long id; - public abstract string TypeName { get; set; } + [ObservableProperty] + private string typeName; [JsonIgnore] - public abstract bool ShowInApp { get; set; } + [ObservableProperty] + private bool showInApp; - public abstract string FriendlyName { get; set; } + [ObservableProperty] + private string friendlyName; [JsonIgnore] public bool Initialized { get; set; } @@ -77,6 +81,6 @@ public void SendDataToAllSubscribers() sendLastDataTimer.Change(250, Timeout.Infinite); } - public virtual void StopDevice() {} + public virtual void StopDevice() { } public virtual void Reconnect(ByteLengthList parameter) { } } \ No newline at end of file diff --git a/AppBroker.Core/Devices/WorkflowDevice.cs b/AppBroker.Core/Devices/WorkflowDevice.cs index da8c24c..ec427f8 100644 --- a/AppBroker.Core/Devices/WorkflowDevice.cs +++ b/AppBroker.Core/Devices/WorkflowDevice.cs @@ -11,32 +11,15 @@ namespace AppBroker.Core.Devices; -[ClassPropertyChangedAppbroker] [RequiresPreviewFeatures] public abstract partial class WorkflowDevice : ConnectionDevice where TPropertySignaler : IWorkflowPropertySignaler where TDeviceSignaler : IWorkflowDeviceSignaler { - [AddOverride] - private long id; - [AddOverride] - private string typeName; - [AddOverride] - private bool showInApp; - [AddOverride] - private string friendlyName; - [AddOverride] - private bool isConnected; - public WorkflowDevice(long nodeId) : base(nodeId) { - Initialized = false; - id = nodeId; - typeName = GetType().Name; - isConnected = true; Logger = NLog.LogManager.GetCurrentClassLogger(); Logger = Logger.WithProperty(nameof(Id), Id); - friendlyName = ""; } protected virtual void OnPropertyChanging(ref T field, T value, [CallerMemberName] string? propertyName = "") diff --git a/AppBroker.Generators.Test/AppBroker.Generators.Test.csproj b/AppBroker.Generators.Test/AppBroker.Generators.Test.csproj deleted file mode 100644 index 7ec66f6..0000000 --- a/AppBroker.Generators.Test/AppBroker.Generators.Test.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - net6.0 - enable - - false - - - - preview - - - - preview - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - diff --git a/AppBroker.Generators.Test/GeneratorStartTest.cs b/AppBroker.Generators.Test/GeneratorStartTest.cs deleted file mode 100644 index 0bf0b19..0000000 --- a/AppBroker.Generators.Test/GeneratorStartTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -using NUnit.Framework; - -using System.Collections.Generic; -using System.ComponentModel; -using System.Reflection; -using System; -using System.Linq; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using System.IO; -using AppBroker.Core.Devices; - -namespace AppBroker.Generators.Test; - -[Explicit] -public class Tests -{ - public static Dictionary GetGeneratedOutput(IDictionary sources, bool failOnInvalidSource = false, bool failOnDiagnostigs = true) - where TGenerator : ISourceGenerator, new() - => GetGeneratedOutput(sources, () => new TGenerator(), failOnInvalidSource, failOnDiagnostigs); - - public static CSharpCompilation Compile(IDictionary sources) - => CSharpCompilation.Create( - "test", - sources.Select(x => CSharpSyntaxTree.ParseText(x.Value, path: x.Key)), - new[] - { - MetadataReference.CreateFromFile(typeof(Binder).GetTypeInfo().Assembly.Location), - MetadataReference.CreateFromFile(typeof(INotifyPropertyChanged).GetTypeInfo().Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Text.Json.Serialization.JsonIgnoreAttribute).GetTypeInfo().Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.ComponentModel.DescriptionAttribute).GetTypeInfo().Assembly.Location), - }, - new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); - - public static Dictionary GetGeneratedOutput(IDictionary sources, Func makeGenerator, bool failOnInvalidSource = false, bool failOnDiagnostigs = true) - { - var compilation = Compile(sources); - - if (failOnInvalidSource) - { - FailIfError(compilation.GetDiagnostics()); - } - - var generator = makeGenerator(); - - var driver = CSharpGeneratorDriver.Create(generator); - _ = driver.RunGeneratorsAndUpdateCompilation(compilation, out var outputCompilation, out var generateDiagnostics); - var output = outputCompilation.SyntaxTrees.ToDictionary(tree => tree.FilePath, tree => tree.ToString()); - - if (failOnDiagnostigs) - { - FailIfError(generateDiagnostics); - } - - return output; - } - - private static void FailIfError(IEnumerable diag) - { - var errors = diag.Where(d => d.Severity == DiagnosticSeverity.Error); - var msg = "Failed: " + errors.FirstOrDefault()?.GetMessage(); - Assert.That(errors, Is.Empty, msg); - } - - //private AdhocWorkspace Workspace; - - [SetUp] - public void Setup() - { - //Workspace = new(); - } - - [Test, Explicit] - public void DebugGenerator() - { - var input = File.ReadAllText(@"C:\Users\susch\source\repos\AppBroker\TestGenerator\PropChanged.cs"); - var sources = new Dictionary() - { - { "test.cs", input } - }; - _ = GetGeneratedOutput(sources, failOnInvalidSource: false, failOnDiagnostigs: false); - } -} diff --git a/AppBroker.Generators/AppBroker.Generators.csproj b/AppBroker.Generators/AppBroker.Generators.csproj deleted file mode 100644 index 9f4da28..0000000 --- a/AppBroker.Generators/AppBroker.Generators.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - netstandard2.0 - 10.0 - - - false - - - - - preview - - - - preview - - - - - - - - - - - - - - - - - - - - - diff --git a/AppBroker.Generators/NotifyPropertyChangedGenerator.cs b/AppBroker.Generators/NotifyPropertyChangedGenerator.cs deleted file mode 100644 index 4ba385b..0000000 --- a/AppBroker.Generators/NotifyPropertyChangedGenerator.cs +++ /dev/null @@ -1,409 +0,0 @@ -using Microsoft.CodeAnalysis.Text; -using Microsoft.CodeAnalysis; -using System.Text; -using Microsoft.CodeAnalysis.CSharp.Syntax; - -namespace AppBroker.Generators -{ - [Generator] - public class NotifyPropertyChangedGenerator : ISourceGenerator - { - private const string ignoreFieldAttribute = @" -using System; -namespace AppBroker -{ - [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] - [System.Diagnostics.Conditional(""NotifyPropertyChangedGenerator_DEBUG"")] - internal sealed class IgnoreFieldAttribute : Attribute - { - public IgnoreFieldAttribute() - { - } - } -} -"; - - - private const string addOverrideAttribute = @" -using System; -namespace AppBroker -{ - [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] - [System.Diagnostics.Conditional(""NotifyPropertyChangedGenerator_DEBUG"")] - internal sealed class AddOverrideAttribute : Attribute - { - public AddOverrideAttribute() - { - } - } -} -"; - - private const string ignoreChangedFieldAttribute = @" -using System; -namespace AppBroker -{ - [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] - [System.Diagnostics.Conditional(""NotifyPropertyChangedGenerator_DEBUG"")] - internal sealed class IgnoreChangedFieldAttribute : Attribute - { - public IgnoreChangedFieldAttribute() - { - } - } -} -"; - - private const string propertyChangedFieldAttribute = @" -using System; -namespace AppBroker -{ - [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)] - [System.Diagnostics.Conditional(""NotifyPropertyChangedGenerator_DEBUG"")] - internal sealed class PropertyChangedAppbrokerAttribute : Attribute - { - public PropertyChangedAppbrokerAttribute() - { - } - - - public string? PropertyName { get; set; } - } -} -"; - private const string classAttribute = @" -using System; -namespace AppBroker -{ - - [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] - [System.Diagnostics.Conditional(""ImplementNotifyPropertyChangedGenerator_DEBUG"")] - internal sealed class ClassPropertyChangedAppbrokerAttribute : Attribute - { - public ClassPropertyChangedAppbrokerAttribute(Type? typeName, bool callPropertyChanging = true, bool callPropertyChanged = false) : this(callPropertyChanging, callPropertyChanged) - { - TypeName = typeName; - } - public ClassPropertyChangedAppbrokerAttribute(bool callPropertyChanging = true, bool callPropertyChanged = false) - { - CallPropertyChanged = callPropertyChanged; - CallPropertyChanging = callPropertyChanging; - } - public bool CallPropertyChanged { get; } - public bool CallPropertyChanging { get; } - public Type? TypeName { get; } - } -} -"; - - public NotifyPropertyChangedGenerator() - { - } - - public void Initialize(GeneratorInitializationContext context) - { - // Register the attribute source - context.RegisterForPostInitialization((i) => - { - i.AddSource("IgnoreChangedFieldAttribute", ignoreChangedFieldAttribute); - i.AddSource("ClassPropertyChangedAppbrokerAttribute", classAttribute); - i.AddSource("PropertyChangedAppbrokerAttribute", propertyChangedFieldAttribute); - i.AddSource("IgnoreFieldAttribute", ignoreFieldAttribute); - i.AddSource("AddOverrideAttribute", addOverrideAttribute); - }); - - // Register a syntax receiver that will be created for each generation pass - context.RegisterForSyntaxNotifications(() => new SyntaxReceiver()); - } - - public void Execute(GeneratorExecutionContext context) - { - // retrieve the populated receiver - if (context.SyntaxContextReceiver is not SyntaxReceiver receiver) - return; - - //Debugger.Launch(); - - // get the added attribute, and INotifyPropertyChanged - INamedTypeSymbol attributeSymbol = context.Compilation.GetTypeByMetadataName("AppBroker.PropertyChangedAppbrokerAttribute"); - INamedTypeSymbol ignoreChangedFieldSymbol = context.Compilation.GetTypeByMetadataName("AppBroker.IgnoreChangedFieldAttribute"); - INamedTypeSymbol ignoreFieldSymbol = context.Compilation.GetTypeByMetadataName("AppBroker.IgnoreFieldAttribute"); - INamedTypeSymbol overrideFieldSymbol = context.Compilation.GetTypeByMetadataName("AppBroker.AddOverrideAttribute"); - - foreach (var group in receiver.Classes) - { - string classSource = ProcessClass(group.Key as INamedTypeSymbol, group.Value, attributeSymbol, ignoreChangedFieldSymbol, ignoreFieldSymbol, overrideFieldSymbol, context); - context.AddSource($"{group.Key.Name}.Appbroker.cs", SourceText.From(classSource, Encoding.UTF8)); - } - } - - private bool BaseClassAlreadyHasAttribute(INamedTypeSymbol parent, string attributeName) - { - if (parent.BaseType == null) - return false; - var attr = parent.BaseType.GetAttributes(); - - return attr.Any(x => $"{x.AttributeClass.ContainingNamespace}.{x.AttributeClass.Name}" == attributeName) || BaseClassAlreadyHasAttribute(parent.BaseType, attributeName); - } - - private string ProcessClass(INamedTypeSymbol classSymbol, SyntaxReceiver.ClassThingy thingy, INamedTypeSymbol attributeSymbol, INamedTypeSymbol ignoreAttributeSymbol, INamedTypeSymbol ignoreFieldSymbol, INamedTypeSymbol overrideFieldSymbol, GeneratorExecutionContext context) - { - if (!classSymbol.ContainingSymbol.Equals(classSymbol.ContainingNamespace, SymbolEqualityComparer.Default)) - { - return null; //TODO: issue a diagnostic that it must be top level - } - - string namespaceName = classSymbol.ContainingNamespace.ToDisplayString(); - - var alreadyContainsMethod = BaseClassAlreadyHasAttribute(classSymbol, "AppBroker.ClassPropertyChangedAppbrokerAttribute"); - string additional = ""; - if (classSymbol.IsGenericType) - additional = $"<{string.Join(",", classSymbol.TypeParameters.Select(x => x.Name))}>"; - - // begin building the generated source - StringBuilder source = new($@" -using System.Runtime.CompilerServices; -namespace {namespaceName} -{{ - partial class {classSymbol.Name}{additional}"); - - // if the class doesn't implement INotifyPropertyChanged already, add it - - _ = source.Append($@" - {{ -{(alreadyContainsMethod ? "" : $@" - protected T RaiseAndSetIfChanged(ref T field, T value, [CallerMemberName] string? propertyName = null) - {{ - if (System.Collections.Generic.EqualityComparer.Default.Equals(field, value)) - return value; - {(thingy.CallPropertyChanging ? "OnPropertyChanging(ref field, value, propertyName);" : "")} - field = value; - {(thingy.CallPropertyChanged ? "OnPropertyChanged(propertyName);" : "")} - return value; - }} -")} - "); - - // create properties for each field - foreach (IFieldSymbol fieldSymbol in thingy.Fields) - { - _ = thingy.AdditionalAttributesForGeneratedProp.TryGetValue(fieldSymbol, out var additionalAttributes); - - ProcessField(source, fieldSymbol, attributeSymbol, ignoreAttributeSymbol, ignoreFieldSymbol, overrideFieldSymbol, additionalAttributes, context); - } - - _ = source.Append(" }\n}"); - return source.ToString(); - } - - private void ProcessField(StringBuilder source, IFieldSymbol fieldSymbol, ISymbol attributeSymbol, INamedTypeSymbol ignoreAttributeSymbol, INamedTypeSymbol ignoreFieldSymbol, INamedTypeSymbol overrideFieldSymbol, List additionalAttributes, GeneratorExecutionContext context) - { - // get the name and type of the field - string fieldName = fieldSymbol.Name; - ITypeSymbol fieldType = fieldSymbol.Type; - - // get the AutoNotify attribute from the field, and any associated data - var fieldAttrs = fieldSymbol.GetAttributes(); - - var ignore = fieldAttrs.Any(ad => ad.AttributeClass.Equals(ignoreFieldSymbol, SymbolEqualityComparer.Default)); - if (ignore == true) - return; - ignore = fieldAttrs.Any(ad => ad.AttributeClass.Equals(ignoreAttributeSymbol, SymbolEqualityComparer.Default)); - - AttributeData attributeData = fieldAttrs.FirstOrDefault(ad => ad.AttributeClass.Equals(attributeSymbol, SymbolEqualityComparer.Default)); - TypedConstant? overridenNameOpt = attributeData?.NamedArguments.SingleOrDefault(kvp => kvp.Key == "PropertyName").Value; - - string propertyName = chooseName(fieldName, overridenNameOpt); - if (propertyName.Length == 0 || propertyName == fieldName) - { - //TODO: issue a diagnostic that we can't process this field - return; - - // NoosonGenerator.MakeDiagnostic("0005", - //"", - //"IEnumerable is not supported for deserialization, implement own deserializer or this value will be lost.", - //property.Symbol, - //DiagnosticSeverity.Error - //); - } - - if (additionalAttributes != null && additionalAttributes.Count > 0) - { - foreach (var additionalAttribute in additionalAttributes) - { - var mod = context.Compilation.GetSemanticModel(additionalAttribute.SyntaxTree); - foreach (var addAttr in additionalAttribute.Attributes) - { - var symb = mod.GetSymbolInfo(addAttr); - var candidate = symb.Symbol ?? symb.CandidateSymbols.FirstOrDefault(); - if (candidate == null) - { - context.ReportDiagnostic( - Diagnostic.Create( - "AB0234", - "Generator", - $"The type or namespace name '{addAttr.Name}' does not exist.' (did you use a the wrong namespace while declaring the fullname of the property attribute?)", - DiagnosticSeverity.Error, - DiagnosticSeverity.Error, - true, - 0, - location: Location.Create(addAttr.SyntaxTree, addAttr.Span))); - _ = source.AppendLine($" [{addAttr.ToFullString()}]"); - } - else - { - _ = source.AppendLine($" [{candidate.ContainingType.ToDisplayString()}{addAttr.ArgumentList.ToFullString()}]"); - } - } - } - } - - var @override = fieldAttrs.Any(ad => ad.AttributeClass.Equals(overrideFieldSymbol, SymbolEqualityComparer.Default)); - - _ = source.Append($@" - public {(@override ? "override " : "")}{fieldType} {propertyName} - {{ - get => this.{fieldName}; - set => {(ignore ? $"this.{fieldName} = value;" : $"this.RaiseAndSetIfChanged(ref {fieldName}, value);")} - }} -"); - - string chooseName(string fieldName, TypedConstant? overridenNameOpt) - { - if (overridenNameOpt is not null && !overridenNameOpt.Value.IsNull) - { - return overridenNameOpt.Value.Value.ToString(); - } - - fieldName = fieldName.TrimStart('_'); - if (fieldName.Length == 0) - return string.Empty; - - return fieldName.Length == 1 ? fieldName.ToUpper() : fieldName.Substring(0, 1).ToUpper() + fieldName.Substring(1); - } - } - - /// - /// Created on demand before each generation pass - /// - class SyntaxReceiver : ISyntaxContextReceiver - { - public class ClassThingy - { - public ClassThingy(ISymbol classSymbol) - { - ClassSymbol = classSymbol; - } - public ISymbol ClassSymbol { get; } - public bool CallPropertyChanged { get; set; } - public bool CallPropertyChanging { get; set; } - - public List Fields { get; } = new List(); - - public Dictionary> AdditionalAttributesForGeneratedProp = new(); - - } - public Dictionary Classes { get; } = new(); - /// - /// Called for every syntax node in the compilation, we can inspect the nodes and save any information useful for generation - /// - public void OnVisitSyntaxNode(GeneratorSyntaxContext context) - { - // any field with at least one attribute is a candidate for property generation - if (context.Node is FieldDeclarationSyntax fieldDeclarationSyntax - && fieldDeclarationSyntax.AttributeLists.Count > 0) - { - foreach (VariableDeclaratorSyntax variable in fieldDeclarationSyntax.Declaration.Variables) - { - // Get the symbol being declared by the field, and keep it if its annotated - var fieldSymbol = context.SemanticModel.GetDeclaredSymbol(variable) as IFieldSymbol; - if (fieldSymbol.GetAttributes().Any(ad => ad.AttributeClass.ToDisplayString() == "AppBroker.PropertyChangedAppbrokerAttribute")) - { - var symbol = fieldSymbol.ContainingType as ISymbol; - if (!Classes.TryGetValue(symbol, out var thingy)) - Classes[symbol] = thingy = new ClassThingy(symbol); - - if (thingy.Fields.Contains(fieldSymbol)) - continue; - thingy.Fields.Add(fieldSymbol); - } - } - } - else if (context.Node is ClassDeclarationSyntax classDeclarationSyntax - && classDeclarationSyntax.AttributeLists.Count > 0) - { - var symbol = context.SemanticModel.GetDeclaredSymbol(classDeclarationSyntax); - var symbolAttr = symbol.GetAttributes().FirstOrDefault(ad => ad.AttributeClass.ToDisplayString() == "AppBroker.ClassPropertyChangedAppbrokerAttribute"); - if (symbolAttr is not null) - { - if (!Classes.TryGetValue(symbol, out var thingy)) - Classes[symbol] = thingy = new ClassThingy(symbol); - - ClassDeclarationSyntax tmp; - - if (symbolAttr.ConstructorArguments.Length == 2) - { - tmp = classDeclarationSyntax; - } - else - { - var typeToGenerateFor = symbolAttr.ConstructorArguments.FirstOrDefault().Value as ITypeSymbol; - tmp = (ClassDeclarationSyntax)typeToGenerateFor.DeclaringSyntaxReferences.First().GetSyntax(); - } - - for (int i = 0; i < symbolAttr.AttributeConstructor.Parameters.Length; i++) - { - IParameterSymbol item = symbolAttr.AttributeConstructor.Parameters[i]; - var parameterValue = symbolAttr.ConstructorArguments[i].Value; - - switch (item.Name) - { - case "callPropertyChanged": - thingy.CallPropertyChanged = (bool)parameterValue; - break; - case "callPropertyChanging": - thingy.CallPropertyChanging = (bool)parameterValue; - break; - default: - break; - } - } - - var symbol2 = context.SemanticModel.GetDeclaredSymbol(tmp) as INamedTypeSymbol; - var allMembers = symbol2.GetMembers(); - foreach (var p in allMembers) - { - if (p is IFieldSymbol fieldSymbol && !thingy.Fields.Contains(fieldSymbol)) - { - thingy.Fields.Add(fieldSymbol); - - var declaringSyntax - = fieldSymbol - .DeclaringSyntaxReferences - .FirstOrDefault(); - - if (declaringSyntax == default) - continue; - - var attribuesForProp - = declaringSyntax - .GetSyntax() - .Parent - .Parent - .ChildNodes() - .OfType() - .Where(x => x.Target?.Identifier.Text == "property") - .ToList(); - - if (attribuesForProp.Count == 0) - continue; - - thingy.AdditionalAttributesForGeneratedProp[fieldSymbol] = attribuesForProp; - } - } - } - } - } - } - } -} diff --git a/AppBroker.Generators/Properties/launchSettings.json b/AppBroker.Generators/Properties/launchSettings.json deleted file mode 100644 index 695d9a6..0000000 --- a/AppBroker.Generators/Properties/launchSettings.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "profiles": { - "AppBrokerManual": { - "commandName": "Executable", - "executablePath": "C:\\Programme\\Microsoft Visual Studio\\2022\\Preview\\MSBuild\\Current\\Bin\\Roslyn\\csc.exe", - "commandLineArgs": "@\"C:\\Users\\susch\\source\\repos\\AppBroker\\AppBroker.Generators\\Properties\\AppBrokerManual.rsp\"", - "workingDirectory": "C:\\Users\\susch\\source\\repos\\AppBroker\\AppBrokerASP" - }, - "TestManual": { - "commandName": "Executable", - "executablePath": "C:\\Programme\\Microsoft Visual Studio\\2022\\Preview\\MSBuild\\Current\\Bin\\Roslyn\\csc.exe", - "commandLineArgs": "@\"C:\\Users\\susch\\source\\repos\\AppBroker\\AppBroker.Generators\\Properties\\TestGenerator.rsp\"", - "workingDirectory": "C:\\Users\\susch\\source\\repos\\AppBroker\\TestGenerator" - }, - "AppBroker": { - "commandName": "DebugRoslynComponent", - "targetProject": "C:\\Users\\susch\\source\\repos\\AppBroker\\AppBrokerASP\\AppBrokerASP.csproj" - } - } -} \ No newline at end of file diff --git a/AppBroker.PainlessMesh.Elsa/AppBroker.PainlessMesh.Elsa.csproj b/AppBroker.PainlessMesh.Elsa/AppBroker.PainlessMesh.Elsa.csproj index 7e78e82..4bd80cc 100644 --- a/AppBroker.PainlessMesh.Elsa/AppBroker.PainlessMesh.Elsa.csproj +++ b/AppBroker.PainlessMesh.Elsa/AppBroker.PainlessMesh.Elsa.csproj @@ -5,18 +5,11 @@ enable enable True - - - - preview - - - - preview + preview - + diff --git a/AppBroker.sln b/AppBroker.sln index ae2b862..b9b2fc7 100644 --- a/AppBroker.sln +++ b/AppBroker.sln @@ -9,19 +9,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TranslateTTMToHumanReadable EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DbMigrator", "DbMigrator\DbMigrator.csproj", "{77F46A84-21E3-440C-8DC2-893177244FA1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppBroker.Generators", "AppBroker.Generators\AppBroker.Generators.csproj", "{9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestGenerator", "TestGenerator\TestGenerator.csproj", "{50833AB1-C7AA-4524-A48D-BD6423020D89}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppBroker.Generators.Test", "AppBroker.Generators.Test\AppBroker.Generators.Test.csproj", "{A553ED81-487F-49A0-8ACB-DD49BEBBCA48}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppBroker.Elsa", "AppBroker.Elsa\AppBroker.Elsa.csproj", "{49CD08E7-D07D-4952-B4F7-6FDEBEF37240}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elsa", "Elsa", "{985CE004-B3C1-4E1A-A269-E2F15D496E0D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E76B3A29-D64E-4881-BAAE-19D87C124334}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + Nuget.Config = Nuget.Config EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppBroker.Core", "AppBroker.Core\AppBroker.Core.csproj", "{6579337A-A00D-4912-839D-F28C3604FD31}" @@ -64,30 +57,6 @@ Global {77F46A84-21E3-440C-8DC2-893177244FA1}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU {77F46A84-21E3-440C-8DC2-893177244FA1}.Release|Any CPU.ActiveCfg = Release|Any CPU {77F46A84-21E3-440C-8DC2-893177244FA1}.Release|Any CPU.Build.0 = Release|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9410CEB2-5BE1-4BFC-BF8E-7F5EEA30401C}.Release|Any CPU.Build.0 = Release|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50833AB1-C7AA-4524-A48D-BD6423020D89}.Release|Any CPU.Build.0 = Release|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A553ED81-487F-49A0-8ACB-DD49BEBBCA48}.Release|Any CPU.Build.0 = Release|Any CPU {49CD08E7-D07D-4952-B4F7-6FDEBEF37240}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU {49CD08E7-D07D-4952-B4F7-6FDEBEF37240}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU {49CD08E7-D07D-4952-B4F7-6FDEBEF37240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/AppBrokerASP/AppBrokerASP.csproj b/AppBrokerASP/AppBrokerASP.csproj index f837f5c..c5144ed 100644 --- a/AppBrokerASP/AppBrokerASP.csproj +++ b/AppBrokerASP/AppBrokerASP.csproj @@ -28,17 +28,17 @@ - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - + + + PreserveNewest + + + PreserveNewest + - + @@ -65,17 +65,14 @@ - - - Always - PreserveNewest + PreserveNewest Always @@ -83,7 +80,7 @@ - + diff --git a/AppBrokerASP/Devices/Painless/Heater/Heater.cs b/AppBrokerASP/Devices/Painless/Heater/Heater.cs index 7705c89..04bb330 100644 --- a/AppBrokerASP/Devices/Painless/Heater/Heater.cs +++ b/AppBrokerASP/Devices/Painless/Heater/Heater.cs @@ -4,34 +4,39 @@ using AppBrokerASP.Database.Model; using AppBrokerASP.Devices.Zigbee; +using CommunityToolkit.Mvvm.ComponentModel; + using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Linq; using PainlessMesh; -using System.Diagnostics.CodeAnalysis; -using System.Threading; -using System.Threading.Tasks; - namespace AppBrokerASP.Devices.Painless.Heater; [DeviceName("heater")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class Heater : PainlessDevice, IDisposable { + [ObservableProperty] private HeaterConfig? temperature; + + [ObservableProperty] private HeaterConfig? currentConfig; + + [ObservableProperty] private HeaterConfig? currentCalibration; + + [ObservableProperty] private long xiaomiTempSensor; + + [ObservableProperty] private bool disableHeating; + + [ObservableProperty] private bool disableLed; - [AppBroker.IgnoreField] private readonly Task? heaterSensorMapping; - [AppBroker.IgnoreField] private readonly List timeTemps = new(); - [AppBroker.IgnoreField] private bool disposed; public Heater(long id, ByteLengthList parameters) : base(id) diff --git a/AppBrokerASP/Devices/Painless/Heater/HeaterConfig.cs b/AppBrokerASP/Devices/Painless/Heater/HeaterConfig.cs index 1418a40..35de747 100644 --- a/AppBrokerASP/Devices/Painless/Heater/HeaterConfig.cs +++ b/AppBrokerASP/Devices/Painless/Heater/HeaterConfig.cs @@ -1,16 +1,22 @@ -using Newtonsoft.Json; +using CommunityToolkit.Mvvm.ComponentModel; + +using Newtonsoft.Json; using System.Runtime.CompilerServices; namespace AppBrokerASP.Devices.Painless.Heater; -[AppBroker.ClassPropertyChangedAppbroker] -public partial class HeaterConfig +public partial class HeaterConfig : ObservableObject { + [ObservableProperty] [property: JsonProperty("dayOfWeek"), JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] private DayOfWeek dayOfWeek; + + [ObservableProperty] [property: JsonProperty("timeOfDay")] private DateTime timeOfDay; + + [ObservableProperty] [property: JsonProperty("temperature")] private double temperature; diff --git a/AppBrokerASP/Devices/Painless/LedStrip.cs b/AppBrokerASP/Devices/Painless/LedStrip.cs index d7980f6..31435db 100644 --- a/AppBrokerASP/Devices/Painless/LedStrip.cs +++ b/AppBrokerASP/Devices/Painless/LedStrip.cs @@ -1,6 +1,8 @@  using AppBroker.Core; +using CommunityToolkit.Mvvm.ComponentModel; + using Newtonsoft.Json.Linq; using PainlessMesh; @@ -8,16 +10,30 @@ namespace AppBrokerASP.Devices.Painless; [DeviceName("ledstri")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class LedStrip : PainlessDevice { + [ObservableProperty] private string colorMode = ""; + + [ObservableProperty] private int delay; + + [ObservableProperty] private int numberOfLeds; + + [ObservableProperty] private int brightness; + + [ObservableProperty] private uint step; + + [ObservableProperty] private bool reverse; + + [ObservableProperty] private uint colorNumber; + + [ObservableProperty] private ushort version; public LedStrip(long id, ByteLengthList parameter) : base(id, parameter) diff --git a/AppBrokerASP/Devices/Painless/PainlessDevice.cs b/AppBrokerASP/Devices/Painless/PainlessDevice.cs index 866e17d..82eba41 100644 --- a/AppBrokerASP/Devices/Painless/PainlessDevice.cs +++ b/AppBrokerASP/Devices/Painless/PainlessDevice.cs @@ -3,25 +3,32 @@ using AppBroker.Core.Devices; using AppBroker.Elsa.Signaler; +using CommunityToolkit.Mvvm.ComponentModel; + using PainlessMesh; using PainlessMesh.Ota; using System.Reflection; using System.Text; -using System.Threading.Tasks; namespace AppBrokerASP.Devices.Painless; -[AppBroker.ClassPropertyChangedAppbroker] public abstract partial class PainlessDevice : WorkflowDevice { + [ObservableProperty] private string iP = ""; + [ObservableProperty] + [NotifyPropertyChangedFor(nameof(FirmwareVersion))] private uint firmwareVersionNr; + public string FirmwareVersion => "Firmware Version: " + FirmwareVersionNr; protected string LogName => Id + "/" + FriendlyName; + + [ObservableProperty] private string deviceName; + [ObservableProperty] private DateTime lastPartRequestReceived; protected PainlessDevice(long nodeId) : base(nodeId) diff --git a/AppBrokerASP/Devices/Zigbee/TradfriLedBulb.cs b/AppBrokerASP/Devices/Zigbee/TradfriLedBulb.cs index bde95d7..ff98f50 100644 --- a/AppBrokerASP/Devices/Zigbee/TradfriLedBulb.cs +++ b/AppBrokerASP/Devices/Zigbee/TradfriLedBulb.cs @@ -1,33 +1,29 @@  using AppBroker.Core; -using Microsoft.EntityFrameworkCore.Metadata.Internal; +using CommunityToolkit.Mvvm.ComponentModel; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using PainlessMesh; - using SocketIOClient; -using System.Threading.Tasks; - namespace AppBrokerASP.Devices.Zigbee; [DeviceName("TRADFRI bulb E27 CWS opal 600lm", "TRADFRI bulb E14 CWS opal 600lm", "LED1624G9")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class TradfriLedBulb : UpdateableZigbeeDevice { - [AppBroker.IgnoreField] private byte brightness; public byte Brightness { get => brightness; - set => _ = RaiseAndSetIfChanged(ref brightness, Math.Clamp(value, (byte)0, (byte)100)); + set => _ = SetProperty(ref brightness, Math.Clamp(value, (byte)0, (byte)100)); } + [ObservableProperty] private string color = "#0000FF"; + + [ObservableProperty] private bool state; public TradfriLedBulb(long nodeId, SocketIO socket) : diff --git a/AppBrokerASP/Devices/Zigbee/TradfriMotionSensor.cs b/AppBrokerASP/Devices/Zigbee/TradfriMotionSensor.cs index 85c2d7d..dfed856 100644 --- a/AppBrokerASP/Devices/Zigbee/TradfriMotionSensor.cs +++ b/AppBrokerASP/Devices/Zigbee/TradfriMotionSensor.cs @@ -1,14 +1,19 @@ -using Newtonsoft.Json; +using CommunityToolkit.Mvvm.ComponentModel; + using SocketIOClient; namespace AppBrokerASP.Devices.Zigbee; [DeviceName("E1525/E1745")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class TradfriMotionSensor : ZigbeeDevice { + [ObservableProperty] private byte battery; + + [ObservableProperty] private long noMotion; + + [ObservableProperty] private bool occupancy; public TradfriMotionSensor(long nodeId, SocketIO socket) : base(nodeId, socket) diff --git a/AppBrokerASP/Devices/Zigbee/TuyaSwitchSensor.cs b/AppBrokerASP/Devices/Zigbee/TuyaSwitchSensor.cs index 9cc126b..f7f8b72 100644 --- a/AppBrokerASP/Devices/Zigbee/TuyaSwitchSensor.cs +++ b/AppBrokerASP/Devices/Zigbee/TuyaSwitchSensor.cs @@ -5,19 +5,27 @@ using System.Runtime.CompilerServices; using Newtonsoft.Json; using AppBrokerASP.IOBroker; +using CommunityToolkit.Mvvm.ComponentModel; namespace AppBrokerASP.Devices.Zigbee; [DeviceName("TS011F_plug_1")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class TuyaSwitchSensor : ZigbeeSwitch { - + [ObservableProperty] private bool childLock; + + [ObservableProperty] private float current; + + [ObservableProperty] private float energy; + + [ObservableProperty] [property: JsonProperty("load_power")] private float loadPower; + + [ObservableProperty] private float voltage; public TuyaSwitchSensor(long nodeId, SocketIO socket) : base(nodeId, socket) diff --git a/AppBrokerASP/Devices/Zigbee/XiaomiTempSensor.cs b/AppBrokerASP/Devices/Zigbee/XiaomiTempSensor.cs index 955fb71..7f246da 100644 --- a/AppBrokerASP/Devices/Zigbee/XiaomiTempSensor.cs +++ b/AppBrokerASP/Devices/Zigbee/XiaomiTempSensor.cs @@ -1,6 +1,7 @@ using AppBroker.Core; using AppBroker.Core.Devices; using AppBroker.Core.DynamicUI; +using CommunityToolkit.Mvvm.ComponentModel; using Elsa.Activities.StateMachine; @@ -13,17 +14,29 @@ namespace AppBrokerASP.Devices.Zigbee; [DeviceName("lumi.weather", "WSDCGQ11LM")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class XiaomiTempSensor : ZigbeeDevice { public event EventHandler? TemperatureChanged; + + [ObservableProperty] + [NotifyPropertyChangedFor(nameof(IsConnected))] bool? overridenState; + public new bool IsConnected => overridenState ?? Available; + + [ObservableProperty] private float humidity; + [ObservableProperty] private float pressure; + + [ObservableProperty] private byte battery; + + [ObservableProperty] private float voltage; + + [ObservableProperty] private float temperature; public XiaomiTempSensor(long id, SocketIO socket) : base(id, socket) diff --git a/AppBrokerASP/Devices/Zigbee/ZigbeeContactSensor.cs b/AppBrokerASP/Devices/Zigbee/ZigbeeContactSensor.cs index 72ce8c4..1ac33cb 100644 --- a/AppBrokerASP/Devices/Zigbee/ZigbeeContactSensor.cs +++ b/AppBrokerASP/Devices/Zigbee/ZigbeeContactSensor.cs @@ -1,15 +1,19 @@ -using SocketIOClient; +using CommunityToolkit.Mvvm.ComponentModel; + +using SocketIOClient; namespace AppBrokerASP.Devices.Zigbee; [DeviceName("MCCGQ11LM")] -[AppBroker.ClassPropertyChangedAppbroker] public partial class ZigbeeContactSensor : ZigbeeDevice { - + [ObservableProperty] private double temperature; + + [ObservableProperty] private bool state; + public ZigbeeContactSensor(long nodeId, SocketIO socket) : base(nodeId, socket) { ShowInApp = true; diff --git a/AppBrokerASP/Devices/Zigbee/ZigbeeDevice.cs b/AppBrokerASP/Devices/Zigbee/ZigbeeDevice.cs index d79b098..f1a47ec 100644 --- a/AppBrokerASP/Devices/Zigbee/ZigbeeDevice.cs +++ b/AppBrokerASP/Devices/Zigbee/ZigbeeDevice.cs @@ -4,37 +4,41 @@ using AppBrokerASP.Extension; using AppBrokerASP.IOBroker; +using CommunityToolkit.Mvvm.ComponentModel; + using Newtonsoft.Json; using SocketIOClient; using System.Collections.ObjectModel; -using System.Globalization; using System.Reflection; using static AppBrokerASP.IOBroker.IoBrokerHistory; namespace AppBrokerASP.Devices.Zigbee; -[AppBroker.ClassPropertyChangedAppbroker] public abstract partial class ZigbeeDevice : WorkflowDevice { protected SocketIO Socket { get; } //[property: JsonIgnore()] + [ObservableProperty] private DateTime lastReceived; public string LastReceivedFormatted => lastReceived.ToString("dd.MM.yyyy HH:mm:ss"); + [ObservableProperty] [property: JsonProperty("link_Quality")] private byte linkQuality; + + [ObservableProperty] private bool available; + + [ObservableProperty] private string adapterWithId = ""; - [AppBroker.IgnoreField] private readonly ReadOnlyCollection<(string[] Names, PropertyInfo Info)> propertyInfos; - [AppBroker.IgnoreField] private readonly HashSet unknownProperties = new(); public ZigbeeDevice(long nodeId, SocketIO socket) : base(nodeId) @@ -158,7 +162,6 @@ private void SetProperty(IoBrokerObject ioBrokerObject, PropertyInfo prop) //private void SetValueOnProperty(PropertyInfo prop, T v1) where T : INumber, IMinMaxValue // => prop.SetValue(this, T.CreateSaturating(v1)); - [AppBroker.IgnoreField] private Dictionary createSaturatingMethods = new(); private void SetValueOnProperty(PropertyInfo prop, long v1) // where T : INumber, IMinMaxValue // => prop.SetValue(this, resT.CreateSaturating(v1)); diff --git a/AppBrokerASP/Devices/Zigbee/ZigbeeLamp.cs b/AppBrokerASP/Devices/Zigbee/ZigbeeLamp.cs index 9a160d7..d74b5cb 100644 --- a/AppBrokerASP/Devices/Zigbee/ZigbeeLamp.cs +++ b/AppBrokerASP/Devices/Zigbee/ZigbeeLamp.cs @@ -1,22 +1,25 @@ using AppBroker.Core; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using CommunityToolkit.Mvvm.ComponentModel; -using PainlessMesh; +using Newtonsoft.Json.Linq; using SocketIOClient; -using System.Threading.Tasks; - namespace AppBrokerASP.Devices.Zigbee; -[AppBroker.ClassPropertyChangedAppbroker] public abstract partial class ZigbeeLamp : UpdateableZigbeeDevice { + [ObservableProperty] private byte brightness; + + [ObservableProperty] private bool state; + + [ObservableProperty] private int colorTemp; + + [ObservableProperty] [property: JsonProperty("transition_Time")] private float transitionTime; diff --git a/AppBrokerASP/Devices/Zigbee/ZigbeeSwitch.cs b/AppBrokerASP/Devices/Zigbee/ZigbeeSwitch.cs index cb58697..96d0174 100644 --- a/AppBrokerASP/Devices/Zigbee/ZigbeeSwitch.cs +++ b/AppBrokerASP/Devices/Zigbee/ZigbeeSwitch.cs @@ -1,18 +1,16 @@ using AppBroker.Core; -using Newtonsoft.Json.Linq; +using CommunityToolkit.Mvvm.ComponentModel; -using PainlessMesh; +using Newtonsoft.Json.Linq; using SocketIOClient; -using System.Threading.Tasks; - namespace AppBrokerASP.Devices.Zigbee; -[AppBroker.ClassPropertyChangedAppbroker] public abstract partial class ZigbeeSwitch : UpdateableZigbeeDevice { + [ObservableProperty] private bool state; protected ZigbeeSwitch(long nodeId, SocketIO socket) : base(nodeId, socket) diff --git a/Configs/Daniel/appsettings.debug.json b/Configs/Daniel/appsettings.debug.json new file mode 100644 index 0000000..60ded7a --- /dev/null +++ b/Configs/Daniel/appsettings.debug.json @@ -0,0 +1,137 @@ +{ + + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ZigbeeConfig": { + "SocketIOUrl": "http://ZigbeeHub:8084", + "HttpUrl": "http://ZigbeeHub:8087", + "HistoryPath": "F:\\Temp\\Neuer Ordner", + "NewSocketIoversion": false + }, + "NLog": { + "autoReload": true, + "throwConfigExceptions": true, + "targets": { + "logfile": { + "type": "File", + "fileName": "file.txt" + }, + "file": { + "type": "File", + "fileName": "${basedir}/Logs/${shortdate}.log" + }, + "logconsole": { + "type": "Console" + } + }, + "rules": [ + { + "logger": "Microsoft.EntityFramework*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Elsa.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Rebus.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Quartz.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "logconsole" + }, + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "file" + } + ] + }, + "PainlessMeshSettings": { + "Enabled": false, + "ListenPort": 8801, + "PainlessCertFingerprint": "643b4f728a001e1b0aa429b6109ec42cb14f7881" + }, + "ServerConfig": { + "ListenPort": 5056, + "InstanceName": "appbroker", + "ClusterId": "XQsIJWQPylaCJyJN5", + "ListenUrls": [ + "http://[::1]", + "http://0.0.0.0" + //Examples of allowed uri formats + //"http://[::1]:5056", + //"http://0.0.0.0:5056", + //"http://[::1]:443", + //"http://0.0.0.0:443", + //"http://[::1]", + //"http://0.0.0.0", + //"https://[::1]", + //"https://0.0.0.0", + //"https://[::1]:80", + //"https://0.0.0.0:80" + + ] + }, + "Elsa": { + "Features": { + "DefaultPersistence": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + }, + "DispatcherHangfire": false, + "Console": true, + "Http": true, + "Email": true, + "TemporalQuartz": true, + "JavaScriptActivities": true, + "UserTask": true, + "Conductor": true, + "Telnyx": true, + "File": true, + "Webhooks": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + }, + "WorkflowSettings": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + } + }, + "WorkflowChannels": { + "Channels": [ + "High", + "Normal", + "Low" + ], + "Default": "Normal" + }, + "Server": { + "BaseUrl": "http://localhost:5056", + "BasePath": "/workflows" + }, + "Smtp": { + "Host": "localhost", + "Port": "2525", + "DefaultSender": "noreply@acme.com" + } + } +} \ No newline at end of file diff --git a/Configs/Daniel/appsettings.json b/Configs/Daniel/appsettings.json new file mode 100644 index 0000000..0281ab8 --- /dev/null +++ b/Configs/Daniel/appsettings.json @@ -0,0 +1,139 @@ +{ + "ZigbeeConfig": { + "SocketIOUrl": "http://ZigbeeHub:8084", + "HttpUrl": "http://ZigbeeHub:8087", + "HistoryPath": "F:\\Temp\\Neuer Ordner", + "NewSocketIoversion": false + }, + "NLog": { + "autoReload": true, + "throwConfigExceptions": true, + "targets": { + "logfile": { + "type": "File", + "fileName": "file.txt" + }, + "file": { + "type": "File", + "fileName": "${basedir}/Logs/${shortdate}.log" + }, + "logconsole": { + "type": "Console" + } + }, + "rules": [ + { + "logger": "Microsoft.EntityFramework*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Elsa.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Rebus.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "Quartz.*", + "maxLevel": "off", + "final": true + }, + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "logconsole" + }, + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "file" + } + ] + }, + "PainlessMeshSettings": { + "Enabled": false, + "ListenPort": 8801, + "PainlessCertFingerprint": "643b4f728a001e1b0aa429b6109ec42cb14f7881" + }, + "ServerConfig": { + "ListenPort": 5056, + "InstanceName": "appbroker", + "ClusterId": "XQsIJWQPylaCJyJN5", + "ListenUrls": [ + "http://[::1]", + "http://0.0.0.0" + //Examples of allowed uri formats + //"http://[::1]:5056", + //"http://0.0.0.0:5056", + //"http://[::1]:443", + //"http://0.0.0.0:443", + //"http://[::1]", + //"http://0.0.0.0", + //"https://[::1]", + //"https://0.0.0.0", + //"https://[::1]:80", + //"https://0.0.0.0:80" + + ] + + }, + "Elsa": { + "Features": { + "DefaultPersistence": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + }, + "DispatcherHangfire": false, + "Console": true, + "Http": true, + "Email": true, + "TemporalQuartz": true, + "JavaScriptActivities": true, + "UserTask": true, + "Conductor": true, + "Telnyx": true, + "File": true, + "Webhooks": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + }, + "WorkflowSettings": { + "Enabled": false, + "Framework": "EntityFrameworkCore", + "ConnectionStringIdentifier": "Sqlite" + } + }, + "WorkflowChannels": { + "Channels": [ + "High", + "Normal", + "Low" + ], + "Default": "Normal" + }, + "Server": { + "BaseUrl": "http://localhost:5056", + "BasePath": "/workflows" + }, + "Smtp": { + "Host": "localhost", + "Port": "2525", + "DefaultSender": "noreply@acme.com" + }, + "Retention": { + "SweepInterval": "0:00:00:10", + "TimeToLive": "0:00:10:00", + "PageSize": "10" + }, + "Conductor": { + "CommandsHookUrl": "https://localhost:16001/elsa-hook/commands", + "TasksHookUrl": "https://localhost:16001/elsa-hook/tasks" + } + } +} \ No newline at end of file diff --git a/TcpProxy/TcpProxy.csproj b/TcpProxy/TcpProxy.csproj index 85fe173..18794c2 100644 --- a/TcpProxy/TcpProxy.csproj +++ b/TcpProxy/TcpProxy.csproj @@ -6,13 +6,6 @@ enable enable Linux - - - - preview - - - preview diff --git a/TestGenerator/Program.cs b/TestGenerator/Program.cs deleted file mode 100644 index e5f1bcf..0000000 --- a/TestGenerator/Program.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace TestGenerator -{ - public class Programm - { - public static void Main(string[] args) - { - var asd = new PropChanged - { - MyProperty = 123, - MyProperty2 = 123 - }; - //asd.Different = 123; - } - } -} \ No newline at end of file diff --git a/TestGenerator/PropChanged.cs b/TestGenerator/PropChanged.cs deleted file mode 100644 index d854b95..0000000 --- a/TestGenerator/PropChanged.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; - -namespace TestGenerator -{ - public class TestAttributeWithParameterAttribute : Attribute - { - public TestAttributeWithParameterAttribute(string name) - { - PropName = name; - } - - public string PropName { get; } - } - - [AppBroker.ClassPropertyChangedAppbroker(true, false)] - public partial class PropChanged2 : PropChanged - { - private int myPropertySecond; - - } - - [AppBroker.ClassPropertyChangedAppbroker(true, false)] - public partial class PropChanged - { - private int myProperty; - - [AppBroker.IgnoreChangedField] - private int myProperty2; - [AppBroker.IgnoreField] - private int myPropertyIgnored; - - [property: JsonPropertyName("transition_Time")] - [AppBroker.PropertyChangedAppbroker(PropertyName = "Different2")] - private int myProperty3; - - [property: System.Text.Json.Serialization.JsonPropertyName("transition_Time")] - private int myProperty4; - - protected virtual void OnPropertyChanging(ref T field, T value, string propertyName) - { - - } - protected virtual void OnPropertyChanged(string propertyName) - { - - } - } -} diff --git a/TestGenerator/TestGenerator.csproj b/TestGenerator/TestGenerator.csproj deleted file mode 100644 index 8a99e2d..0000000 --- a/TestGenerator/TestGenerator.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - net5.0 - - enable - - - - - - - diff --git a/TranslateTTMToHumanReadable/TranslateTTMToHumanReadable.csproj b/TranslateTTMToHumanReadable/TranslateTTMToHumanReadable.csproj index eb7b69b..e670f56 100644 --- a/TranslateTTMToHumanReadable/TranslateTTMToHumanReadable.csproj +++ b/TranslateTTMToHumanReadable/TranslateTTMToHumanReadable.csproj @@ -4,13 +4,6 @@ Exe net6.0 true - - - - preview - - - preview