From a4fbfd38e80a5ea6f286fe4ee9e8352a938ec36c Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Wed, 18 Feb 2026 09:47:32 +0100 Subject: [PATCH 01/15] Create draft PR for #499 From 2a4f5c183696c11fb1e601bf3da7d34f847e50d5 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Wed, 18 Feb 2026 13:23:33 +0100 Subject: [PATCH 02/15] Update line endings in FormatCode method and add new ixc_data profile in launchSettings --- .../src/AXSharp.Cs.Compiler/Helpers/CsFormatting.cs | 2 +- src/AXSharp.compiler/src/ixc/Properties/launchSettings.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/CsFormatting.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/CsFormatting.cs index 6a974744..ae8dfb37 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/CsFormatting.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/CsFormatting.cs @@ -14,6 +14,6 @@ internal static class CsFormatting { public static string FormatCode(this string code) { - return CSharpSyntaxTree.ParseText(code).GetRoot().NormalizeWhitespace().SyntaxTree.GetText().ToString(); + return CSharpSyntaxTree.ParseText(code).GetRoot().NormalizeWhitespace(eol:"\n").SyntaxTree.GetText().ToString(); } } \ No newline at end of file diff --git a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json index 594fce4a..aec971df 100644 --- a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json +++ b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json @@ -69,6 +69,10 @@ "axopen-traversal-in-tepmplates": { "commandName": "Project", "workingDirectory": "C:\\W\\Develop\\gh\\inxton\\simatic-ax\\axopen.templates\\axopen\\src\\traversals\\apax" + }, + "ixc_data": { + "commandName": "Project", + "workingDirectory": "D:\\github\\Inxton\\axopen\\src\\data\\tests\\AXOpen.Data.Tests_L1\\ax" } } } \ No newline at end of file From c627b7dbdeb96b7babf95115ffa537ee3e727723 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 06:37:02 +0100 Subject: [PATCH 03/15] wip --- .editorconfig | 6 ++++++ .gitattributes | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..7ae9c18a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..18d2d489 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,29 @@ +# Default: treat as text, normalize to LF in the repository +* text=auto eol=lf + +# Typical source files (explicit, but the default already covers these) +*.c text eol=lf +*.cpp text eol=lf +*.h text eol=lf +*.py text eol=lf +*.js text eol=lf +*.ts text eol=lf +*.sh text eol=lf +*.yaml text eol=lf +*.yml text eol=lf +*.json text eol=lf +*.css text eol=lf +*.cs text eol=lf + + +# Windows-native scripts that often *must* be CRLF in the working tree +# (repo still stores LF; checkout converts to CRLF) +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Binary files (never touch line endings) +*.png -text +*.jpg -text +*.zip -text +*.pdf -text \ No newline at end of file From 86092dcdae6a81a335cab5b533d2a39f80a4972f Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 06:51:28 +0100 Subject: [PATCH 04/15] deleted_expected_tests_examples --- .../units/expected/ax/.g/Configurations.g.cs | 181 -- .../ax/.g/Onliners/abstract_members.g.cs | 238 -- .../ax/.g/Onliners/array_declaration.g.cs | 462 ---- .../ax/.g/Onliners/class_all_primitives.g.cs | 558 ----- .../class_extended_by_known_type.g.cs | 373 --- .../ax/.g/Onliners/class_extends.g.cs | 334 --- .../class_extends_and_implements.g.cs | 342 --- .../.g/Onliners/class_generic_extension.g.cs | 733 ------ .../ax/.g/Onliners/class_implements.g.cs | 209 -- .../Onliners/class_implements_multiple.g.cs | 213 -- .../ax/.g/Onliners/class_internal.g.cs | 205 -- .../.g/Onliners/class_no_access_modifier.g.cs | 205 -- .../Onliners/class_with_complex_members.g.cs | 430 ---- .../class_with_non_public_members.g.cs | 430 ---- .../ax/.g/Onliners/class_with_pragmas.g.cs | 432 ---- .../class_with_primitive_members.g.cs | 641 ----- .../Onliners/class_with_using_directives.g.cs | 223 -- .../.g/Onliners/compileromitsattribute.g.cs | 2122 ----------------- .../ax/.g/Onliners/configuration.g.cs | 1124 --------- .../expected/ax/.g/Onliners/enum_simple.g.cs | 13 - .../ax/.g/Onliners/file_with_unsupported.g.cs | 10 - .../ax/.g/Onliners/file_with_usings.g.cs | 820 ------- .../expected/ax/.g/Onliners/generics.g.cs | 595 ----- .../expected/ax/.g/Onliners/makereadonce.g.cs | 522 ---- .../expected/ax/.g/Onliners/makereadonly.g.cs | 522 ---- .../units/expected/ax/.g/Onliners/misc.g.cs | 1660 ------------- .../expected/ax/.g/Onliners/mixed_access.g.cs | 1586 ------------ .../ax/.g/Onliners/multiline_pragmas.g.cs | 236 -- .../expected/ax/.g/Onliners/program.g.cs | 6 - .../ax/.g/Onliners/ref_to_simple.g.cs | 424 ---- .../ax/.g/Onliners/simple_empty_class.g.cs | 205 -- .../simple_empty_class_within_namespace.g.cs | 208 -- .../ax/.g/Onliners/struct_simple.g.cs | 456 ---- .../ax/.g/Onliners/type_named_values.g.cs | 233 -- .../Onliners/type_named_values_literals.g.cs | 235 -- .../ax/.g/Onliners/type_with_enum.g.cs | 260 -- .../Onliners/types_with_name_attributes.g.cs | 692 ------ .../types_with_property_attributes.g.cs | 243 -- .../expected/ax/.g/POCO/abstract_members.g.cs | 16 - .../ax/.g/POCO/array_declaration.g.cs | 29 - .../ax/.g/POCO/class_all_primitives.g.cs | 36 - .../.g/POCO/class_extended_by_known_type.g.cs | 29 - .../expected/ax/.g/POCO/class_extends.g.cs | 20 - .../.g/POCO/class_extends_and_implements.g.cs | 28 - .../ax/.g/POCO/class_generic_extension.g.cs | 42 - .../expected/ax/.g/POCO/class_implements.g.cs | 17 - .../ax/.g/POCO/class_implements_multiple.g.cs | 21 - .../expected/ax/.g/POCO/class_internal.g.cs | 13 - .../ax/.g/POCO/class_no_access_modifier.g.cs | 13 - .../.g/POCO/class_with_complex_members.g.cs | 25 - .../POCO/class_with_non_public_members.g.cs | 25 - .../ax/.g/POCO/class_with_pragmas.g.cs | 25 - .../.g/POCO/class_with_primitive_members.g.cs | 44 - .../.g/POCO/class_with_using_directives.g.cs | 34 - .../ax/.g/POCO/compileromitsattribute.g.cs | 109 - .../expected/ax/.g/POCO/configuration.g.cs | 61 - .../expected/ax/.g/POCO/enum_simple.g.cs | 7 - .../ax/.g/POCO/file_with_unsupported.g.cs | 10 - .../expected/ax/.g/POCO/file_with_usings.g.cs | 52 - .../units/expected/ax/.g/POCO/generics.g.cs | 36 - .../expected/ax/.g/POCO/makereadonce.g.cs | 31 - .../expected/ax/.g/POCO/makereadonly.g.cs | 31 - .../units/expected/ax/.g/POCO/misc.g.cs | 86 - .../expected/ax/.g/POCO/mixed_access.g.cs | 75 - .../ax/.g/POCO/multiline_pragmas.g.cs | 29 - .../units/expected/ax/.g/POCO/program.g.cs | 7 - .../expected/ax/.g/POCO/ref_to_simple.g.cs | 25 - .../ax/.g/POCO/simple_empty_class.g.cs | 13 - .../simple_empty_class_within_namespace.g.cs | 16 - .../expected/ax/.g/POCO/struct_simple.g.cs | 25 - .../ax/.g/POCO/type_named_values.g.cs | 18 - .../.g/POCO/type_named_values_literals.g.cs | 18 - .../expected/ax/.g/POCO/type_with_enum.g.cs | 26 - .../.g/POCO/types_with_name_attributes.g.cs | 37 - .../POCO/types_with_property_attributes.g.cs | 20 - .../units/expected/ax/.g/PlcResources.g.cs | 26 - .../samples/units/expected/ax/units.csproj | 21 - .../units/expected/tia/.g/Configurations.g.cs | 181 -- .../tia/.g/Onliners/abstract_members.g.cs | 238 -- .../tia/.g/Onliners/array_declaration.g.cs | 462 ---- .../tia/.g/Onliners/class_all_primitives.g.cs | 558 ----- .../class_extended_by_known_type.g.cs | 373 --- .../tia/.g/Onliners/class_extends.g.cs | 334 --- .../class_extends_and_implements.g.cs | 342 --- .../.g/Onliners/class_generic_extension.g.cs | 733 ------ .../tia/.g/Onliners/class_implements.g.cs | 209 -- .../Onliners/class_implements_multiple.g.cs | 213 -- .../tia/.g/Onliners/class_internal.g.cs | 205 -- .../.g/Onliners/class_no_access_modifier.g.cs | 205 -- .../Onliners/class_with_complex_members.g.cs | 430 ---- .../class_with_non_public_members.g.cs | 430 ---- .../tia/.g/Onliners/class_with_pragmas.g.cs | 432 ---- .../class_with_primitive_members.g.cs | 641 ----- .../Onliners/class_with_using_directives.g.cs | 223 -- .../.g/Onliners/compileromitsattribute.g.cs | 2122 ----------------- .../tia/.g/Onliners/configuration.g.cs | 1124 --------- .../expected/tia/.g/Onliners/enum_simple.g.cs | 13 - .../.g/Onliners/file_with_unsupported.g.cs | 10 - .../tia/.g/Onliners/file_with_usings.g.cs | 820 ------- .../expected/tia/.g/Onliners/generics.g.cs | 595 ----- .../tia/.g/Onliners/makereadonce.g.cs | 522 ---- .../tia/.g/Onliners/makereadonly.g.cs | 522 ---- .../units/expected/tia/.g/Onliners/misc.g.cs | 1660 ------------- .../tia/.g/Onliners/mixed_access.g.cs | 1586 ------------ .../tia/.g/Onliners/multiline_pragmas.g.cs | 236 -- .../expected/tia/.g/Onliners/program.g.cs | 6 - .../tia/.g/Onliners/ref_to_simple.g.cs | 424 ---- .../tia/.g/Onliners/simple_empty_class.g.cs | 205 -- .../simple_empty_class_within_namespace.g.cs | 208 -- .../tia/.g/Onliners/struct_simple.g.cs | 456 ---- .../tia/.g/Onliners/type_named_values.g.cs | 233 -- .../Onliners/type_named_values_literals.g.cs | 235 -- .../tia/.g/Onliners/type_with_enum.g.cs | 260 -- .../Onliners/types_with_name_attributes.g.cs | 692 ------ .../types_with_property_attributes.g.cs | 243 -- .../tia/.g/POCO/abstract_members.g.cs | 16 - .../tia/.g/POCO/array_declaration.g.cs | 29 - .../tia/.g/POCO/class_all_primitives.g.cs | 36 - .../.g/POCO/class_extended_by_known_type.g.cs | 29 - .../expected/tia/.g/POCO/class_extends.g.cs | 20 - .../.g/POCO/class_extends_and_implements.g.cs | 28 - .../tia/.g/POCO/class_generic_extension.g.cs | 42 - .../tia/.g/POCO/class_implements.g.cs | 17 - .../.g/POCO/class_implements_multiple.g.cs | 21 - .../expected/tia/.g/POCO/class_internal.g.cs | 13 - .../tia/.g/POCO/class_no_access_modifier.g.cs | 13 - .../.g/POCO/class_with_complex_members.g.cs | 25 - .../POCO/class_with_non_public_members.g.cs | 25 - .../tia/.g/POCO/class_with_pragmas.g.cs | 25 - .../.g/POCO/class_with_primitive_members.g.cs | 44 - .../.g/POCO/class_with_using_directives.g.cs | 34 - .../tia/.g/POCO/compileromitsattribute.g.cs | 109 - .../expected/tia/.g/POCO/configuration.g.cs | 61 - .../expected/tia/.g/POCO/enum_simple.g.cs | 7 - .../tia/.g/POCO/file_with_unsupported.g.cs | 10 - .../tia/.g/POCO/file_with_usings.g.cs | 52 - .../units/expected/tia/.g/POCO/generics.g.cs | 36 - .../expected/tia/.g/POCO/makereadonce.g.cs | 31 - .../expected/tia/.g/POCO/makereadonly.g.cs | 31 - .../units/expected/tia/.g/POCO/misc.g.cs | 86 - .../expected/tia/.g/POCO/mixed_access.g.cs | 75 - .../tia/.g/POCO/multiline_pragmas.g.cs | 29 - .../units/expected/tia/.g/POCO/program.g.cs | 7 - .../expected/tia/.g/POCO/ref_to_simple.g.cs | 25 - .../tia/.g/POCO/simple_empty_class.g.cs | 13 - .../simple_empty_class_within_namespace.g.cs | 16 - .../expected/tia/.g/POCO/struct_simple.g.cs | 25 - .../tia/.g/POCO/type_named_values.g.cs | 18 - .../.g/POCO/type_named_values_literals.g.cs | 18 - .../expected/tia/.g/POCO/type_with_enum.g.cs | 26 - .../.g/POCO/types_with_name_attributes.g.cs | 37 - .../POCO/types_with_property_attributes.g.cs | 20 - .../units/expected/tia/.g/PlcResources.g.cs | 26 - .../samples/units/expected/tia/units.csproj | 21 - 154 files changed, 39154 deletions(-) delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs delete mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs deleted file mode 100644 index 17dc6c6f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class unitsTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public ComplexForConfig Complex { get; } - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - [ReadOnce()] - public OnlinerWString myWSTRING_readOnce { get; } - - [ReadOnly()] - public OnlinerWString myWSTRING_readOnly { get; } - - [ReadOnce()] - public ComplexForConfig cReadOnce { get; } - - [ReadOnly()] - public ComplexForConfig cReadOnly { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] - public OnlinerInt Colorss { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] - public OnlinerULInt Colorsss { get; } - - [CompilerOmitsAttribute("POCO")] - public OnlinerBool _must_be_omitted_in_poco { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] - public OnlinerInt Colorss2 { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] - public OnlinerULInt Colorsss2 { get; } - public OnlinerBool MotorOn { get; } - public OnlinerInt MotorState { get; } - public Motor Motor1 { get; } - public Motor Motor2 { get; } - public struct1 s1 { get; } - public struct4 s4 { get; } - public SpecificMotorA mot1 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); - Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); - Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs deleted file mode 100644 index 0e57b992..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class AbstractMotor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - public OnlinerBool ReverseDirection { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) - { - Run.Shadow = plain.Run; - ReverseDirection.Shadow = plain.ReverseDirection; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - if (plain.ReverseDirection != ReverseDirection.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.AbstractMotor CreateEmptyPoco() - { - return new global::Pocos.AbstractMotor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs deleted file mode 100644 index 49415da1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs +++ /dev/null @@ -1,462 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ArrayDeclarationSimpleNamespace -{ - public partial class array_declaration_class : AXSharp.Connector.ITwinObject - { - public OnlinerInt[] primitive { get; } - public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public array_declaration_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - primitive = new OnlinerInt[100]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(primitive, this, "primitive", "primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateINT(p, rt, st), new[] { (1, 100) }); - complex = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, this, "complex", "complex", (p, rt, st) => new ArrayDeclarationSimpleNamespace.some_complex_type(p, rt, st), new[] { (1, 100) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - await this.ReadAsync(priority); - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, eAccessPriority priority = eAccessPriority.Normal) - { - var _primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var _complex_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - var _primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var _complex_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - plain.primitive = primitive.Select(p => p.Shadow).ToArray(); - plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - plain.primitive = primitive.Select(p => p.Shadow).ToArray(); - plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - var _primitive_i_FE8484DAB3 = 0; - primitive.Select(p => p.Shadow = plain.primitive[_primitive_i_FE8484DAB3++]).ToArray(); - var _complex_i_FE8484DAB3 = 0; - complex.Select(p => p.PlainToShadowAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.primitive.Length; i760901_3001_mimi++) - { - if (latest.primitive.ElementAt(i760901_3001_mimi) != plain.primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.complex.Length; i760901_3001_mimi++) - { - if (await complex.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain.complex[i760901_3001_mimi], latest.complex[i760901_3001_mimi])) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class CreateEmptyPoco() - { - return new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class some_complex_type : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public some_complex_type(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type CreateEmptyPoco() - { - return new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs deleted file mode 100644 index 36c26531..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs +++ /dev/null @@ -1,558 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class class_all_primitives : AXSharp.Connector.ITwinObject -{ - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.class_all_primitives plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.class_all_primitives plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.class_all_primitives plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.class_all_primitives plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives plain, global::Pocos.class_all_primitives latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.class_all_primitives CreateEmptyPoco() - { - return new global::Pocos.class_all_primitives(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs deleted file mode 100644 index 41bd6829..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs +++ /dev/null @@ -1,373 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public State1Transition(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, global::Pocos.Simatic.Ax.StateFramework.State1Transition latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Simatic.Ax.StateFramework.State1Transition CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - } - } -} - -namespace Simatic.Ax.StateFramework -{ - public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable - { - public OnlinerInt StateID { get; } - public OnlinerString StateName { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); - StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - await this.ReadAsync(priority); - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - StateID.LethargicWrite(plain.StateID); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - StateName.LethargicWrite(plain.StateName); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { -#pragma warning disable CS0612 - StateID.LethargicWrite(plain.StateID); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - StateName.LethargicWrite(plain.StateName); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - plain.StateID = StateID.Shadow; - plain.StateName = StateName.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - plain.StateID = StateID.Shadow; - plain.StateName = StateName.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - StateID.Shadow = plain.StateID; - StateName.Shadow = plain.StateName; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, global::Pocos.Simatic.Ax.StateFramework.AbstractState latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.StateID != StateID.LastValue) - somethingChanged = true; - if (plain.StateName != StateName.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.AbstractState CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs deleted file mode 100644 index ae98b0e0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs +++ /dev/null @@ -1,334 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Extended : Extendee -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extended(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Extended plain = new global::Pocos.Extended(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Extended plain = new global::Pocos.Extended(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extended plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Extended plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Extended plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Extended plain = new global::Pocos.Extended(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Extended plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Extended plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Extended plain, global::Pocos.Extended latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Extended CreateEmptyPoco() - { - return new global::Pocos.Extended(); - } -} - -public partial class Extendee : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extendee plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Extendee plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Extendee plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Extendee plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Extendee plain, global::Pocos.Extendee latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Extendee CreateEmptyPoco() - { - return new global::Pocos.Extendee(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs deleted file mode 100644 index 2f519df4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs +++ /dev/null @@ -1,342 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, IImplementation1, IImplementation2 -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendsAndImplements plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendsAndImplements plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExtendsAndImplements plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExtendsAndImplements plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.ExtendsAndImplements plain, global::Pocos.ExtendsAndImplements latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.ExtendsAndImplements CreateEmptyPoco() - { - return new global::Pocos.ExtendsAndImplements(); - } -} - -public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ExtendeeExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExtendeeExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ExtendeeExtendsAndImplements plain, global::Pocos.ExtendeeExtendsAndImplements latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ExtendeeExtendsAndImplements CreateEmptyPoco() - { - return new global::Pocos.ExtendeeExtendsAndImplements(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IImplementation1 -{ -} - -public partial interface IImplementation2 -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs deleted file mode 100644 index 6f1bf375..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs +++ /dev/null @@ -1,733 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Generics -{ - public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extender plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extender plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extender plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extender plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extender plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extender plain, global::Pocos.Generics.Extender latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Generics.Extender CreateEmptyPoco() - { - return new global::Pocos.Generics.Extender(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Extendee : Generics.Extender - { - public Generics.SomeType SomeType { get; } - public Generics.SomeType SomeTypeAsPoco { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); - SomeTypeAsPoco = new Generics.SomeType(this, "SomeTypeAsPoco", "SomeTypeAsPoco"); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeType.PlainToShadowAsync(plain.SomeType); - await this.SomeTypeAsPoco.PlainToShadowAsync(plain.SomeTypeAsPoco); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee plain, global::Pocos.Generics.Extendee latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) - somethingChanged = true; - if (await SomeTypeAsPoco.DetectsAnyChangeAsync(plain.SomeTypeAsPoco, latest.SomeTypeAsPoco)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Generics.Extendee CreateEmptyPoco() - { - return new global::Pocos.Generics.Extendee(); - } - } - - public partial class Extendee2 : Generics.Extender - { - public Generics.SomeType SomeType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee2 plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee2 plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee2 plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee2 plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeType.PlainToShadowAsync(plain.SomeType); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee2 plain, global::Pocos.Generics.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Generics.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.Generics.Extendee2(); - } - } - - public partial class SomeType : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeType(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.SomeType plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.SomeType plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.SomeType plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.SomeType plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.SomeType plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Generics.SomeType plain, global::Pocos.Generics.SomeType latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Generics.SomeType CreateEmptyPoco() - { - return new global::Pocos.Generics.SomeType(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs deleted file mode 100644 index ee0cb2ce..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class _NULL_CONTEXT : AXSharp.Connector.ITwinObject, IContext -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public _NULL_CONTEXT(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT plain, global::Pocos._NULL_CONTEXT latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos._NULL_CONTEXT CreateEmptyPoco() - { - return new global::Pocos._NULL_CONTEXT(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IContext -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs deleted file mode 100644 index 95d287ca..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.ITwinObject, IContext_Multiple, IObject_Multiple -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public _NULL_CONTEXT_MULTIPLE(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, global::Pocos._NULL_CONTEXT_MULTIPLE latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos._NULL_CONTEXT_MULTIPLE CreateEmptyPoco() - { - return new global::Pocos._NULL_CONTEXT_MULTIPLE(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IContext_Multiple -{ -} - -public partial interface IObject_Multiple -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs deleted file mode 100644 index 4125361e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -internal partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypes plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypes plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypes plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypes plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs deleted file mode 100644 index 2d2272b1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.NoAccessModifierClass plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.NoAccessModifierClass plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.NoAccessModifierClass plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.NoAccessModifierClass plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.NoAccessModifierClass plain, global::Pocos.NoAccessModifierClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.NoAccessModifierClass CreateEmptyPoco() - { - return new global::Pocos.NoAccessModifierClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs deleted file mode 100644 index d423ae31..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithComplexTypesNamespace -{ - public partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject - { - public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithComplexTypesNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs deleted file mode 100644 index aced06ee..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithNonTraspilableMemberssNamespace -{ - public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.ITwinObject - { - public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithNonTraspilableMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers CreateEmptyPoco() - { - return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs deleted file mode 100644 index 383d092d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs +++ /dev/null @@ -1,432 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithPragmasNamespace -{ - [Container(Layout.Stack)] - public partial class ClassWithPragmas : AXSharp.Connector.ITwinObject - { - [Container(Layout.Wrap)] - public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithPragmas(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithPragmasNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas CreateEmptyPoco() - { - return new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, global::Pocos.ClassWithPragmasNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPragmasNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs deleted file mode 100644 index 279c7fb4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs +++ /dev/null @@ -1,641 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithPrimitiveTypesNamespace -{ - public partial class ClassWithPrimitiveTypes : AXSharp.Connector.ITwinObject - { - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myLDATE.Shadow = plain.myLDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; - myCHAR.Shadow = plain.myCHAR; - myWCHAR.Shadow = plain.myWCHAR; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myLDATE != myLDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myCHAR != myCHAR.LastValue) - somethingChanged = true; - if (plain.myWCHAR != myWCHAR.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs deleted file mode 100644 index 41fa3c4c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; -using SimpleFirstLevelNamespace; -using SimpleQualifiedNamespace.Qualified; -using HelloLevelOne.HelloLevelTwo; - -internal partial class ClassWithUsingDirectives : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithUsingDirectives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithUsingDirectives plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithUsingDirectives plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithUsingDirectives plain, global::Pocos.ClassWithUsingDirectives latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithUsingDirectives CreateEmptyPoco() - { - return new global::Pocos.ClassWithUsingDirectives(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -namespace SimpleFirstLevelNamespace -{ -} - -namespace SimpleQualifiedNamespace.Qualified -{ -} - -namespace HelloLevelOne -{ - namespace HelloLevelTwo - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs deleted file mode 100644 index b302f337..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs +++ /dev/null @@ -1,2122 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace CompilerOmmits -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - [CompilerOmitsAttribute("POCO")] - public CompilerOmmits.Complex _must_be_omitted_in_poco { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _must_be_omitted_in_poco = new CompilerOmmits.Complex(this, "_must_be_omitted_in_poco", "_must_be_omitted_in_poco"); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - await this.ReadAsync(priority); - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, global::Pocos.CompilerOmmits.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.CompilerOmmits.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.CompilerOmmits.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.Complex plain, global::Pocos.CompilerOmmits.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.CompilerOmmits.Complex CreateEmptyPoco() - { - return new global::Pocos.CompilerOmmits.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace Enums -{ - public partial class ClassWithEnums : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] - public OnlinerInt colors { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] - public OnlinerString NamedValuesColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); - NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - await this.ReadAsync(priority); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) - { - colors.Shadow = (short)plain.colors; - NamedValuesColors.Shadow = plain.NamedValuesColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.colors != (Enums.Colors)latest.colors) - somethingChanged = true; - if (plain.NamedValuesColors != NamedValuesColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() - { - return new global::Pocos.Enums.ClassWithEnums(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public enum Colors - { - Red, - Green, - Blue - } - - public enum NamedValuesColors : String - { - Red = 49, - Green = 50, - Blue = 51 - } -} - -namespace misc -{ - public partial class VariousMembers : AXSharp.Connector.ITwinObject - { - public misc.SomeClass _SomeClass { get; } - public misc.Motor _Motor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); - _Motor = new misc.Motor(this, "_Motor", "_Motor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) - { - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) - { - await this._SomeClass.PlainToShadowAsync(plain._SomeClass); - await this._Motor.PlainToShadowAsync(plain._Motor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) - somethingChanged = true; - if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.VariousMembers CreateEmptyPoco() - { - return new global::Pocos.misc.VariousMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeClass : AXSharp.Connector.ITwinObject - { - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.SomeClass CreateEmptyPoco() - { - return new global::Pocos.misc.SomeClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Motor CreateEmptyPoco() - { - return new global::Pocos.misc.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public misc.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new misc.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Vehicle CreateEmptyPoco() - { - return new global::Pocos.misc.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace UnknownArraysShouldNotBeTraspiled -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; - _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) - { - if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs deleted file mode 100644 index bf55ab8e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs +++ /dev/null @@ -1,1124 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class ComplexForConfig : AXSharp.Connector.ITwinObject -{ - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - public Motor myMotor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - myMotor = new Motor(this, "myMotor", "myMotor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ComplexForConfig plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ComplexForConfig plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ComplexForConfig plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - plain.myMotor = await myMotor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ComplexForConfig plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - plain.myMotor = await myMotor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ComplexForConfig plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myLDATE.Shadow = plain.myLDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; - myCHAR.Shadow = plain.myCHAR; - myWCHAR.Shadow = plain.myWCHAR; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - await this.myMotor.PlainToShadowAsync(plain.myMotor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ComplexForConfig plain, global::Pocos.ComplexForConfig latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myLDATE != myLDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myCHAR != myCHAR.LastValue) - somethingChanged = true; - if (plain.myWCHAR != myWCHAR.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - if (await myMotor.DetectsAnyChangeAsync(plain.myMotor, latest.myMotor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ComplexForConfig CreateEmptyPoco() - { - return new global::Pocos.ComplexForConfig(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public enum Colorss -{ - Red, - Green, - Blue -} - -public enum Colorsss : UInt64 -{ - Red = 1, - Green = 2, - Blue = 3 -} - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class Vehicle : AXSharp.Connector.ITwinObject -{ - public Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Vehicle CreateEmptyPoco() - { - return new global::Pocos.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs deleted file mode 100644 index e509210f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public enum Colors -{ - Red, - Green, - Blue -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs deleted file mode 100644 index 7b8ffd8e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Unsupported -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs deleted file mode 100644 index 56f39f28..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs +++ /dev/null @@ -1,820 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; -using FileWithUsingsSimpleFirstLevelNamespace; -using FileWithUsingsSimpleQualifiedNamespace.Qualified; -using FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; - -namespace FileWithUsingsSimpleFirstLevelNamespace -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace FileWithUsingsSimpleQualifiedNamespace.Qualified -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace FileWithUsingsHelloLevelOne -{ - namespace FileWithUsingsHelloLevelTwo - { - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - } -} - -namespace ExampleNamespace -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExampleNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExampleNamespace.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ExampleNamespace.Hello plain, global::Pocos.ExampleNamespace.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ExampleNamespace.Hello CreateEmptyPoco() - { - return new global::Pocos.ExampleNamespace.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs deleted file mode 100644 index 2e4106be..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs +++ /dev/null @@ -1,595 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace GenericsTests -{ - public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extender plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extender plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extender plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extender plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extender plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extender plain, global::Pocos.GenericsTests.Extender latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.GenericsTests.Extender CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.Extender(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeTypeToBeGeneric : AXSharp.Connector.ITwinObject - { - public OnlinerBool Boolean { get; } - public OnlinerInt Cele { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeTypeToBeGeneric(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Boolean = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Boolean", "Boolean"); - Cele = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Cele", "Cele"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - await this.ReadAsync(priority); - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Boolean.LethargicWrite(plain.Boolean); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Cele.LethargicWrite(plain.Cele); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { -#pragma warning disable CS0612 - Boolean.LethargicWrite(plain.Boolean); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Cele.LethargicWrite(plain.Cele); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - plain.Boolean = Boolean.Shadow; - plain.Cele = Cele.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - plain.Boolean = Boolean.Shadow; - plain.Cele = Cele.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - Boolean.Shadow = plain.Boolean; - Cele.Shadow = plain.Cele; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, global::Pocos.GenericsTests.SomeTypeToBeGeneric latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Boolean != Boolean.LastValue) - somethingChanged = true; - if (plain.Cele != Cele.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.GenericsTests.SomeTypeToBeGeneric CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Extendee2 : GenericsTests.Extender - { - [AXOpen.Data.AxoDataEntityAttribute] - [Container(Layout.Stack)] - public GenericsTests.SomeTypeToBeGeneric SomeData { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeData = new GenericsTests.SomeTypeToBeGeneric(this, "Shared Header", "SomeData"); - SomeData.AttributeName = @"Shared Header"; - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); - await base.ShadowToPlainAsync(plain); - plain.SomeData = await SomeData.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeData = await SomeData.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeData.PlainToShadowAsync(plain.SomeData); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extendee2 plain, global::Pocos.GenericsTests.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeData.DetectsAnyChangeAsync(plain.SomeData, latest.SomeData)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.GenericsTests.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.Extendee2(); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs deleted file mode 100644 index 54dfa84f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs +++ /dev/null @@ -1,522 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace makereadonce -{ - public partial class MembersWithMakeReadOnce : AXSharp.Connector.ITwinObject - { - [ReadOnce()] - public OnlinerString makeReadOnceMember { get; } - public OnlinerString someOtherMember { get; } - - [ReadOnce()] - public makereadonce.ComplexMember makeReadComplexMember { get; } - public makereadonce.ComplexMember someotherComplexMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); - makeReadOnceMember.MakeReadOnce(); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); - makeReadComplexMember.MakeReadOnce(); - someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - await this.ReadAsync(priority); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - makeReadOnceMember.Shadow = plain.makeReadOnceMember; - someOtherMember.Shadow = plain.someOtherMember; - await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); - await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, global::Pocos.makereadonce.MembersWithMakeReadOnce latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) - somethingChanged = true; - if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonce.MembersWithMakeReadOnce CreateEmptyPoco() - { - return new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexMember : AXSharp.Connector.ITwinObject - { - public OnlinerString someMember { get; } - public OnlinerString someOtherMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - await this.ReadAsync(priority); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.ComplexMember plain) - { - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.ComplexMember plain) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.ComplexMember plain) - { - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonce.ComplexMember plain) - { - someMember.Shadow = plain.someMember; - someOtherMember.Shadow = plain.someOtherMember; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.ComplexMember plain, global::Pocos.makereadonce.ComplexMember latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.someMember != someMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonce.ComplexMember CreateEmptyPoco() - { - return new global::Pocos.makereadonce.ComplexMember(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs deleted file mode 100644 index f33dd211..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs +++ /dev/null @@ -1,522 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace makereadonly -{ - public partial class MembersWithMakeReadOnly : AXSharp.Connector.ITwinObject - { - [ReadOnly()] - public OnlinerString makeReadOnceMember { get; } - public OnlinerString someOtherMember { get; } - - [ReadOnly()] - public makereadonly.ComplexMember makeReadComplexMember { get; } - public makereadonly.ComplexMember someotherComplexMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); - makeReadOnceMember.MakeReadOnly(); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); - makeReadComplexMember.MakeReadOnly(); - someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - await this.ReadAsync(priority); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - makeReadOnceMember.Shadow = plain.makeReadOnceMember; - someOtherMember.Shadow = plain.someOtherMember; - await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); - await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, global::Pocos.makereadonly.MembersWithMakeReadOnly latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) - somethingChanged = true; - if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonly.MembersWithMakeReadOnly CreateEmptyPoco() - { - return new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexMember : AXSharp.Connector.ITwinObject - { - public OnlinerString someMember { get; } - public OnlinerString someOtherMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - await this.ReadAsync(priority); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.ComplexMember plain) - { - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.ComplexMember plain) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.ComplexMember plain) - { - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonly.ComplexMember plain) - { - someMember.Shadow = plain.someMember; - someOtherMember.Shadow = plain.someOtherMember; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.ComplexMember plain, global::Pocos.makereadonly.ComplexMember latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.someMember != someMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonly.ComplexMember CreateEmptyPoco() - { - return new global::Pocos.makereadonly.ComplexMember(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs deleted file mode 100644 index 0ad24a32..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs +++ /dev/null @@ -1,1660 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Enums -{ - public partial class ClassWithEnums : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] - public OnlinerInt colors { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] - public OnlinerString NamedValuesColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); - NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - await this.ReadAsync(priority); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) - { - colors.Shadow = (short)plain.colors; - NamedValuesColors.Shadow = plain.NamedValuesColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.colors != (Enums.Colors)latest.colors) - somethingChanged = true; - if (plain.NamedValuesColors != NamedValuesColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() - { - return new global::Pocos.Enums.ClassWithEnums(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public enum Colors - { - Red, - Green, - Blue - } - - public enum NamedValuesColors : String - { - Red = 49, - Green = 50, - Blue = 51 - } -} - -namespace misc -{ - public partial class VariousMembers : AXSharp.Connector.ITwinObject - { - public misc.SomeClass _SomeClass { get; } - public misc.Motor _Motor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); - _Motor = new misc.Motor(this, "_Motor", "_Motor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) - { - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) - { - await this._SomeClass.PlainToShadowAsync(plain._SomeClass); - await this._Motor.PlainToShadowAsync(plain._Motor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) - somethingChanged = true; - if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.VariousMembers CreateEmptyPoco() - { - return new global::Pocos.misc.VariousMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeClass : AXSharp.Connector.ITwinObject - { - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.SomeClass CreateEmptyPoco() - { - return new global::Pocos.misc.SomeClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Motor CreateEmptyPoco() - { - return new global::Pocos.misc.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public misc.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new misc.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Vehicle CreateEmptyPoco() - { - return new global::Pocos.misc.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace UnknownArraysShouldNotBeTraspiled -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; - _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) - { - if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs deleted file mode 100644 index 07e927da..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs +++ /dev/null @@ -1,1586 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.Run = Run.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Motor plain) - { - plain.Run = Run.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.Run = Run.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.Run = Run.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - Run.Shadow = plain.Run; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct1 : AXSharp.Connector.ITwinObject -{ - public struct2 s2 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s2 = new struct2(this, "s2", "s2"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct1 plain) - { -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct1 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s2._PlainToOnlineNoacAsync(plain.s2); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct1 plain) - { -#pragma warning disable CS0612 - await this.s2._PlainToOnlineNoacAsync(plain.s2); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); - plain.s2 = await s2.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct1 plain) - { - plain.s2 = await s2.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct1 plain) - { - await this.s2.PlainToShadowAsync(plain.s2); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct1 plain, global::Pocos.struct1 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s2.DetectsAnyChangeAsync(plain.s2, latest.s2)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct1 CreateEmptyPoco() - { - return new global::Pocos.struct1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct2 : AXSharp.Connector.ITwinObject -{ - public struct3 s3 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s3 = new struct3(this, "s3", "s3"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct2 plain) - { -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct2 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s3._PlainToOnlineNoacAsync(plain.s3); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct2 plain) - { -#pragma warning disable CS0612 - await this.s3._PlainToOnlineNoacAsync(plain.s3); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); - plain.s3 = await s3.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct2 plain) - { - plain.s3 = await s3.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct2 plain) - { - await this.s3.PlainToShadowAsync(plain.s3); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct2 plain, global::Pocos.struct2 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s3.DetectsAnyChangeAsync(plain.s3, latest.s3)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct2 CreateEmptyPoco() - { - return new global::Pocos.struct2(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct3 : AXSharp.Connector.ITwinObject -{ - public struct4 s4 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct3(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s4 = new struct4(this, "s4", "s4"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct3 plain) - { -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct3 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s4._PlainToOnlineNoacAsync(plain.s4); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct3 plain) - { -#pragma warning disable CS0612 - await this.s4._PlainToOnlineNoacAsync(plain.s4); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); - plain.s4 = await s4.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct3 plain) - { - plain.s4 = await s4.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct3 plain) - { - await this.s4.PlainToShadowAsync(plain.s4); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct3 plain, global::Pocos.struct3 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s4.DetectsAnyChangeAsync(plain.s4, latest.s4)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct3 CreateEmptyPoco() - { - return new global::Pocos.struct3(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct4 : AXSharp.Connector.ITwinObject -{ - public OnlinerInt s5 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct4(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s5 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "s5", "s5"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - await this.ReadAsync(priority); - plain.s5 = s5.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - plain.s5 = s5.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct4 plain) - { - plain.s5 = s5.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct4 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - s5.LethargicWrite(plain.s5); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct4 plain) - { -#pragma warning disable CS0612 - s5.LethargicWrite(plain.s5); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - plain.s5 = s5.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct4 plain) - { - plain.s5 = s5.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct4 plain) - { - s5.Shadow = plain.s5; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct4 plain, global::Pocos.struct4 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.s5 != s5.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct4 CreateEmptyPoco() - { - return new global::Pocos.struct4(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class AbstractMotor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - public OnlinerBool ReverseDirection { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) - { - Run.Shadow = plain.Run; - ReverseDirection.Shadow = plain.ReverseDirection; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - if (plain.ReverseDirection != ReverseDirection.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.AbstractMotor CreateEmptyPoco() - { - return new global::Pocos.AbstractMotor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class GenericMotor : AbstractMotor -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public GenericMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericMotor plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericMotor plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericMotor plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericMotor plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.GenericMotor plain, global::Pocos.GenericMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.GenericMotor CreateEmptyPoco() - { - return new global::Pocos.GenericMotor(); - } -} - -public partial class SpecificMotorA : GenericMotor -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SpecificMotorA(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.SpecificMotorA plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.SpecificMotorA plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.SpecificMotorA plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.SpecificMotorA plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.SpecificMotorA plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.SpecificMotorA plain, global::Pocos.SpecificMotorA latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.SpecificMotorA CreateEmptyPoco() - { - return new global::Pocos.SpecificMotorA(); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs deleted file mode 100644 index 73d9d290..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace MultilinePragmas -{ - public partial class Extendee2 : AXSharp.Connector.ITwinObject - { - public OnlinerInt _messge { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _messge = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "_messge", "_messge"); - _messge.PlcTextList = @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; - [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; - [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; - [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; - [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; - [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; - [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; - [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; - [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; - [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; - [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'"; - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - await this.ReadAsync(priority); - plain._messge = _messge.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - plain._messge = _messge.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - plain._messge = _messge.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.MultilinePragmas.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - _messge.LethargicWrite(plain._messge); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { -#pragma warning disable CS0612 - _messge.LethargicWrite(plain._messge); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - plain._messge = _messge.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - plain._messge = _messge.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - _messge.Shadow = plain._messge; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.MultilinePragmas.Extendee2 plain, global::Pocos.MultilinePragmas.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain._messge != _messge.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.MultilinePragmas.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.MultilinePragmas.Extendee2(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs deleted file mode 100644 index 44712577..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs +++ /dev/null @@ -1,424 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace RefToSimple -{ - public partial class ref_to_simple : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ref_to_simple(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.ref_to_simple plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.ref_to_simple plain, global::Pocos.RefToSimple.ref_to_simple latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.RefToSimple.ref_to_simple CreateEmptyPoco() - { - return new global::Pocos.RefToSimple.ref_to_simple(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class referenced : AXSharp.Connector.ITwinObject - { - public OnlinerInt b { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public referenced(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - b = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "b", "b"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - await this.ReadAsync(priority); - plain.b = b.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - plain.b = b.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.referenced plain) - { - plain.b = b.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.referenced plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - b.LethargicWrite(plain.b); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.referenced plain) - { -#pragma warning disable CS0612 - b.LethargicWrite(plain.b); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - plain.b = b.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.referenced plain) - { - plain.b = b.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.referenced plain) - { - b.Shadow = plain.b; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.referenced plain, global::Pocos.RefToSimple.referenced latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.b != b.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.RefToSimple.referenced CreateEmptyPoco() - { - return new global::Pocos.RefToSimple.referenced(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs deleted file mode 100644 index 9c0e8c99..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class simple_class : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public simple_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.simple_class plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.simple_class plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.simple_class plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.simple_class plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.simple_class plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.simple_class plain, global::Pocos.simple_class latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.simple_class CreateEmptyPoco() - { - return new global::Pocos.simple_class(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs deleted file mode 100644 index 35d2fc8b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace sampleNamespace -{ - public partial class simple_empty_class_within_namespace : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public simple_empty_class_within_namespace(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, global::Pocos.sampleNamespace.simple_empty_class_within_namespace latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.sampleNamespace.simple_empty_class_within_namespace CreateEmptyPoco() - { - return new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs deleted file mode 100644 index f316e620..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs +++ /dev/null @@ -1,456 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class Vehicle : AXSharp.Connector.ITwinObject -{ - public Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Vehicle CreateEmptyPoco() - { - return new global::Pocos.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs deleted file mode 100644 index 13a8bca3..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace NamedValuesNamespace -{ - public enum LightColors : Int16 - { - LRED = 12, - LGREEN = 14, - LBLUE = 23 - } - - public partial class using_type_named_values : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(NamedValuesNamespace.LightColors))] - public OnlinerInt LColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "LColors", "LColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - await this.ReadAsync(priority); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - plain.LColors = LColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - plain.LColors = LColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - plain.LColors = LColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - LColors.Shadow = plain.LColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, global::Pocos.NamedValuesNamespace.using_type_named_values latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.LColors != LColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.NamedValuesNamespace.using_type_named_values CreateEmptyPoco() - { - return new global::Pocos.NamedValuesNamespace.using_type_named_values(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs deleted file mode 100644 index 343ca703..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs +++ /dev/null @@ -1,235 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public enum StateControllerStatus : UInt16 - { - STATUS_NO_ERR = 28672, - STATUS_IS_RUNNING = 28673, - STATUS_STATE_CHANGED = 28674, - STATUS_NO_INITIALSTATE = 33024, - STATUS_NO_NEXTSTATE = 33025 - } - - public partial class using_type_named_values : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.StateControllerStatus))] - public OnlinerWord LColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "LColors", "LColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - await this.ReadAsync(priority); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - plain.LColors = LColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - plain.LColors = LColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - plain.LColors = LColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - LColors.Shadow = plain.LColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, global::Pocos.Simatic.Ax.StateFramework.using_type_named_values latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.LColors != LColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.using_type_named_values CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs deleted file mode 100644 index 21d4caed..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public partial interface IGuard - { - } -} - -namespace Simatic.Ax.StateFramework -{ - public enum Condition - { - GT, - EQ, - LT, - NE, - GE, - LE - } - - public partial class CompareGuardLint : AXSharp.Connector.ITwinObject, IGuard - { - public OnlinerLInt CompareToValue { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.Condition))] - public OnlinerInt Condition { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public CompareGuardLint(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - CompareToValue = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "CompareToValue", "CompareToValue"); - Condition = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Condition", "Condition"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - await this.ReadAsync(priority); - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - CompareToValue.LethargicWrite(plain.CompareToValue); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Condition.LethargicWrite((short)plain.Condition); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { -#pragma warning disable CS0612 - CompareToValue.LethargicWrite(plain.CompareToValue); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Condition.LethargicWrite((short)plain.Condition); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - plain.CompareToValue = CompareToValue.Shadow; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - plain.CompareToValue = CompareToValue.Shadow; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - CompareToValue.Shadow = plain.CompareToValue; - Condition.Shadow = (short)plain.Condition; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.CompareToValue != CompareToValue.LastValue) - somethingChanged = true; - if (plain.Condition != (Simatic.Ax.StateFramework.Condition)latest.Condition) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs deleted file mode 100644 index 687e6895..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs +++ /dev/null @@ -1,692 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace TypeWithNameAttributes -{ - [Container(Layout.Wrap)] - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Motor plain, global::Pocos.TypeWithNameAttributes.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.Motor CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public TypeWithNameAttributes.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new TypeWithNameAttributes.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, global::Pocos.TypeWithNameAttributes.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.Vehicle CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject - { - private string _AttributeName; - public string AttributeName { get => string.IsNullOrEmpty(_AttributeName) ? SymbolTail : _AttributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _AttributeName = value; } - - public string GetAttributeName(System.Globalization.CultureInfo culture) - { - return this.Translate(_AttributeName, culture).Interpolate(this); - } - - public string AttributeName_raw - { - get - { - return _AttributeName; - } - } - - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, global::Pocos.TypeWithNameAttributes.NoAccessModifierClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.NoAccessModifierClass CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs deleted file mode 100644 index c9c7212d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs +++ /dev/null @@ -1,243 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace TypesWithPropertyAttributes -{ - public partial class SomeAddedProperties : AXSharp.Connector.ITwinObject - { - private string _Description; - public string Description { get => string.IsNullOrEmpty(_Description) ? SymbolTail : _Description.Interpolate(this).CleanUpLocalizationTokens(); set => _Description = value; } - - public string GetDescription(System.Globalization.CultureInfo culture) - { - return this.Translate(_Description, culture).Interpolate(this); - } - - public string Description_raw - { - get - { - return _Description; - } - } - - public OnlinerInt Counter { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeAddedProperties(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Description = @"Some added property name value"; - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Counter = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Pocitadlo", "Counter"); - Counter.AttributeName = @"Pocitadlo"; - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - await this.ReadAsync(priority); - plain.Counter = Counter.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - plain.Counter = Counter.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - plain.Counter = Counter.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Counter.LethargicWrite(plain.Counter); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { -#pragma warning disable CS0612 - Counter.LethargicWrite(plain.Counter); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - plain.Counter = Counter.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - plain.Counter = Counter.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - Counter.Shadow = plain.Counter; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Counter != Counter.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties CreateEmptyPoco() - { - return new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs deleted file mode 100644 index 5400b2ac..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class AbstractMotor : AXSharp.Connector.IPlain - { - public AbstractMotor() - { - } - - public Boolean Run { get; set; } - public Boolean ReverseDirection { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs deleted file mode 100644 index ce30a3c8..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ArrayDeclarationSimpleNamespace - { - public partial class array_declaration_class : AXSharp.Connector.IPlain - { - public array_declaration_class() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, () => new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(), new[] { (1, 100) }); -#pragma warning restore CS0612 - } - - public Int16[] primitive { get; set; } = new Int16[100]; - public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; set; } = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; - } - - public partial class some_complex_type : AXSharp.Connector.IPlain - { - public some_complex_type() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs deleted file mode 100644 index b8b47eef..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class class_all_primitives : AXSharp.Connector.IPlain - { - public class_all_primitives() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs deleted file mode 100644 index 221f97ee..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState, AXSharp.Connector.IPlain - { - public State1Transition() : base() - { - } - } - } - - namespace Simatic.Ax.StateFramework - { - public partial class AbstractState : AXSharp.Connector.IPlain, IState, IStateMuteable - { - public AbstractState() - { - } - - public Int16 StateID { get; set; } - public string StateName { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs deleted file mode 100644 index 4ce871c9..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Extended : Extendee, AXSharp.Connector.IPlain - { - public Extended() : base() - { - } - } - - public partial class Extendee : AXSharp.Connector.IPlain - { - public Extendee() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs deleted file mode 100644 index 91481513..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, AXSharp.Connector.IPlain, IImplementation1, IImplementation2 - { - public ExtendsAndImplements() : base() - { - } - } - - public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.IPlain - { - public ExtendeeExtendsAndImplements() - { - } - } - - public partial interface IImplementation1 - { - } - - public partial interface IImplementation2 - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs deleted file mode 100644 index 906b0bc0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Generics - { - public partial class Extender : AXSharp.Connector.IPlain - { - public Extender() - { - } - } - - public partial class Extendee : Generics.Extender, AXSharp.Connector.IPlain - { - public Extendee() : base() - { - } - - public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); - public Generics.SomeType SomeTypeAsPoco { get; set; } = new Generics.SomeType(); - } - - public partial class Extendee2 : Generics.Extender, AXSharp.Connector.IPlain - { - public Extendee2() : base() - { - } - - public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); - } - - public partial class SomeType : AXSharp.Connector.IPlain - { - public SomeType() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs deleted file mode 100644 index 5eb39ed0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class _NULL_CONTEXT : AXSharp.Connector.IPlain, IContext - { - public _NULL_CONTEXT() - { - } - } - - public partial interface IContext - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs deleted file mode 100644 index aca3704d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.IPlain, IContext_Multiple, IObject_Multiple - { - public _NULL_CONTEXT_MULTIPLE() - { - } - } - - public partial interface IContext_Multiple - { - } - - public partial interface IObject_Multiple - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs deleted file mode 100644 index e4ba926f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - internal partial class ClassWithComplexTypes : AXSharp.Connector.IPlain - { - public ClassWithComplexTypes() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs deleted file mode 100644 index 43b8cdaa..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class NoAccessModifierClass : AXSharp.Connector.IPlain - { - public NoAccessModifierClass() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs deleted file mode 100644 index 27f5f1d8..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithComplexTypesNamespace - { - public partial class ClassWithComplexTypes : AXSharp.Connector.IPlain - { - public ClassWithComplexTypes() - { - } - - public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithComplexTypesNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs deleted file mode 100644 index 7f96b873..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithNonTraspilableMemberssNamespace - { - public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.IPlain - { - public ClassWithNonTraspilableMembers() - { - } - - public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs deleted file mode 100644 index 3f2f1d38..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithPragmasNamespace - { - public partial class ClassWithPragmas : AXSharp.Connector.IPlain - { - public ClassWithPragmas() - { - } - - public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithPragmasNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs deleted file mode 100644 index bc4e1b33..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithPrimitiveTypesNamespace - { - public partial class ClassWithPrimitiveTypes : AXSharp.Connector.IPlain - { - public ClassWithPrimitiveTypes() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); - public DateOnly myLDATE { get; set; } = new DateOnly(1970, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); - public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); - public Char myCHAR { get; set; } - public Char myWCHAR { get; set; } - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs deleted file mode 100644 index ca595c93..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - using SimpleFirstLevelNamespace; - using SimpleQualifiedNamespace.Qualified; - using HelloLevelOne.HelloLevelTwo; - - internal partial class ClassWithUsingDirectives : AXSharp.Connector.IPlain - { - public ClassWithUsingDirectives() - { - } - - using SimpleFirstLevelNamespace ; using SimpleQualifiedNamespace . Qualified ; using HelloLevelOne . HelloLevelTwo ; - -} - -namespace SimpleFirstLevelNamespace -{ -} - -namespace SimpleQualifiedNamespace.Qualified -{ -} - -namespace HelloLevelOne -{ - namespace HelloLevelTwo - { - } -} } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs deleted file mode 100644 index 2e89b94c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace CompilerOmmits - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { - } - - public CompilerOmmits.Complex _must_be_omitted_in_onliner { get; set; } = new CompilerOmmits.Complex(); - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } - - namespace Enums - { - public partial class ClassWithEnums : AXSharp.Connector.IPlain - { - public ClassWithEnums() - { - } - - public global::Enums.Colors colors { get; set; } - public String NamedValuesColors { get; set; } - } - } - - namespace misc - { - public partial class VariousMembers : AXSharp.Connector.IPlain - { - public VariousMembers() - { - } - - public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); - public misc.Motor _Motor { get; set; } = new misc.Motor(); - } - - public partial class SomeClass : AXSharp.Connector.IPlain - { - public SomeClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public misc.Motor m { get; set; } = new misc.Motor(); - public Int16 displacement { get; set; } - } - } - - namespace UnknownArraysShouldNotBeTraspiled - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); -#pragma warning restore CS0612 - } - - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs deleted file mode 100644 index db934855..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class ComplexForConfig : AXSharp.Connector.IPlain - { - public ComplexForConfig() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); - public DateOnly myLDATE { get; set; } = new DateOnly(1970, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); - public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); - public Char myCHAR { get; set; } - public Char myWCHAR { get; set; } - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - public Motor myMotor { get; set; } = new Motor(); - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public Motor m { get; set; } = new Motor(); - public Int16 displacement { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs deleted file mode 100644 index 56cacaa1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Unsupported - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs deleted file mode 100644 index 1fecb933..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; -using Pocos.FileWithUsingsSimpleFirstLevelNamespace; -using Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified; -using Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; - -namespace Pocos -{ - namespace FileWithUsingsSimpleFirstLevelNamespace - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - - namespace FileWithUsingsSimpleQualifiedNamespace.Qualified - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - - namespace FileWithUsingsHelloLevelOne - { - namespace FileWithUsingsHelloLevelTwo - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - } - - namespace ExampleNamespace - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs deleted file mode 100644 index 47e0b1d4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace GenericsTests - { - public partial class Extender : AXSharp.Connector.IPlain - { - public Extender() - { - } - } - - public partial class SomeTypeToBeGeneric : AXSharp.Connector.IPlain - { - public SomeTypeToBeGeneric() - { - } - - public Boolean Boolean { get; set; } - public Int16 Cele { get; set; } - } - - public partial class Extendee2 : GenericsTests.Extender, AXSharp.Connector.IPlain - { - public Extendee2() : base() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Shared Header")] - public GenericsTests.SomeTypeToBeGeneric SomeData { get; set; } = new GenericsTests.SomeTypeToBeGeneric(); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs deleted file mode 100644 index b1f0575c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace makereadonce - { - public partial class MembersWithMakeReadOnce : AXSharp.Connector.IPlain - { - public MembersWithMakeReadOnce() - { - } - - public string makeReadOnceMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - public makereadonce.ComplexMember makeReadComplexMember { get; set; } = new makereadonce.ComplexMember(); - public makereadonce.ComplexMember someotherComplexMember { get; set; } = new makereadonce.ComplexMember(); - } - - public partial class ComplexMember : AXSharp.Connector.IPlain - { - public ComplexMember() - { - } - - public string someMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs deleted file mode 100644 index ecafb34f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace makereadonly - { - public partial class MembersWithMakeReadOnly : AXSharp.Connector.IPlain - { - public MembersWithMakeReadOnly() - { - } - - public string makeReadOnceMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - public makereadonly.ComplexMember makeReadComplexMember { get; set; } = new makereadonly.ComplexMember(); - public makereadonly.ComplexMember someotherComplexMember { get; set; } = new makereadonly.ComplexMember(); - } - - public partial class ComplexMember : AXSharp.Connector.IPlain - { - public ComplexMember() - { - } - - public string someMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs deleted file mode 100644 index 1eae7fcb..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Enums - { - public partial class ClassWithEnums : AXSharp.Connector.IPlain - { - public ClassWithEnums() - { - } - - public global::Enums.Colors colors { get; set; } - public String NamedValuesColors { get; set; } - } - } - - namespace misc - { - public partial class VariousMembers : AXSharp.Connector.IPlain - { - public VariousMembers() - { - } - - public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); - public misc.Motor _Motor { get; set; } = new misc.Motor(); - } - - public partial class SomeClass : AXSharp.Connector.IPlain - { - public SomeClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public misc.Motor m { get; set; } = new misc.Motor(); - public Int16 displacement { get; set; } - } - } - - namespace UnknownArraysShouldNotBeTraspiled - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); -#pragma warning restore CS0612 - } - - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs deleted file mode 100644 index a7383fdf..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean Run { get; set; } - } - - public partial class struct1 : AXSharp.Connector.IPlain - { - public struct1() - { - } - - public struct2 s2 { get; set; } = new struct2(); - } - - public partial class struct2 : AXSharp.Connector.IPlain - { - public struct2() - { - } - - public struct3 s3 { get; set; } = new struct3(); - } - - public partial class struct3 : AXSharp.Connector.IPlain - { - public struct3() - { - } - - public struct4 s4 { get; set; } = new struct4(); - } - - public partial class struct4 : AXSharp.Connector.IPlain - { - public struct4() - { - } - - public Int16 s5 { get; set; } - } - - public partial class AbstractMotor : AXSharp.Connector.IPlain - { - public AbstractMotor() - { - } - - public Boolean Run { get; set; } - public Boolean ReverseDirection { get; set; } - } - - public partial class GenericMotor : AbstractMotor, AXSharp.Connector.IPlain - { - public GenericMotor() : base() - { - } - } - - public partial class SpecificMotorA : GenericMotor, AXSharp.Connector.IPlain - { - public SpecificMotorA() : base() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs deleted file mode 100644 index 7eb75e26..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace MultilinePragmas - { - public partial class Extendee2 : AXSharp.Connector.IPlain - { - public Extendee2() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("PlcTextList", @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; - [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; - [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; - [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; - [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; - [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; - [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; - [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; - [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; - [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; - [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'")] - public Int16 _messge { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs deleted file mode 100644 index 22248e83..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace RefToSimple - { - public partial class ref_to_simple : AXSharp.Connector.IPlain - { - public ref_to_simple() - { - } - } - - public partial class referenced : AXSharp.Connector.IPlain - { - public referenced() - { - } - - public Int16 b { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs deleted file mode 100644 index 49d5fd25..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class simple_class : AXSharp.Connector.IPlain - { - public simple_class() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs deleted file mode 100644 index 3cf279ae..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace sampleNamespace - { - public partial class simple_empty_class_within_namespace : AXSharp.Connector.IPlain - { - public simple_empty_class_within_namespace() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs deleted file mode 100644 index 0c0b4d7c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public Motor m { get; set; } = new Motor(); - public Int16 displacement { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs deleted file mode 100644 index a5e6936b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace NamedValuesNamespace - { - public partial class using_type_named_values : AXSharp.Connector.IPlain - { - public using_type_named_values() - { - } - - public Int16 LColors { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs deleted file mode 100644 index 14b4df59..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial class using_type_named_values : AXSharp.Connector.IPlain - { - public using_type_named_values() - { - } - - public UInt16 LColors { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs deleted file mode 100644 index 14b70914..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial interface IGuard - { - } - } - - namespace Simatic.Ax.StateFramework - { - public partial class CompareGuardLint : AXSharp.Connector.IPlain, IGuard - { - public CompareGuardLint() - { - } - - public Int64 CompareToValue { get; set; } - public global::Simatic.Ax.StateFramework.Condition Condition { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs deleted file mode 100644 index 2c9aba9f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace TypeWithNameAttributes - { - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public TypeWithNameAttributes.Motor m { get; set; } = new TypeWithNameAttributes.Motor(); - public Int16 displacement { get; set; } - } - - public partial class NoAccessModifierClass : AXSharp.Connector.IPlain - { - public NoAccessModifierClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs deleted file mode 100644 index a68b5471..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace TypesWithPropertyAttributes - { - [AXSharp.Connector.AddedPropertiesAttribute("Description", @"Some added property name value")] - public partial class SomeAddedProperties : AXSharp.Connector.IPlain - { - public SomeAddedProperties() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Pocitadlo")] - public Int16 Counter { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs deleted file mode 100644 index 1ba9627a..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace units -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator)); - var resource = assembly.GetType("units.Resources.PlcStringResources"); - this.SetLocalizationResource(resource, assembly); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj deleted file mode 100644 index 2cb3c2ea..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - net10.0 - enable - enable - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs deleted file mode 100644 index 17dc6c6f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs +++ /dev/null @@ -1,181 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class unitsTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public ComplexForConfig Complex { get; } - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - [ReadOnce()] - public OnlinerWString myWSTRING_readOnce { get; } - - [ReadOnly()] - public OnlinerWString myWSTRING_readOnly { get; } - - [ReadOnce()] - public ComplexForConfig cReadOnce { get; } - - [ReadOnly()] - public ComplexForConfig cReadOnly { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] - public OnlinerInt Colorss { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] - public OnlinerULInt Colorsss { get; } - - [CompilerOmitsAttribute("POCO")] - public OnlinerBool _must_be_omitted_in_poco { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] - public OnlinerInt Colorss2 { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] - public OnlinerULInt Colorsss2 { get; } - public OnlinerBool MotorOn { get; } - public OnlinerInt MotorState { get; } - public Motor Motor1 { get; } - public Motor Motor2 { get; } - public struct1 s1 { get; } - public struct4 s4 { get; } - public SpecificMotorA mot1 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); - Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } - - public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - Complex = new ComplexForConfig(this.Connector, "", "Complex"); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); - myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); - myWSTRING_readOnce.MakeReadOnce(); - myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); - myWSTRING_readOnly.MakeReadOnly(); - cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); - cReadOnce.MakeReadOnce(); - cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); - cReadOnly.MakeReadOnly(); - Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); - Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); - _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); - Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); - Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); - MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); - MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); - Motor1 = new Motor(this.Connector, "", "Motor1"); - Motor2 = new Motor(this.Connector, "", "Motor2"); - s1 = new struct1(this.Connector, "", "s1"); - s4 = new struct4(this.Connector, "", "s4"); - mot1 = new SpecificMotorA(this.Connector, "", "mot1"); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs deleted file mode 100644 index 0e57b992..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class AbstractMotor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - public OnlinerBool ReverseDirection { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) - { - Run.Shadow = plain.Run; - ReverseDirection.Shadow = plain.ReverseDirection; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - if (plain.ReverseDirection != ReverseDirection.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.AbstractMotor CreateEmptyPoco() - { - return new global::Pocos.AbstractMotor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs deleted file mode 100644 index 49415da1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs +++ /dev/null @@ -1,462 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ArrayDeclarationSimpleNamespace -{ - public partial class array_declaration_class : AXSharp.Connector.ITwinObject - { - public OnlinerInt[] primitive { get; } - public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public array_declaration_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - primitive = new OnlinerInt[100]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(primitive, this, "primitive", "primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateINT(p, rt, st), new[] { (1, 100) }); - complex = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, this, "complex", "complex", (p, rt, st) => new ArrayDeclarationSimpleNamespace.some_complex_type(p, rt, st), new[] { (1, 100) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - await this.ReadAsync(priority); - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - plain.primitive = primitive.Select(p => p.LastValue).ToArray(); -#pragma warning disable CS0612 - plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, eAccessPriority priority = eAccessPriority.Normal) - { - var _primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var _complex_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - var _primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var _complex_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - plain.primitive = primitive.Select(p => p.Shadow).ToArray(); - plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - plain.primitive = primitive.Select(p => p.Shadow).ToArray(); - plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) - { - var _primitive_i_FE8484DAB3 = 0; - primitive.Select(p => p.Shadow = plain.primitive[_primitive_i_FE8484DAB3++]).ToArray(); - var _complex_i_FE8484DAB3 = 0; - complex.Select(p => p.PlainToShadowAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.primitive.Length; i760901_3001_mimi++) - { - if (latest.primitive.ElementAt(i760901_3001_mimi) != plain.primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.complex.Length; i760901_3001_mimi++) - { - if (await complex.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain.complex[i760901_3001_mimi], latest.complex[i760901_3001_mimi])) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class CreateEmptyPoco() - { - return new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class some_complex_type : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public some_complex_type(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type CreateEmptyPoco() - { - return new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs deleted file mode 100644 index 36c26531..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs +++ /dev/null @@ -1,558 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class class_all_primitives : AXSharp.Connector.ITwinObject -{ - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.class_all_primitives plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.class_all_primitives plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.class_all_primitives plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.class_all_primitives plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives plain, global::Pocos.class_all_primitives latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.class_all_primitives CreateEmptyPoco() - { - return new global::Pocos.class_all_primitives(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs deleted file mode 100644 index 41bd6829..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs +++ /dev/null @@ -1,373 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public State1Transition(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, global::Pocos.Simatic.Ax.StateFramework.State1Transition latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Simatic.Ax.StateFramework.State1Transition CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); - } - } -} - -namespace Simatic.Ax.StateFramework -{ - public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable - { - public OnlinerInt StateID { get; } - public OnlinerString StateName { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); - StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - await this.ReadAsync(priority); - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - plain.StateID = StateID.LastValue; - plain.StateName = StateName.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - StateID.LethargicWrite(plain.StateID); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - StateName.LethargicWrite(plain.StateName); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { -#pragma warning disable CS0612 - StateID.LethargicWrite(plain.StateID); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - StateName.LethargicWrite(plain.StateName); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - plain.StateID = StateID.Shadow; - plain.StateName = StateName.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - plain.StateID = StateID.Shadow; - plain.StateName = StateName.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) - { - StateID.Shadow = plain.StateID; - StateName.Shadow = plain.StateName; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, global::Pocos.Simatic.Ax.StateFramework.AbstractState latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.StateID != StateID.LastValue) - somethingChanged = true; - if (plain.StateName != StateName.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.AbstractState CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs deleted file mode 100644 index ae98b0e0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs +++ /dev/null @@ -1,334 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Extended : Extendee -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extended(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Extended plain = new global::Pocos.Extended(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Extended plain = new global::Pocos.Extended(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extended plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Extended plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Extended plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Extended plain = new global::Pocos.Extended(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Extended plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Extended plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Extended plain, global::Pocos.Extended latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Extended CreateEmptyPoco() - { - return new global::Pocos.Extended(); - } -} - -public partial class Extendee : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extendee plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Extendee plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Extendee plain = new global::Pocos.Extendee(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Extendee plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Extendee plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Extendee plain, global::Pocos.Extendee latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Extendee CreateEmptyPoco() - { - return new global::Pocos.Extendee(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs deleted file mode 100644 index 2f519df4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs +++ /dev/null @@ -1,342 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, IImplementation1, IImplementation2 -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendsAndImplements plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendsAndImplements plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExtendsAndImplements plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExtendsAndImplements plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.ExtendsAndImplements plain, global::Pocos.ExtendsAndImplements latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.ExtendsAndImplements CreateEmptyPoco() - { - return new global::Pocos.ExtendsAndImplements(); - } -} - -public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ExtendeeExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExtendeeExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExtendeeExtendsAndImplements plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ExtendeeExtendsAndImplements plain, global::Pocos.ExtendeeExtendsAndImplements latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ExtendeeExtendsAndImplements CreateEmptyPoco() - { - return new global::Pocos.ExtendeeExtendsAndImplements(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IImplementation1 -{ -} - -public partial interface IImplementation2 -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs deleted file mode 100644 index 6f1bf375..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs +++ /dev/null @@ -1,733 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Generics -{ - public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extender plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extender plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extender plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extender plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extender plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extender plain, global::Pocos.Generics.Extender latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Generics.Extender CreateEmptyPoco() - { - return new global::Pocos.Generics.Extender(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Extendee : Generics.Extender - { - public Generics.SomeType SomeType { get; } - public Generics.SomeType SomeTypeAsPoco { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); - SomeTypeAsPoco = new Generics.SomeType(this, "SomeTypeAsPoco", "SomeTypeAsPoco"); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeType.PlainToShadowAsync(plain.SomeType); - await this.SomeTypeAsPoco.PlainToShadowAsync(plain.SomeTypeAsPoco); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee plain, global::Pocos.Generics.Extendee latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) - somethingChanged = true; - if (await SomeTypeAsPoco.DetectsAnyChangeAsync(plain.SomeTypeAsPoco, latest.SomeTypeAsPoco)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Generics.Extendee CreateEmptyPoco() - { - return new global::Pocos.Generics.Extendee(); - } - } - - public partial class Extendee2 : Generics.Extender - { - public Generics.SomeType SomeType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee2 plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee2 plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee2 plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeType = await SomeType.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee2 plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeType.PlainToShadowAsync(plain.SomeType); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee2 plain, global::Pocos.Generics.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.Generics.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.Generics.Extendee2(); - } - } - - public partial class SomeType : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeType(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.SomeType plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Generics.SomeType plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.SomeType plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Generics.SomeType plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Generics.SomeType plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Generics.SomeType plain, global::Pocos.Generics.SomeType latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Generics.SomeType CreateEmptyPoco() - { - return new global::Pocos.Generics.SomeType(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs deleted file mode 100644 index ee0cb2ce..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class _NULL_CONTEXT : AXSharp.Connector.ITwinObject, IContext -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public _NULL_CONTEXT(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT plain, global::Pocos._NULL_CONTEXT latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos._NULL_CONTEXT CreateEmptyPoco() - { - return new global::Pocos._NULL_CONTEXT(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IContext -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs deleted file mode 100644 index 95d287ca..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.ITwinObject, IContext_Multiple, IObject_Multiple -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public _NULL_CONTEXT_MULTIPLE(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, global::Pocos._NULL_CONTEXT_MULTIPLE latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos._NULL_CONTEXT_MULTIPLE CreateEmptyPoco() - { - return new global::Pocos._NULL_CONTEXT_MULTIPLE(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial interface IContext_Multiple -{ -} - -public partial interface IObject_Multiple -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs deleted file mode 100644 index 4125361e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -internal partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypes plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypes plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypes plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypes plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs deleted file mode 100644 index 2d2272b1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.NoAccessModifierClass plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.NoAccessModifierClass plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.NoAccessModifierClass plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.NoAccessModifierClass plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.NoAccessModifierClass plain, global::Pocos.NoAccessModifierClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.NoAccessModifierClass CreateEmptyPoco() - { - return new global::Pocos.NoAccessModifierClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs deleted file mode 100644 index d423ae31..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithComplexTypesNamespace -{ - public partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject - { - public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithComplexTypesNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs deleted file mode 100644 index aced06ee..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithNonTraspilableMemberssNamespace -{ - public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.ITwinObject - { - public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithNonTraspilableMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers CreateEmptyPoco() - { - return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs deleted file mode 100644 index 383d092d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs +++ /dev/null @@ -1,432 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithPragmasNamespace -{ - [Container(Layout.Stack)] - public partial class ClassWithPragmas : AXSharp.Connector.ITwinObject - { - [Container(Layout.Wrap)] - public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithPragmas(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myComplexType = new ClassWithPragmasNamespace.ComplexType1(this, "myComplexType", "myComplexType"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { -#pragma warning disable CS0612 - plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { -#pragma warning disable CS0612 - await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { - plain.myComplexType = await myComplexType.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) - { - await this.myComplexType.PlainToShadowAsync(plain.myComplexType); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas CreateEmptyPoco() - { - return new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexType1 : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, global::Pocos.ClassWithPragmasNamespace.ComplexType1 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPragmasNamespace.ComplexType1 CreateEmptyPoco() - { - return new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs deleted file mode 100644 index 279c7fb4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs +++ /dev/null @@ -1,641 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace ClassWithPrimitiveTypesNamespace -{ - public partial class ClassWithPrimitiveTypes : AXSharp.Connector.ITwinObject - { - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myLDATE.Shadow = plain.myLDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; - myCHAR.Shadow = plain.myCHAR; - myWCHAR.Shadow = plain.myWCHAR; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myLDATE != myLDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myCHAR != myCHAR.LastValue) - somethingChanged = true; - if (plain.myWCHAR != myWCHAR.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes CreateEmptyPoco() - { - return new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs deleted file mode 100644 index 41fa3c4c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; -using SimpleFirstLevelNamespace; -using SimpleQualifiedNamespace.Qualified; -using HelloLevelOne.HelloLevelTwo; - -internal partial class ClassWithUsingDirectives : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithUsingDirectives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ClassWithUsingDirectives plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithUsingDirectives plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ClassWithUsingDirectives plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithUsingDirectives plain, global::Pocos.ClassWithUsingDirectives latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ClassWithUsingDirectives CreateEmptyPoco() - { - return new global::Pocos.ClassWithUsingDirectives(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -namespace SimpleFirstLevelNamespace -{ -} - -namespace SimpleQualifiedNamespace.Qualified -{ -} - -namespace HelloLevelOne -{ - namespace HelloLevelTwo - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs deleted file mode 100644 index b302f337..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs +++ /dev/null @@ -1,2122 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace CompilerOmmits -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - [CompilerOmitsAttribute("POCO")] - public CompilerOmmits.Complex _must_be_omitted_in_poco { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _must_be_omitted_in_poco = new CompilerOmmits.Complex(this, "_must_be_omitted_in_poco", "_must_be_omitted_in_poco"); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - await this.ReadAsync(priority); - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) - { - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, global::Pocos.CompilerOmmits.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.CompilerOmmits.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.CompilerOmmits.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.Complex plain, global::Pocos.CompilerOmmits.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.CompilerOmmits.Complex CreateEmptyPoco() - { - return new global::Pocos.CompilerOmmits.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace Enums -{ - public partial class ClassWithEnums : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] - public OnlinerInt colors { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] - public OnlinerString NamedValuesColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); - NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - await this.ReadAsync(priority); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) - { - colors.Shadow = (short)plain.colors; - NamedValuesColors.Shadow = plain.NamedValuesColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.colors != (Enums.Colors)latest.colors) - somethingChanged = true; - if (plain.NamedValuesColors != NamedValuesColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() - { - return new global::Pocos.Enums.ClassWithEnums(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public enum Colors - { - Red, - Green, - Blue - } - - public enum NamedValuesColors : String - { - Red = 49, - Green = 50, - Blue = 51 - } -} - -namespace misc -{ - public partial class VariousMembers : AXSharp.Connector.ITwinObject - { - public misc.SomeClass _SomeClass { get; } - public misc.Motor _Motor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); - _Motor = new misc.Motor(this, "_Motor", "_Motor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) - { - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) - { - await this._SomeClass.PlainToShadowAsync(plain._SomeClass); - await this._Motor.PlainToShadowAsync(plain._Motor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) - somethingChanged = true; - if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.VariousMembers CreateEmptyPoco() - { - return new global::Pocos.misc.VariousMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeClass : AXSharp.Connector.ITwinObject - { - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.SomeClass CreateEmptyPoco() - { - return new global::Pocos.misc.SomeClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Motor CreateEmptyPoco() - { - return new global::Pocos.misc.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public misc.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new misc.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Vehicle CreateEmptyPoco() - { - return new global::Pocos.misc.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace UnknownArraysShouldNotBeTraspiled -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; - _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) - { - if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs deleted file mode 100644 index bf55ab8e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs +++ /dev/null @@ -1,1124 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class ComplexForConfig : AXSharp.Connector.ITwinObject -{ - public OnlinerBool myBOOL { get; } - public OnlinerByte myBYTE { get; } - public OnlinerWord myWORD { get; } - public OnlinerDWord myDWORD { get; } - public OnlinerLWord myLWORD { get; } - public OnlinerSInt mySINT { get; } - public OnlinerInt myINT { get; } - public OnlinerDInt myDINT { get; } - public OnlinerLInt myLINT { get; } - public OnlinerUSInt myUSINT { get; } - public OnlinerUInt myUINT { get; } - public OnlinerUDInt myUDINT { get; } - public OnlinerULInt myULINT { get; } - public OnlinerReal myREAL { get; } - public OnlinerLReal myLREAL { get; } - public OnlinerTime myTIME { get; } - public OnlinerLTime myLTIME { get; } - public OnlinerDate myDATE { get; } - public OnlinerDate myLDATE { get; } - public OnlinerTimeOfDay myTIME_OF_DAY { get; } - public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } - public OnlinerDateTime myDATE_AND_TIME { get; } - public OnlinerLDateTime myLDATE_AND_TIME { get; } - public OnlinerChar myCHAR { get; } - public OnlinerWChar myWCHAR { get; } - public OnlinerString mySTRING { get; } - public OnlinerWString myWSTRING { get; } - public Motor myMotor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); - myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); - myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); - myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); - myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); - mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); - myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); - myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); - myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); - myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); - myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); - myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); - myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); - myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); - myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); - myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); - myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); - myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); - myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); - myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); - myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); - myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); - myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); - myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); - myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); - mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); - myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); - myMotor = new Motor(this, "myMotor", "myMotor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - await this.ReadAsync(priority); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ComplexForConfig plain) - { - plain.myBOOL = myBOOL.LastValue; - plain.myBYTE = myBYTE.LastValue; - plain.myWORD = myWORD.LastValue; - plain.myDWORD = myDWORD.LastValue; - plain.myLWORD = myLWORD.LastValue; - plain.mySINT = mySINT.LastValue; - plain.myINT = myINT.LastValue; - plain.myDINT = myDINT.LastValue; - plain.myLINT = myLINT.LastValue; - plain.myUSINT = myUSINT.LastValue; - plain.myUINT = myUINT.LastValue; - plain.myUDINT = myUDINT.LastValue; - plain.myULINT = myULINT.LastValue; - plain.myREAL = myREAL.LastValue; - plain.myLREAL = myLREAL.LastValue; - plain.myTIME = myTIME.LastValue; - plain.myLTIME = myLTIME.LastValue; - plain.myDATE = myDATE.LastValue; - plain.myLDATE = myLDATE.LastValue; - plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; - plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; - plain.myCHAR = myCHAR.LastValue; - plain.myWCHAR = myWCHAR.LastValue; - plain.mySTRING = mySTRING.LastValue; - plain.myWSTRING = myWSTRING.LastValue; -#pragma warning disable CS0612 - plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ComplexForConfig plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ComplexForConfig plain) - { -#pragma warning disable CS0612 - myBOOL.LethargicWrite(plain.myBOOL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myBYTE.LethargicWrite(plain.myBYTE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWORD.LethargicWrite(plain.myWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDWORD.LethargicWrite(plain.myDWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLWORD.LethargicWrite(plain.myLWORD); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySINT.LethargicWrite(plain.mySINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myINT.LethargicWrite(plain.myINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDINT.LethargicWrite(plain.myDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLINT.LethargicWrite(plain.myLINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUSINT.LethargicWrite(plain.myUSINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUINT.LethargicWrite(plain.myUINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myUDINT.LethargicWrite(plain.myUDINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myULINT.LethargicWrite(plain.myULINT); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myREAL.LethargicWrite(plain.myREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLREAL.LethargicWrite(plain.myLREAL); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME.LethargicWrite(plain.myTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME.LethargicWrite(plain.myLTIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE.LethargicWrite(plain.myDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE.LethargicWrite(plain.myLDATE); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myCHAR.LethargicWrite(plain.myCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWCHAR.LethargicWrite(plain.myWCHAR); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - mySTRING.LethargicWrite(plain.mySTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - myWSTRING.LethargicWrite(plain.myWSTRING); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - plain.myMotor = await myMotor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ComplexForConfig plain) - { - plain.myBOOL = myBOOL.Shadow; - plain.myBYTE = myBYTE.Shadow; - plain.myWORD = myWORD.Shadow; - plain.myDWORD = myDWORD.Shadow; - plain.myLWORD = myLWORD.Shadow; - plain.mySINT = mySINT.Shadow; - plain.myINT = myINT.Shadow; - plain.myDINT = myDINT.Shadow; - plain.myLINT = myLINT.Shadow; - plain.myUSINT = myUSINT.Shadow; - plain.myUINT = myUINT.Shadow; - plain.myUDINT = myUDINT.Shadow; - plain.myULINT = myULINT.Shadow; - plain.myREAL = myREAL.Shadow; - plain.myLREAL = myLREAL.Shadow; - plain.myTIME = myTIME.Shadow; - plain.myLTIME = myLTIME.Shadow; - plain.myDATE = myDATE.Shadow; - plain.myLDATE = myLDATE.Shadow; - plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; - plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; - plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; - plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; - plain.myCHAR = myCHAR.Shadow; - plain.myWCHAR = myWCHAR.Shadow; - plain.mySTRING = mySTRING.Shadow; - plain.myWSTRING = myWSTRING.Shadow; - plain.myMotor = await myMotor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ComplexForConfig plain) - { - myBOOL.Shadow = plain.myBOOL; - myBYTE.Shadow = plain.myBYTE; - myWORD.Shadow = plain.myWORD; - myDWORD.Shadow = plain.myDWORD; - myLWORD.Shadow = plain.myLWORD; - mySINT.Shadow = plain.mySINT; - myINT.Shadow = plain.myINT; - myDINT.Shadow = plain.myDINT; - myLINT.Shadow = plain.myLINT; - myUSINT.Shadow = plain.myUSINT; - myUINT.Shadow = plain.myUINT; - myUDINT.Shadow = plain.myUDINT; - myULINT.Shadow = plain.myULINT; - myREAL.Shadow = plain.myREAL; - myLREAL.Shadow = plain.myLREAL; - myTIME.Shadow = plain.myTIME; - myLTIME.Shadow = plain.myLTIME; - myDATE.Shadow = plain.myDATE; - myLDATE.Shadow = plain.myLDATE; - myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; - myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; - myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; - myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; - myCHAR.Shadow = plain.myCHAR; - myWCHAR.Shadow = plain.myWCHAR; - mySTRING.Shadow = plain.mySTRING; - myWSTRING.Shadow = plain.myWSTRING; - await this.myMotor.PlainToShadowAsync(plain.myMotor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ComplexForConfig plain, global::Pocos.ComplexForConfig latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.myBOOL != myBOOL.LastValue) - somethingChanged = true; - if (plain.myBYTE != myBYTE.LastValue) - somethingChanged = true; - if (plain.myWORD != myWORD.LastValue) - somethingChanged = true; - if (plain.myDWORD != myDWORD.LastValue) - somethingChanged = true; - if (plain.myLWORD != myLWORD.LastValue) - somethingChanged = true; - if (plain.mySINT != mySINT.LastValue) - somethingChanged = true; - if (plain.myINT != myINT.LastValue) - somethingChanged = true; - if (plain.myDINT != myDINT.LastValue) - somethingChanged = true; - if (plain.myLINT != myLINT.LastValue) - somethingChanged = true; - if (plain.myUSINT != myUSINT.LastValue) - somethingChanged = true; - if (plain.myUINT != myUINT.LastValue) - somethingChanged = true; - if (plain.myUDINT != myUDINT.LastValue) - somethingChanged = true; - if (plain.myULINT != myULINT.LastValue) - somethingChanged = true; - if (plain.myREAL != myREAL.LastValue) - somethingChanged = true; - if (plain.myLREAL != myLREAL.LastValue) - somethingChanged = true; - if (plain.myTIME != myTIME.LastValue) - somethingChanged = true; - if (plain.myLTIME != myLTIME.LastValue) - somethingChanged = true; - if (plain.myDATE != myDATE.LastValue) - somethingChanged = true; - if (plain.myLDATE != myLDATE.LastValue) - somethingChanged = true; - if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) - somethingChanged = true; - if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) - somethingChanged = true; - if (plain.myCHAR != myCHAR.LastValue) - somethingChanged = true; - if (plain.myWCHAR != myWCHAR.LastValue) - somethingChanged = true; - if (plain.mySTRING != mySTRING.LastValue) - somethingChanged = true; - if (plain.myWSTRING != myWSTRING.LastValue) - somethingChanged = true; - if (await myMotor.DetectsAnyChangeAsync(plain.myMotor, latest.myMotor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ComplexForConfig CreateEmptyPoco() - { - return new global::Pocos.ComplexForConfig(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public enum Colorss -{ - Red, - Green, - Blue -} - -public enum Colorsss : UInt64 -{ - Red = 1, - Green = 2, - Blue = 3 -} - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class Vehicle : AXSharp.Connector.ITwinObject -{ - public Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Vehicle CreateEmptyPoco() - { - return new global::Pocos.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs deleted file mode 100644 index e509210f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public enum Colors -{ - Red, - Green, - Blue -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs deleted file mode 100644 index 7b8ffd8e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Unsupported -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs deleted file mode 100644 index 56f39f28..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs +++ /dev/null @@ -1,820 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; -using FileWithUsingsSimpleFirstLevelNamespace; -using FileWithUsingsSimpleQualifiedNamespace.Qualified; -using FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; - -namespace FileWithUsingsSimpleFirstLevelNamespace -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace FileWithUsingsSimpleQualifiedNamespace.Qualified -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace FileWithUsingsHelloLevelOne -{ - namespace FileWithUsingsHelloLevelTwo - { - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello CreateEmptyPoco() - { - return new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - } -} - -namespace ExampleNamespace -{ - public partial class Hello : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.ExampleNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.ExampleNamespace.Hello plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.ExampleNamespace.Hello plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.ExampleNamespace.Hello plain, global::Pocos.ExampleNamespace.Hello latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.ExampleNamespace.Hello CreateEmptyPoco() - { - return new global::Pocos.ExampleNamespace.Hello(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs deleted file mode 100644 index 2e4106be..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs +++ /dev/null @@ -1,595 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace GenericsTests -{ - public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extender plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extender plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extender plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extender plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extender plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extender plain, global::Pocos.GenericsTests.Extender latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.GenericsTests.Extender CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.Extender(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeTypeToBeGeneric : AXSharp.Connector.ITwinObject - { - public OnlinerBool Boolean { get; } - public OnlinerInt Cele { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeTypeToBeGeneric(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Boolean = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Boolean", "Boolean"); - Cele = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Cele", "Cele"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - await this.ReadAsync(priority); - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - plain.Boolean = Boolean.LastValue; - plain.Cele = Cele.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Boolean.LethargicWrite(plain.Boolean); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Cele.LethargicWrite(plain.Cele); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { -#pragma warning disable CS0612 - Boolean.LethargicWrite(plain.Boolean); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Cele.LethargicWrite(plain.Cele); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - plain.Boolean = Boolean.Shadow; - plain.Cele = Cele.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - plain.Boolean = Boolean.Shadow; - plain.Cele = Cele.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) - { - Boolean.Shadow = plain.Boolean; - Cele.Shadow = plain.Cele; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, global::Pocos.GenericsTests.SomeTypeToBeGeneric latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Boolean != Boolean.LastValue) - somethingChanged = true; - if (plain.Cele != Cele.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.GenericsTests.SomeTypeToBeGeneric CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Extendee2 : GenericsTests.Extender - { - [AXOpen.Data.AxoDataEntityAttribute] - [Container(Layout.Stack)] - public GenericsTests.SomeTypeToBeGeneric SomeData { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - SomeData = new GenericsTests.SomeTypeToBeGeneric(this, "Shared Header", "SomeData"); - SomeData.AttributeName = @"Shared Header"; - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base._PlainToOnlineNoacAsync(plain); -#pragma warning disable CS0612 - await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); -#pragma warning restore CS0612 - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); - await base.ShadowToPlainAsync(plain); - plain.SomeData = await SomeData.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base.ShadowToPlainAsync(plain); - plain.SomeData = await SomeData.ShadowToPlainAsync(); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extendee2 plain) - { - await base.PlainToShadowAsync(plain); - await this.SomeData.PlainToShadowAsync(plain.SomeData); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extendee2 plain, global::Pocos.GenericsTests.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - if (await SomeData.DetectsAnyChangeAsync(plain.SomeData, latest.SomeData)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.GenericsTests.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.GenericsTests.Extendee2(); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs deleted file mode 100644 index 54dfa84f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs +++ /dev/null @@ -1,522 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace makereadonce -{ - public partial class MembersWithMakeReadOnce : AXSharp.Connector.ITwinObject - { - [ReadOnce()] - public OnlinerString makeReadOnceMember { get; } - public OnlinerString someOtherMember { get; } - - [ReadOnce()] - public makereadonce.ComplexMember makeReadComplexMember { get; } - public makereadonce.ComplexMember someotherComplexMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); - makeReadOnceMember.MakeReadOnce(); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); - makeReadComplexMember.MakeReadOnce(); - someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - await this.ReadAsync(priority); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) - { - makeReadOnceMember.Shadow = plain.makeReadOnceMember; - someOtherMember.Shadow = plain.someOtherMember; - await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); - await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, global::Pocos.makereadonce.MembersWithMakeReadOnce latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) - somethingChanged = true; - if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonce.MembersWithMakeReadOnce CreateEmptyPoco() - { - return new global::Pocos.makereadonce.MembersWithMakeReadOnce(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexMember : AXSharp.Connector.ITwinObject - { - public OnlinerString someMember { get; } - public OnlinerString someOtherMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - await this.ReadAsync(priority); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.ComplexMember plain) - { - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.ComplexMember plain) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.ComplexMember plain) - { - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonce.ComplexMember plain) - { - someMember.Shadow = plain.someMember; - someOtherMember.Shadow = plain.someOtherMember; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.ComplexMember plain, global::Pocos.makereadonce.ComplexMember latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.someMember != someMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonce.ComplexMember CreateEmptyPoco() - { - return new global::Pocos.makereadonce.ComplexMember(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs deleted file mode 100644 index f33dd211..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs +++ /dev/null @@ -1,522 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace makereadonly -{ - public partial class MembersWithMakeReadOnly : AXSharp.Connector.ITwinObject - { - [ReadOnly()] - public OnlinerString makeReadOnceMember { get; } - public OnlinerString someOtherMember { get; } - - [ReadOnly()] - public makereadonly.ComplexMember makeReadComplexMember { get; } - public makereadonly.ComplexMember someotherComplexMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); - makeReadOnceMember.MakeReadOnly(); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); - makeReadComplexMember.MakeReadOnly(); - someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - await this.ReadAsync(priority); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - plain.makeReadOnceMember = makeReadOnceMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; -#pragma warning disable CS0612 - plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { -#pragma warning disable CS0612 - makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - plain.makeReadOnceMember = makeReadOnceMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); - plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) - { - makeReadOnceMember.Shadow = plain.makeReadOnceMember; - someOtherMember.Shadow = plain.someOtherMember; - await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); - await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, global::Pocos.makereadonly.MembersWithMakeReadOnly latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) - somethingChanged = true; - if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonly.MembersWithMakeReadOnly CreateEmptyPoco() - { - return new global::Pocos.makereadonly.MembersWithMakeReadOnly(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class ComplexMember : AXSharp.Connector.ITwinObject - { - public OnlinerString someMember { get; } - public OnlinerString someOtherMember { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); - someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - await this.ReadAsync(priority); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.ComplexMember plain) - { - plain.someMember = someMember.LastValue; - plain.someOtherMember = someOtherMember.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.ComplexMember plain) - { -#pragma warning disable CS0612 - someMember.LethargicWrite(plain.someMember); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - someOtherMember.LethargicWrite(plain.someOtherMember); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.ComplexMember plain) - { - plain.someMember = someMember.Shadow; - plain.someOtherMember = someOtherMember.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.makereadonly.ComplexMember plain) - { - someMember.Shadow = plain.someMember; - someOtherMember.Shadow = plain.someOtherMember; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.ComplexMember plain, global::Pocos.makereadonly.ComplexMember latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.someMember != someMember.LastValue) - somethingChanged = true; - if (plain.someOtherMember != someOtherMember.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.makereadonly.ComplexMember CreateEmptyPoco() - { - return new global::Pocos.makereadonly.ComplexMember(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs deleted file mode 100644 index 0ad24a32..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs +++ /dev/null @@ -1,1660 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Enums -{ - public partial class ClassWithEnums : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] - public OnlinerInt colors { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] - public OnlinerString NamedValuesColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); - NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - await this.ReadAsync(priority); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.LastValue; - plain.NamedValuesColors = NamedValuesColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) - { -#pragma warning disable CS0612 - colors.LethargicWrite((short)plain.colors); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - NamedValuesColors.LethargicWrite(plain.NamedValuesColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) - { - plain.colors = (Enums.Colors)colors.Shadow; - plain.NamedValuesColors = NamedValuesColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) - { - colors.Shadow = (short)plain.colors; - NamedValuesColors.Shadow = plain.NamedValuesColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.colors != (Enums.Colors)latest.colors) - somethingChanged = true; - if (plain.NamedValuesColors != NamedValuesColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() - { - return new global::Pocos.Enums.ClassWithEnums(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public enum Colors - { - Red, - Green, - Blue - } - - public enum NamedValuesColors : String - { - Red = 49, - Green = 50, - Blue = 51 - } -} - -namespace misc -{ - public partial class VariousMembers : AXSharp.Connector.ITwinObject - { - public misc.SomeClass _SomeClass { get; } - public misc.Motor _Motor { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); - _Motor = new misc.Motor(this, "_Motor", "_Motor"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - plain._Motor = await _Motor._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) - { -#pragma warning disable CS0612 - await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - await this._Motor._PlainToOnlineNoacAsync(plain._Motor); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) - { - plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); - plain._Motor = await _Motor.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) - { - await this._SomeClass.PlainToShadowAsync(plain._SomeClass); - await this._Motor.PlainToShadowAsync(plain._Motor); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) - somethingChanged = true; - if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.VariousMembers CreateEmptyPoco() - { - return new global::Pocos.misc.VariousMembers(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class SomeClass : AXSharp.Connector.ITwinObject - { - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.SomeClass CreateEmptyPoco() - { - return new global::Pocos.misc.SomeClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Motor CreateEmptyPoco() - { - return new global::Pocos.misc.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public misc.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new misc.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.misc.Vehicle CreateEmptyPoco() - { - return new global::Pocos.misc.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} - -namespace UnknownArraysShouldNotBeTraspiled -{ - public partial class ClassWithArrays : AXSharp.Connector.ITwinObject - { - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } - public OnlinerByte[] _primitive { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); - _primitive = new OnlinerByte[11]; - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { -#pragma warning disable CS0612 - plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); -#pragma warning restore CS0612 - plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - var __primitive_i_FE8484DAB3 = 0; -#pragma warning disable CS0612 - _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); - plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) - { - var __complexKnown_i_FE8484DAB3 = 0; - _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); - var __primitive_i_FE8484DAB3 = 0; - _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) - { - if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) - somethingChanged = true; - } - - for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) - { - if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) - somethingChanged = true; - } - - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Complex : AXSharp.Connector.ITwinObject - { - public OnlinerString HelloString { get; } - public OnlinerULInt Id { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); - Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - await this.ReadAsync(priority); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.LastValue; - plain.Id = Id.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { -#pragma warning disable CS0612 - HelloString.LethargicWrite(plain.HelloString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Id.LethargicWrite(plain.Id); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - plain.HelloString = HelloString.Shadow; - plain.Id = Id.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) - { - HelloString.Shadow = plain.HelloString; - Id.Shadow = plain.Id; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.HelloString != HelloString.LastValue) - somethingChanged = true; - if (plain.Id != Id.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() - { - return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs deleted file mode 100644 index 07e927da..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs +++ /dev/null @@ -1,1586 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.Run = Run.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Motor plain) - { - plain.Run = Run.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.Run = Run.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.Run = Run.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - Run.Shadow = plain.Run; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct1 : AXSharp.Connector.ITwinObject -{ - public struct2 s2 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s2 = new struct2(this, "s2", "s2"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct1 plain) - { -#pragma warning disable CS0612 - plain.s2 = await s2._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct1 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s2._PlainToOnlineNoacAsync(plain.s2); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct1 plain) - { -#pragma warning disable CS0612 - await this.s2._PlainToOnlineNoacAsync(plain.s2); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct1 plain = new global::Pocos.struct1(); - plain.s2 = await s2.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct1 plain) - { - plain.s2 = await s2.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct1 plain) - { - await this.s2.PlainToShadowAsync(plain.s2); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct1 plain, global::Pocos.struct1 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s2.DetectsAnyChangeAsync(plain.s2, latest.s2)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct1 CreateEmptyPoco() - { - return new global::Pocos.struct1(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct2 : AXSharp.Connector.ITwinObject -{ - public struct3 s3 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s3 = new struct3(this, "s3", "s3"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct2 plain) - { -#pragma warning disable CS0612 - plain.s3 = await s3._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct2 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s3._PlainToOnlineNoacAsync(plain.s3); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct2 plain) - { -#pragma warning disable CS0612 - await this.s3._PlainToOnlineNoacAsync(plain.s3); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct2 plain = new global::Pocos.struct2(); - plain.s3 = await s3.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct2 plain) - { - plain.s3 = await s3.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct2 plain) - { - await this.s3.PlainToShadowAsync(plain.s3); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct2 plain, global::Pocos.struct2 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s3.DetectsAnyChangeAsync(plain.s3, latest.s3)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct2 CreateEmptyPoco() - { - return new global::Pocos.struct2(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct3 : AXSharp.Connector.ITwinObject -{ - public struct4 s4 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct3(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s4 = new struct4(this, "s4", "s4"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct3 plain) - { -#pragma warning disable CS0612 - plain.s4 = await s4._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct3 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.s4._PlainToOnlineNoacAsync(plain.s4); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct3 plain) - { -#pragma warning disable CS0612 - await this.s4._PlainToOnlineNoacAsync(plain.s4); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct3 plain = new global::Pocos.struct3(); - plain.s4 = await s4.ShadowToPlainAsync(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct3 plain) - { - plain.s4 = await s4.ShadowToPlainAsync(); - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct3 plain) - { - await this.s4.PlainToShadowAsync(plain.s4); - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct3 plain, global::Pocos.struct3 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await s4.DetectsAnyChangeAsync(plain.s4, latest.s4)) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct3 CreateEmptyPoco() - { - return new global::Pocos.struct3(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class struct4 : AXSharp.Connector.ITwinObject -{ - public OnlinerInt s5 { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public struct4(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - s5 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "s5", "s5"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - await this.ReadAsync(priority); - plain.s5 = s5.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - plain.s5 = s5.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.struct4 plain) - { - plain.s5 = s5.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.struct4 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - s5.LethargicWrite(plain.s5); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.struct4 plain) - { -#pragma warning disable CS0612 - s5.LethargicWrite(plain.s5); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.struct4 plain = new global::Pocos.struct4(); - plain.s5 = s5.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.struct4 plain) - { - plain.s5 = s5.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.struct4 plain) - { - s5.Shadow = plain.s5; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.struct4 plain, global::Pocos.struct4 latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.s5 != s5.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.struct4 CreateEmptyPoco() - { - return new global::Pocos.struct4(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class AbstractMotor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool Run { get; } - public OnlinerBool ReverseDirection { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); - ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - await this.ReadAsync(priority); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.LastValue; - plain.ReverseDirection = ReverseDirection.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) - { -#pragma warning disable CS0612 - Run.LethargicWrite(plain.Run); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - ReverseDirection.LethargicWrite(plain.ReverseDirection); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) - { - plain.Run = Run.Shadow; - plain.ReverseDirection = ReverseDirection.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) - { - Run.Shadow = plain.Run; - ReverseDirection.Shadow = plain.ReverseDirection; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Run != Run.LastValue) - somethingChanged = true; - if (plain.ReverseDirection != ReverseDirection.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.AbstractMotor CreateEmptyPoco() - { - return new global::Pocos.AbstractMotor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class GenericMotor : AbstractMotor -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public GenericMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericMotor plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.GenericMotor plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericMotor plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.GenericMotor plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.GenericMotor plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.GenericMotor plain, global::Pocos.GenericMotor latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.GenericMotor CreateEmptyPoco() - { - return new global::Pocos.GenericMotor(); - } -} - -public partial class SpecificMotorA : GenericMotor -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SpecificMotorA(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - PostConstruct(parent, readableTail, symbolTail); - } - - public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public new async Task _OnlineToPlainNoacAsync() - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.SpecificMotorA plain) - { -#pragma warning disable CS0612 - await base._OnlineToPlainNoacAsync(plain); -#pragma warning restore CS0612 - return plain; - } - - public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.SpecificMotorA plain, eAccessPriority priority = eAccessPriority.Normal) - { - await base._PlainToOnlineNoacAsync(plain); - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.SpecificMotorA plain) - { - await base._PlainToOnlineNoacAsync(plain); - } - - public async override Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public new async Task ShadowToPlainAsync() - { - global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); - await base.ShadowToPlainAsync(plain); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.SpecificMotorA plain) - { - await base.ShadowToPlainAsync(plain); - return plain; - } - - public async override Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.SpecificMotorA plain) - { - await base.PlainToShadowAsync(plain); - return this.RetrievePrimitives(); - } - - /// - public async override Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public new async Task DetectsAnyChangeAsync(global::Pocos.SpecificMotorA plain, global::Pocos.SpecificMotorA latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (await base.DetectsAnyChangeAsync(plain)) - return true; - plain = latest; - return somethingChanged; - }); - } - - public new void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public new global::Pocos.SpecificMotorA CreateEmptyPoco() - { - return new global::Pocos.SpecificMotorA(); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs deleted file mode 100644 index 73d9d290..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace MultilinePragmas -{ - public partial class Extendee2 : AXSharp.Connector.ITwinObject - { - public OnlinerInt _messge { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - _messge = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "_messge", "_messge"); - _messge.PlcTextList = @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; - [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; - [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; - [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; - [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; - [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; - [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; - [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; - [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; - [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; - [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'"; - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - await this.ReadAsync(priority); - plain._messge = _messge.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - plain._messge = _messge.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - plain._messge = _messge.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.MultilinePragmas.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - _messge.LethargicWrite(plain._messge); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { -#pragma warning disable CS0612 - _messge.LethargicWrite(plain._messge); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); - plain._messge = _messge.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - plain._messge = _messge.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.MultilinePragmas.Extendee2 plain) - { - _messge.Shadow = plain._messge; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.MultilinePragmas.Extendee2 plain, global::Pocos.MultilinePragmas.Extendee2 latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain._messge != _messge.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.MultilinePragmas.Extendee2 CreateEmptyPoco() - { - return new global::Pocos.MultilinePragmas.Extendee2(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs deleted file mode 100644 index 44712577..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs +++ /dev/null @@ -1,424 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace RefToSimple -{ - public partial class ref_to_simple : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public ref_to_simple(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.ref_to_simple plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.ref_to_simple plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.ref_to_simple plain, global::Pocos.RefToSimple.ref_to_simple latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.RefToSimple.ref_to_simple CreateEmptyPoco() - { - return new global::Pocos.RefToSimple.ref_to_simple(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class referenced : AXSharp.Connector.ITwinObject - { - public OnlinerInt b { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public referenced(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - b = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "b", "b"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - await this.ReadAsync(priority); - plain.b = b.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - plain.b = b.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.referenced plain) - { - plain.b = b.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.referenced plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - b.LethargicWrite(plain.b); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.referenced plain) - { -#pragma warning disable CS0612 - b.LethargicWrite(plain.b); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); - plain.b = b.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.referenced plain) - { - plain.b = b.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.referenced plain) - { - b.Shadow = plain.b; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.referenced plain, global::Pocos.RefToSimple.referenced latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.b != b.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.RefToSimple.referenced CreateEmptyPoco() - { - return new global::Pocos.RefToSimple.referenced(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs deleted file mode 100644 index 9c0e8c99..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class simple_class : AXSharp.Connector.ITwinObject -{ - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public simple_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.simple_class plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.simple_class plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.simple_class plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.simple_class plain = new global::Pocos.simple_class(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.simple_class plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.simple_class plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.simple_class plain, global::Pocos.simple_class latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.simple_class CreateEmptyPoco() - { - return new global::Pocos.simple_class(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs deleted file mode 100644 index 35d2fc8b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace sampleNamespace -{ - public partial class simple_empty_class_within_namespace : AXSharp.Connector.ITwinObject - { - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public simple_empty_class_within_namespace(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - await this.ReadAsync(priority); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, eAccessPriority priority = eAccessPriority.Normal) - { - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) - { - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, global::Pocos.sampleNamespace.simple_empty_class_within_namespace latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.sampleNamespace.simple_empty_class_within_namespace CreateEmptyPoco() - { - return new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs deleted file mode 100644 index f316e620..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs +++ /dev/null @@ -1,456 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class Motor : AXSharp.Connector.ITwinObject -{ - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Motor plain = new global::Pocos.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Motor CreateEmptyPoco() - { - return new global::Pocos.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} - -public partial class Vehicle : AXSharp.Connector.ITwinObject -{ - public Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Vehicle CreateEmptyPoco() - { - return new global::Pocos.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs deleted file mode 100644 index 13a8bca3..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace NamedValuesNamespace -{ - public enum LightColors : Int16 - { - LRED = 12, - LGREEN = 14, - LBLUE = 23 - } - - public partial class using_type_named_values : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(NamedValuesNamespace.LightColors))] - public OnlinerInt LColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "LColors", "LColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - await this.ReadAsync(priority); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - plain.LColors = LColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); - plain.LColors = LColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - plain.LColors = LColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) - { - LColors.Shadow = plain.LColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, global::Pocos.NamedValuesNamespace.using_type_named_values latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.LColors != LColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.NamedValuesNamespace.using_type_named_values CreateEmptyPoco() - { - return new global::Pocos.NamedValuesNamespace.using_type_named_values(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs deleted file mode 100644 index 343ca703..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs +++ /dev/null @@ -1,235 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public enum StateControllerStatus : UInt16 - { - STATUS_NO_ERR = 28672, - STATUS_IS_RUNNING = 28673, - STATUS_STATE_CHANGED = 28674, - STATUS_NO_INITIALSTATE = 33024, - STATUS_NO_NEXTSTATE = 33025 - } - - public partial class using_type_named_values : AXSharp.Connector.ITwinObject - { - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.StateControllerStatus))] - public OnlinerWord LColors { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "LColors", "LColors"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - await this.ReadAsync(priority); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - plain.LColors = LColors.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - plain.LColors = LColors.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { -#pragma warning disable CS0612 - LColors.LethargicWrite(plain.LColors); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - plain.LColors = LColors.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - plain.LColors = LColors.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) - { - LColors.Shadow = plain.LColors; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, global::Pocos.Simatic.Ax.StateFramework.using_type_named_values latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.LColors != LColors.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.using_type_named_values CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs deleted file mode 100644 index 21d4caed..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace Simatic.Ax.StateFramework -{ - public partial interface IGuard - { - } -} - -namespace Simatic.Ax.StateFramework -{ - public enum Condition - { - GT, - EQ, - LT, - NE, - GE, - LE - } - - public partial class CompareGuardLint : AXSharp.Connector.ITwinObject, IGuard - { - public OnlinerLInt CompareToValue { get; } - - [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.Condition))] - public OnlinerInt Condition { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public CompareGuardLint(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - CompareToValue = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "CompareToValue", "CompareToValue"); - Condition = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Condition", "Condition"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - await this.ReadAsync(priority); - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - plain.CompareToValue = CompareToValue.LastValue; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - CompareToValue.LethargicWrite(plain.CompareToValue); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Condition.LethargicWrite((short)plain.Condition); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { -#pragma warning disable CS0612 - CompareToValue.LethargicWrite(plain.CompareToValue); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - Condition.LethargicWrite((short)plain.Condition); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - plain.CompareToValue = CompareToValue.Shadow; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - plain.CompareToValue = CompareToValue.Shadow; - plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) - { - CompareToValue.Shadow = plain.CompareToValue; - Condition.Shadow = (short)plain.Condition; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.CompareToValue != CompareToValue.LastValue) - somethingChanged = true; - if (plain.Condition != (Simatic.Ax.StateFramework.Condition)latest.Condition) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint CreateEmptyPoco() - { - return new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs deleted file mode 100644 index 687e6895..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs +++ /dev/null @@ -1,692 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace TypeWithNameAttributes -{ - [Container(Layout.Wrap)] - public partial class Motor : AXSharp.Connector.ITwinObject - { - public OnlinerBool isRunning { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - await this.ReadAsync(priority); - plain.isRunning = isRunning.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - plain.isRunning = isRunning.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - plain.isRunning = isRunning.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Motor plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { -#pragma warning disable CS0612 - isRunning.LethargicWrite(plain.isRunning); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); - plain.isRunning = isRunning.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - plain.isRunning = isRunning.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Motor plain) - { - isRunning.Shadow = plain.isRunning; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Motor plain, global::Pocos.TypeWithNameAttributes.Motor latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (plain.isRunning != isRunning.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.Motor CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.Motor(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class Vehicle : AXSharp.Connector.ITwinObject - { - public TypeWithNameAttributes.Motor m { get; } - public OnlinerInt displacement { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - PreConstruct(parent, readableTail, symbolTail); - m = new TypeWithNameAttributes.Motor(this, "m", "m"); - displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); - await this.ReadAsync(priority); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { -#pragma warning disable CS0612 - plain.m = await m._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 - plain.displacement = displacement.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { -#pragma warning disable CS0612 - await this.m._PlainToOnlineNoacAsync(plain.m); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - displacement.LethargicWrite(plain.displacement); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { - plain.m = await m.ShadowToPlainAsync(); - plain.displacement = displacement.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) - { - await this.m.PlainToShadowAsync(plain.m); - displacement.Shadow = plain.displacement; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, global::Pocos.TypeWithNameAttributes.Vehicle latest = null) - { - var somethingChanged = false; - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - return await Task.Run(async () => - { - if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) - somethingChanged = true; - if (plain.displacement != displacement.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.Vehicle CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.Vehicle(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } - - public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject - { - private string _AttributeName; - public string AttributeName { get => string.IsNullOrEmpty(_AttributeName) ? SymbolTail : _AttributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _AttributeName = value; } - - public string GetAttributeName(System.Globalization.CultureInfo culture) - { - return this.Translate(_AttributeName, culture).Interpolate(this); - } - - public string AttributeName_raw - { - get - { - return _AttributeName; - } - } - - public OnlinerString SomeClassVariable { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - await this.ReadAsync(priority); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - plain.SomeClassVariable = SomeClassVariable.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { -#pragma warning disable CS0612 - SomeClassVariable.LethargicWrite(plain.SomeClassVariable); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - plain.SomeClassVariable = SomeClassVariable.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) - { - SomeClassVariable.Shadow = plain.SomeClassVariable; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, global::Pocos.TypeWithNameAttributes.NoAccessModifierClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.SomeClassVariable != SomeClassVariable.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypeWithNameAttributes.NoAccessModifierClass CreateEmptyPoco() - { - return new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs deleted file mode 100644 index c9c7212d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs +++ /dev/null @@ -1,243 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace TypesWithPropertyAttributes -{ - public partial class SomeAddedProperties : AXSharp.Connector.ITwinObject - { - private string _Description; - public string Description { get => string.IsNullOrEmpty(_Description) ? SymbolTail : _Description.Interpolate(this).CleanUpLocalizationTokens(); set => _Description = value; } - - public string GetDescription(System.Globalization.CultureInfo culture) - { - return this.Translate(_Description, culture).Interpolate(this); - } - - public string Description_raw - { - get - { - return _Description; - } - } - - public OnlinerInt Counter { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public SomeAddedProperties(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Description = @"Some added property name value"; - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - Counter = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Pocitadlo", "Counter"); - Counter.AttributeName = @"Pocitadlo"; - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) - { - return await (dynamic)this.OnlineToPlainAsync(priority); - } - - public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - await this.ReadAsync(priority); - plain.Counter = Counter.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - plain.Counter = Counter.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - plain.Counter = Counter.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) - { - await this.PlainToOnlineAsync((dynamic)plain, priority); - } - - public async Task> PlainToOnlineAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, eAccessPriority priority = eAccessPriority.Normal) - { -#pragma warning disable CS0612 - Counter.LethargicWrite(plain.Counter); -#pragma warning restore CS0612 - return await this.WriteAsync(priority); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { -#pragma warning disable CS0612 - Counter.LethargicWrite(plain.Counter); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - plain.Counter = Counter.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - plain.Counter = Counter.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) - { - Counter.Shadow = plain.Counter; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.Counter != Counter.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties CreateEmptyPoco() - { - return new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - if (string.IsNullOrEmpty(_attributeName)) - { - return SymbolTail; - } - - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs deleted file mode 100644 index 5400b2ac..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class AbstractMotor : AXSharp.Connector.IPlain - { - public AbstractMotor() - { - } - - public Boolean Run { get; set; } - public Boolean ReverseDirection { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs deleted file mode 100644 index ce30a3c8..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ArrayDeclarationSimpleNamespace - { - public partial class array_declaration_class : AXSharp.Connector.IPlain - { - public array_declaration_class() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, () => new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(), new[] { (1, 100) }); -#pragma warning restore CS0612 - } - - public Int16[] primitive { get; set; } = new Int16[100]; - public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; set; } = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; - } - - public partial class some_complex_type : AXSharp.Connector.IPlain - { - public some_complex_type() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs deleted file mode 100644 index 422a2a2d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class class_all_primitives : AXSharp.Connector.IPlain - { - public class_all_primitives() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs deleted file mode 100644 index 221f97ee..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState, AXSharp.Connector.IPlain - { - public State1Transition() : base() - { - } - } - } - - namespace Simatic.Ax.StateFramework - { - public partial class AbstractState : AXSharp.Connector.IPlain, IState, IStateMuteable - { - public AbstractState() - { - } - - public Int16 StateID { get; set; } - public string StateName { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs deleted file mode 100644 index 4ce871c9..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Extended : Extendee, AXSharp.Connector.IPlain - { - public Extended() : base() - { - } - } - - public partial class Extendee : AXSharp.Connector.IPlain - { - public Extendee() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs deleted file mode 100644 index 91481513..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, AXSharp.Connector.IPlain, IImplementation1, IImplementation2 - { - public ExtendsAndImplements() : base() - { - } - } - - public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.IPlain - { - public ExtendeeExtendsAndImplements() - { - } - } - - public partial interface IImplementation1 - { - } - - public partial interface IImplementation2 - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs deleted file mode 100644 index 906b0bc0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Generics - { - public partial class Extender : AXSharp.Connector.IPlain - { - public Extender() - { - } - } - - public partial class Extendee : Generics.Extender, AXSharp.Connector.IPlain - { - public Extendee() : base() - { - } - - public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); - public Generics.SomeType SomeTypeAsPoco { get; set; } = new Generics.SomeType(); - } - - public partial class Extendee2 : Generics.Extender, AXSharp.Connector.IPlain - { - public Extendee2() : base() - { - } - - public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); - } - - public partial class SomeType : AXSharp.Connector.IPlain - { - public SomeType() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs deleted file mode 100644 index 5eb39ed0..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class _NULL_CONTEXT : AXSharp.Connector.IPlain, IContext - { - public _NULL_CONTEXT() - { - } - } - - public partial interface IContext - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs deleted file mode 100644 index aca3704d..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.IPlain, IContext_Multiple, IObject_Multiple - { - public _NULL_CONTEXT_MULTIPLE() - { - } - } - - public partial interface IContext_Multiple - { - } - - public partial interface IObject_Multiple - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs deleted file mode 100644 index e4ba926f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - internal partial class ClassWithComplexTypes : AXSharp.Connector.IPlain - { - public ClassWithComplexTypes() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs deleted file mode 100644 index 43b8cdaa..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class NoAccessModifierClass : AXSharp.Connector.IPlain - { - public NoAccessModifierClass() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs deleted file mode 100644 index 27f5f1d8..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithComplexTypesNamespace - { - public partial class ClassWithComplexTypes : AXSharp.Connector.IPlain - { - public ClassWithComplexTypes() - { - } - - public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithComplexTypesNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs deleted file mode 100644 index 7f96b873..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithNonTraspilableMemberssNamespace - { - public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.IPlain - { - public ClassWithNonTraspilableMembers() - { - } - - public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs deleted file mode 100644 index 3f2f1d38..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithPragmasNamespace - { - public partial class ClassWithPragmas : AXSharp.Connector.IPlain - { - public ClassWithPragmas() - { - } - - public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithPragmasNamespace.ComplexType1(); - } - - public partial class ComplexType1 : AXSharp.Connector.IPlain - { - public ComplexType1() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs deleted file mode 100644 index 1c2a9588..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace ClassWithPrimitiveTypesNamespace - { - public partial class ClassWithPrimitiveTypes : AXSharp.Connector.IPlain - { - public ClassWithPrimitiveTypes() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); - public DateOnly myLDATE { get; set; } = new DateOnly(1990, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); - public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); - public Char myCHAR { get; set; } - public Char myWCHAR { get; set; } - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs deleted file mode 100644 index ca595c93..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - using SimpleFirstLevelNamespace; - using SimpleQualifiedNamespace.Qualified; - using HelloLevelOne.HelloLevelTwo; - - internal partial class ClassWithUsingDirectives : AXSharp.Connector.IPlain - { - public ClassWithUsingDirectives() - { - } - - using SimpleFirstLevelNamespace ; using SimpleQualifiedNamespace . Qualified ; using HelloLevelOne . HelloLevelTwo ; - -} - -namespace SimpleFirstLevelNamespace -{ -} - -namespace SimpleQualifiedNamespace.Qualified -{ -} - -namespace HelloLevelOne -{ - namespace HelloLevelTwo - { - } -} } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs deleted file mode 100644 index 2e89b94c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace CompilerOmmits - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { - } - - public CompilerOmmits.Complex _must_be_omitted_in_onliner { get; set; } = new CompilerOmmits.Complex(); - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } - - namespace Enums - { - public partial class ClassWithEnums : AXSharp.Connector.IPlain - { - public ClassWithEnums() - { - } - - public global::Enums.Colors colors { get; set; } - public String NamedValuesColors { get; set; } - } - } - - namespace misc - { - public partial class VariousMembers : AXSharp.Connector.IPlain - { - public VariousMembers() - { - } - - public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); - public misc.Motor _Motor { get; set; } = new misc.Motor(); - } - - public partial class SomeClass : AXSharp.Connector.IPlain - { - public SomeClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public misc.Motor m { get; set; } = new misc.Motor(); - public Int16 displacement { get; set; } - } - } - - namespace UnknownArraysShouldNotBeTraspiled - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); -#pragma warning restore CS0612 - } - - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs deleted file mode 100644 index 8a7a774e..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class ComplexForConfig : AXSharp.Connector.IPlain - { - public ComplexForConfig() - { - } - - public Boolean myBOOL { get; set; } - public Byte myBYTE { get; set; } - public UInt16 myWORD { get; set; } - public UInt32 myDWORD { get; set; } - public UInt64 myLWORD { get; set; } - public SByte mySINT { get; set; } - public Int16 myINT { get; set; } - public Int32 myDINT { get; set; } - public Int64 myLINT { get; set; } - public Byte myUSINT { get; set; } - public UInt16 myUINT { get; set; } - public UInt32 myUDINT { get; set; } - public UInt64 myULINT { get; set; } - public Single myREAL { get; set; } - public Double myLREAL { get; set; } - public TimeSpan myTIME { get; set; } = default(TimeSpan); - public TimeSpan myLTIME { get; set; } = default(TimeSpan); - public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); - public DateOnly myLDATE { get; set; } = new DateOnly(1990, 1, 1); - public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); - public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); - public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); - public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); - public Char myCHAR { get; set; } - public Char myWCHAR { get; set; } - public string mySTRING { get; set; } = string.Empty; - public string myWSTRING { get; set; } = string.Empty; - public Motor myMotor { get; set; } = new Motor(); - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public Motor m { get; set; } = new Motor(); - public Int16 displacement { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs deleted file mode 100644 index 56cacaa1..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Unsupported - { - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs deleted file mode 100644 index 1fecb933..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; -using Pocos.FileWithUsingsSimpleFirstLevelNamespace; -using Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified; -using Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; - -namespace Pocos -{ - namespace FileWithUsingsSimpleFirstLevelNamespace - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - - namespace FileWithUsingsSimpleQualifiedNamespace.Qualified - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - - namespace FileWithUsingsHelloLevelOne - { - namespace FileWithUsingsHelloLevelTwo - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } - } - - namespace ExampleNamespace - { - public partial class Hello : AXSharp.Connector.IPlain - { - public Hello() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs deleted file mode 100644 index 47e0b1d4..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace GenericsTests - { - public partial class Extender : AXSharp.Connector.IPlain - { - public Extender() - { - } - } - - public partial class SomeTypeToBeGeneric : AXSharp.Connector.IPlain - { - public SomeTypeToBeGeneric() - { - } - - public Boolean Boolean { get; set; } - public Int16 Cele { get; set; } - } - - public partial class Extendee2 : GenericsTests.Extender, AXSharp.Connector.IPlain - { - public Extendee2() : base() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Shared Header")] - public GenericsTests.SomeTypeToBeGeneric SomeData { get; set; } = new GenericsTests.SomeTypeToBeGeneric(); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs deleted file mode 100644 index b1f0575c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace makereadonce - { - public partial class MembersWithMakeReadOnce : AXSharp.Connector.IPlain - { - public MembersWithMakeReadOnce() - { - } - - public string makeReadOnceMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - public makereadonce.ComplexMember makeReadComplexMember { get; set; } = new makereadonce.ComplexMember(); - public makereadonce.ComplexMember someotherComplexMember { get; set; } = new makereadonce.ComplexMember(); - } - - public partial class ComplexMember : AXSharp.Connector.IPlain - { - public ComplexMember() - { - } - - public string someMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs deleted file mode 100644 index ecafb34f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace makereadonly - { - public partial class MembersWithMakeReadOnly : AXSharp.Connector.IPlain - { - public MembersWithMakeReadOnly() - { - } - - public string makeReadOnceMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - public makereadonly.ComplexMember makeReadComplexMember { get; set; } = new makereadonly.ComplexMember(); - public makereadonly.ComplexMember someotherComplexMember { get; set; } = new makereadonly.ComplexMember(); - } - - public partial class ComplexMember : AXSharp.Connector.IPlain - { - public ComplexMember() - { - } - - public string someMember { get; set; } = string.Empty; - public string someOtherMember { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs deleted file mode 100644 index 1eae7fcb..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Enums - { - public partial class ClassWithEnums : AXSharp.Connector.IPlain - { - public ClassWithEnums() - { - } - - public global::Enums.Colors colors { get; set; } - public String NamedValuesColors { get; set; } - } - } - - namespace misc - { - public partial class VariousMembers : AXSharp.Connector.IPlain - { - public VariousMembers() - { - } - - public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); - public misc.Motor _Motor { get; set; } = new misc.Motor(); - } - - public partial class SomeClass : AXSharp.Connector.IPlain - { - public SomeClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public misc.Motor m { get; set; } = new misc.Motor(); - public Int16 displacement { get; set; } - } - } - - namespace UnknownArraysShouldNotBeTraspiled - { - public partial class ClassWithArrays : AXSharp.Connector.IPlain - { - public ClassWithArrays() - { -#pragma warning disable CS0612 - AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); -#pragma warning restore CS0612 - } - - public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; - public Byte[] _primitive { get; set; } = new Byte[11]; - } - - public partial class Complex : AXSharp.Connector.IPlain - { - public Complex() - { - } - - public string HelloString { get; set; } = string.Empty; - public UInt64 Id { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs deleted file mode 100644 index a7383fdf..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean Run { get; set; } - } - - public partial class struct1 : AXSharp.Connector.IPlain - { - public struct1() - { - } - - public struct2 s2 { get; set; } = new struct2(); - } - - public partial class struct2 : AXSharp.Connector.IPlain - { - public struct2() - { - } - - public struct3 s3 { get; set; } = new struct3(); - } - - public partial class struct3 : AXSharp.Connector.IPlain - { - public struct3() - { - } - - public struct4 s4 { get; set; } = new struct4(); - } - - public partial class struct4 : AXSharp.Connector.IPlain - { - public struct4() - { - } - - public Int16 s5 { get; set; } - } - - public partial class AbstractMotor : AXSharp.Connector.IPlain - { - public AbstractMotor() - { - } - - public Boolean Run { get; set; } - public Boolean ReverseDirection { get; set; } - } - - public partial class GenericMotor : AbstractMotor, AXSharp.Connector.IPlain - { - public GenericMotor() : base() - { - } - } - - public partial class SpecificMotorA : GenericMotor, AXSharp.Connector.IPlain - { - public SpecificMotorA() : base() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs deleted file mode 100644 index 7eb75e26..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace MultilinePragmas - { - public partial class Extendee2 : AXSharp.Connector.IPlain - { - public Extendee2() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("PlcTextList", @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; - [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; - [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; - [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; - [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; - [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; - [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; - [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; - [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; - [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; - [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'")] - public Int16 _messge { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs deleted file mode 100644 index 22248e83..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace RefToSimple - { - public partial class ref_to_simple : AXSharp.Connector.IPlain - { - public ref_to_simple() - { - } - } - - public partial class referenced : AXSharp.Connector.IPlain - { - public referenced() - { - } - - public Int16 b { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs deleted file mode 100644 index 49d5fd25..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class simple_class : AXSharp.Connector.IPlain - { - public simple_class() - { - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs deleted file mode 100644 index 3cf279ae..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace sampleNamespace - { - public partial class simple_empty_class_within_namespace : AXSharp.Connector.IPlain - { - public simple_empty_class_within_namespace() - { - } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs deleted file mode 100644 index 0c0b4d7c..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public Motor m { get; set; } = new Motor(); - public Int16 displacement { get; set; } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs deleted file mode 100644 index a5e6936b..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace NamedValuesNamespace - { - public partial class using_type_named_values : AXSharp.Connector.IPlain - { - public using_type_named_values() - { - } - - public Int16 LColors { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs deleted file mode 100644 index 14b4df59..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial class using_type_named_values : AXSharp.Connector.IPlain - { - public using_type_named_values() - { - } - - public UInt16 LColors { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs deleted file mode 100644 index 14b70914..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace Simatic.Ax.StateFramework - { - public partial interface IGuard - { - } - } - - namespace Simatic.Ax.StateFramework - { - public partial class CompareGuardLint : AXSharp.Connector.IPlain, IGuard - { - public CompareGuardLint() - { - } - - public Int64 CompareToValue { get; set; } - public global::Simatic.Ax.StateFramework.Condition Condition { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs deleted file mode 100644 index 2c9aba9f..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace TypeWithNameAttributes - { - public partial class Motor : AXSharp.Connector.IPlain - { - public Motor() - { - } - - public Boolean isRunning { get; set; } - } - - public partial class Vehicle : AXSharp.Connector.IPlain - { - public Vehicle() - { - } - - public TypeWithNameAttributes.Motor m { get; set; } = new TypeWithNameAttributes.Motor(); - public Int16 displacement { get; set; } - } - - public partial class NoAccessModifierClass : AXSharp.Connector.IPlain - { - public NoAccessModifierClass() - { - } - - public string SomeClassVariable { get; set; } = string.Empty; - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs deleted file mode 100644 index a68b5471..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace TypesWithPropertyAttributes - { - [AXSharp.Connector.AddedPropertiesAttribute("Description", @"Some added property name value")] - public partial class SomeAddedProperties : AXSharp.Connector.IPlain - { - public SomeAddedProperties() - { - } - - [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Pocitadlo")] - public Int16 Counter { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs deleted file mode 100644 index 1ba9627a..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace units -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator)); - var resource = assembly.GetType("units.Resources.PlcStringResources"); - this.SetLocalizationResource(resource, assembly); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj deleted file mode 100644 index 2cb3c2ea..00000000 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - net10.0 - enable - enable - - - - - - - - - - - - - - - - \ No newline at end of file From bd6bbd4a68029bb36363f24a6b6977480f275ea4 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 06:54:53 +0100 Subject: [PATCH 05/15] expected test results copied back --- .../units/expected/ax/.g/Configurations.g.cs | 181 ++ .../ax/.g/Onliners/abstract_members.g.cs | 238 ++ .../ax/.g/Onliners/array_declaration.g.cs | 462 ++++ .../ax/.g/Onliners/class_all_primitives.g.cs | 558 +++++ .../class_extended_by_known_type.g.cs | 373 +++ .../ax/.g/Onliners/class_extends.g.cs | 334 +++ .../class_extends_and_implements.g.cs | 342 +++ .../.g/Onliners/class_generic_extension.g.cs | 733 ++++++ .../ax/.g/Onliners/class_implements.g.cs | 209 ++ .../Onliners/class_implements_multiple.g.cs | 213 ++ .../ax/.g/Onliners/class_internal.g.cs | 205 ++ .../.g/Onliners/class_no_access_modifier.g.cs | 205 ++ .../Onliners/class_with_complex_members.g.cs | 430 ++++ .../class_with_non_public_members.g.cs | 430 ++++ .../ax/.g/Onliners/class_with_pragmas.g.cs | 432 ++++ .../class_with_primitive_members.g.cs | 641 +++++ .../Onliners/class_with_using_directives.g.cs | 223 ++ .../.g/Onliners/compileromitsattribute.g.cs | 2122 +++++++++++++++++ .../ax/.g/Onliners/configuration.g.cs | 1124 +++++++++ .../expected/ax/.g/Onliners/enum_simple.g.cs | 13 + .../ax/.g/Onliners/file_with_unsupported.g.cs | 10 + .../ax/.g/Onliners/file_with_usings.g.cs | 820 +++++++ .../expected/ax/.g/Onliners/generics.g.cs | 595 +++++ .../expected/ax/.g/Onliners/makereadonce.g.cs | 522 ++++ .../expected/ax/.g/Onliners/makereadonly.g.cs | 522 ++++ .../units/expected/ax/.g/Onliners/misc.g.cs | 1660 +++++++++++++ .../expected/ax/.g/Onliners/mixed_access.g.cs | 1586 ++++++++++++ .../ax/.g/Onliners/multiline_pragmas.g.cs | 236 ++ .../expected/ax/.g/Onliners/program.g.cs | 6 + .../ax/.g/Onliners/ref_to_simple.g.cs | 424 ++++ .../ax/.g/Onliners/simple_empty_class.g.cs | 205 ++ .../simple_empty_class_within_namespace.g.cs | 208 ++ .../ax/.g/Onliners/struct_simple.g.cs | 456 ++++ .../ax/.g/Onliners/type_named_values.g.cs | 233 ++ .../Onliners/type_named_values_literals.g.cs | 235 ++ .../ax/.g/Onliners/type_with_enum.g.cs | 260 ++ .../Onliners/types_with_name_attributes.g.cs | 692 ++++++ .../types_with_property_attributes.g.cs | 243 ++ .../expected/ax/.g/POCO/abstract_members.g.cs | 16 + .../ax/.g/POCO/array_declaration.g.cs | 29 + .../ax/.g/POCO/class_all_primitives.g.cs | 36 + .../.g/POCO/class_extended_by_known_type.g.cs | 29 + .../expected/ax/.g/POCO/class_extends.g.cs | 20 + .../.g/POCO/class_extends_and_implements.g.cs | 28 + .../ax/.g/POCO/class_generic_extension.g.cs | 42 + .../expected/ax/.g/POCO/class_implements.g.cs | 17 + .../ax/.g/POCO/class_implements_multiple.g.cs | 21 + .../expected/ax/.g/POCO/class_internal.g.cs | 13 + .../ax/.g/POCO/class_no_access_modifier.g.cs | 13 + .../.g/POCO/class_with_complex_members.g.cs | 25 + .../POCO/class_with_non_public_members.g.cs | 25 + .../ax/.g/POCO/class_with_pragmas.g.cs | 25 + .../.g/POCO/class_with_primitive_members.g.cs | 44 + .../.g/POCO/class_with_using_directives.g.cs | 34 + .../ax/.g/POCO/compileromitsattribute.g.cs | 109 + .../expected/ax/.g/POCO/configuration.g.cs | 61 + .../expected/ax/.g/POCO/enum_simple.g.cs | 7 + .../ax/.g/POCO/file_with_unsupported.g.cs | 10 + .../expected/ax/.g/POCO/file_with_usings.g.cs | 52 + .../units/expected/ax/.g/POCO/generics.g.cs | 36 + .../expected/ax/.g/POCO/makereadonce.g.cs | 31 + .../expected/ax/.g/POCO/makereadonly.g.cs | 31 + .../units/expected/ax/.g/POCO/misc.g.cs | 86 + .../expected/ax/.g/POCO/mixed_access.g.cs | 75 + .../ax/.g/POCO/multiline_pragmas.g.cs | 29 + .../units/expected/ax/.g/POCO/program.g.cs | 7 + .../expected/ax/.g/POCO/ref_to_simple.g.cs | 25 + .../ax/.g/POCO/simple_empty_class.g.cs | 13 + .../simple_empty_class_within_namespace.g.cs | 16 + .../expected/ax/.g/POCO/struct_simple.g.cs | 25 + .../ax/.g/POCO/type_named_values.g.cs | 18 + .../.g/POCO/type_named_values_literals.g.cs | 18 + .../expected/ax/.g/POCO/type_with_enum.g.cs | 26 + .../.g/POCO/types_with_name_attributes.g.cs | 37 + .../POCO/types_with_property_attributes.g.cs | 20 + .../units/expected/ax/.g/PlcResources.g.cs | 26 + .../samples/units/expected/ax/units.csproj | 21 + .../units/expected/tia/.g/Configurations.g.cs | 181 ++ .../tia/.g/Onliners/abstract_members.g.cs | 238 ++ .../tia/.g/Onliners/array_declaration.g.cs | 462 ++++ .../tia/.g/Onliners/class_all_primitives.g.cs | 558 +++++ .../class_extended_by_known_type.g.cs | 373 +++ .../tia/.g/Onliners/class_extends.g.cs | 334 +++ .../class_extends_and_implements.g.cs | 342 +++ .../.g/Onliners/class_generic_extension.g.cs | 733 ++++++ .../tia/.g/Onliners/class_implements.g.cs | 209 ++ .../Onliners/class_implements_multiple.g.cs | 213 ++ .../tia/.g/Onliners/class_internal.g.cs | 205 ++ .../.g/Onliners/class_no_access_modifier.g.cs | 205 ++ .../Onliners/class_with_complex_members.g.cs | 430 ++++ .../class_with_non_public_members.g.cs | 430 ++++ .../tia/.g/Onliners/class_with_pragmas.g.cs | 432 ++++ .../class_with_primitive_members.g.cs | 641 +++++ .../Onliners/class_with_using_directives.g.cs | 223 ++ .../.g/Onliners/compileromitsattribute.g.cs | 2122 +++++++++++++++++ .../tia/.g/Onliners/configuration.g.cs | 1124 +++++++++ .../expected/tia/.g/Onliners/enum_simple.g.cs | 13 + .../.g/Onliners/file_with_unsupported.g.cs | 10 + .../tia/.g/Onliners/file_with_usings.g.cs | 820 +++++++ .../expected/tia/.g/Onliners/generics.g.cs | 595 +++++ .../tia/.g/Onliners/makereadonce.g.cs | 522 ++++ .../tia/.g/Onliners/makereadonly.g.cs | 522 ++++ .../units/expected/tia/.g/Onliners/misc.g.cs | 1660 +++++++++++++ .../tia/.g/Onliners/mixed_access.g.cs | 1586 ++++++++++++ .../tia/.g/Onliners/multiline_pragmas.g.cs | 236 ++ .../expected/tia/.g/Onliners/program.g.cs | 6 + .../tia/.g/Onliners/ref_to_simple.g.cs | 424 ++++ .../tia/.g/Onliners/simple_empty_class.g.cs | 205 ++ .../simple_empty_class_within_namespace.g.cs | 208 ++ .../tia/.g/Onliners/struct_simple.g.cs | 456 ++++ .../tia/.g/Onliners/type_named_values.g.cs | 233 ++ .../Onliners/type_named_values_literals.g.cs | 235 ++ .../tia/.g/Onliners/type_with_enum.g.cs | 260 ++ .../Onliners/types_with_name_attributes.g.cs | 692 ++++++ .../types_with_property_attributes.g.cs | 243 ++ .../tia/.g/POCO/abstract_members.g.cs | 16 + .../tia/.g/POCO/array_declaration.g.cs | 29 + .../tia/.g/POCO/class_all_primitives.g.cs | 36 + .../.g/POCO/class_extended_by_known_type.g.cs | 29 + .../expected/tia/.g/POCO/class_extends.g.cs | 20 + .../.g/POCO/class_extends_and_implements.g.cs | 28 + .../tia/.g/POCO/class_generic_extension.g.cs | 42 + .../tia/.g/POCO/class_implements.g.cs | 17 + .../.g/POCO/class_implements_multiple.g.cs | 21 + .../expected/tia/.g/POCO/class_internal.g.cs | 13 + .../tia/.g/POCO/class_no_access_modifier.g.cs | 13 + .../.g/POCO/class_with_complex_members.g.cs | 25 + .../POCO/class_with_non_public_members.g.cs | 25 + .../tia/.g/POCO/class_with_pragmas.g.cs | 25 + .../.g/POCO/class_with_primitive_members.g.cs | 44 + .../.g/POCO/class_with_using_directives.g.cs | 34 + .../tia/.g/POCO/compileromitsattribute.g.cs | 109 + .../expected/tia/.g/POCO/configuration.g.cs | 61 + .../expected/tia/.g/POCO/enum_simple.g.cs | 7 + .../tia/.g/POCO/file_with_unsupported.g.cs | 10 + .../tia/.g/POCO/file_with_usings.g.cs | 52 + .../units/expected/tia/.g/POCO/generics.g.cs | 36 + .../expected/tia/.g/POCO/makereadonce.g.cs | 31 + .../expected/tia/.g/POCO/makereadonly.g.cs | 31 + .../units/expected/tia/.g/POCO/misc.g.cs | 86 + .../expected/tia/.g/POCO/mixed_access.g.cs | 75 + .../tia/.g/POCO/multiline_pragmas.g.cs | 29 + .../units/expected/tia/.g/POCO/program.g.cs | 7 + .../expected/tia/.g/POCO/ref_to_simple.g.cs | 25 + .../tia/.g/POCO/simple_empty_class.g.cs | 13 + .../simple_empty_class_within_namespace.g.cs | 16 + .../expected/tia/.g/POCO/struct_simple.g.cs | 25 + .../tia/.g/POCO/type_named_values.g.cs | 18 + .../.g/POCO/type_named_values_literals.g.cs | 18 + .../expected/tia/.g/POCO/type_with_enum.g.cs | 26 + .../.g/POCO/types_with_name_attributes.g.cs | 37 + .../POCO/types_with_property_attributes.g.cs | 20 + .../units/expected/tia/.g/PlcResources.g.cs | 26 + .../samples/units/expected/tia/units.csproj | 21 + 154 files changed, 39154 insertions(+) create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs new file mode 100644 index 00000000..17dc6c6f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Configurations.g.cs @@ -0,0 +1,181 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class unitsTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public ComplexForConfig Complex { get; } + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + [ReadOnce()] + public OnlinerWString myWSTRING_readOnce { get; } + + [ReadOnly()] + public OnlinerWString myWSTRING_readOnly { get; } + + [ReadOnce()] + public ComplexForConfig cReadOnce { get; } + + [ReadOnly()] + public ComplexForConfig cReadOnly { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss { get; } + + [CompilerOmitsAttribute("POCO")] + public OnlinerBool _must_be_omitted_in_poco { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss2 { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss2 { get; } + public OnlinerBool MotorOn { get; } + public OnlinerInt MotorState { get; } + public Motor Motor1 { get; } + public Motor Motor2 { get; } + public struct1 s1 { get; } + public struct4 s4 { get; } + public SpecificMotorA mot1 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } + + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs new file mode 100644 index 00000000..0e57b992 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/abstract_members.g.cs @@ -0,0 +1,238 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class AbstractMotor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + public OnlinerBool ReverseDirection { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + if (plain.ReverseDirection != ReverseDirection.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.AbstractMotor CreateEmptyPoco() + { + return new global::Pocos.AbstractMotor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs new file mode 100644 index 00000000..49415da1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/array_declaration.g.cs @@ -0,0 +1,462 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ArrayDeclarationSimpleNamespace +{ + public partial class array_declaration_class : AXSharp.Connector.ITwinObject + { + public OnlinerInt[] primitive { get; } + public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public array_declaration_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + primitive = new OnlinerInt[100]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(primitive, this, "primitive", "primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateINT(p, rt, st), new[] { (1, 100) }); + complex = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, this, "complex", "complex", (p, rt, st) => new ArrayDeclarationSimpleNamespace.some_complex_type(p, rt, st), new[] { (1, 100) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + await this.ReadAsync(priority); + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, eAccessPriority priority = eAccessPriority.Normal) + { + var _primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var _complex_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + var _primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var _complex_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + plain.primitive = primitive.Select(p => p.Shadow).ToArray(); + plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + plain.primitive = primitive.Select(p => p.Shadow).ToArray(); + plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + var _primitive_i_FE8484DAB3 = 0; + primitive.Select(p => p.Shadow = plain.primitive[_primitive_i_FE8484DAB3++]).ToArray(); + var _complex_i_FE8484DAB3 = 0; + complex.Select(p => p.PlainToShadowAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.primitive.Length; i760901_3001_mimi++) + { + if (latest.primitive.ElementAt(i760901_3001_mimi) != plain.primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.complex.Length; i760901_3001_mimi++) + { + if (await complex.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain.complex[i760901_3001_mimi], latest.complex[i760901_3001_mimi])) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class CreateEmptyPoco() + { + return new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class some_complex_type : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public some_complex_type(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type CreateEmptyPoco() + { + return new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs new file mode 100644 index 00000000..36c26531 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs @@ -0,0 +1,558 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class class_all_primitives : AXSharp.Connector.ITwinObject +{ + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.class_all_primitives plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.class_all_primitives plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.class_all_primitives plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.class_all_primitives plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives plain, global::Pocos.class_all_primitives latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.class_all_primitives CreateEmptyPoco() + { + return new global::Pocos.class_all_primitives(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs new file mode 100644 index 00000000..41bd6829 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs @@ -0,0 +1,373 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public State1Transition(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, global::Pocos.Simatic.Ax.StateFramework.State1Transition latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Simatic.Ax.StateFramework.State1Transition CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + } + } +} + +namespace Simatic.Ax.StateFramework +{ + public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable + { + public OnlinerInt StateID { get; } + public OnlinerString StateName { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); + StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + await this.ReadAsync(priority); + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + StateID.LethargicWrite(plain.StateID); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + StateName.LethargicWrite(plain.StateName); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { +#pragma warning disable CS0612 + StateID.LethargicWrite(plain.StateID); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + StateName.LethargicWrite(plain.StateName); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + plain.StateID = StateID.Shadow; + plain.StateName = StateName.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + plain.StateID = StateID.Shadow; + plain.StateName = StateName.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + StateID.Shadow = plain.StateID; + StateName.Shadow = plain.StateName; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, global::Pocos.Simatic.Ax.StateFramework.AbstractState latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.StateID != StateID.LastValue) + somethingChanged = true; + if (plain.StateName != StateName.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.AbstractState CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs new file mode 100644 index 00000000..ae98b0e0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends.g.cs @@ -0,0 +1,334 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Extended : Extendee +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extended(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Extended plain = new global::Pocos.Extended(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Extended plain = new global::Pocos.Extended(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extended plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Extended plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Extended plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Extended plain = new global::Pocos.Extended(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Extended plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Extended plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Extended plain, global::Pocos.Extended latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Extended CreateEmptyPoco() + { + return new global::Pocos.Extended(); + } +} + +public partial class Extendee : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extendee plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Extendee plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Extendee plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Extendee plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Extendee plain, global::Pocos.Extendee latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Extendee CreateEmptyPoco() + { + return new global::Pocos.Extendee(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs new file mode 100644 index 00000000..2f519df4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extends_and_implements.g.cs @@ -0,0 +1,342 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, IImplementation1, IImplementation2 +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendsAndImplements plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendsAndImplements plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExtendsAndImplements plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExtendsAndImplements plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.ExtendsAndImplements plain, global::Pocos.ExtendsAndImplements latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.ExtendsAndImplements CreateEmptyPoco() + { + return new global::Pocos.ExtendsAndImplements(); + } +} + +public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ExtendeeExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExtendeeExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ExtendeeExtendsAndImplements plain, global::Pocos.ExtendeeExtendsAndImplements latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ExtendeeExtendsAndImplements CreateEmptyPoco() + { + return new global::Pocos.ExtendeeExtendsAndImplements(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IImplementation1 +{ +} + +public partial interface IImplementation2 +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs new file mode 100644 index 00000000..6f1bf375 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_generic_extension.g.cs @@ -0,0 +1,733 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Generics +{ + public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extender plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extender plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extender plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extender plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extender plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extender plain, global::Pocos.Generics.Extender latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Generics.Extender CreateEmptyPoco() + { + return new global::Pocos.Generics.Extender(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Extendee : Generics.Extender + { + public Generics.SomeType SomeType { get; } + public Generics.SomeType SomeTypeAsPoco { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); + SomeTypeAsPoco = new Generics.SomeType(this, "SomeTypeAsPoco", "SomeTypeAsPoco"); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeType.PlainToShadowAsync(plain.SomeType); + await this.SomeTypeAsPoco.PlainToShadowAsync(plain.SomeTypeAsPoco); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee plain, global::Pocos.Generics.Extendee latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) + somethingChanged = true; + if (await SomeTypeAsPoco.DetectsAnyChangeAsync(plain.SomeTypeAsPoco, latest.SomeTypeAsPoco)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Generics.Extendee CreateEmptyPoco() + { + return new global::Pocos.Generics.Extendee(); + } + } + + public partial class Extendee2 : Generics.Extender + { + public Generics.SomeType SomeType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee2 plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee2 plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee2 plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeType.PlainToShadowAsync(plain.SomeType); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee2 plain, global::Pocos.Generics.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Generics.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.Generics.Extendee2(); + } + } + + public partial class SomeType : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeType(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.SomeType plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.SomeType plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.SomeType plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.SomeType plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.SomeType plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Generics.SomeType plain, global::Pocos.Generics.SomeType latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Generics.SomeType CreateEmptyPoco() + { + return new global::Pocos.Generics.SomeType(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs new file mode 100644 index 00000000..ee0cb2ce --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements.g.cs @@ -0,0 +1,209 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class _NULL_CONTEXT : AXSharp.Connector.ITwinObject, IContext +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public _NULL_CONTEXT(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT plain, global::Pocos._NULL_CONTEXT latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos._NULL_CONTEXT CreateEmptyPoco() + { + return new global::Pocos._NULL_CONTEXT(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IContext +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs new file mode 100644 index 00000000..95d287ca --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_implements_multiple.g.cs @@ -0,0 +1,213 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.ITwinObject, IContext_Multiple, IObject_Multiple +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public _NULL_CONTEXT_MULTIPLE(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, global::Pocos._NULL_CONTEXT_MULTIPLE latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos._NULL_CONTEXT_MULTIPLE CreateEmptyPoco() + { + return new global::Pocos._NULL_CONTEXT_MULTIPLE(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IContext_Multiple +{ +} + +public partial interface IObject_Multiple +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs new file mode 100644 index 00000000..4125361e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_internal.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +internal partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypes plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypes plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypes plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypes plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs new file mode 100644 index 00000000..2d2272b1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_no_access_modifier.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.NoAccessModifierClass plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.NoAccessModifierClass plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.NoAccessModifierClass plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.NoAccessModifierClass plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.NoAccessModifierClass plain, global::Pocos.NoAccessModifierClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.NoAccessModifierClass CreateEmptyPoco() + { + return new global::Pocos.NoAccessModifierClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs new file mode 100644 index 00000000..d423ae31 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_complex_members.g.cs @@ -0,0 +1,430 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithComplexTypesNamespace +{ + public partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject + { + public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithComplexTypesNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs new file mode 100644 index 00000000..aced06ee --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_non_public_members.g.cs @@ -0,0 +1,430 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithNonTraspilableMemberssNamespace +{ + public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.ITwinObject + { + public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithNonTraspilableMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers CreateEmptyPoco() + { + return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs new file mode 100644 index 00000000..383d092d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_pragmas.g.cs @@ -0,0 +1,432 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithPragmasNamespace +{ + [Container(Layout.Stack)] + public partial class ClassWithPragmas : AXSharp.Connector.ITwinObject + { + [Container(Layout.Wrap)] + public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithPragmas(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithPragmasNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas CreateEmptyPoco() + { + return new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, global::Pocos.ClassWithPragmasNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPragmasNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs new file mode 100644 index 00000000..279c7fb4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs @@ -0,0 +1,641 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithPrimitiveTypesNamespace +{ + public partial class ClassWithPrimitiveTypes : AXSharp.Connector.ITwinObject + { + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myLDATE.Shadow = plain.myLDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; + myCHAR.Shadow = plain.myCHAR; + myWCHAR.Shadow = plain.myWCHAR; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myLDATE != myLDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myCHAR != myCHAR.LastValue) + somethingChanged = true; + if (plain.myWCHAR != myWCHAR.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs new file mode 100644 index 00000000..41fa3c4c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_using_directives.g.cs @@ -0,0 +1,223 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; +using SimpleFirstLevelNamespace; +using SimpleQualifiedNamespace.Qualified; +using HelloLevelOne.HelloLevelTwo; + +internal partial class ClassWithUsingDirectives : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithUsingDirectives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithUsingDirectives plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithUsingDirectives plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithUsingDirectives plain, global::Pocos.ClassWithUsingDirectives latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithUsingDirectives CreateEmptyPoco() + { + return new global::Pocos.ClassWithUsingDirectives(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +namespace SimpleFirstLevelNamespace +{ +} + +namespace SimpleQualifiedNamespace.Qualified +{ +} + +namespace HelloLevelOne +{ + namespace HelloLevelTwo + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs new file mode 100644 index 00000000..b302f337 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs @@ -0,0 +1,2122 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace CompilerOmmits +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + [CompilerOmitsAttribute("POCO")] + public CompilerOmmits.Complex _must_be_omitted_in_poco { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _must_be_omitted_in_poco = new CompilerOmmits.Complex(this, "_must_be_omitted_in_poco", "_must_be_omitted_in_poco"); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + await this.ReadAsync(priority); + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, global::Pocos.CompilerOmmits.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.CompilerOmmits.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.CompilerOmmits.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.Complex plain, global::Pocos.CompilerOmmits.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.CompilerOmmits.Complex CreateEmptyPoco() + { + return new global::Pocos.CompilerOmmits.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace Enums +{ + public partial class ClassWithEnums : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] + public OnlinerInt colors { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] + public OnlinerString NamedValuesColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); + NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + await this.ReadAsync(priority); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) + { + colors.Shadow = (short)plain.colors; + NamedValuesColors.Shadow = plain.NamedValuesColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.colors != (Enums.Colors)latest.colors) + somethingChanged = true; + if (plain.NamedValuesColors != NamedValuesColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() + { + return new global::Pocos.Enums.ClassWithEnums(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public enum Colors + { + Red, + Green, + Blue + } + + public enum NamedValuesColors : String + { + Red = 49, + Green = 50, + Blue = 51 + } +} + +namespace misc +{ + public partial class VariousMembers : AXSharp.Connector.ITwinObject + { + public misc.SomeClass _SomeClass { get; } + public misc.Motor _Motor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); + _Motor = new misc.Motor(this, "_Motor", "_Motor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) + { + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) + { + await this._SomeClass.PlainToShadowAsync(plain._SomeClass); + await this._Motor.PlainToShadowAsync(plain._Motor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) + somethingChanged = true; + if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.VariousMembers CreateEmptyPoco() + { + return new global::Pocos.misc.VariousMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeClass : AXSharp.Connector.ITwinObject + { + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.SomeClass CreateEmptyPoco() + { + return new global::Pocos.misc.SomeClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Motor CreateEmptyPoco() + { + return new global::Pocos.misc.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public misc.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new misc.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Vehicle CreateEmptyPoco() + { + return new global::Pocos.misc.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace UnknownArraysShouldNotBeTraspiled +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; + _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) + { + if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs new file mode 100644 index 00000000..bf55ab8e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs @@ -0,0 +1,1124 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class ComplexForConfig : AXSharp.Connector.ITwinObject +{ + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + public Motor myMotor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myMotor = new Motor(this, "myMotor", "myMotor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ComplexForConfig plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ComplexForConfig plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ComplexForConfig plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + plain.myMotor = await myMotor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ComplexForConfig plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + plain.myMotor = await myMotor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ComplexForConfig plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myLDATE.Shadow = plain.myLDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; + myCHAR.Shadow = plain.myCHAR; + myWCHAR.Shadow = plain.myWCHAR; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + await this.myMotor.PlainToShadowAsync(plain.myMotor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ComplexForConfig plain, global::Pocos.ComplexForConfig latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myLDATE != myLDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myCHAR != myCHAR.LastValue) + somethingChanged = true; + if (plain.myWCHAR != myWCHAR.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + if (await myMotor.DetectsAnyChangeAsync(plain.myMotor, latest.myMotor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ComplexForConfig CreateEmptyPoco() + { + return new global::Pocos.ComplexForConfig(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public enum Colorss +{ + Red, + Green, + Blue +} + +public enum Colorsss : UInt64 +{ + Red = 1, + Green = 2, + Blue = 3 +} + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class Vehicle : AXSharp.Connector.ITwinObject +{ + public Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Vehicle CreateEmptyPoco() + { + return new global::Pocos.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs new file mode 100644 index 00000000..e509210f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/enum_simple.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public enum Colors +{ + Red, + Green, + Blue +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs new file mode 100644 index 00000000..7b8ffd8e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_unsupported.g.cs @@ -0,0 +1,10 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Unsupported +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs new file mode 100644 index 00000000..56f39f28 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/file_with_usings.g.cs @@ -0,0 +1,820 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; +using FileWithUsingsSimpleFirstLevelNamespace; +using FileWithUsingsSimpleQualifiedNamespace.Qualified; +using FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; + +namespace FileWithUsingsSimpleFirstLevelNamespace +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace FileWithUsingsSimpleQualifiedNamespace.Qualified +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace FileWithUsingsHelloLevelOne +{ + namespace FileWithUsingsHelloLevelTwo + { + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + } +} + +namespace ExampleNamespace +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExampleNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExampleNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ExampleNamespace.Hello plain, global::Pocos.ExampleNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ExampleNamespace.Hello CreateEmptyPoco() + { + return new global::Pocos.ExampleNamespace.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs new file mode 100644 index 00000000..2e4106be --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/generics.g.cs @@ -0,0 +1,595 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace GenericsTests +{ + public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extender plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extender plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extender plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extender plain, global::Pocos.GenericsTests.Extender latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.GenericsTests.Extender CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.Extender(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.ITwinObject + { + public OnlinerBool Boolean { get; } + public OnlinerInt Cele { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeTypeToBeGeneric(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Boolean = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Boolean", "Boolean"); + Cele = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Cele", "Cele"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + await this.ReadAsync(priority); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + Boolean.Shadow = plain.Boolean; + Cele.Shadow = plain.Cele; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, global::Pocos.GenericsTests.SomeTypeToBeGeneric latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Boolean != Boolean.LastValue) + somethingChanged = true; + if (plain.Cele != Cele.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.GenericsTests.SomeTypeToBeGeneric CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Extendee2 : GenericsTests.Extender + { + [AXOpen.Data.AxoDataEntityAttribute] + [Container(Layout.Stack)] + public GenericsTests.SomeTypeToBeGeneric SomeData { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeData = new GenericsTests.SomeTypeToBeGeneric(this, "Shared Header", "SomeData"); + SomeData.AttributeName = @"Shared Header"; + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeData.PlainToShadowAsync(plain.SomeData); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extendee2 plain, global::Pocos.GenericsTests.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeData.DetectsAnyChangeAsync(plain.SomeData, latest.SomeData)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.GenericsTests.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.Extendee2(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs new file mode 100644 index 00000000..54dfa84f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs @@ -0,0 +1,522 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace makereadonce +{ + public partial class MembersWithMakeReadOnce : AXSharp.Connector.ITwinObject + { + [ReadOnce()] + public OnlinerString makeReadOnceMember { get; } + public OnlinerString someOtherMember { get; } + + [ReadOnce()] + public makereadonce.ComplexMember makeReadComplexMember { get; } + public makereadonce.ComplexMember someotherComplexMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.MakeReadOnce(); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); + makeReadComplexMember.MakeReadOnce(); + someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + await this.ReadAsync(priority); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + makeReadOnceMember.Shadow = plain.makeReadOnceMember; + someOtherMember.Shadow = plain.someOtherMember; + await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); + await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, global::Pocos.makereadonce.MembersWithMakeReadOnce latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) + somethingChanged = true; + if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonce.MembersWithMakeReadOnce CreateEmptyPoco() + { + return new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexMember : AXSharp.Connector.ITwinObject + { + public OnlinerString someMember { get; } + public OnlinerString someOtherMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + await this.ReadAsync(priority); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.ComplexMember plain) + { + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.ComplexMember plain) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.ComplexMember plain) + { + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonce.ComplexMember plain) + { + someMember.Shadow = plain.someMember; + someOtherMember.Shadow = plain.someOtherMember; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.ComplexMember plain, global::Pocos.makereadonce.ComplexMember latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.someMember != someMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonce.ComplexMember CreateEmptyPoco() + { + return new global::Pocos.makereadonce.ComplexMember(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs new file mode 100644 index 00000000..f33dd211 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs @@ -0,0 +1,522 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace makereadonly +{ + public partial class MembersWithMakeReadOnly : AXSharp.Connector.ITwinObject + { + [ReadOnly()] + public OnlinerString makeReadOnceMember { get; } + public OnlinerString someOtherMember { get; } + + [ReadOnly()] + public makereadonly.ComplexMember makeReadComplexMember { get; } + public makereadonly.ComplexMember someotherComplexMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.MakeReadOnly(); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); + makeReadComplexMember.MakeReadOnly(); + someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + await this.ReadAsync(priority); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + makeReadOnceMember.Shadow = plain.makeReadOnceMember; + someOtherMember.Shadow = plain.someOtherMember; + await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); + await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, global::Pocos.makereadonly.MembersWithMakeReadOnly latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) + somethingChanged = true; + if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonly.MembersWithMakeReadOnly CreateEmptyPoco() + { + return new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexMember : AXSharp.Connector.ITwinObject + { + public OnlinerString someMember { get; } + public OnlinerString someOtherMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + await this.ReadAsync(priority); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.ComplexMember plain) + { + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.ComplexMember plain) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.ComplexMember plain) + { + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonly.ComplexMember plain) + { + someMember.Shadow = plain.someMember; + someOtherMember.Shadow = plain.someOtherMember; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.ComplexMember plain, global::Pocos.makereadonly.ComplexMember latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.someMember != someMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonly.ComplexMember CreateEmptyPoco() + { + return new global::Pocos.makereadonly.ComplexMember(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs new file mode 100644 index 00000000..0ad24a32 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs @@ -0,0 +1,1660 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Enums +{ + public partial class ClassWithEnums : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] + public OnlinerInt colors { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] + public OnlinerString NamedValuesColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); + NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + await this.ReadAsync(priority); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) + { + colors.Shadow = (short)plain.colors; + NamedValuesColors.Shadow = plain.NamedValuesColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.colors != (Enums.Colors)latest.colors) + somethingChanged = true; + if (plain.NamedValuesColors != NamedValuesColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() + { + return new global::Pocos.Enums.ClassWithEnums(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public enum Colors + { + Red, + Green, + Blue + } + + public enum NamedValuesColors : String + { + Red = 49, + Green = 50, + Blue = 51 + } +} + +namespace misc +{ + public partial class VariousMembers : AXSharp.Connector.ITwinObject + { + public misc.SomeClass _SomeClass { get; } + public misc.Motor _Motor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); + _Motor = new misc.Motor(this, "_Motor", "_Motor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) + { + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) + { + await this._SomeClass.PlainToShadowAsync(plain._SomeClass); + await this._Motor.PlainToShadowAsync(plain._Motor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) + somethingChanged = true; + if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.VariousMembers CreateEmptyPoco() + { + return new global::Pocos.misc.VariousMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeClass : AXSharp.Connector.ITwinObject + { + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.SomeClass CreateEmptyPoco() + { + return new global::Pocos.misc.SomeClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Motor CreateEmptyPoco() + { + return new global::Pocos.misc.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public misc.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new misc.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Vehicle CreateEmptyPoco() + { + return new global::Pocos.misc.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace UnknownArraysShouldNotBeTraspiled +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; + _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) + { + if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs new file mode 100644 index 00000000..07e927da --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/mixed_access.g.cs @@ -0,0 +1,1586 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.Run = Run.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Motor plain) + { + plain.Run = Run.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.Run = Run.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.Run = Run.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + Run.Shadow = plain.Run; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct1 : AXSharp.Connector.ITwinObject +{ + public struct2 s2 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s2 = new struct2(this, "s2", "s2"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct1 plain) + { +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct1 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s2._PlainToOnlineNoacAsync(plain.s2); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct1 plain) + { +#pragma warning disable CS0612 + await this.s2._PlainToOnlineNoacAsync(plain.s2); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); + plain.s2 = await s2.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct1 plain) + { + plain.s2 = await s2.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct1 plain) + { + await this.s2.PlainToShadowAsync(plain.s2); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct1 plain, global::Pocos.struct1 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s2.DetectsAnyChangeAsync(plain.s2, latest.s2)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct1 CreateEmptyPoco() + { + return new global::Pocos.struct1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct2 : AXSharp.Connector.ITwinObject +{ + public struct3 s3 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s3 = new struct3(this, "s3", "s3"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct2 plain) + { +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct2 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s3._PlainToOnlineNoacAsync(plain.s3); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct2 plain) + { +#pragma warning disable CS0612 + await this.s3._PlainToOnlineNoacAsync(plain.s3); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); + plain.s3 = await s3.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct2 plain) + { + plain.s3 = await s3.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct2 plain) + { + await this.s3.PlainToShadowAsync(plain.s3); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct2 plain, global::Pocos.struct2 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s3.DetectsAnyChangeAsync(plain.s3, latest.s3)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct2 CreateEmptyPoco() + { + return new global::Pocos.struct2(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct3 : AXSharp.Connector.ITwinObject +{ + public struct4 s4 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct3(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s4 = new struct4(this, "s4", "s4"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct3 plain) + { +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct3 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s4._PlainToOnlineNoacAsync(plain.s4); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct3 plain) + { +#pragma warning disable CS0612 + await this.s4._PlainToOnlineNoacAsync(plain.s4); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); + plain.s4 = await s4.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct3 plain) + { + plain.s4 = await s4.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct3 plain) + { + await this.s4.PlainToShadowAsync(plain.s4); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct3 plain, global::Pocos.struct3 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s4.DetectsAnyChangeAsync(plain.s4, latest.s4)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct3 CreateEmptyPoco() + { + return new global::Pocos.struct3(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct4 : AXSharp.Connector.ITwinObject +{ + public OnlinerInt s5 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct4(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s5 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "s5", "s5"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + await this.ReadAsync(priority); + plain.s5 = s5.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + plain.s5 = s5.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct4 plain) + { + plain.s5 = s5.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct4 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + s5.LethargicWrite(plain.s5); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct4 plain) + { +#pragma warning disable CS0612 + s5.LethargicWrite(plain.s5); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + plain.s5 = s5.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct4 plain) + { + plain.s5 = s5.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct4 plain) + { + s5.Shadow = plain.s5; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct4 plain, global::Pocos.struct4 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.s5 != s5.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct4 CreateEmptyPoco() + { + return new global::Pocos.struct4(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class AbstractMotor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + public OnlinerBool ReverseDirection { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + if (plain.ReverseDirection != ReverseDirection.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.AbstractMotor CreateEmptyPoco() + { + return new global::Pocos.AbstractMotor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class GenericMotor : AbstractMotor +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public GenericMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericMotor plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericMotor plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericMotor plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericMotor plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.GenericMotor plain, global::Pocos.GenericMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.GenericMotor CreateEmptyPoco() + { + return new global::Pocos.GenericMotor(); + } +} + +public partial class SpecificMotorA : GenericMotor +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SpecificMotorA(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.SpecificMotorA plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.SpecificMotorA plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.SpecificMotorA plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.SpecificMotorA plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.SpecificMotorA plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.SpecificMotorA plain, global::Pocos.SpecificMotorA latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.SpecificMotorA CreateEmptyPoco() + { + return new global::Pocos.SpecificMotorA(); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs new file mode 100644 index 00000000..73d9d290 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/multiline_pragmas.g.cs @@ -0,0 +1,236 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace MultilinePragmas +{ + public partial class Extendee2 : AXSharp.Connector.ITwinObject + { + public OnlinerInt _messge { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _messge = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "_messge", "_messge"); + _messge.PlcTextList = @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; + [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; + [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; + [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; + [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; + [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; + [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; + [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; + [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; + [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; + [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'"; + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + await this.ReadAsync(priority); + plain._messge = _messge.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + plain._messge = _messge.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + plain._messge = _messge.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.MultilinePragmas.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + _messge.LethargicWrite(plain._messge); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { +#pragma warning disable CS0612 + _messge.LethargicWrite(plain._messge); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + plain._messge = _messge.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + plain._messge = _messge.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + _messge.Shadow = plain._messge; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.MultilinePragmas.Extendee2 plain, global::Pocos.MultilinePragmas.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain._messge != _messge.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.MultilinePragmas.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.MultilinePragmas.Extendee2(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/program.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs new file mode 100644 index 00000000..44712577 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/ref_to_simple.g.cs @@ -0,0 +1,424 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace RefToSimple +{ + public partial class ref_to_simple : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ref_to_simple(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.ref_to_simple plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.ref_to_simple plain, global::Pocos.RefToSimple.ref_to_simple latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.RefToSimple.ref_to_simple CreateEmptyPoco() + { + return new global::Pocos.RefToSimple.ref_to_simple(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class referenced : AXSharp.Connector.ITwinObject + { + public OnlinerInt b { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public referenced(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + b = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "b", "b"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + await this.ReadAsync(priority); + plain.b = b.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + plain.b = b.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.referenced plain) + { + plain.b = b.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.referenced plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + b.LethargicWrite(plain.b); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.referenced plain) + { +#pragma warning disable CS0612 + b.LethargicWrite(plain.b); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + plain.b = b.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.referenced plain) + { + plain.b = b.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.referenced plain) + { + b.Shadow = plain.b; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.referenced plain, global::Pocos.RefToSimple.referenced latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.b != b.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.RefToSimple.referenced CreateEmptyPoco() + { + return new global::Pocos.RefToSimple.referenced(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs new file mode 100644 index 00000000..9c0e8c99 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class simple_class : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public simple_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.simple_class plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.simple_class plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.simple_class plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.simple_class plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.simple_class plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.simple_class plain, global::Pocos.simple_class latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.simple_class CreateEmptyPoco() + { + return new global::Pocos.simple_class(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs new file mode 100644 index 00000000..35d2fc8b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/simple_empty_class_within_namespace.g.cs @@ -0,0 +1,208 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace sampleNamespace +{ + public partial class simple_empty_class_within_namespace : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public simple_empty_class_within_namespace(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, global::Pocos.sampleNamespace.simple_empty_class_within_namespace latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.sampleNamespace.simple_empty_class_within_namespace CreateEmptyPoco() + { + return new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs new file mode 100644 index 00000000..f316e620 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/struct_simple.g.cs @@ -0,0 +1,456 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class Vehicle : AXSharp.Connector.ITwinObject +{ + public Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Vehicle CreateEmptyPoco() + { + return new global::Pocos.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs new file mode 100644 index 00000000..13a8bca3 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values.g.cs @@ -0,0 +1,233 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace NamedValuesNamespace +{ + public enum LightColors : Int16 + { + LRED = 12, + LGREEN = 14, + LBLUE = 23 + } + + public partial class using_type_named_values : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(NamedValuesNamespace.LightColors))] + public OnlinerInt LColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "LColors", "LColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + await this.ReadAsync(priority); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + plain.LColors = LColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + plain.LColors = LColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + plain.LColors = LColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + LColors.Shadow = plain.LColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, global::Pocos.NamedValuesNamespace.using_type_named_values latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.LColors != LColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.NamedValuesNamespace.using_type_named_values CreateEmptyPoco() + { + return new global::Pocos.NamedValuesNamespace.using_type_named_values(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs new file mode 100644 index 00000000..343ca703 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_named_values_literals.g.cs @@ -0,0 +1,235 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public enum StateControllerStatus : UInt16 + { + STATUS_NO_ERR = 28672, + STATUS_IS_RUNNING = 28673, + STATUS_STATE_CHANGED = 28674, + STATUS_NO_INITIALSTATE = 33024, + STATUS_NO_NEXTSTATE = 33025 + } + + public partial class using_type_named_values : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.StateControllerStatus))] + public OnlinerWord LColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "LColors", "LColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + await this.ReadAsync(priority); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + plain.LColors = LColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + plain.LColors = LColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + plain.LColors = LColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + LColors.Shadow = plain.LColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, global::Pocos.Simatic.Ax.StateFramework.using_type_named_values latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.LColors != LColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.using_type_named_values CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs new file mode 100644 index 00000000..21d4caed --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/type_with_enum.g.cs @@ -0,0 +1,260 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public partial interface IGuard + { + } +} + +namespace Simatic.Ax.StateFramework +{ + public enum Condition + { + GT, + EQ, + LT, + NE, + GE, + LE + } + + public partial class CompareGuardLint : AXSharp.Connector.ITwinObject, IGuard + { + public OnlinerLInt CompareToValue { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.Condition))] + public OnlinerInt Condition { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public CompareGuardLint(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + CompareToValue = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "CompareToValue", "CompareToValue"); + Condition = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Condition", "Condition"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + await this.ReadAsync(priority); + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + CompareToValue.LethargicWrite(plain.CompareToValue); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Condition.LethargicWrite((short)plain.Condition); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { +#pragma warning disable CS0612 + CompareToValue.LethargicWrite(plain.CompareToValue); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Condition.LethargicWrite((short)plain.Condition); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + plain.CompareToValue = CompareToValue.Shadow; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + plain.CompareToValue = CompareToValue.Shadow; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + CompareToValue.Shadow = plain.CompareToValue; + Condition.Shadow = (short)plain.Condition; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.CompareToValue != CompareToValue.LastValue) + somethingChanged = true; + if (plain.Condition != (Simatic.Ax.StateFramework.Condition)latest.Condition) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs new file mode 100644 index 00000000..687e6895 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs @@ -0,0 +1,692 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace TypeWithNameAttributes +{ + [Container(Layout.Wrap)] + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Motor plain, global::Pocos.TypeWithNameAttributes.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.Motor CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public TypeWithNameAttributes.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new TypeWithNameAttributes.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, global::Pocos.TypeWithNameAttributes.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.Vehicle CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject + { + private string _AttributeName; + public string AttributeName { get => string.IsNullOrEmpty(_AttributeName) ? SymbolTail : _AttributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _AttributeName = value; } + + public string GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_AttributeName, culture).Interpolate(this); + } + + public string AttributeName_raw + { + get + { + return _AttributeName; + } + } + + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, global::Pocos.TypeWithNameAttributes.NoAccessModifierClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.NoAccessModifierClass CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs new file mode 100644 index 00000000..c9c7212d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_property_attributes.g.cs @@ -0,0 +1,243 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace TypesWithPropertyAttributes +{ + public partial class SomeAddedProperties : AXSharp.Connector.ITwinObject + { + private string _Description; + public string Description { get => string.IsNullOrEmpty(_Description) ? SymbolTail : _Description.Interpolate(this).CleanUpLocalizationTokens(); set => _Description = value; } + + public string GetDescription(System.Globalization.CultureInfo culture) + { + return this.Translate(_Description, culture).Interpolate(this); + } + + public string Description_raw + { + get + { + return _Description; + } + } + + public OnlinerInt Counter { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeAddedProperties(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Description = @"Some added property name value"; + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Counter = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Pocitadlo", "Counter"); + Counter.AttributeName = @"Pocitadlo"; + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + await this.ReadAsync(priority); + plain.Counter = Counter.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + plain.Counter = Counter.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + plain.Counter = Counter.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Counter.LethargicWrite(plain.Counter); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { +#pragma warning disable CS0612 + Counter.LethargicWrite(plain.Counter); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + plain.Counter = Counter.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + plain.Counter = Counter.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + Counter.Shadow = plain.Counter; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Counter != Counter.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties CreateEmptyPoco() + { + return new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs new file mode 100644 index 00000000..5400b2ac --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/abstract_members.g.cs @@ -0,0 +1,16 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public AbstractMotor() + { + } + + public Boolean Run { get; set; } + public Boolean ReverseDirection { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs new file mode 100644 index 00000000..ce30a3c8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/array_declaration.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ArrayDeclarationSimpleNamespace + { + public partial class array_declaration_class : AXSharp.Connector.IPlain + { + public array_declaration_class() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, () => new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(), new[] { (1, 100) }); +#pragma warning restore CS0612 + } + + public Int16[] primitive { get; set; } = new Int16[100]; + public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; set; } = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; + } + + public partial class some_complex_type : AXSharp.Connector.IPlain + { + public some_complex_type() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs new file mode 100644 index 00000000..b8b47eef --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs @@ -0,0 +1,36 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class class_all_primitives : AXSharp.Connector.IPlain + { + public class_all_primitives() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs new file mode 100644 index 00000000..221f97ee --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extended_by_known_type.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState, AXSharp.Connector.IPlain + { + public State1Transition() : base() + { + } + } + } + + namespace Simatic.Ax.StateFramework + { + public partial class AbstractState : AXSharp.Connector.IPlain, IState, IStateMuteable + { + public AbstractState() + { + } + + public Int16 StateID { get; set; } + public string StateName { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs new file mode 100644 index 00000000..4ce871c9 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends.g.cs @@ -0,0 +1,20 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Extended : Extendee, AXSharp.Connector.IPlain + { + public Extended() : base() + { + } + } + + public partial class Extendee : AXSharp.Connector.IPlain + { + public Extendee() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs new file mode 100644 index 00000000..91481513 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_extends_and_implements.g.cs @@ -0,0 +1,28 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, AXSharp.Connector.IPlain, IImplementation1, IImplementation2 + { + public ExtendsAndImplements() : base() + { + } + } + + public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.IPlain + { + public ExtendeeExtendsAndImplements() + { + } + } + + public partial interface IImplementation1 + { + } + + public partial interface IImplementation2 + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs new file mode 100644 index 00000000..906b0bc0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_generic_extension.g.cs @@ -0,0 +1,42 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Generics + { + public partial class Extender : AXSharp.Connector.IPlain + { + public Extender() + { + } + } + + public partial class Extendee : Generics.Extender, AXSharp.Connector.IPlain + { + public Extendee() : base() + { + } + + public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); + public Generics.SomeType SomeTypeAsPoco { get; set; } = new Generics.SomeType(); + } + + public partial class Extendee2 : Generics.Extender, AXSharp.Connector.IPlain + { + public Extendee2() : base() + { + } + + public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); + } + + public partial class SomeType : AXSharp.Connector.IPlain + { + public SomeType() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs new file mode 100644 index 00000000..5eb39ed0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements.g.cs @@ -0,0 +1,17 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class _NULL_CONTEXT : AXSharp.Connector.IPlain, IContext + { + public _NULL_CONTEXT() + { + } + } + + public partial interface IContext + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs new file mode 100644 index 00000000..aca3704d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_implements_multiple.g.cs @@ -0,0 +1,21 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.IPlain, IContext_Multiple, IObject_Multiple + { + public _NULL_CONTEXT_MULTIPLE() + { + } + } + + public partial interface IContext_Multiple + { + } + + public partial interface IObject_Multiple + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs new file mode 100644 index 00000000..e4ba926f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_internal.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + internal partial class ClassWithComplexTypes : AXSharp.Connector.IPlain + { + public ClassWithComplexTypes() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs new file mode 100644 index 00000000..43b8cdaa --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_no_access_modifier.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class NoAccessModifierClass : AXSharp.Connector.IPlain + { + public NoAccessModifierClass() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs new file mode 100644 index 00000000..27f5f1d8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_complex_members.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithComplexTypesNamespace + { + public partial class ClassWithComplexTypes : AXSharp.Connector.IPlain + { + public ClassWithComplexTypes() + { + } + + public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithComplexTypesNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs new file mode 100644 index 00000000..7f96b873 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_non_public_members.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithNonTraspilableMemberssNamespace + { + public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.IPlain + { + public ClassWithNonTraspilableMembers() + { + } + + public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs new file mode 100644 index 00000000..3f2f1d38 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_pragmas.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithPragmasNamespace + { + public partial class ClassWithPragmas : AXSharp.Connector.IPlain + { + public ClassWithPragmas() + { + } + + public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithPragmasNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs new file mode 100644 index 00000000..bc4e1b33 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_primitive_members.g.cs @@ -0,0 +1,44 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithPrimitiveTypesNamespace + { + public partial class ClassWithPrimitiveTypes : AXSharp.Connector.IPlain + { + public ClassWithPrimitiveTypes() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); + public DateOnly myLDATE { get; set; } = new DateOnly(1970, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); + public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); + public Char myCHAR { get; set; } + public Char myWCHAR { get; set; } + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs new file mode 100644 index 00000000..ca595c93 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_using_directives.g.cs @@ -0,0 +1,34 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + using SimpleFirstLevelNamespace; + using SimpleQualifiedNamespace.Qualified; + using HelloLevelOne.HelloLevelTwo; + + internal partial class ClassWithUsingDirectives : AXSharp.Connector.IPlain + { + public ClassWithUsingDirectives() + { + } + + using SimpleFirstLevelNamespace ; using SimpleQualifiedNamespace . Qualified ; using HelloLevelOne . HelloLevelTwo ; + +} + +namespace SimpleFirstLevelNamespace +{ +} + +namespace SimpleQualifiedNamespace.Qualified +{ +} + +namespace HelloLevelOne +{ + namespace HelloLevelTwo + { + } +} } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs new file mode 100644 index 00000000..2e89b94c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/compileromitsattribute.g.cs @@ -0,0 +1,109 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace CompilerOmmits + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { + } + + public CompilerOmmits.Complex _must_be_omitted_in_onliner { get; set; } = new CompilerOmmits.Complex(); + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } + + namespace Enums + { + public partial class ClassWithEnums : AXSharp.Connector.IPlain + { + public ClassWithEnums() + { + } + + public global::Enums.Colors colors { get; set; } + public String NamedValuesColors { get; set; } + } + } + + namespace misc + { + public partial class VariousMembers : AXSharp.Connector.IPlain + { + public VariousMembers() + { + } + + public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); + public misc.Motor _Motor { get; set; } = new misc.Motor(); + } + + public partial class SomeClass : AXSharp.Connector.IPlain + { + public SomeClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public misc.Motor m { get; set; } = new misc.Motor(); + public Int16 displacement { get; set; } + } + } + + namespace UnknownArraysShouldNotBeTraspiled + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); +#pragma warning restore CS0612 + } + + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs new file mode 100644 index 00000000..db934855 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/configuration.g.cs @@ -0,0 +1,61 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class ComplexForConfig : AXSharp.Connector.IPlain + { + public ComplexForConfig() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1970, 1, 1); + public DateOnly myLDATE { get; set; } = new DateOnly(1970, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); + public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); + public Char myCHAR { get; set; } + public Char myWCHAR { get; set; } + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + public Motor myMotor { get; set; } = new Motor(); + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public Motor m { get; set; } = new Motor(); + public Int16 displacement { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/enum_simple.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs new file mode 100644 index 00000000..56cacaa1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_unsupported.g.cs @@ -0,0 +1,10 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Unsupported + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs new file mode 100644 index 00000000..1fecb933 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/file_with_usings.g.cs @@ -0,0 +1,52 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; +using Pocos.FileWithUsingsSimpleFirstLevelNamespace; +using Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified; +using Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; + +namespace Pocos +{ + namespace FileWithUsingsSimpleFirstLevelNamespace + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + + namespace FileWithUsingsSimpleQualifiedNamespace.Qualified + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + + namespace FileWithUsingsHelloLevelOne + { + namespace FileWithUsingsHelloLevelTwo + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + } + + namespace ExampleNamespace + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs new file mode 100644 index 00000000..47e0b1d4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/generics.g.cs @@ -0,0 +1,36 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace GenericsTests + { + public partial class Extender : AXSharp.Connector.IPlain + { + public Extender() + { + } + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.IPlain + { + public SomeTypeToBeGeneric() + { + } + + public Boolean Boolean { get; set; } + public Int16 Cele { get; set; } + } + + public partial class Extendee2 : GenericsTests.Extender, AXSharp.Connector.IPlain + { + public Extendee2() : base() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Shared Header")] + public GenericsTests.SomeTypeToBeGeneric SomeData { get; set; } = new GenericsTests.SomeTypeToBeGeneric(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs new file mode 100644 index 00000000..b1f0575c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonce.g.cs @@ -0,0 +1,31 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace makereadonce + { + public partial class MembersWithMakeReadOnce : AXSharp.Connector.IPlain + { + public MembersWithMakeReadOnce() + { + } + + public string makeReadOnceMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + public makereadonce.ComplexMember makeReadComplexMember { get; set; } = new makereadonce.ComplexMember(); + public makereadonce.ComplexMember someotherComplexMember { get; set; } = new makereadonce.ComplexMember(); + } + + public partial class ComplexMember : AXSharp.Connector.IPlain + { + public ComplexMember() + { + } + + public string someMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs new file mode 100644 index 00000000..ecafb34f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/makereadonly.g.cs @@ -0,0 +1,31 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace makereadonly + { + public partial class MembersWithMakeReadOnly : AXSharp.Connector.IPlain + { + public MembersWithMakeReadOnly() + { + } + + public string makeReadOnceMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + public makereadonly.ComplexMember makeReadComplexMember { get; set; } = new makereadonly.ComplexMember(); + public makereadonly.ComplexMember someotherComplexMember { get; set; } = new makereadonly.ComplexMember(); + } + + public partial class ComplexMember : AXSharp.Connector.IPlain + { + public ComplexMember() + { + } + + public string someMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs new file mode 100644 index 00000000..1eae7fcb --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/misc.g.cs @@ -0,0 +1,86 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Enums + { + public partial class ClassWithEnums : AXSharp.Connector.IPlain + { + public ClassWithEnums() + { + } + + public global::Enums.Colors colors { get; set; } + public String NamedValuesColors { get; set; } + } + } + + namespace misc + { + public partial class VariousMembers : AXSharp.Connector.IPlain + { + public VariousMembers() + { + } + + public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); + public misc.Motor _Motor { get; set; } = new misc.Motor(); + } + + public partial class SomeClass : AXSharp.Connector.IPlain + { + public SomeClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public misc.Motor m { get; set; } = new misc.Motor(); + public Int16 displacement { get; set; } + } + } + + namespace UnknownArraysShouldNotBeTraspiled + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); +#pragma warning restore CS0612 + } + + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs new file mode 100644 index 00000000..a7383fdf --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/mixed_access.g.cs @@ -0,0 +1,75 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean Run { get; set; } + } + + public partial class struct1 : AXSharp.Connector.IPlain + { + public struct1() + { + } + + public struct2 s2 { get; set; } = new struct2(); + } + + public partial class struct2 : AXSharp.Connector.IPlain + { + public struct2() + { + } + + public struct3 s3 { get; set; } = new struct3(); + } + + public partial class struct3 : AXSharp.Connector.IPlain + { + public struct3() + { + } + + public struct4 s4 { get; set; } = new struct4(); + } + + public partial class struct4 : AXSharp.Connector.IPlain + { + public struct4() + { + } + + public Int16 s5 { get; set; } + } + + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public AbstractMotor() + { + } + + public Boolean Run { get; set; } + public Boolean ReverseDirection { get; set; } + } + + public partial class GenericMotor : AbstractMotor, AXSharp.Connector.IPlain + { + public GenericMotor() : base() + { + } + } + + public partial class SpecificMotorA : GenericMotor, AXSharp.Connector.IPlain + { + public SpecificMotorA() : base() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs new file mode 100644 index 00000000..7eb75e26 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/multiline_pragmas.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace MultilinePragmas + { + public partial class Extendee2 : AXSharp.Connector.IPlain + { + public Extendee2() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("PlcTextList", @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; + [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; + [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; + [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; + [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; + [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; + [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; + [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; + [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; + [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; + [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'")] + public Int16 _messge { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/program.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs new file mode 100644 index 00000000..22248e83 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/ref_to_simple.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace RefToSimple + { + public partial class ref_to_simple : AXSharp.Connector.IPlain + { + public ref_to_simple() + { + } + } + + public partial class referenced : AXSharp.Connector.IPlain + { + public referenced() + { + } + + public Int16 b { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs new file mode 100644 index 00000000..49d5fd25 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class simple_class : AXSharp.Connector.IPlain + { + public simple_class() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs new file mode 100644 index 00000000..3cf279ae --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/simple_empty_class_within_namespace.g.cs @@ -0,0 +1,16 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace sampleNamespace + { + public partial class simple_empty_class_within_namespace : AXSharp.Connector.IPlain + { + public simple_empty_class_within_namespace() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs new file mode 100644 index 00000000..0c0b4d7c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/struct_simple.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public Motor m { get; set; } = new Motor(); + public Int16 displacement { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs new file mode 100644 index 00000000..a5e6936b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace NamedValuesNamespace + { + public partial class using_type_named_values : AXSharp.Connector.IPlain + { + public using_type_named_values() + { + } + + public Int16 LColors { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs new file mode 100644 index 00000000..14b4df59 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_named_values_literals.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial class using_type_named_values : AXSharp.Connector.IPlain + { + public using_type_named_values() + { + } + + public UInt16 LColors { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs new file mode 100644 index 00000000..14b70914 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/type_with_enum.g.cs @@ -0,0 +1,26 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial interface IGuard + { + } + } + + namespace Simatic.Ax.StateFramework + { + public partial class CompareGuardLint : AXSharp.Connector.IPlain, IGuard + { + public CompareGuardLint() + { + } + + public Int64 CompareToValue { get; set; } + public global::Simatic.Ax.StateFramework.Condition Condition { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs new file mode 100644 index 00000000..2c9aba9f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_name_attributes.g.cs @@ -0,0 +1,37 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace TypeWithNameAttributes + { + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public TypeWithNameAttributes.Motor m { get; set; } = new TypeWithNameAttributes.Motor(); + public Int16 displacement { get; set; } + } + + public partial class NoAccessModifierClass : AXSharp.Connector.IPlain + { + public NoAccessModifierClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs new file mode 100644 index 00000000..a68b5471 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/types_with_property_attributes.g.cs @@ -0,0 +1,20 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace TypesWithPropertyAttributes + { + [AXSharp.Connector.AddedPropertiesAttribute("Description", @"Some added property name value")] + public partial class SomeAddedProperties : AXSharp.Connector.IPlain + { + public SomeAddedProperties() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Pocitadlo")] + public Int16 Counter { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs new file mode 100644 index 00000000..1ba9627a --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace units +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator)); + var resource = assembly.GetType("units.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj new file mode 100644 index 00000000..2cb3c2ea --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs new file mode 100644 index 00000000..17dc6c6f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Configurations.g.cs @@ -0,0 +1,181 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class unitsTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public ComplexForConfig Complex { get; } + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + [ReadOnce()] + public OnlinerWString myWSTRING_readOnce { get; } + + [ReadOnly()] + public OnlinerWString myWSTRING_readOnly { get; } + + [ReadOnce()] + public ComplexForConfig cReadOnce { get; } + + [ReadOnly()] + public ComplexForConfig cReadOnly { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss { get; } + + [CompilerOmitsAttribute("POCO")] + public OnlinerBool _must_be_omitted_in_poco { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorss))] + public OnlinerInt Colorss2 { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Colorsss))] + public OnlinerULInt Colorsss2 { get; } + public OnlinerBool MotorOn { get; } + public OnlinerInt MotorState { get; } + public Motor Motor1 { get; } + public Motor Motor2 { get; } + public struct1 s1 { get; } + public struct4 s4 { get; } + public SpecificMotorA mot1 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } + + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + Complex = new ComplexForConfig(this.Connector, "", "Complex"); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this.Connector, "", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this.Connector, "", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this.Connector, "", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this.Connector, "", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this.Connector, "", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this.Connector, "", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this.Connector, "", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this.Connector, "", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this.Connector, "", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this.Connector, "", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this.Connector, "", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this.Connector, "", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this.Connector, "", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this.Connector, "", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this.Connector, "", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this.Connector, "", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this.Connector, "", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this.Connector, "", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this.Connector, "", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this.Connector, "", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this.Connector, "", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this.Connector, "", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this.Connector, "", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this.Connector, "", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING"); + myWSTRING_readOnce = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnce"); + myWSTRING_readOnce.MakeReadOnce(); + myWSTRING_readOnly = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this.Connector, "", "myWSTRING_readOnly"); + myWSTRING_readOnly.MakeReadOnly(); + cReadOnce = new ComplexForConfig(this.Connector, "", "cReadOnce"); + cReadOnce.MakeReadOnce(); + cReadOnly = new ComplexForConfig(this.Connector, "", "cReadOnly"); + cReadOnly.MakeReadOnly(); + Colorss = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss"); + Colorsss = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss", "Colorsss"); + _must_be_omitted_in_poco = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "_must_be_omitted_in_poco"); + Colorss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "Colorss2"); + Colorsss2 = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Colorsss2", "Colorsss2"); + MotorOn = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this.Connector, "", "MotorOn"); + MotorState = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this.Connector, "", "MotorState"); + Motor1 = new Motor(this.Connector, "", "Motor1"); + Motor2 = new Motor(this.Connector, "", "Motor2"); + s1 = new struct1(this.Connector, "", "s1"); + s4 = new struct4(this.Connector, "", "s4"); + mot1 = new SpecificMotorA(this.Connector, "", "mot1"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs new file mode 100644 index 00000000..0e57b992 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/abstract_members.g.cs @@ -0,0 +1,238 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class AbstractMotor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + public OnlinerBool ReverseDirection { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + if (plain.ReverseDirection != ReverseDirection.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.AbstractMotor CreateEmptyPoco() + { + return new global::Pocos.AbstractMotor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs new file mode 100644 index 00000000..49415da1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/array_declaration.g.cs @@ -0,0 +1,462 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ArrayDeclarationSimpleNamespace +{ + public partial class array_declaration_class : AXSharp.Connector.ITwinObject + { + public OnlinerInt[] primitive { get; } + public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public array_declaration_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + primitive = new OnlinerInt[100]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(primitive, this, "primitive", "primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateINT(p, rt, st), new[] { (1, 100) }); + complex = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, this, "complex", "complex", (p, rt, st) => new ArrayDeclarationSimpleNamespace.some_complex_type(p, rt, st), new[] { (1, 100) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + await this.ReadAsync(priority); + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + plain.primitive = primitive.Select(p => p.LastValue).ToArray(); +#pragma warning disable CS0612 + plain.complex = complex.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, eAccessPriority priority = eAccessPriority.Normal) + { + var _primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var _complex_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + var _primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + primitive.Select(p => p.LethargicWrite(plain.primitive[_primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var _complex_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + complex.Select(p => p._PlainToOnlineNoacAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain = new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + plain.primitive = primitive.Select(p => p.Shadow).ToArray(); + plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + plain.primitive = primitive.Select(p => p.Shadow).ToArray(); + plain.complex = complex.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain) + { + var _primitive_i_FE8484DAB3 = 0; + primitive.Select(p => p.Shadow = plain.primitive[_primitive_i_FE8484DAB3++]).ToArray(); + var _complex_i_FE8484DAB3 = 0; + complex.Select(p => p.PlainToShadowAsync(plain.complex[_complex_i_FE8484DAB3++])).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class plain, global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.primitive.Length; i760901_3001_mimi++) + { + if (latest.primitive.ElementAt(i760901_3001_mimi) != plain.primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest.complex.Length; i760901_3001_mimi++) + { + if (await complex.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain.complex[i760901_3001_mimi], latest.complex[i760901_3001_mimi])) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class CreateEmptyPoco() + { + return new global::Pocos.ArrayDeclarationSimpleNamespace.array_declaration_class(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class some_complex_type : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public some_complex_type(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain = new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type plain, global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type CreateEmptyPoco() + { + return new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs new file mode 100644 index 00000000..36c26531 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs @@ -0,0 +1,558 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class class_all_primitives : AXSharp.Connector.ITwinObject +{ + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.class_all_primitives plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.class_all_primitives plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.class_all_primitives plain = new global::Pocos.class_all_primitives(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.class_all_primitives plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.class_all_primitives plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives plain, global::Pocos.class_all_primitives latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.class_all_primitives CreateEmptyPoco() + { + return new global::Pocos.class_all_primitives(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs new file mode 100644 index 00000000..41bd6829 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs @@ -0,0 +1,373 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public State1Transition(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.State1Transition plain = new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.State1Transition plain, global::Pocos.Simatic.Ax.StateFramework.State1Transition latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Simatic.Ax.StateFramework.State1Transition CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.State1Transition(); + } + } +} + +namespace Simatic.Ax.StateFramework +{ + public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable + { + public OnlinerInt StateID { get; } + public OnlinerString StateName { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); + StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + await this.ReadAsync(priority); + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + plain.StateID = StateID.LastValue; + plain.StateName = StateName.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + StateID.LethargicWrite(plain.StateID); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + StateName.LethargicWrite(plain.StateName); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { +#pragma warning disable CS0612 + StateID.LethargicWrite(plain.StateID); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + StateName.LethargicWrite(plain.StateName); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.AbstractState plain = new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + plain.StateID = StateID.Shadow; + plain.StateName = StateName.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + plain.StateID = StateID.Shadow; + plain.StateName = StateName.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain) + { + StateID.Shadow = plain.StateID; + StateName.Shadow = plain.StateName; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.AbstractState plain, global::Pocos.Simatic.Ax.StateFramework.AbstractState latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.StateID != StateID.LastValue) + somethingChanged = true; + if (plain.StateName != StateName.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.AbstractState CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.AbstractState(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs new file mode 100644 index 00000000..ae98b0e0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends.g.cs @@ -0,0 +1,334 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Extended : Extendee +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extended(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Extended plain = new global::Pocos.Extended(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Extended plain = new global::Pocos.Extended(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extended plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Extended plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Extended plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Extended plain = new global::Pocos.Extended(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Extended plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Extended plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Extended plain, global::Pocos.Extended latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Extended CreateEmptyPoco() + { + return new global::Pocos.Extended(); + } +} + +public partial class Extendee : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Extendee plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Extendee plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Extendee plain = new global::Pocos.Extendee(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Extendee plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Extendee plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Extendee plain, global::Pocos.Extendee latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Extendee CreateEmptyPoco() + { + return new global::Pocos.Extendee(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs new file mode 100644 index 00000000..2f519df4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extends_and_implements.g.cs @@ -0,0 +1,342 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, IImplementation1, IImplementation2 +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendsAndImplements plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendsAndImplements plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.ExtendsAndImplements plain = new global::Pocos.ExtendsAndImplements(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExtendsAndImplements plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExtendsAndImplements plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.ExtendsAndImplements plain, global::Pocos.ExtendsAndImplements latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.ExtendsAndImplements CreateEmptyPoco() + { + return new global::Pocos.ExtendsAndImplements(); + } +} + +public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ExtendeeExtendsAndImplements(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExtendeeExtendsAndImplements plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ExtendeeExtendsAndImplements plain = new global::Pocos.ExtendeeExtendsAndImplements(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExtendeeExtendsAndImplements plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ExtendeeExtendsAndImplements plain, global::Pocos.ExtendeeExtendsAndImplements latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ExtendeeExtendsAndImplements CreateEmptyPoco() + { + return new global::Pocos.ExtendeeExtendsAndImplements(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IImplementation1 +{ +} + +public partial interface IImplementation2 +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs new file mode 100644 index 00000000..6f1bf375 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_generic_extension.g.cs @@ -0,0 +1,733 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Generics +{ + public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extender plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extender plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extender plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extender plain = new global::Pocos.Generics.Extender(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extender plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extender plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extender plain, global::Pocos.Generics.Extender latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Generics.Extender CreateEmptyPoco() + { + return new global::Pocos.Generics.Extender(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Extendee : Generics.Extender + { + public Generics.SomeType SomeType { get; } + public Generics.SomeType SomeTypeAsPoco { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); + SomeTypeAsPoco = new Generics.SomeType(this, "SomeTypeAsPoco", "SomeTypeAsPoco"); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeTypeAsPoco = await SomeTypeAsPoco._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.SomeTypeAsPoco._PlainToOnlineNoacAsync(plain.SomeTypeAsPoco); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extendee plain = new global::Pocos.Generics.Extendee(); + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + plain.SomeTypeAsPoco = await SomeTypeAsPoco.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeType.PlainToShadowAsync(plain.SomeType); + await this.SomeTypeAsPoco.PlainToShadowAsync(plain.SomeTypeAsPoco); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee plain, global::Pocos.Generics.Extendee latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) + somethingChanged = true; + if (await SomeTypeAsPoco.DetectsAnyChangeAsync(plain.SomeTypeAsPoco, latest.SomeTypeAsPoco)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Generics.Extendee CreateEmptyPoco() + { + return new global::Pocos.Generics.Extendee(); + } + } + + public partial class Extendee2 : Generics.Extender + { + public Generics.SomeType SomeType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeType = new Generics.SomeType(this, "SomeType", "SomeType"); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.Extendee2 plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeType = await SomeType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeType._PlainToOnlineNoacAsync(plain.SomeType); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.Generics.Extendee2 plain = new global::Pocos.Generics.Extendee2(); + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.Extendee2 plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeType = await SomeType.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.Extendee2 plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeType.PlainToShadowAsync(plain.SomeType); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.Generics.Extendee2 plain, global::Pocos.Generics.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeType.DetectsAnyChangeAsync(plain.SomeType, latest.SomeType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.Generics.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.Generics.Extendee2(); + } + } + + public partial class SomeType : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeType(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Generics.SomeType plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Generics.SomeType plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Generics.SomeType plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Generics.SomeType plain = new global::Pocos.Generics.SomeType(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Generics.SomeType plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Generics.SomeType plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Generics.SomeType plain, global::Pocos.Generics.SomeType latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Generics.SomeType CreateEmptyPoco() + { + return new global::Pocos.Generics.SomeType(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs new file mode 100644 index 00000000..ee0cb2ce --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements.g.cs @@ -0,0 +1,209 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class _NULL_CONTEXT : AXSharp.Connector.ITwinObject, IContext +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public _NULL_CONTEXT(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos._NULL_CONTEXT plain = new global::Pocos._NULL_CONTEXT(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT plain, global::Pocos._NULL_CONTEXT latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos._NULL_CONTEXT CreateEmptyPoco() + { + return new global::Pocos._NULL_CONTEXT(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IContext +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs new file mode 100644 index 00000000..95d287ca --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_implements_multiple.g.cs @@ -0,0 +1,213 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.ITwinObject, IContext_Multiple, IObject_Multiple +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public _NULL_CONTEXT_MULTIPLE(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos._NULL_CONTEXT_MULTIPLE plain = new global::Pocos._NULL_CONTEXT_MULTIPLE(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos._NULL_CONTEXT_MULTIPLE plain, global::Pocos._NULL_CONTEXT_MULTIPLE latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos._NULL_CONTEXT_MULTIPLE CreateEmptyPoco() + { + return new global::Pocos._NULL_CONTEXT_MULTIPLE(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial interface IContext_Multiple +{ +} + +public partial interface IObject_Multiple +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs new file mode 100644 index 00000000..4125361e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_internal.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +internal partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypes plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypes plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypes(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypes plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypes plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs new file mode 100644 index 00000000..2d2272b1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_no_access_modifier.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.NoAccessModifierClass plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.NoAccessModifierClass plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.NoAccessModifierClass plain = new global::Pocos.NoAccessModifierClass(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.NoAccessModifierClass plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.NoAccessModifierClass plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.NoAccessModifierClass plain, global::Pocos.NoAccessModifierClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.NoAccessModifierClass CreateEmptyPoco() + { + return new global::Pocos.NoAccessModifierClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs new file mode 100644 index 00000000..d423ae31 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_complex_members.g.cs @@ -0,0 +1,430 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithComplexTypesNamespace +{ + public partial class ClassWithComplexTypes : AXSharp.Connector.ITwinObject + { + public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithComplexTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithComplexTypesNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain = new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes plain, global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypesNamespace.ClassWithComplexTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain = new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 plain, global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithComplexTypesNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithComplexTypesNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs new file mode 100644 index 00000000..aced06ee --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_non_public_members.g.cs @@ -0,0 +1,430 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithNonTraspilableMemberssNamespace +{ + public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.ITwinObject + { + public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithNonTraspilableMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers CreateEmptyPoco() + { + return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ClassWithNonTraspilableMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain = new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 plain, global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs new file mode 100644 index 00000000..383d092d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_pragmas.g.cs @@ -0,0 +1,432 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithPragmasNamespace +{ + [Container(Layout.Stack)] + public partial class ClassWithPragmas : AXSharp.Connector.ITwinObject + { + [Container(Layout.Wrap)] + public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithPragmas(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myComplexType = new ClassWithPragmasNamespace.ComplexType1(this, "myComplexType", "myComplexType"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { +#pragma warning disable CS0612 + plain.myComplexType = await myComplexType._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { +#pragma warning disable CS0612 + await this.myComplexType._PlainToOnlineNoacAsync(plain.myComplexType); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain = new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { + plain.myComplexType = await myComplexType.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain) + { + await this.myComplexType.PlainToShadowAsync(plain.myComplexType); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas plain, global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await myComplexType.DetectsAnyChangeAsync(plain.myComplexType, latest.myComplexType)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas CreateEmptyPoco() + { + return new global::Pocos.ClassWithPragmasNamespace.ClassWithPragmas(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexType1 : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexType1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain = new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPragmasNamespace.ComplexType1 plain, global::Pocos.ClassWithPragmasNamespace.ComplexType1 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPragmasNamespace.ComplexType1 CreateEmptyPoco() + { + return new global::Pocos.ClassWithPragmasNamespace.ComplexType1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs new file mode 100644 index 00000000..279c7fb4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs @@ -0,0 +1,641 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithPrimitiveTypesNamespace +{ + public partial class ClassWithPrimitiveTypes : AXSharp.Connector.ITwinObject + { + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain = new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myLDATE.Shadow = plain.myLDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; + myCHAR.Shadow = plain.myCHAR; + myWCHAR.Shadow = plain.myWCHAR; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes plain, global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myLDATE != myLDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myCHAR != myCHAR.LastValue) + somethingChanged = true; + if (plain.myWCHAR != myWCHAR.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes CreateEmptyPoco() + { + return new global::Pocos.ClassWithPrimitiveTypesNamespace.ClassWithPrimitiveTypes(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs new file mode 100644 index 00000000..41fa3c4c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_using_directives.g.cs @@ -0,0 +1,223 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; +using SimpleFirstLevelNamespace; +using SimpleQualifiedNamespace.Qualified; +using HelloLevelOne.HelloLevelTwo; + +internal partial class ClassWithUsingDirectives : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithUsingDirectives(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithUsingDirectives plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ClassWithUsingDirectives plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithUsingDirectives plain = new global::Pocos.ClassWithUsingDirectives(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithUsingDirectives plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ClassWithUsingDirectives plain, global::Pocos.ClassWithUsingDirectives latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithUsingDirectives CreateEmptyPoco() + { + return new global::Pocos.ClassWithUsingDirectives(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +namespace SimpleFirstLevelNamespace +{ +} + +namespace SimpleQualifiedNamespace.Qualified +{ +} + +namespace HelloLevelOne +{ + namespace HelloLevelTwo + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs new file mode 100644 index 00000000..b302f337 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs @@ -0,0 +1,2122 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace CompilerOmmits +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + [CompilerOmitsAttribute("POCO")] + public CompilerOmmits.Complex _must_be_omitted_in_poco { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _must_be_omitted_in_poco = new CompilerOmmits.Complex(this, "_must_be_omitted_in_poco", "_must_be_omitted_in_poco"); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + await this.ReadAsync(priority); + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.CompilerOmmits.ClassWithArrays plain = new global::Pocos.CompilerOmmits.ClassWithArrays(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain) + { + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.ClassWithArrays plain, global::Pocos.CompilerOmmits.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.CompilerOmmits.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.CompilerOmmits.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.CompilerOmmits.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.CompilerOmmits.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.CompilerOmmits.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.CompilerOmmits.Complex plain = new global::Pocos.CompilerOmmits.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.CompilerOmmits.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.CompilerOmmits.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.CompilerOmmits.Complex plain, global::Pocos.CompilerOmmits.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.CompilerOmmits.Complex CreateEmptyPoco() + { + return new global::Pocos.CompilerOmmits.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace Enums +{ + public partial class ClassWithEnums : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] + public OnlinerInt colors { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] + public OnlinerString NamedValuesColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); + NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + await this.ReadAsync(priority); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) + { + colors.Shadow = (short)plain.colors; + NamedValuesColors.Shadow = plain.NamedValuesColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.colors != (Enums.Colors)latest.colors) + somethingChanged = true; + if (plain.NamedValuesColors != NamedValuesColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() + { + return new global::Pocos.Enums.ClassWithEnums(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public enum Colors + { + Red, + Green, + Blue + } + + public enum NamedValuesColors : String + { + Red = 49, + Green = 50, + Blue = 51 + } +} + +namespace misc +{ + public partial class VariousMembers : AXSharp.Connector.ITwinObject + { + public misc.SomeClass _SomeClass { get; } + public misc.Motor _Motor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); + _Motor = new misc.Motor(this, "_Motor", "_Motor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) + { + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) + { + await this._SomeClass.PlainToShadowAsync(plain._SomeClass); + await this._Motor.PlainToShadowAsync(plain._Motor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) + somethingChanged = true; + if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.VariousMembers CreateEmptyPoco() + { + return new global::Pocos.misc.VariousMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeClass : AXSharp.Connector.ITwinObject + { + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.SomeClass CreateEmptyPoco() + { + return new global::Pocos.misc.SomeClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Motor CreateEmptyPoco() + { + return new global::Pocos.misc.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public misc.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new misc.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Vehicle CreateEmptyPoco() + { + return new global::Pocos.misc.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace UnknownArraysShouldNotBeTraspiled +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; + _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) + { + if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs new file mode 100644 index 00000000..bf55ab8e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs @@ -0,0 +1,1124 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class ComplexForConfig : AXSharp.Connector.ITwinObject +{ + public OnlinerBool myBOOL { get; } + public OnlinerByte myBYTE { get; } + public OnlinerWord myWORD { get; } + public OnlinerDWord myDWORD { get; } + public OnlinerLWord myLWORD { get; } + public OnlinerSInt mySINT { get; } + public OnlinerInt myINT { get; } + public OnlinerDInt myDINT { get; } + public OnlinerLInt myLINT { get; } + public OnlinerUSInt myUSINT { get; } + public OnlinerUInt myUINT { get; } + public OnlinerUDInt myUDINT { get; } + public OnlinerULInt myULINT { get; } + public OnlinerReal myREAL { get; } + public OnlinerLReal myLREAL { get; } + public OnlinerTime myTIME { get; } + public OnlinerLTime myLTIME { get; } + public OnlinerDate myDATE { get; } + public OnlinerDate myLDATE { get; } + public OnlinerTimeOfDay myTIME_OF_DAY { get; } + public OnlinerLTimeOfDay myLTIME_OF_DAY { get; } + public OnlinerDateTime myDATE_AND_TIME { get; } + public OnlinerLDateTime myLDATE_AND_TIME { get; } + public OnlinerChar myCHAR { get; } + public OnlinerWChar myWCHAR { get; } + public OnlinerString mySTRING { get; } + public OnlinerWString myWSTRING { get; } + public Motor myMotor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + myBOOL = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "myBOOL", "myBOOL"); + myBYTE = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "myBYTE", "myBYTE"); + myWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "myWORD", "myWORD"); + myDWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateDWORD(this, "myDWORD", "myDWORD"); + myLWORD = @Connector.ConnectorAdapter.AdapterFactory.CreateLWORD(this, "myLWORD", "myLWORD"); + mySINT = @Connector.ConnectorAdapter.AdapterFactory.CreateSINT(this, "mySINT", "mySINT"); + myINT = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myINT", "myINT"); + myDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateDINT(this, "myDINT", "myDINT"); + myLINT = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "myLINT", "myLINT"); + myUSINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUSINT(this, "myUSINT", "myUSINT"); + myUINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUINT(this, "myUINT", "myUINT"); + myUDINT = @Connector.ConnectorAdapter.AdapterFactory.CreateUDINT(this, "myUDINT", "myUDINT"); + myULINT = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "myULINT", "myULINT"); + myREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateREAL(this, "myREAL", "myREAL"); + myLREAL = @Connector.ConnectorAdapter.AdapterFactory.CreateLREAL(this, "myLREAL", "myLREAL"); + myTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME(this, "myTIME", "myTIME"); + myLTIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME(this, "myLTIME", "myLTIME"); + myDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE(this, "myDATE", "myDATE"); + myLDATE = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE(this, "myLDATE", "myLDATE"); + myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); + myLTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateLTIME_OF_DAY(this, "myLTIME_OF_DAY", "myLTIME_OF_DAY"); + myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); + myLDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateLDATE_AND_TIME(this, "myLDATE_AND_TIME", "myLDATE_AND_TIME"); + myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); + myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); + mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myMotor = new Motor(this, "myMotor", "myMotor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + await this.ReadAsync(priority); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ComplexForConfig plain) + { + plain.myBOOL = myBOOL.LastValue; + plain.myBYTE = myBYTE.LastValue; + plain.myWORD = myWORD.LastValue; + plain.myDWORD = myDWORD.LastValue; + plain.myLWORD = myLWORD.LastValue; + plain.mySINT = mySINT.LastValue; + plain.myINT = myINT.LastValue; + plain.myDINT = myDINT.LastValue; + plain.myLINT = myLINT.LastValue; + plain.myUSINT = myUSINT.LastValue; + plain.myUINT = myUINT.LastValue; + plain.myUDINT = myUDINT.LastValue; + plain.myULINT = myULINT.LastValue; + plain.myREAL = myREAL.LastValue; + plain.myLREAL = myLREAL.LastValue; + plain.myTIME = myTIME.LastValue; + plain.myLTIME = myLTIME.LastValue; + plain.myDATE = myDATE.LastValue; + plain.myLDATE = myLDATE.LastValue; + plain.myTIME_OF_DAY = myTIME_OF_DAY.LastValue; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.LastValue; + plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.LastValue; + plain.myCHAR = myCHAR.LastValue; + plain.myWCHAR = myWCHAR.LastValue; + plain.mySTRING = mySTRING.LastValue; + plain.myWSTRING = myWSTRING.LastValue; +#pragma warning disable CS0612 + plain.myMotor = await myMotor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ComplexForConfig plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ComplexForConfig plain) + { +#pragma warning disable CS0612 + myBOOL.LethargicWrite(plain.myBOOL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myBYTE.LethargicWrite(plain.myBYTE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWORD.LethargicWrite(plain.myWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDWORD.LethargicWrite(plain.myDWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLWORD.LethargicWrite(plain.myLWORD); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySINT.LethargicWrite(plain.mySINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myINT.LethargicWrite(plain.myINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDINT.LethargicWrite(plain.myDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLINT.LethargicWrite(plain.myLINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUSINT.LethargicWrite(plain.myUSINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUINT.LethargicWrite(plain.myUINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myUDINT.LethargicWrite(plain.myUDINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myULINT.LethargicWrite(plain.myULINT); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myREAL.LethargicWrite(plain.myREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLREAL.LethargicWrite(plain.myLREAL); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME.LethargicWrite(plain.myTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME.LethargicWrite(plain.myLTIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE.LethargicWrite(plain.myDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE.LethargicWrite(plain.myLDATE); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myTIME_OF_DAY.LethargicWrite(plain.myTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLTIME_OF_DAY.LethargicWrite(plain.myLTIME_OF_DAY); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myDATE_AND_TIME.LethargicWrite(plain.myDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myLDATE_AND_TIME.LethargicWrite(plain.myLDATE_AND_TIME); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myCHAR.LethargicWrite(plain.myCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWCHAR.LethargicWrite(plain.myWCHAR); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING.LethargicWrite(plain.mySTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.myMotor._PlainToOnlineNoacAsync(plain.myMotor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ComplexForConfig plain = new global::Pocos.ComplexForConfig(); + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + plain.myMotor = await myMotor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ComplexForConfig plain) + { + plain.myBOOL = myBOOL.Shadow; + plain.myBYTE = myBYTE.Shadow; + plain.myWORD = myWORD.Shadow; + plain.myDWORD = myDWORD.Shadow; + plain.myLWORD = myLWORD.Shadow; + plain.mySINT = mySINT.Shadow; + plain.myINT = myINT.Shadow; + plain.myDINT = myDINT.Shadow; + plain.myLINT = myLINT.Shadow; + plain.myUSINT = myUSINT.Shadow; + plain.myUINT = myUINT.Shadow; + plain.myUDINT = myUDINT.Shadow; + plain.myULINT = myULINT.Shadow; + plain.myREAL = myREAL.Shadow; + plain.myLREAL = myLREAL.Shadow; + plain.myTIME = myTIME.Shadow; + plain.myLTIME = myLTIME.Shadow; + plain.myDATE = myDATE.Shadow; + plain.myLDATE = myLDATE.Shadow; + plain.myTIME_OF_DAY = myTIME_OF_DAY.Shadow; + plain.myLTIME_OF_DAY = myLTIME_OF_DAY.Shadow; + plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; + plain.myLDATE_AND_TIME = myLDATE_AND_TIME.Shadow; + plain.myCHAR = myCHAR.Shadow; + plain.myWCHAR = myWCHAR.Shadow; + plain.mySTRING = mySTRING.Shadow; + plain.myWSTRING = myWSTRING.Shadow; + plain.myMotor = await myMotor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ComplexForConfig plain) + { + myBOOL.Shadow = plain.myBOOL; + myBYTE.Shadow = plain.myBYTE; + myWORD.Shadow = plain.myWORD; + myDWORD.Shadow = plain.myDWORD; + myLWORD.Shadow = plain.myLWORD; + mySINT.Shadow = plain.mySINT; + myINT.Shadow = plain.myINT; + myDINT.Shadow = plain.myDINT; + myLINT.Shadow = plain.myLINT; + myUSINT.Shadow = plain.myUSINT; + myUINT.Shadow = plain.myUINT; + myUDINT.Shadow = plain.myUDINT; + myULINT.Shadow = plain.myULINT; + myREAL.Shadow = plain.myREAL; + myLREAL.Shadow = plain.myLREAL; + myTIME.Shadow = plain.myTIME; + myLTIME.Shadow = plain.myLTIME; + myDATE.Shadow = plain.myDATE; + myLDATE.Shadow = plain.myLDATE; + myTIME_OF_DAY.Shadow = plain.myTIME_OF_DAY; + myLTIME_OF_DAY.Shadow = plain.myLTIME_OF_DAY; + myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; + myLDATE_AND_TIME.Shadow = plain.myLDATE_AND_TIME; + myCHAR.Shadow = plain.myCHAR; + myWCHAR.Shadow = plain.myWCHAR; + mySTRING.Shadow = plain.mySTRING; + myWSTRING.Shadow = plain.myWSTRING; + await this.myMotor.PlainToShadowAsync(plain.myMotor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ComplexForConfig plain, global::Pocos.ComplexForConfig latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myBOOL != myBOOL.LastValue) + somethingChanged = true; + if (plain.myBYTE != myBYTE.LastValue) + somethingChanged = true; + if (plain.myWORD != myWORD.LastValue) + somethingChanged = true; + if (plain.myDWORD != myDWORD.LastValue) + somethingChanged = true; + if (plain.myLWORD != myLWORD.LastValue) + somethingChanged = true; + if (plain.mySINT != mySINT.LastValue) + somethingChanged = true; + if (plain.myINT != myINT.LastValue) + somethingChanged = true; + if (plain.myDINT != myDINT.LastValue) + somethingChanged = true; + if (plain.myLINT != myLINT.LastValue) + somethingChanged = true; + if (plain.myUSINT != myUSINT.LastValue) + somethingChanged = true; + if (plain.myUINT != myUINT.LastValue) + somethingChanged = true; + if (plain.myUDINT != myUDINT.LastValue) + somethingChanged = true; + if (plain.myULINT != myULINT.LastValue) + somethingChanged = true; + if (plain.myREAL != myREAL.LastValue) + somethingChanged = true; + if (plain.myLREAL != myLREAL.LastValue) + somethingChanged = true; + if (plain.myTIME != myTIME.LastValue) + somethingChanged = true; + if (plain.myLTIME != myLTIME.LastValue) + somethingChanged = true; + if (plain.myDATE != myDATE.LastValue) + somethingChanged = true; + if (plain.myLDATE != myLDATE.LastValue) + somethingChanged = true; + if (plain.myTIME_OF_DAY != myTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myLTIME_OF_DAY != myLTIME_OF_DAY.LastValue) + somethingChanged = true; + if (plain.myDATE_AND_TIME != myDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myLDATE_AND_TIME != myLDATE_AND_TIME.LastValue) + somethingChanged = true; + if (plain.myCHAR != myCHAR.LastValue) + somethingChanged = true; + if (plain.myWCHAR != myWCHAR.LastValue) + somethingChanged = true; + if (plain.mySTRING != mySTRING.LastValue) + somethingChanged = true; + if (plain.myWSTRING != myWSTRING.LastValue) + somethingChanged = true; + if (await myMotor.DetectsAnyChangeAsync(plain.myMotor, latest.myMotor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ComplexForConfig CreateEmptyPoco() + { + return new global::Pocos.ComplexForConfig(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public enum Colorss +{ + Red, + Green, + Blue +} + +public enum Colorsss : UInt64 +{ + Red = 1, + Green = 2, + Blue = 3 +} + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class Vehicle : AXSharp.Connector.ITwinObject +{ + public Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Vehicle CreateEmptyPoco() + { + return new global::Pocos.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs new file mode 100644 index 00000000..e509210f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/enum_simple.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public enum Colors +{ + Red, + Green, + Blue +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs new file mode 100644 index 00000000..7b8ffd8e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_unsupported.g.cs @@ -0,0 +1,10 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Unsupported +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs new file mode 100644 index 00000000..56f39f28 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/file_with_usings.g.cs @@ -0,0 +1,820 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; +using FileWithUsingsSimpleFirstLevelNamespace; +using FileWithUsingsSimpleQualifiedNamespace.Qualified; +using FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; + +namespace FileWithUsingsSimpleFirstLevelNamespace +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace FileWithUsingsSimpleQualifiedNamespace.Qualified +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace FileWithUsingsHelloLevelOne +{ + namespace FileWithUsingsHelloLevelTwo + { + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello CreateEmptyPoco() + { + return new global::Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + } +} + +namespace ExampleNamespace +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ExampleNamespace.Hello plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.ExampleNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ExampleNamespace.Hello plain = new global::Pocos.ExampleNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ExampleNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.ExampleNamespace.Hello plain, global::Pocos.ExampleNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ExampleNamespace.Hello CreateEmptyPoco() + { + return new global::Pocos.ExampleNamespace.Hello(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs new file mode 100644 index 00000000..2e4106be --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/generics.g.cs @@ -0,0 +1,595 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace GenericsTests +{ + public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extender plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extender plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.Extender plain = new global::Pocos.GenericsTests.Extender(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extender plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extender plain, global::Pocos.GenericsTests.Extender latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.GenericsTests.Extender CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.Extender(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.ITwinObject + { + public OnlinerBool Boolean { get; } + public OnlinerInt Cele { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeTypeToBeGeneric(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Boolean = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Boolean", "Boolean"); + Cele = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Cele", "Cele"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + await this.ReadAsync(priority); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.SomeTypeToBeGeneric plain = new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + Boolean.Shadow = plain.Boolean; + Cele.Shadow = plain.Cele; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.SomeTypeToBeGeneric plain, global::Pocos.GenericsTests.SomeTypeToBeGeneric latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Boolean != Boolean.LastValue) + somethingChanged = true; + if (plain.Cele != Cele.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.GenericsTests.SomeTypeToBeGeneric CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.SomeTypeToBeGeneric(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Extendee2 : GenericsTests.Extender + { + [AXOpen.Data.AxoDataEntityAttribute] + [Container(Layout.Stack)] + public GenericsTests.SomeTypeToBeGeneric SomeData { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeData = new GenericsTests.SomeTypeToBeGeneric(this, "Shared Header", "SomeData"); + SomeData.AttributeName = @"Shared Header"; + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericsTests.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.GenericsTests.Extendee2 plain = new global::Pocos.GenericsTests.Extendee2(); + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericsTests.Extendee2 plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeData.PlainToShadowAsync(plain.SomeData); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.GenericsTests.Extendee2 plain, global::Pocos.GenericsTests.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeData.DetectsAnyChangeAsync(plain.SomeData, latest.SomeData)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.GenericsTests.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.GenericsTests.Extendee2(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs new file mode 100644 index 00000000..54dfa84f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs @@ -0,0 +1,522 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace makereadonce +{ + public partial class MembersWithMakeReadOnce : AXSharp.Connector.ITwinObject + { + [ReadOnce()] + public OnlinerString makeReadOnceMember { get; } + public OnlinerString someOtherMember { get; } + + [ReadOnce()] + public makereadonce.ComplexMember makeReadComplexMember { get; } + public makereadonce.ComplexMember someotherComplexMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.MakeReadOnce(); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); + makeReadComplexMember.MakeReadOnce(); + someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + await this.ReadAsync(priority); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonce.MembersWithMakeReadOnce plain = new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain) + { + makeReadOnceMember.Shadow = plain.makeReadOnceMember; + someOtherMember.Shadow = plain.someOtherMember; + await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); + await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.MembersWithMakeReadOnce plain, global::Pocos.makereadonce.MembersWithMakeReadOnce latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) + somethingChanged = true; + if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonce.MembersWithMakeReadOnce CreateEmptyPoco() + { + return new global::Pocos.makereadonce.MembersWithMakeReadOnce(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexMember : AXSharp.Connector.ITwinObject + { + public OnlinerString someMember { get; } + public OnlinerString someOtherMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + await this.ReadAsync(priority); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonce.ComplexMember plain) + { + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonce.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonce.ComplexMember plain) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonce.ComplexMember plain = new global::Pocos.makereadonce.ComplexMember(); + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonce.ComplexMember plain) + { + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonce.ComplexMember plain) + { + someMember.Shadow = plain.someMember; + someOtherMember.Shadow = plain.someOtherMember; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonce.ComplexMember plain, global::Pocos.makereadonce.ComplexMember latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.someMember != someMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonce.ComplexMember CreateEmptyPoco() + { + return new global::Pocos.makereadonce.ComplexMember(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs new file mode 100644 index 00000000..f33dd211 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs @@ -0,0 +1,522 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace makereadonly +{ + public partial class MembersWithMakeReadOnly : AXSharp.Connector.ITwinObject + { + [ReadOnly()] + public OnlinerString makeReadOnceMember { get; } + public OnlinerString someOtherMember { get; } + + [ReadOnly()] + public makereadonly.ComplexMember makeReadComplexMember { get; } + public makereadonly.ComplexMember someotherComplexMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.MakeReadOnly(); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); + makeReadComplexMember.MakeReadOnly(); + someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + await this.ReadAsync(priority); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + plain.makeReadOnceMember = makeReadOnceMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; +#pragma warning disable CS0612 + plain.makeReadComplexMember = await makeReadComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.someotherComplexMember = await someotherComplexMember._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { +#pragma warning disable CS0612 + makeReadOnceMember.LethargicWrite(plain.makeReadOnceMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.makeReadComplexMember._PlainToOnlineNoacAsync(plain.makeReadComplexMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this.someotherComplexMember._PlainToOnlineNoacAsync(plain.someotherComplexMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonly.MembersWithMakeReadOnly plain = new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + plain.makeReadOnceMember = makeReadOnceMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + plain.makeReadComplexMember = await makeReadComplexMember.ShadowToPlainAsync(); + plain.someotherComplexMember = await someotherComplexMember.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain) + { + makeReadOnceMember.Shadow = plain.makeReadOnceMember; + someOtherMember.Shadow = plain.someOtherMember; + await this.makeReadComplexMember.PlainToShadowAsync(plain.makeReadComplexMember); + await this.someotherComplexMember.PlainToShadowAsync(plain.someotherComplexMember); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.MembersWithMakeReadOnly plain, global::Pocos.makereadonly.MembersWithMakeReadOnly latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.makeReadOnceMember != makeReadOnceMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + if (await makeReadComplexMember.DetectsAnyChangeAsync(plain.makeReadComplexMember, latest.makeReadComplexMember)) + somethingChanged = true; + if (await someotherComplexMember.DetectsAnyChangeAsync(plain.someotherComplexMember, latest.someotherComplexMember)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonly.MembersWithMakeReadOnly CreateEmptyPoco() + { + return new global::Pocos.makereadonly.MembersWithMakeReadOnly(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class ComplexMember : AXSharp.Connector.ITwinObject + { + public OnlinerString someMember { get; } + public OnlinerString someOtherMember { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + await this.ReadAsync(priority); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.makereadonly.ComplexMember plain) + { + plain.someMember = someMember.LastValue; + plain.someOtherMember = someOtherMember.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.makereadonly.ComplexMember plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.makereadonly.ComplexMember plain) + { +#pragma warning disable CS0612 + someMember.LethargicWrite(plain.someMember); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + someOtherMember.LethargicWrite(plain.someOtherMember); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.makereadonly.ComplexMember plain = new global::Pocos.makereadonly.ComplexMember(); + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.makereadonly.ComplexMember plain) + { + plain.someMember = someMember.Shadow; + plain.someOtherMember = someOtherMember.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.makereadonly.ComplexMember plain) + { + someMember.Shadow = plain.someMember; + someOtherMember.Shadow = plain.someOtherMember; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.makereadonly.ComplexMember plain, global::Pocos.makereadonly.ComplexMember latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.someMember != someMember.LastValue) + somethingChanged = true; + if (plain.someOtherMember != someOtherMember.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.makereadonly.ComplexMember CreateEmptyPoco() + { + return new global::Pocos.makereadonly.ComplexMember(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs new file mode 100644 index 00000000..0ad24a32 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs @@ -0,0 +1,1660 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Enums +{ + public partial class ClassWithEnums : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.Colors))] + public OnlinerInt colors { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Enums.NamedValuesColors))] + public OnlinerString NamedValuesColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithEnums(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + colors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "colors", "colors"); + NamedValuesColors = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "NamedValuesColors", "NamedValuesColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + await this.ReadAsync(priority); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.LastValue; + plain.NamedValuesColors = NamedValuesColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Enums.ClassWithEnums plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Enums.ClassWithEnums plain) + { +#pragma warning disable CS0612 + colors.LethargicWrite((short)plain.colors); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + NamedValuesColors.LethargicWrite(plain.NamedValuesColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Enums.ClassWithEnums plain = new global::Pocos.Enums.ClassWithEnums(); + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Enums.ClassWithEnums plain) + { + plain.colors = (Enums.Colors)colors.Shadow; + plain.NamedValuesColors = NamedValuesColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Enums.ClassWithEnums plain) + { + colors.Shadow = (short)plain.colors; + NamedValuesColors.Shadow = plain.NamedValuesColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Enums.ClassWithEnums plain, global::Pocos.Enums.ClassWithEnums latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.colors != (Enums.Colors)latest.colors) + somethingChanged = true; + if (plain.NamedValuesColors != NamedValuesColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Enums.ClassWithEnums CreateEmptyPoco() + { + return new global::Pocos.Enums.ClassWithEnums(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public enum Colors + { + Red, + Green, + Blue + } + + public enum NamedValuesColors : String + { + Red = 49, + Green = 50, + Blue = 51 + } +} + +namespace misc +{ + public partial class VariousMembers : AXSharp.Connector.ITwinObject + { + public misc.SomeClass _SomeClass { get; } + public misc.Motor _Motor { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public VariousMembers(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _SomeClass = new misc.SomeClass(this, "_SomeClass", "_SomeClass"); + _Motor = new misc.Motor(this, "_Motor", "_Motor"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + plain._SomeClass = await _SomeClass._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain._Motor = await _Motor._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.VariousMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.VariousMembers plain) + { +#pragma warning disable CS0612 + await this._SomeClass._PlainToOnlineNoacAsync(plain._SomeClass); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + await this._Motor._PlainToOnlineNoacAsync(plain._Motor); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.VariousMembers plain = new global::Pocos.misc.VariousMembers(); + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.VariousMembers plain) + { + plain._SomeClass = await _SomeClass.ShadowToPlainAsync(); + plain._Motor = await _Motor.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.VariousMembers plain) + { + await this._SomeClass.PlainToShadowAsync(plain._SomeClass); + await this._Motor.PlainToShadowAsync(plain._Motor); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.VariousMembers plain, global::Pocos.misc.VariousMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await _SomeClass.DetectsAnyChangeAsync(plain._SomeClass, latest._SomeClass)) + somethingChanged = true; + if (await _Motor.DetectsAnyChangeAsync(plain._Motor, latest._Motor)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.VariousMembers CreateEmptyPoco() + { + return new global::Pocos.misc.VariousMembers(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeClass : AXSharp.Connector.ITwinObject + { + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.SomeClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.SomeClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.SomeClass plain = new global::Pocos.misc.SomeClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.SomeClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.SomeClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.SomeClass plain, global::Pocos.misc.SomeClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.SomeClass CreateEmptyPoco() + { + return new global::Pocos.misc.SomeClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Motor plain = new global::Pocos.misc.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Motor plain, global::Pocos.misc.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Motor CreateEmptyPoco() + { + return new global::Pocos.misc.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public misc.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new misc.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.misc.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.misc.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.misc.Vehicle plain = new global::Pocos.misc.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.misc.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.misc.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.misc.Vehicle plain, global::Pocos.misc.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.misc.Vehicle CreateEmptyPoco() + { + return new global::Pocos.misc.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} + +namespace UnknownArraysShouldNotBeTraspiled +{ + public partial class ClassWithArrays : AXSharp.Connector.ITwinObject + { + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; } + public OnlinerByte[] _primitive { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithArrays(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _complexKnown = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, this, "_complexKnown", "_complexKnown", (p, rt, st) => new UnknownArraysShouldNotBeTraspiled.Complex(p, rt, st), new[] { (0, 10) }); + _primitive = new OnlinerByte[11]; + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_primitive, this, "_primitive", "_primitive", (p, rt, st) => @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(p, rt, st), new[] { (0, 10) }); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { +#pragma warning disable CS0612 + plain._complexKnown = _complexKnown.Select(async p => await p._OnlineToPlainNoacAsync()).Select(p => p.Result).ToArray(); +#pragma warning restore CS0612 + plain._primitive = _primitive.Select(p => p.LastValue).ToArray(); + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, eAccessPriority priority = eAccessPriority.Normal) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _complexKnown.Select(p => p._PlainToOnlineNoacAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + var __primitive_i_FE8484DAB3 = 0; +#pragma warning disable CS0612 + _primitive.Select(p => p.LethargicWrite(plain._primitive[__primitive_i_FE8484DAB3++])).ToArray(); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + plain._complexKnown = _complexKnown.Select(async p => await p.ShadowToPlainAsync()).Select(p => p.Result).ToArray(); + plain._primitive = _primitive.Select(p => p.Shadow).ToArray(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain) + { + var __complexKnown_i_FE8484DAB3 = 0; + _complexKnown.Select(p => p.PlainToShadowAsync(plain._complexKnown[__complexKnown_i_FE8484DAB3++])).ToArray(); + var __primitive_i_FE8484DAB3 = 0; + _primitive.Select(p => p.Shadow = plain._primitive[__primitive_i_FE8484DAB3++]).ToArray(); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._complexKnown.Length; i760901_3001_mimi++) + { + if (await _complexKnown.ElementAt(i760901_3001_mimi).DetectsAnyChangeAsync(plain._complexKnown[i760901_3001_mimi], latest._complexKnown[i760901_3001_mimi])) + somethingChanged = true; + } + + for (int i760901_3001_mimi = 0; i760901_3001_mimi < latest._primitive.Length; i760901_3001_mimi++) + { + if (latest._primitive.ElementAt(i760901_3001_mimi) != plain._primitive[i760901_3001_mimi]) + somethingChanged = true; + } + + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.ClassWithArrays(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Complex : AXSharp.Connector.ITwinObject + { + public OnlinerString HelloString { get; } + public OnlinerULInt Id { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + await this.ReadAsync(priority); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.LastValue; + plain.Id = Id.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { +#pragma warning disable CS0612 + HelloString.LethargicWrite(plain.HelloString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Id.LethargicWrite(plain.Id); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain = new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + plain.HelloString = HelloString.Shadow; + plain.Id = Id.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain) + { + HelloString.Shadow = plain.HelloString; + Id.Shadow = plain.Id; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex plain, global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.HelloString != HelloString.LastValue) + somethingChanged = true; + if (plain.Id != Id.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex CreateEmptyPoco() + { + return new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs new file mode 100644 index 00000000..07e927da --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/mixed_access.g.cs @@ -0,0 +1,1586 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.Run = Run.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Motor plain) + { + plain.Run = Run.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.Run = Run.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.Run = Run.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + Run.Shadow = plain.Run; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct1 : AXSharp.Connector.ITwinObject +{ + public struct2 s2 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct1(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s2 = new struct2(this, "s2", "s2"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct1 plain) + { +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct1 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s2._PlainToOnlineNoacAsync(plain.s2); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct1 plain) + { +#pragma warning disable CS0612 + await this.s2._PlainToOnlineNoacAsync(plain.s2); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct1 plain = new global::Pocos.struct1(); + plain.s2 = await s2.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct1 plain) + { + plain.s2 = await s2.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct1 plain) + { + await this.s2.PlainToShadowAsync(plain.s2); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct1 plain, global::Pocos.struct1 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s2.DetectsAnyChangeAsync(plain.s2, latest.s2)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct1 CreateEmptyPoco() + { + return new global::Pocos.struct1(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct2 : AXSharp.Connector.ITwinObject +{ + public struct3 s3 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s3 = new struct3(this, "s3", "s3"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct2 plain) + { +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct2 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s3._PlainToOnlineNoacAsync(plain.s3); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct2 plain) + { +#pragma warning disable CS0612 + await this.s3._PlainToOnlineNoacAsync(plain.s3); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct2 plain = new global::Pocos.struct2(); + plain.s3 = await s3.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct2 plain) + { + plain.s3 = await s3.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct2 plain) + { + await this.s3.PlainToShadowAsync(plain.s3); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct2 plain, global::Pocos.struct2 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s3.DetectsAnyChangeAsync(plain.s3, latest.s3)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct2 CreateEmptyPoco() + { + return new global::Pocos.struct2(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct3 : AXSharp.Connector.ITwinObject +{ + public struct4 s4 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct3(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s4 = new struct4(this, "s4", "s4"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct3 plain) + { +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct3 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.s4._PlainToOnlineNoacAsync(plain.s4); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct3 plain) + { +#pragma warning disable CS0612 + await this.s4._PlainToOnlineNoacAsync(plain.s4); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct3 plain = new global::Pocos.struct3(); + plain.s4 = await s4.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct3 plain) + { + plain.s4 = await s4.ShadowToPlainAsync(); + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct3 plain) + { + await this.s4.PlainToShadowAsync(plain.s4); + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct3 plain, global::Pocos.struct3 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await s4.DetectsAnyChangeAsync(plain.s4, latest.s4)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct3 CreateEmptyPoco() + { + return new global::Pocos.struct3(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class struct4 : AXSharp.Connector.ITwinObject +{ + public OnlinerInt s5 { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public struct4(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + s5 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "s5", "s5"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + await this.ReadAsync(priority); + plain.s5 = s5.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + plain.s5 = s5.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.struct4 plain) + { + plain.s5 = s5.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.struct4 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + s5.LethargicWrite(plain.s5); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.struct4 plain) + { +#pragma warning disable CS0612 + s5.LethargicWrite(plain.s5); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.struct4 plain = new global::Pocos.struct4(); + plain.s5 = s5.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.struct4 plain) + { + plain.s5 = s5.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.struct4 plain) + { + s5.Shadow = plain.s5; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.struct4 plain, global::Pocos.struct4 latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.s5 != s5.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.struct4 CreateEmptyPoco() + { + return new global::Pocos.struct4(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class AbstractMotor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + public OnlinerBool ReverseDirection { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + await this.ReadAsync(priority); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.AbstractMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.AbstractMotor plain = new global::Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.AbstractMotor plain) + { + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.AbstractMotor plain, global::Pocos.AbstractMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + if (plain.ReverseDirection != ReverseDirection.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.AbstractMotor CreateEmptyPoco() + { + return new global::Pocos.AbstractMotor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class GenericMotor : AbstractMotor +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public GenericMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.GenericMotor plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.GenericMotor plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.GenericMotor plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.GenericMotor plain = new global::Pocos.GenericMotor(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.GenericMotor plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.GenericMotor plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.GenericMotor plain, global::Pocos.GenericMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.GenericMotor CreateEmptyPoco() + { + return new global::Pocos.GenericMotor(); + } +} + +public partial class SpecificMotorA : GenericMotor +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SpecificMotorA(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public new async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.SpecificMotorA plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.SpecificMotorA plain, eAccessPriority priority = eAccessPriority.Normal) + { + await base._PlainToOnlineNoacAsync(plain); + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.SpecificMotorA plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + global::Pocos.SpecificMotorA plain = new global::Pocos.SpecificMotorA(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.SpecificMotorA plain) + { + await base.ShadowToPlainAsync(plain); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.SpecificMotorA plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(global::Pocos.SpecificMotorA plain, global::Pocos.SpecificMotorA latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new global::Pocos.SpecificMotorA CreateEmptyPoco() + { + return new global::Pocos.SpecificMotorA(); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs new file mode 100644 index 00000000..73d9d290 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/multiline_pragmas.g.cs @@ -0,0 +1,236 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace MultilinePragmas +{ + public partial class Extendee2 : AXSharp.Connector.ITwinObject + { + public OnlinerInt _messge { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + _messge = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "_messge", "_messge"); + _messge.PlcTextList = @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; + [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; + [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; + [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; + [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; + [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; + [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; + [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; + [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; + [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; + [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'"; + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + await this.ReadAsync(priority); + plain._messge = _messge.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + plain._messge = _messge.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + plain._messge = _messge.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.MultilinePragmas.Extendee2 plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + _messge.LethargicWrite(plain._messge); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { +#pragma warning disable CS0612 + _messge.LethargicWrite(plain._messge); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.MultilinePragmas.Extendee2 plain = new global::Pocos.MultilinePragmas.Extendee2(); + plain._messge = _messge.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + plain._messge = _messge.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.MultilinePragmas.Extendee2 plain) + { + _messge.Shadow = plain._messge; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.MultilinePragmas.Extendee2 plain, global::Pocos.MultilinePragmas.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain._messge != _messge.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.MultilinePragmas.Extendee2 CreateEmptyPoco() + { + return new global::Pocos.MultilinePragmas.Extendee2(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/program.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs new file mode 100644 index 00000000..44712577 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/ref_to_simple.g.cs @@ -0,0 +1,424 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace RefToSimple +{ + public partial class ref_to_simple : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ref_to_simple(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.ref_to_simple plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.RefToSimple.ref_to_simple plain = new global::Pocos.RefToSimple.ref_to_simple(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.ref_to_simple plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.ref_to_simple plain, global::Pocos.RefToSimple.ref_to_simple latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.RefToSimple.ref_to_simple CreateEmptyPoco() + { + return new global::Pocos.RefToSimple.ref_to_simple(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class referenced : AXSharp.Connector.ITwinObject + { + public OnlinerInt b { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public referenced(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + b = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "b", "b"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + await this.ReadAsync(priority); + plain.b = b.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + plain.b = b.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.RefToSimple.referenced plain) + { + plain.b = b.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.RefToSimple.referenced plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + b.LethargicWrite(plain.b); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.RefToSimple.referenced plain) + { +#pragma warning disable CS0612 + b.LethargicWrite(plain.b); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.RefToSimple.referenced plain = new global::Pocos.RefToSimple.referenced(); + plain.b = b.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.RefToSimple.referenced plain) + { + plain.b = b.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.RefToSimple.referenced plain) + { + b.Shadow = plain.b; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.RefToSimple.referenced plain, global::Pocos.RefToSimple.referenced latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.b != b.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.RefToSimple.referenced CreateEmptyPoco() + { + return new global::Pocos.RefToSimple.referenced(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs new file mode 100644 index 00000000..9c0e8c99 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class.g.cs @@ -0,0 +1,205 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class simple_class : AXSharp.Connector.ITwinObject +{ + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public simple_class(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.simple_class plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.simple_class plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.simple_class plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.simple_class plain = new global::Pocos.simple_class(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.simple_class plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.simple_class plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.simple_class plain, global::Pocos.simple_class latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.simple_class CreateEmptyPoco() + { + return new global::Pocos.simple_class(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs new file mode 100644 index 00000000..35d2fc8b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/simple_empty_class_within_namespace.g.cs @@ -0,0 +1,208 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace sampleNamespace +{ + public partial class simple_empty_class_within_namespace : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public simple_empty_class_within_namespace(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + await this.ReadAsync(priority); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, eAccessPriority priority = eAccessPriority.Normal) + { + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain = new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.sampleNamespace.simple_empty_class_within_namespace plain, global::Pocos.sampleNamespace.simple_empty_class_within_namespace latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.sampleNamespace.simple_empty_class_within_namespace CreateEmptyPoco() + { + return new global::Pocos.sampleNamespace.simple_empty_class_within_namespace(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs new file mode 100644 index 00000000..f316e620 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/struct_simple.g.cs @@ -0,0 +1,456 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class Motor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Motor plain = new global::Pocos.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Motor plain, global::Pocos.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Motor CreateEmptyPoco() + { + return new global::Pocos.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} + +public partial class Vehicle : AXSharp.Connector.ITwinObject +{ + public Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Vehicle plain = new global::Pocos.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Vehicle plain, global::Pocos.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Vehicle CreateEmptyPoco() + { + return new global::Pocos.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs new file mode 100644 index 00000000..13a8bca3 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values.g.cs @@ -0,0 +1,233 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace NamedValuesNamespace +{ + public enum LightColors : Int16 + { + LRED = 12, + LGREEN = 14, + LBLUE = 23 + } + + public partial class using_type_named_values : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(NamedValuesNamespace.LightColors))] + public OnlinerInt LColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "LColors", "LColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + await this.ReadAsync(priority); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + plain.LColors = LColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.NamedValuesNamespace.using_type_named_values plain = new global::Pocos.NamedValuesNamespace.using_type_named_values(); + plain.LColors = LColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + plain.LColors = LColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain) + { + LColors.Shadow = plain.LColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.NamedValuesNamespace.using_type_named_values plain, global::Pocos.NamedValuesNamespace.using_type_named_values latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.LColors != LColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.NamedValuesNamespace.using_type_named_values CreateEmptyPoco() + { + return new global::Pocos.NamedValuesNamespace.using_type_named_values(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs new file mode 100644 index 00000000..343ca703 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_named_values_literals.g.cs @@ -0,0 +1,235 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public enum StateControllerStatus : UInt16 + { + STATUS_NO_ERR = 28672, + STATUS_IS_RUNNING = 28673, + STATUS_STATE_CHANGED = 28674, + STATUS_NO_INITIALSTATE = 33024, + STATUS_NO_NEXTSTATE = 33025 + } + + public partial class using_type_named_values : AXSharp.Connector.ITwinObject + { + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.StateControllerStatus))] + public OnlinerWord LColors { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public using_type_named_values(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + LColors = @Connector.ConnectorAdapter.AdapterFactory.CreateWORD(this, "LColors", "LColors"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + await this.ReadAsync(priority); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + plain.LColors = LColors.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + plain.LColors = LColors.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { +#pragma warning disable CS0612 + LColors.LethargicWrite(plain.LColors); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain = new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + plain.LColors = LColors.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + plain.LColors = LColors.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain) + { + LColors.Shadow = plain.LColors; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.using_type_named_values plain, global::Pocos.Simatic.Ax.StateFramework.using_type_named_values latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.LColors != LColors.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.using_type_named_values CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.using_type_named_values(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs new file mode 100644 index 00000000..21d4caed --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/type_with_enum.g.cs @@ -0,0 +1,260 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace Simatic.Ax.StateFramework +{ + public partial interface IGuard + { + } +} + +namespace Simatic.Ax.StateFramework +{ + public enum Condition + { + GT, + EQ, + LT, + NE, + GE, + LE + } + + public partial class CompareGuardLint : AXSharp.Connector.ITwinObject, IGuard + { + public OnlinerLInt CompareToValue { get; } + + [AXSharp.Connector.EnumeratorDiscriminatorAttribute(typeof(Simatic.Ax.StateFramework.Condition))] + public OnlinerInt Condition { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public CompareGuardLint(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + CompareToValue = @Connector.ConnectorAdapter.AdapterFactory.CreateLINT(this, "CompareToValue", "CompareToValue"); + Condition = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Condition", "Condition"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + await this.ReadAsync(priority); + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + plain.CompareToValue = CompareToValue.LastValue; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + CompareToValue.LethargicWrite(plain.CompareToValue); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Condition.LethargicWrite((short)plain.Condition); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { +#pragma warning disable CS0612 + CompareToValue.LethargicWrite(plain.CompareToValue); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Condition.LethargicWrite((short)plain.Condition); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain = new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + plain.CompareToValue = CompareToValue.Shadow; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + plain.CompareToValue = CompareToValue.Shadow; + plain.Condition = (Simatic.Ax.StateFramework.Condition)Condition.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain) + { + CompareToValue.Shadow = plain.CompareToValue; + Condition.Shadow = (short)plain.Condition; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint plain, global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.CompareToValue != CompareToValue.LastValue) + somethingChanged = true; + if (plain.Condition != (Simatic.Ax.StateFramework.Condition)latest.Condition) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint CreateEmptyPoco() + { + return new global::Pocos.Simatic.Ax.StateFramework.CompareGuardLint(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs new file mode 100644 index 00000000..687e6895 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs @@ -0,0 +1,692 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace TypeWithNameAttributes +{ + [Container(Layout.Wrap)] + public partial class Motor : AXSharp.Connector.ITwinObject + { + public OnlinerBool isRunning { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Motor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + isRunning = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "isRunning", "isRunning"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + await this.ReadAsync(priority); + plain.isRunning = isRunning.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + plain.isRunning = isRunning.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + plain.isRunning = isRunning.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Motor plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { +#pragma warning disable CS0612 + isRunning.LethargicWrite(plain.isRunning); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.Motor plain = new global::Pocos.TypeWithNameAttributes.Motor(); + plain.isRunning = isRunning.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + plain.isRunning = isRunning.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Motor plain) + { + isRunning.Shadow = plain.isRunning; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Motor plain, global::Pocos.TypeWithNameAttributes.Motor latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (plain.isRunning != isRunning.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.Motor CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.Motor(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Vehicle : AXSharp.Connector.ITwinObject + { + public TypeWithNameAttributes.Motor m { get; } + public OnlinerInt displacement { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Vehicle(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + m = new TypeWithNameAttributes.Motor(this, "m", "m"); + displacement = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "displacement", "displacement"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); + await this.ReadAsync(priority); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { +#pragma warning disable CS0612 + plain.m = await m._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + plain.displacement = displacement.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { +#pragma warning disable CS0612 + await this.m._PlainToOnlineNoacAsync(plain.m); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + displacement.LethargicWrite(plain.displacement); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.Vehicle plain = new global::Pocos.TypeWithNameAttributes.Vehicle(); + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { + plain.m = await m.ShadowToPlainAsync(); + plain.displacement = displacement.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain) + { + await this.m.PlainToShadowAsync(plain.m); + displacement.Shadow = plain.displacement; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.Vehicle plain, global::Pocos.TypeWithNameAttributes.Vehicle latest = null) + { + var somethingChanged = false; + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + return await Task.Run(async () => + { + if (await m.DetectsAnyChangeAsync(plain.m, latest.m)) + somethingChanged = true; + if (plain.displacement != displacement.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.Vehicle CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.Vehicle(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class NoAccessModifierClass : AXSharp.Connector.ITwinObject + { + private string _AttributeName; + public string AttributeName { get => string.IsNullOrEmpty(_AttributeName) ? SymbolTail : _AttributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _AttributeName = value; } + + public string GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_AttributeName, culture).Interpolate(this); + } + + public string AttributeName_raw + { + get + { + return _AttributeName; + } + } + + public OnlinerString SomeClassVariable { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + await this.ReadAsync(priority); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + plain.SomeClassVariable = SomeClassVariable.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { +#pragma warning disable CS0612 + SomeClassVariable.LethargicWrite(plain.SomeClassVariable); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain = new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + plain.SomeClassVariable = SomeClassVariable.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain) + { + SomeClassVariable.Shadow = plain.SomeClassVariable; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypeWithNameAttributes.NoAccessModifierClass plain, global::Pocos.TypeWithNameAttributes.NoAccessModifierClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.SomeClassVariable != SomeClassVariable.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypeWithNameAttributes.NoAccessModifierClass CreateEmptyPoco() + { + return new global::Pocos.TypeWithNameAttributes.NoAccessModifierClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs new file mode 100644 index 00000000..c9c7212d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_property_attributes.g.cs @@ -0,0 +1,243 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace TypesWithPropertyAttributes +{ + public partial class SomeAddedProperties : AXSharp.Connector.ITwinObject + { + private string _Description; + public string Description { get => string.IsNullOrEmpty(_Description) ? SymbolTail : _Description.Interpolate(this).CleanUpLocalizationTokens(); set => _Description = value; } + + public string GetDescription(System.Globalization.CultureInfo culture) + { + return this.Translate(_Description, culture).Interpolate(this); + } + + public string Description_raw + { + get + { + return _Description; + } + } + + public OnlinerInt Counter { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeAddedProperties(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Description = @"Some added property name value"; + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Counter = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Pocitadlo", "Counter"); + Counter.AttributeName = @"Pocitadlo"; + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + await this.ReadAsync(priority); + plain.Counter = Counter.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + plain.Counter = Counter.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + plain.Counter = Counter.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + Counter.LethargicWrite(plain.Counter); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { +#pragma warning disable CS0612 + Counter.LethargicWrite(plain.Counter); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain = new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + plain.Counter = Counter.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + plain.Counter = Counter.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain) + { + Counter.Shadow = plain.Counter; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties plain, global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Counter != Counter.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties CreateEmptyPoco() + { + return new global::Pocos.TypesWithPropertyAttributes.SomeAddedProperties(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs new file mode 100644 index 00000000..5400b2ac --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/abstract_members.g.cs @@ -0,0 +1,16 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public AbstractMotor() + { + } + + public Boolean Run { get; set; } + public Boolean ReverseDirection { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs new file mode 100644 index 00000000..ce30a3c8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/array_declaration.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ArrayDeclarationSimpleNamespace + { + public partial class array_declaration_class : AXSharp.Connector.IPlain + { + public array_declaration_class() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(complex, () => new global::Pocos.ArrayDeclarationSimpleNamespace.some_complex_type(), new[] { (1, 100) }); +#pragma warning restore CS0612 + } + + public Int16[] primitive { get; set; } = new Int16[100]; + public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; set; } = new ArrayDeclarationSimpleNamespace.some_complex_type[100]; + } + + public partial class some_complex_type : AXSharp.Connector.IPlain + { + public some_complex_type() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs new file mode 100644 index 00000000..422a2a2d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs @@ -0,0 +1,36 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class class_all_primitives : AXSharp.Connector.IPlain + { + public class_all_primitives() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs new file mode 100644 index 00000000..221f97ee --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extended_by_known_type.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial class State1Transition : Simatic.Ax.StateFramework.AbstractState, AXSharp.Connector.IPlain + { + public State1Transition() : base() + { + } + } + } + + namespace Simatic.Ax.StateFramework + { + public partial class AbstractState : AXSharp.Connector.IPlain, IState, IStateMuteable + { + public AbstractState() + { + } + + public Int16 StateID { get; set; } + public string StateName { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs new file mode 100644 index 00000000..4ce871c9 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends.g.cs @@ -0,0 +1,20 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Extended : Extendee, AXSharp.Connector.IPlain + { + public Extended() : base() + { + } + } + + public partial class Extendee : AXSharp.Connector.IPlain + { + public Extendee() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs new file mode 100644 index 00000000..91481513 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_extends_and_implements.g.cs @@ -0,0 +1,28 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class ExtendsAndImplements : ExtendeeExtendsAndImplements, AXSharp.Connector.IPlain, IImplementation1, IImplementation2 + { + public ExtendsAndImplements() : base() + { + } + } + + public partial class ExtendeeExtendsAndImplements : AXSharp.Connector.IPlain + { + public ExtendeeExtendsAndImplements() + { + } + } + + public partial interface IImplementation1 + { + } + + public partial interface IImplementation2 + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs new file mode 100644 index 00000000..906b0bc0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_generic_extension.g.cs @@ -0,0 +1,42 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Generics + { + public partial class Extender : AXSharp.Connector.IPlain + { + public Extender() + { + } + } + + public partial class Extendee : Generics.Extender, AXSharp.Connector.IPlain + { + public Extendee() : base() + { + } + + public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); + public Generics.SomeType SomeTypeAsPoco { get; set; } = new Generics.SomeType(); + } + + public partial class Extendee2 : Generics.Extender, AXSharp.Connector.IPlain + { + public Extendee2() : base() + { + } + + public Generics.SomeType SomeType { get; set; } = new Generics.SomeType(); + } + + public partial class SomeType : AXSharp.Connector.IPlain + { + public SomeType() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs new file mode 100644 index 00000000..5eb39ed0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements.g.cs @@ -0,0 +1,17 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class _NULL_CONTEXT : AXSharp.Connector.IPlain, IContext + { + public _NULL_CONTEXT() + { + } + } + + public partial interface IContext + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs new file mode 100644 index 00000000..aca3704d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_implements_multiple.g.cs @@ -0,0 +1,21 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class _NULL_CONTEXT_MULTIPLE : AXSharp.Connector.IPlain, IContext_Multiple, IObject_Multiple + { + public _NULL_CONTEXT_MULTIPLE() + { + } + } + + public partial interface IContext_Multiple + { + } + + public partial interface IObject_Multiple + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs new file mode 100644 index 00000000..e4ba926f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_internal.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + internal partial class ClassWithComplexTypes : AXSharp.Connector.IPlain + { + public ClassWithComplexTypes() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs new file mode 100644 index 00000000..43b8cdaa --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_no_access_modifier.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class NoAccessModifierClass : AXSharp.Connector.IPlain + { + public NoAccessModifierClass() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs new file mode 100644 index 00000000..27f5f1d8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_complex_members.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithComplexTypesNamespace + { + public partial class ClassWithComplexTypes : AXSharp.Connector.IPlain + { + public ClassWithComplexTypes() + { + } + + public ClassWithComplexTypesNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithComplexTypesNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs new file mode 100644 index 00000000..7f96b873 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_non_public_members.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithNonTraspilableMemberssNamespace + { + public partial class ClassWithNonTraspilableMembers : AXSharp.Connector.IPlain + { + public ClassWithNonTraspilableMembers() + { + } + + public ClassWithNonTraspilableMemberssNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithNonTraspilableMemberssNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs new file mode 100644 index 00000000..3f2f1d38 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_pragmas.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithPragmasNamespace + { + public partial class ClassWithPragmas : AXSharp.Connector.IPlain + { + public ClassWithPragmas() + { + } + + public ClassWithPragmasNamespace.ComplexType1 myComplexType { get; set; } = new ClassWithPragmasNamespace.ComplexType1(); + } + + public partial class ComplexType1 : AXSharp.Connector.IPlain + { + public ComplexType1() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs new file mode 100644 index 00000000..1c2a9588 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_primitive_members.g.cs @@ -0,0 +1,44 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithPrimitiveTypesNamespace + { + public partial class ClassWithPrimitiveTypes : AXSharp.Connector.IPlain + { + public ClassWithPrimitiveTypes() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); + public DateOnly myLDATE { get; set; } = new DateOnly(1990, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); + public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); + public Char myCHAR { get; set; } + public Char myWCHAR { get; set; } + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs new file mode 100644 index 00000000..ca595c93 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_using_directives.g.cs @@ -0,0 +1,34 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + using SimpleFirstLevelNamespace; + using SimpleQualifiedNamespace.Qualified; + using HelloLevelOne.HelloLevelTwo; + + internal partial class ClassWithUsingDirectives : AXSharp.Connector.IPlain + { + public ClassWithUsingDirectives() + { + } + + using SimpleFirstLevelNamespace ; using SimpleQualifiedNamespace . Qualified ; using HelloLevelOne . HelloLevelTwo ; + +} + +namespace SimpleFirstLevelNamespace +{ +} + +namespace SimpleQualifiedNamespace.Qualified +{ +} + +namespace HelloLevelOne +{ + namespace HelloLevelTwo + { + } +} } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs new file mode 100644 index 00000000..2e89b94c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/compileromitsattribute.g.cs @@ -0,0 +1,109 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace CompilerOmmits + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { + } + + public CompilerOmmits.Complex _must_be_omitted_in_onliner { get; set; } = new CompilerOmmits.Complex(); + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } + + namespace Enums + { + public partial class ClassWithEnums : AXSharp.Connector.IPlain + { + public ClassWithEnums() + { + } + + public global::Enums.Colors colors { get; set; } + public String NamedValuesColors { get; set; } + } + } + + namespace misc + { + public partial class VariousMembers : AXSharp.Connector.IPlain + { + public VariousMembers() + { + } + + public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); + public misc.Motor _Motor { get; set; } = new misc.Motor(); + } + + public partial class SomeClass : AXSharp.Connector.IPlain + { + public SomeClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public misc.Motor m { get; set; } = new misc.Motor(); + public Int16 displacement { get; set; } + } + } + + namespace UnknownArraysShouldNotBeTraspiled + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); +#pragma warning restore CS0612 + } + + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs new file mode 100644 index 00000000..8a7a774e --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/configuration.g.cs @@ -0,0 +1,61 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class ComplexForConfig : AXSharp.Connector.IPlain + { + public ComplexForConfig() + { + } + + public Boolean myBOOL { get; set; } + public Byte myBYTE { get; set; } + public UInt16 myWORD { get; set; } + public UInt32 myDWORD { get; set; } + public UInt64 myLWORD { get; set; } + public SByte mySINT { get; set; } + public Int16 myINT { get; set; } + public Int32 myDINT { get; set; } + public Int64 myLINT { get; set; } + public Byte myUSINT { get; set; } + public UInt16 myUINT { get; set; } + public UInt32 myUDINT { get; set; } + public UInt64 myULINT { get; set; } + public Single myREAL { get; set; } + public Double myLREAL { get; set; } + public TimeSpan myTIME { get; set; } = default(TimeSpan); + public TimeSpan myLTIME { get; set; } = default(TimeSpan); + public DateOnly myDATE { get; set; } = new DateOnly(1990, 1, 1); + public DateOnly myLDATE { get; set; } = new DateOnly(1990, 1, 1); + public TimeSpan myTIME_OF_DAY { get; set; } = default(TimeSpan); + public TimeSpan myLTIME_OF_DAY { get; set; } = default(TimeSpan); + public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); + public DateTime myLDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); + public Char myCHAR { get; set; } + public Char myWCHAR { get; set; } + public string mySTRING { get; set; } = string.Empty; + public string myWSTRING { get; set; } = string.Empty; + public Motor myMotor { get; set; } = new Motor(); + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public Motor m { get; set; } = new Motor(); + public Int16 displacement { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/enum_simple.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs new file mode 100644 index 00000000..56cacaa1 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_unsupported.g.cs @@ -0,0 +1,10 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Unsupported + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs new file mode 100644 index 00000000..1fecb933 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/file_with_usings.g.cs @@ -0,0 +1,52 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; +using Pocos.FileWithUsingsSimpleFirstLevelNamespace; +using Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified; +using Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; + +namespace Pocos +{ + namespace FileWithUsingsSimpleFirstLevelNamespace + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + + namespace FileWithUsingsSimpleQualifiedNamespace.Qualified + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + + namespace FileWithUsingsHelloLevelOne + { + namespace FileWithUsingsHelloLevelTwo + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } + } + + namespace ExampleNamespace + { + public partial class Hello : AXSharp.Connector.IPlain + { + public Hello() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs new file mode 100644 index 00000000..47e0b1d4 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/generics.g.cs @@ -0,0 +1,36 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace GenericsTests + { + public partial class Extender : AXSharp.Connector.IPlain + { + public Extender() + { + } + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.IPlain + { + public SomeTypeToBeGeneric() + { + } + + public Boolean Boolean { get; set; } + public Int16 Cele { get; set; } + } + + public partial class Extendee2 : GenericsTests.Extender, AXSharp.Connector.IPlain + { + public Extendee2() : base() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Shared Header")] + public GenericsTests.SomeTypeToBeGeneric SomeData { get; set; } = new GenericsTests.SomeTypeToBeGeneric(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs new file mode 100644 index 00000000..b1f0575c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonce.g.cs @@ -0,0 +1,31 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace makereadonce + { + public partial class MembersWithMakeReadOnce : AXSharp.Connector.IPlain + { + public MembersWithMakeReadOnce() + { + } + + public string makeReadOnceMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + public makereadonce.ComplexMember makeReadComplexMember { get; set; } = new makereadonce.ComplexMember(); + public makereadonce.ComplexMember someotherComplexMember { get; set; } = new makereadonce.ComplexMember(); + } + + public partial class ComplexMember : AXSharp.Connector.IPlain + { + public ComplexMember() + { + } + + public string someMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs new file mode 100644 index 00000000..ecafb34f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/makereadonly.g.cs @@ -0,0 +1,31 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace makereadonly + { + public partial class MembersWithMakeReadOnly : AXSharp.Connector.IPlain + { + public MembersWithMakeReadOnly() + { + } + + public string makeReadOnceMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + public makereadonly.ComplexMember makeReadComplexMember { get; set; } = new makereadonly.ComplexMember(); + public makereadonly.ComplexMember someotherComplexMember { get; set; } = new makereadonly.ComplexMember(); + } + + public partial class ComplexMember : AXSharp.Connector.IPlain + { + public ComplexMember() + { + } + + public string someMember { get; set; } = string.Empty; + public string someOtherMember { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs new file mode 100644 index 00000000..1eae7fcb --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/misc.g.cs @@ -0,0 +1,86 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Enums + { + public partial class ClassWithEnums : AXSharp.Connector.IPlain + { + public ClassWithEnums() + { + } + + public global::Enums.Colors colors { get; set; } + public String NamedValuesColors { get; set; } + } + } + + namespace misc + { + public partial class VariousMembers : AXSharp.Connector.IPlain + { + public VariousMembers() + { + } + + public misc.SomeClass _SomeClass { get; set; } = new misc.SomeClass(); + public misc.Motor _Motor { get; set; } = new misc.Motor(); + } + + public partial class SomeClass : AXSharp.Connector.IPlain + { + public SomeClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public misc.Motor m { get; set; } = new misc.Motor(); + public Int16 displacement { get; set; } + } + } + + namespace UnknownArraysShouldNotBeTraspiled + { + public partial class ClassWithArrays : AXSharp.Connector.IPlain + { + public ClassWithArrays() + { +#pragma warning disable CS0612 + AXSharp.Connector.BuilderHelpers.Arrays.InstantiateArray(_complexKnown, () => new global::Pocos.UnknownArraysShouldNotBeTraspiled.Complex(), new[] { (0, 10) }); +#pragma warning restore CS0612 + } + + public UnknownArraysShouldNotBeTraspiled.Complex[] _complexKnown { get; set; } = new UnknownArraysShouldNotBeTraspiled.Complex[11]; + public Byte[] _primitive { get; set; } = new Byte[11]; + } + + public partial class Complex : AXSharp.Connector.IPlain + { + public Complex() + { + } + + public string HelloString { get; set; } = string.Empty; + public UInt64 Id { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs new file mode 100644 index 00000000..a7383fdf --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/mixed_access.g.cs @@ -0,0 +1,75 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean Run { get; set; } + } + + public partial class struct1 : AXSharp.Connector.IPlain + { + public struct1() + { + } + + public struct2 s2 { get; set; } = new struct2(); + } + + public partial class struct2 : AXSharp.Connector.IPlain + { + public struct2() + { + } + + public struct3 s3 { get; set; } = new struct3(); + } + + public partial class struct3 : AXSharp.Connector.IPlain + { + public struct3() + { + } + + public struct4 s4 { get; set; } = new struct4(); + } + + public partial class struct4 : AXSharp.Connector.IPlain + { + public struct4() + { + } + + public Int16 s5 { get; set; } + } + + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public AbstractMotor() + { + } + + public Boolean Run { get; set; } + public Boolean ReverseDirection { get; set; } + } + + public partial class GenericMotor : AbstractMotor, AXSharp.Connector.IPlain + { + public GenericMotor() : base() + { + } + } + + public partial class SpecificMotorA : GenericMotor, AXSharp.Connector.IPlain + { + public SpecificMotorA() : base() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs new file mode 100644 index 00000000..7eb75e26 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/multiline_pragmas.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace MultilinePragmas + { + public partial class Extendee2 : AXSharp.Connector.IPlain + { + public Extendee2() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("PlcTextList", @"[1]:'<#Messenger 1: message text for message code 1#>':'<#Messenger 1: help text for message code 1#>'; + [2]:'<#Messenger 1: message text for message code 2#>':'<#Messenger 1: help text for message code 2#>'; + [3]:'<#Messenger 1: message text for message code 3#>':'<#Messenger 1: help text for message code 3#>'; + [4]:'<#Messenger 1: message text for message code 4#>':'<#Messenger 1: help text for message code 4#>'; + [5]:'<#Messenger 1: message text for message code 5#>':'<#Messenger 1: help text for message code 5#>'; + [6]:'<#Messenger 1: message text for message code 6#>':'<#Messenger 1: help text for message code 6#>'; + [7]:'<#Messenger 1: message text for message code 7#>':'<#Messenger 1: help text for message code 7#>'; + [8]:'<#Messenger 1: message text for message code 8#>':'<#Messenger 1: help text for message code 8#>'; + [9]:'<#Messenger 1: message text for message code 9#>':'<#Messenger 1: help text for message code 9#>'; + [10]:'<#Messenger 1: message text for message code 10#>':'<#Messenger 1: help text for message code 10#>'; + [11]:'<#Messenger 1: message text for message code 11#>':'<#Messenger 1: help text for message code 11#>'")] + public Int16 _messge { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/program.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs new file mode 100644 index 00000000..22248e83 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/ref_to_simple.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace RefToSimple + { + public partial class ref_to_simple : AXSharp.Connector.IPlain + { + public ref_to_simple() + { + } + } + + public partial class referenced : AXSharp.Connector.IPlain + { + public referenced() + { + } + + public Int16 b { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs new file mode 100644 index 00000000..49d5fd25 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class.g.cs @@ -0,0 +1,13 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class simple_class : AXSharp.Connector.IPlain + { + public simple_class() + { + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs new file mode 100644 index 00000000..3cf279ae --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/simple_empty_class_within_namespace.g.cs @@ -0,0 +1,16 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace sampleNamespace + { + public partial class simple_empty_class_within_namespace : AXSharp.Connector.IPlain + { + public simple_empty_class_within_namespace() + { + } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs new file mode 100644 index 00000000..0c0b4d7c --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/struct_simple.g.cs @@ -0,0 +1,25 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public Motor m { get; set; } = new Motor(); + public Int16 displacement { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs new file mode 100644 index 00000000..a5e6936b --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace NamedValuesNamespace + { + public partial class using_type_named_values : AXSharp.Connector.IPlain + { + public using_type_named_values() + { + } + + public Int16 LColors { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs new file mode 100644 index 00000000..14b4df59 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_named_values_literals.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial class using_type_named_values : AXSharp.Connector.IPlain + { + public using_type_named_values() + { + } + + public UInt16 LColors { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs new file mode 100644 index 00000000..14b70914 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/type_with_enum.g.cs @@ -0,0 +1,26 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace Simatic.Ax.StateFramework + { + public partial interface IGuard + { + } + } + + namespace Simatic.Ax.StateFramework + { + public partial class CompareGuardLint : AXSharp.Connector.IPlain, IGuard + { + public CompareGuardLint() + { + } + + public Int64 CompareToValue { get; set; } + public global::Simatic.Ax.StateFramework.Condition Condition { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs new file mode 100644 index 00000000..2c9aba9f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_name_attributes.g.cs @@ -0,0 +1,37 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace TypeWithNameAttributes + { + public partial class Motor : AXSharp.Connector.IPlain + { + public Motor() + { + } + + public Boolean isRunning { get; set; } + } + + public partial class Vehicle : AXSharp.Connector.IPlain + { + public Vehicle() + { + } + + public TypeWithNameAttributes.Motor m { get; set; } = new TypeWithNameAttributes.Motor(); + public Int16 displacement { get; set; } + } + + public partial class NoAccessModifierClass : AXSharp.Connector.IPlain + { + public NoAccessModifierClass() + { + } + + public string SomeClassVariable { get; set; } = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs new file mode 100644 index 00000000..a68b5471 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/types_with_property_attributes.g.cs @@ -0,0 +1,20 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace TypesWithPropertyAttributes + { + [AXSharp.Connector.AddedPropertiesAttribute("Description", @"Some added property name value")] + public partial class SomeAddedProperties : AXSharp.Connector.IPlain + { + public SomeAddedProperties() + { + } + + [AXSharp.Connector.AddedPropertiesAttribute("AttributeName", @"Pocitadlo")] + public Int16 Counter { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs new file mode 100644 index 00000000..1ba9627a --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace units +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(units.PlcTranslator)); + var resource = assembly.GetType("units.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj new file mode 100644 index 00000000..2cb3c2ea --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file From c2c8f2930732dca75556e8421539eb6fd2795b24 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 07:42:52 +0100 Subject: [PATCH 06/15] line endings normalized in the expected results of the integration tests --- .../Cs/CsSourceBuilderTests.cs | 4 +- .../expected/app/AXSharp.config.json | 2 +- .../expected/app/ix/.g/Configurations.g.cs | 29 --- .../app/ix/.g/Onliners/configuration.g.cs | 6 - .../expected/app/ix/.g/Onliners/program.g.cs | 6 - .../app/ix/.g/POCO/configuration.g.cs | 7 - .../expected/app/ix/.g/POCO/program.g.cs | 7 - .../expected/app/ix/.g/PlcResources.g.cs | 26 -- .../expected/app/ix/.meta/meta.json | 1 - .../expected/app/ix/.meta/sourceinfo.json | 1 - .../app/samples/units/ix/ax/app.csproj | 26 ++ .../app/samples/units/ix/tia/app.csproj | 26 ++ .../tests/integration/expected/build.ps1 | 6 +- .../expected/lib1/AXSharp.config.json | 2 +- .../expected/lib1/ix/.g/Configurations.g.cs | 0 .../expected/lib1/ix/.g/Onliners/library.g.cs | 236 ------------------ .../expected/lib1/ix/.g/POCO/library.g.cs | 19 -- .../expected/lib1/ix/.g/PlcResources.g.cs | 26 -- .../expected/lib1/ix/.meta/meta.json | 1 - .../expected/lib1/ix/.meta/sourceinfo.json | 1 - .../lib1/samples/units/ix/ax/lib1.csproj | 21 ++ .../lib1/samples/units/ix/tia/lib1.csproj | 21 ++ .../expected/lib2/AXSharp.config.json | 2 +- .../expected/lib2/ix/.g/Configurations.g.cs | 0 .../expected/lib2/ix/.g/Onliners/library.g.cs | 236 ------------------ .../expected/lib2/ix/.g/POCO/library.g.cs | 19 -- .../expected/lib2/ix/.g/PlcResources.g.cs | 26 -- .../expected/lib2/ix/.meta/meta.json | 1 - .../expected/lib2/ix/.meta/sourceinfo.json | 1 - .../lib2/samples/units/ix/ax/lib2.csproj | 21 ++ .../lib2/samples/units/ix/tia/lib2.csproj | 21 ++ 31 files changed, 144 insertions(+), 657 deletions(-) delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json delete mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs index 240cb14e..a9439f41 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs @@ -1,4 +1,4 @@ -// AXSharp.Compiler.CsTests +// AXSharp.Compiler.CsTests // Copyright (c) 2023 MTS spol. s r.o., and Contributors. All Rights Reserved. // Contributors: https://github.com/inxton/axsharp/graphs/contributors // See the LICENSE file in the repository root for more information. @@ -352,4 +352,4 @@ public string GetMethodName() var name = method.Name; return name; } -} \ No newline at end of file +} diff --git a/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json index a761de8d..d6a2db64 100644 --- a/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json +++ b/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"app.csproj"} \ No newline at end of file +{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"app.csproj"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs deleted file mode 100644 index 2087ba97..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class appTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public lib1.MyClass lib1_MyClass { get; } - public lib2.MyClass lib2_MyClass { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } - - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs deleted file mode 100644 index 19ebced9..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace app -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var assembly = Assembly.GetAssembly(typeof(app.PlcTranslator)); - var resource = assembly.GetType("app.Resources.PlcStringResources"); - this.SetLocalizationResource(resource, assembly); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json deleted file mode 100644 index 752bccfe..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/meta.json +++ /dev/null @@ -1 +0,0 @@ -["NAMESPACE lib1\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE","NAMESPACE lib2\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE"] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json deleted file mode 100644 index 424fcce0..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/.meta/sourceinfo.json +++ /dev/null @@ -1 +0,0 @@ -{"ax-source":"../app"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj new file mode 100644 index 00000000..93d7b60f --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj @@ -0,0 +1,26 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj new file mode 100644 index 00000000..0bb09564 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj @@ -0,0 +1,26 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/build.ps1 b/src/AXSharp.compiler/tests/integration/expected/build.ps1 index 48b220a9..63e78b1f 100644 --- a/src/AXSharp.compiler/tests/integration/expected/build.ps1 +++ b/src/AXSharp.compiler/tests/integration/expected/build.ps1 @@ -1,14 +1,14 @@ cd lib1 -dotnet run --project ..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0 +dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0 dotnet build ./ix/lib1.csproj cd .. cd lib2 -dotnet run --project ..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0 +dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0 dotnet build ./ix/lib2.csproj cd .. cd app -dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0 +dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0 dotnet build ./ix/app.csproj cd .. \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json index bd2469ec..e3f36078 100644 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"lib1.csproj"} \ No newline at end of file +{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"lib1.csproj"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs deleted file mode 100644 index 0c38c998..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace lib1 -{ - public partial class MyClass : AXSharp.Connector.ITwinObject - { - public OnlinerString MyString { get; } - public OnlinerInt MyInt { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); - MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain() - { - return await (dynamic)this.OnlineToPlainAsync(); - } - - public async Task OnlineToPlainAsync() - { - global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); - await this.ReadAsync(); - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib1.MyClass plain) - { - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain) - { - await this.PlainToOnlineAsync((dynamic)plain); - } - - public async Task> PlainToOnlineAsync(global::Pocos.lib1.MyClass plain) - { -#pragma warning disable CS0612 - MyString.LethargicWrite(plain.MyString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - MyInt.LethargicWrite(plain.MyInt); -#pragma warning restore CS0612 - return await this.WriteAsync(); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.lib1.MyClass plain) - { -#pragma warning disable CS0612 - MyString.LethargicWrite(plain.MyString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - MyInt.LethargicWrite(plain.MyInt); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); - plain.MyString = MyString.Shadow; - plain.MyInt = MyInt.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.lib1.MyClass plain) - { - plain.MyString = MyString.Shadow; - plain.MyInt = MyInt.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.lib1.MyClass plain) - { - MyString.Shadow = plain.MyString; - MyInt.Shadow = plain.MyInt; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.lib1.MyClass plain, global::Pocos.lib1.MyClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.MyString != MyString.LastValue) - somethingChanged = true; - if (plain.MyInt != MyInt.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.lib1.MyClass CreateEmptyPoco() - { - return new global::Pocos.lib1.MyClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::lib1.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs deleted file mode 100644 index 38abe0b0..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace lib1 - { - public partial class MyClass : AXSharp.Connector.IPlain - { - public MyClass() - { - } - - public string MyString { get; set; } = string.Empty; - public Int16 MyInt { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs deleted file mode 100644 index e09a1207..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace lib1 -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var defaultResourceType = Assembly.GetAssembly(typeof(lib1.PlcTranslator)) - .GetType("lib1.Resources.PlcStringResources"); - this.SetLocalizationResource(defaultResourceType); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json deleted file mode 100644 index 66fc8850..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/meta.json +++ /dev/null @@ -1 +0,0 @@ -["NAMESPACE lib1\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE",""] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json deleted file mode 100644 index 8d95ff60..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.meta/sourceinfo.json +++ /dev/null @@ -1 +0,0 @@ -{"ax-source":"../lib1"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj new file mode 100644 index 00000000..2e2ada78 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj new file mode 100644 index 00000000..2e2ada78 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json index 5572803e..d871745d 100644 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"lib2.csproj"} \ No newline at end of file +{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"lib2.csproj"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs deleted file mode 100644 index ea3a87b3..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -namespace lib2 -{ - public partial class MyClass : AXSharp.Connector.ITwinObject - { - public OnlinerString MyString { get; } - public OnlinerInt MyInt { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) - { - Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); - this.@SymbolTail = symbolTail; - this.@Connector = parent.GetConnector(); - this.@Parent = parent; - HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); - PreConstruct(parent, readableTail, symbolTail); - MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); - MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); - parent.AddChild(this); - parent.AddKid(this); - PostConstruct(parent, readableTail, symbolTail); - } - - public async virtual Task OnlineToPlain() - { - return await (dynamic)this.OnlineToPlainAsync(); - } - - public async Task OnlineToPlainAsync() - { - global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); - await this.ReadAsync(); - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _OnlineToPlainNoacAsync() - { - global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib2.MyClass plain) - { - plain.MyString = MyString.LastValue; - plain.MyInt = MyInt.LastValue; - return plain; - } - - public async virtual Task PlainToOnline(T plain) - { - await this.PlainToOnlineAsync((dynamic)plain); - } - - public async Task> PlainToOnlineAsync(global::Pocos.lib2.MyClass plain) - { -#pragma warning disable CS0612 - MyString.LethargicWrite(plain.MyString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - MyInt.LethargicWrite(plain.MyInt); -#pragma warning restore CS0612 - return await this.WriteAsync(); - } - - [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public async Task _PlainToOnlineNoacAsync(global::Pocos.lib2.MyClass plain) - { -#pragma warning disable CS0612 - MyString.LethargicWrite(plain.MyString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - MyInt.LethargicWrite(plain.MyInt); -#pragma warning restore CS0612 - } - - public async virtual Task ShadowToPlain() - { - return await (dynamic)this.ShadowToPlainAsync(); - } - - public async Task ShadowToPlainAsync() - { - global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); - plain.MyString = MyString.Shadow; - plain.MyInt = MyInt.Shadow; - return plain; - } - - protected async Task ShadowToPlainAsync(global::Pocos.lib2.MyClass plain) - { - plain.MyString = MyString.Shadow; - plain.MyInt = MyInt.Shadow; - return plain; - } - - public async virtual Task PlainToShadow(T plain) - { - await this.PlainToShadowAsync((dynamic)plain); - } - - public async Task> PlainToShadowAsync(global::Pocos.lib2.MyClass plain) - { - MyString.Shadow = plain.MyString; - MyInt.Shadow = plain.MyInt; - return this.RetrievePrimitives(); - } - - /// - public async virtual Task AnyChangeAsync(T plain) - { - return await this.DetectsAnyChangeAsync((dynamic)plain); - } - - /// - ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. - ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. - /// - public async Task DetectsAnyChangeAsync(global::Pocos.lib2.MyClass plain, global::Pocos.lib2.MyClass latest = null) - { - if (latest == null) - latest = await this._OnlineToPlainNoacAsync(); - var somethingChanged = false; - return await Task.Run(async () => - { - if (plain.MyString != MyString.LastValue) - somethingChanged = true; - if (plain.MyInt != MyInt.LastValue) - somethingChanged = true; - plain = latest; - return somethingChanged; - }); - } - - public void Poll() - { - this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); - } - - public global::Pocos.lib2.MyClass CreateEmptyPoco() - { - return new global::Pocos.lib2.MyClass(); - } - - private IList Children { get; } = new List(); - - public IEnumerable GetChildren() - { - return Children; - } - - private IList Kids { get; } = new List(); - - public IEnumerable GetKids() - { - return Kids; - } - - private IList ValueTags { get; } = new List(); - - public IEnumerable GetValueTags() - { - return ValueTags; - } - - public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) - { - ValueTags.Add(valueTag); - } - - public void AddKid(AXSharp.Connector.ITwinElement kid) - { - Kids.Add(kid); - } - - public void AddChild(AXSharp.Connector.ITwinObject twinObject) - { - Children.Add(twinObject); - } - - protected AXSharp.Connector.Connector @Connector { get; } - - public AXSharp.Connector.Connector GetConnector() - { - return this.@Connector; - } - - public string GetSymbolTail() - { - return this.SymbolTail; - } - - public AXSharp.Connector.ITwinObject GetParent() - { - return this.@Parent; - } - - public string Symbol { get; protected set; } - - private string _attributeName; - public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } - - public System.String GetAttributeName(System.Globalization.CultureInfo culture) - { - return this.Translate(_attributeName, culture).Interpolate(this); - } - - private string _humanReadable; - public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } - - public System.String GetHumanReadable(System.Globalization.CultureInfo culture) - { - return this.Translate(_humanReadable, culture); - } - - protected System.String @SymbolTail { get; set; } - protected AXSharp.Connector.ITwinObject @Parent { get; set; } - public AXSharp.Connector.Localizations.Translator Interpreter => global::lib2.PlcTranslator.Instance; - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs deleted file mode 100644 index 9c8c66ac..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ - namespace lib2 - { - public partial class MyClass : AXSharp.Connector.IPlain - { - public MyClass() - { - } - - public string MyString { get; set; } = string.Empty; - public Int16 MyInt { get; set; } - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs deleted file mode 100644 index 7781a99f..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace lib2 -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var defaultResourceType = Assembly.GetAssembly(typeof(lib2.PlcTranslator)) - .GetType("lib2.Resources.PlcStringResources"); - this.SetLocalizationResource(defaultResourceType); - } - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json deleted file mode 100644 index 3f1fd313..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/meta.json +++ /dev/null @@ -1 +0,0 @@ -["NAMESPACE lib2\n\n{S7.extern=ReadWrite}\nCLASS MyClass \nEND_CLASS\nEND_NAMESPACE",""] \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json deleted file mode 100644 index 70de007c..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.meta/sourceinfo.json +++ /dev/null @@ -1 +0,0 @@ -{"ax-source":"../lib2"} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj new file mode 100644 index 00000000..2e2ada78 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj new file mode 100644 index 00000000..2e2ada78 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj @@ -0,0 +1,21 @@ + + + net10.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file From 595f134cfec229226e100ba5bfa6dba7c8c6c847 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:01:57 +0100 Subject: [PATCH 07/15] wip --- .../expected/app/ix/.g/Configurations.g.cs | 29 +++++++++++++++++++ .../app/ix/.g/Onliners/configuration.g.cs | 6 ++++ .../expected/app/ix/.g/Onliners/program.g.cs | 6 ++++ .../app/ix/.g/POCO/configuration.g.cs | 7 +++++ .../expected/app/ix/.g/POCO/program.g.cs | 7 +++++ .../expected/app/ix/.g/PlcResources.g.cs | 26 +++++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs new file mode 100644 index 00000000..2087ba97 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class appTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public lib1.MyClass lib1_MyClass { get; } + public lib2.MyClass lib2_MyClass { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } + + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs new file mode 100644 index 00000000..19ebced9 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace app +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(app.PlcTranslator)); + var resource = assembly.GetType("app.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file From 5ec231d7a4bafa7b37f6f9249716c5868cb25cf6 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:07:49 +0100 Subject: [PATCH 08/15] wip --- .../tests/integration/expected/{lib2 => lib3}/.gitignore | 0 .../tests/integration/expected/{lib2 => lib3}/AXSharp.config.json | 0 .../tests/integration/expected/{lib2 => lib3}/apax.yml | 0 .../integration/expected/{lib2 => lib3}/axsharp.companion.json | 0 .../tests/integration/expected/{lib2 => lib3}/ix/lib2.csproj | 0 .../expected/{lib2 => lib3}/samples/units/ix/ax/lib2.csproj | 0 .../expected/{lib2 => lib3}/samples/units/ix/tia/lib2.csproj | 0 .../tests/integration/expected/{lib2 => lib3}/src/library.st | 0 .../tests/integration/expected/{lib2 => lib3}/test/test.st | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/ix/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/samples/units/ix/ax/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/samples/units/ix/tia/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib2 => lib3}/test/test.st (100%) diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore b/src/AXSharp.compiler/tests/integration/expected/lib3/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/lib3/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib3/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/expected/lib3/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml b/src/AXSharp.compiler/tests/integration/expected/lib3/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/lib3/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/expected/lib3/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/expected/lib3/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib3/ix/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib3/ix/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/ax/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/ax/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/tia/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/tia/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st b/src/AXSharp.compiler/tests/integration/expected/lib3/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st rename to src/AXSharp.compiler/tests/integration/expected/lib3/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st b/src/AXSharp.compiler/tests/integration/expected/lib3/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st rename to src/AXSharp.compiler/tests/integration/expected/lib3/test/test.st From d7aeac256b418f080ea782fef974fbc3b31483c8 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:08:00 +0100 Subject: [PATCH 09/15] wip --- .../tests/integration/expected/{lib3 => lib2}/.gitignore | 0 .../tests/integration/expected/{lib3 => lib2}/AXSharp.config.json | 0 .../tests/integration/expected/{lib3 => lib2}/apax.yml | 0 .../integration/expected/{lib3 => lib2}/axsharp.companion.json | 0 .../tests/integration/expected/{lib3 => lib2}/ix/lib2.csproj | 0 .../expected/{lib3 => lib2}/samples/units/ix/ax/lib2.csproj | 0 .../expected/{lib3 => lib2}/samples/units/ix/tia/lib2.csproj | 0 .../tests/integration/expected/{lib3 => lib2}/src/library.st | 0 .../tests/integration/expected/{lib3 => lib2}/test/test.st | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/ix/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/samples/units/ix/ax/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/samples/units/ix/tia/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/expected/{lib3 => lib2}/test/test.st (100%) diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/.gitignore b/src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/apax.yml b/src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/ix/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/ix/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/ax/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/ax/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/tia/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/samples/units/ix/tia/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/src/library.st b/src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/src/library.st rename to src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/expected/lib3/test/test.st b/src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib3/test/test.st rename to src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st From c36840cdffd1e173d59b25cc0f1531cf31714884 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:18:38 +0100 Subject: [PATCH 10/15] wip --- .../integration/expected/app/ix/{.g => zg}/Configurations.g.cs | 0 .../expected/app/ix/{.g => zg}/Onliners/configuration.g.cs | 0 .../integration/expected/app/ix/{.g => zg}/Onliners/program.g.cs | 0 .../expected/app/ix/{.g => zg}/POCO/configuration.g.cs | 0 .../integration/expected/app/ix/{.g => zg}/POCO/program.g.cs | 0 .../integration/expected/app/ix/{.g => zg}/PlcResources.g.cs | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/Configurations.g.cs (100%) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/Onliners/configuration.g.cs (100%) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/Onliners/program.g.cs (100%) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/POCO/configuration.g.cs (100%) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/POCO/program.g.cs (100%) rename src/AXSharp.compiler/tests/integration/expected/app/ix/{.g => zg}/PlcResources.g.cs (100%) diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs rename to src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs From a6163d01a3115f77856d246b53902f90f0ddf810 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:18:47 +0100 Subject: [PATCH 11/15] wip --- .../expected/app/ix/zg/Configurations.g.cs | 29 ------------------- .../app/ix/zg/Onliners/configuration.g.cs | 6 ---- .../expected/app/ix/zg/Onliners/program.g.cs | 6 ---- .../app/ix/zg/POCO/configuration.g.cs | 7 ----- .../expected/app/ix/zg/POCO/program.g.cs | 7 ----- .../expected/app/ix/zg/PlcResources.g.cs | 26 ----------------- 6 files changed, 81 deletions(-) delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs delete mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs deleted file mode 100644 index 2087ba97..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Configurations.g.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; - -public partial class appTwinController : ITwinController -{ - public AXSharp.Connector.Connector Connector { get; } - public lib1.MyClass lib1_MyClass { get; } - public lib2.MyClass lib2_MyClass { get; } - - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) - { - this.Connector = adapter.GetConnector(parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } - - public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) - { - this.Connector = adapter.GetConnector(adapter.Parameters); - lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); - lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); - } -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/configuration.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs deleted file mode 100644 index 6c546f63..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/Onliners/program.g.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; -using AXSharp.Connector; -using AXSharp.Connector.ValueTypes; -using System.Collections.Generic; -using AXSharp.Connector.Localizations; -using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/configuration.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs deleted file mode 100644 index e23d372b..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/POCO/program.g.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; -using AXSharp.Abstractions.Presentation; -using AXSharp.Connector; - -namespace Pocos -{ -} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs deleted file mode 100644 index 19ebced9..00000000 --- a/src/AXSharp.compiler/tests/integration/expected/app/ix/zg/PlcResources.g.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System.Reflection; -using AXSharp.Connector.Localizations; - -namespace app -{ - public sealed class PlcTranslator : Translator - { - private static readonly PlcTranslator instance = new PlcTranslator(); - - public static PlcTranslator Instance - { - get - { - return instance; - } - } - - private PlcTranslator() - { - var assembly = Assembly.GetAssembly(typeof(app.PlcTranslator)); - var resource = assembly.GetType("app.Resources.PlcStringResources"); - this.SetLocalizationResource(resource, assembly); - } - } -} \ No newline at end of file From 8e47f8cca8755a43b50066eefea40973ffe7921e Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:33:31 +0100 Subject: [PATCH 12/15] wip --- .gitattributes | 2 +- src/AXSharp.compiler/tests/integration/expected/build.ps1 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 18d2d489..89030da0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,7 +20,7 @@ # (repo still stores LF; checkout converts to CRLF) *.bat text eol=crlf *.cmd text eol=crlf -*.ps1 text eol=crlf +*.ps1 text eol=lf # Binary files (never touch line endings) *.png -text diff --git a/src/AXSharp.compiler/tests/integration/expected/build.ps1 b/src/AXSharp.compiler/tests/integration/expected/build.ps1 index 63e78b1f..90f9c978 100644 --- a/src/AXSharp.compiler/tests/integration/expected/build.ps1 +++ b/src/AXSharp.compiler/tests/integration/expected/build.ps1 @@ -11,4 +11,5 @@ cd .. cd app dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0 dotnet build ./ix/app.csproj -cd .. \ No newline at end of file +cd .. + From f7328759ecbdd750ab20af1cc943d8190ac2139a Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:33:41 +0100 Subject: [PATCH 13/15] wip --- .../tests/integration/{expected => xexpected}/.gitignore | 0 .../tests/integration/{expected => xexpected}/apax-lock.json | 0 .../tests/integration/{expected => xexpected}/apax.yml | 0 .../tests/integration/{expected => xexpected}/app/.gitignore | 0 .../integration/{expected => xexpected}/app/AXSharp.config.json | 0 .../tests/integration/{expected => xexpected}/app/apax-lock.json | 0 .../tests/integration/{expected => xexpected}/app/apax.yml | 0 .../{expected => xexpected}/app/axsharp.companion.json | 0 .../tests/integration/{expected => xexpected}/app/ix/app.csproj | 0 .../tests/integration/{expected => xexpected}/app/ix/app.sln | 0 .../{expected => xexpected}/app/samples/units/ix/ax/app.csproj | 0 .../{expected => xexpected}/app/samples/units/ix/tia/app.csproj | 0 .../integration/{expected => xexpected}/app/src/configuration.st | 0 .../tests/integration/{expected => xexpected}/app/src/program.st | 0 .../tests/integration/{expected => xexpected}/app/test/test.st | 0 .../tests/integration/{expected => xexpected}/build.ps1 | 0 .../tests/integration/{expected => xexpected}/lib1/.gitignore | 0 .../integration/{expected => xexpected}/lib1/AXSharp.config.json | 0 .../tests/integration/{expected => xexpected}/lib1/apax.yml | 0 .../{expected => xexpected}/lib1/axsharp.companion.json | 0 .../tests/integration/{expected => xexpected}/lib1/ix/lib1.csproj | 0 .../{expected => xexpected}/lib1/samples/units/ix/ax/lib1.csproj | 0 .../{expected => xexpected}/lib1/samples/units/ix/tia/lib1.csproj | 0 .../integration/{expected => xexpected}/lib1/src/library.g.cs | 0 .../tests/integration/{expected => xexpected}/lib1/src/library.st | 0 .../tests/integration/{expected => xexpected}/lib1/test/test.st | 0 .../tests/integration/{expected => xexpected}/lib2/.gitignore | 0 .../integration/{expected => xexpected}/lib2/AXSharp.config.json | 0 .../tests/integration/{expected => xexpected}/lib2/apax.yml | 0 .../{expected => xexpected}/lib2/axsharp.companion.json | 0 .../tests/integration/{expected => xexpected}/lib2/ix/lib2.csproj | 0 .../{expected => xexpected}/lib2/samples/units/ix/ax/lib2.csproj | 0 .../{expected => xexpected}/lib2/samples/units/ix/tia/lib2.csproj | 0 .../tests/integration/{expected => xexpected}/lib2/src/library.st | 0 .../tests/integration/{expected => xexpected}/lib2/test/test.st | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/apax-lock.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/apax-lock.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/ix/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/ix/app.sln (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/samples/units/ix/ax/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/samples/units/ix/tia/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/src/configuration.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/src/program.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/app/test/test.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/build.ps1 (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/ix/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/samples/units/ix/ax/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/samples/units/ix/tia/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/src/library.g.cs (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib1/test/test.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/ix/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/samples/units/ix/ax/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/samples/units/ix/tia/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/{expected => xexpected}/lib2/test/test.st (100%) diff --git a/src/AXSharp.compiler/tests/integration/expected/.gitignore b/src/AXSharp.compiler/tests/integration/xexpected/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/.gitignore rename to src/AXSharp.compiler/tests/integration/xexpected/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/apax-lock.json b/src/AXSharp.compiler/tests/integration/xexpected/apax-lock.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/apax-lock.json rename to src/AXSharp.compiler/tests/integration/xexpected/apax-lock.json diff --git a/src/AXSharp.compiler/tests/integration/expected/apax.yml b/src/AXSharp.compiler/tests/integration/xexpected/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/apax.yml rename to src/AXSharp.compiler/tests/integration/xexpected/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/app/.gitignore b/src/AXSharp.compiler/tests/integration/xexpected/app/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/.gitignore rename to src/AXSharp.compiler/tests/integration/xexpected/app/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/xexpected/app/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/xexpected/app/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/expected/app/apax-lock.json b/src/AXSharp.compiler/tests/integration/xexpected/app/apax-lock.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/apax-lock.json rename to src/AXSharp.compiler/tests/integration/xexpected/app/apax-lock.json diff --git a/src/AXSharp.compiler/tests/integration/expected/app/apax.yml b/src/AXSharp.compiler/tests/integration/xexpected/app/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/apax.yml rename to src/AXSharp.compiler/tests/integration/xexpected/app/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/app/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/xexpected/app/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/xexpected/app/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/app.csproj b/src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/app.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/app.sln b/src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.sln similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/ix/app.sln rename to src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.sln diff --git a/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj b/src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/ax/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/ax/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj b/src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/tia/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/tia/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/app/src/configuration.st b/src/AXSharp.compiler/tests/integration/xexpected/app/src/configuration.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/src/configuration.st rename to src/AXSharp.compiler/tests/integration/xexpected/app/src/configuration.st diff --git a/src/AXSharp.compiler/tests/integration/expected/app/src/program.st b/src/AXSharp.compiler/tests/integration/xexpected/app/src/program.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/src/program.st rename to src/AXSharp.compiler/tests/integration/xexpected/app/src/program.st diff --git a/src/AXSharp.compiler/tests/integration/expected/app/test/test.st b/src/AXSharp.compiler/tests/integration/xexpected/app/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/app/test/test.st rename to src/AXSharp.compiler/tests/integration/xexpected/app/test/test.st diff --git a/src/AXSharp.compiler/tests/integration/expected/build.ps1 b/src/AXSharp.compiler/tests/integration/xexpected/build.ps1 similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/build.ps1 rename to src/AXSharp.compiler/tests/integration/xexpected/build.ps1 diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/.gitignore b/src/AXSharp.compiler/tests/integration/xexpected/lib1/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/.gitignore rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/xexpected/lib1/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/apax.yml b/src/AXSharp.compiler/tests/integration/xexpected/lib1/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/apax.yml rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/xexpected/lib1/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/lib1.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib1/ix/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/ix/lib1.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/ix/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/ax/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/ax/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/tia/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/tia/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/src/library.g.cs b/src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/src/library.g.cs rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/src/library.st b/src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/src/library.st rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/test/test.st b/src/AXSharp.compiler/tests/integration/xexpected/lib1/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib1/test/test.st rename to src/AXSharp.compiler/tests/integration/xexpected/lib1/test/test.st diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore b/src/AXSharp.compiler/tests/integration/xexpected/lib2/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/xexpected/lib2/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml b/src/AXSharp.compiler/tests/integration/xexpected/lib2/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/xexpected/lib2/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib2/ix/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/ix/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/ax/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/ax/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj b/src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/tia/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/tia/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st b/src/AXSharp.compiler/tests/integration/xexpected/lib2/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st b/src/AXSharp.compiler/tests/integration/xexpected/lib2/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st rename to src/AXSharp.compiler/tests/integration/xexpected/lib2/test/test.st From f3c8ccddb9ff36004e9db78ef9f2fe61e8b6c046 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:33:49 +0100 Subject: [PATCH 14/15] wip --- .../tests/integration/{xexpected => expected}/.gitignore | 0 .../tests/integration/{xexpected => expected}/apax-lock.json | 0 .../tests/integration/{xexpected => expected}/apax.yml | 0 .../tests/integration/{xexpected => expected}/app/.gitignore | 0 .../integration/{xexpected => expected}/app/AXSharp.config.json | 0 .../tests/integration/{xexpected => expected}/app/apax-lock.json | 0 .../tests/integration/{xexpected => expected}/app/apax.yml | 0 .../{xexpected => expected}/app/axsharp.companion.json | 0 .../tests/integration/{xexpected => expected}/app/ix/app.csproj | 0 .../tests/integration/{xexpected => expected}/app/ix/app.sln | 0 .../{xexpected => expected}/app/samples/units/ix/ax/app.csproj | 0 .../{xexpected => expected}/app/samples/units/ix/tia/app.csproj | 0 .../integration/{xexpected => expected}/app/src/configuration.st | 0 .../tests/integration/{xexpected => expected}/app/src/program.st | 0 .../tests/integration/{xexpected => expected}/app/test/test.st | 0 .../tests/integration/{xexpected => expected}/build.ps1 | 0 .../tests/integration/{xexpected => expected}/lib1/.gitignore | 0 .../integration/{xexpected => expected}/lib1/AXSharp.config.json | 0 .../tests/integration/{xexpected => expected}/lib1/apax.yml | 0 .../{xexpected => expected}/lib1/axsharp.companion.json | 0 .../tests/integration/{xexpected => expected}/lib1/ix/lib1.csproj | 0 .../{xexpected => expected}/lib1/samples/units/ix/ax/lib1.csproj | 0 .../{xexpected => expected}/lib1/samples/units/ix/tia/lib1.csproj | 0 .../integration/{xexpected => expected}/lib1/src/library.g.cs | 0 .../tests/integration/{xexpected => expected}/lib1/src/library.st | 0 .../tests/integration/{xexpected => expected}/lib1/test/test.st | 0 .../tests/integration/{xexpected => expected}/lib2/.gitignore | 0 .../integration/{xexpected => expected}/lib2/AXSharp.config.json | 0 .../tests/integration/{xexpected => expected}/lib2/apax.yml | 0 .../{xexpected => expected}/lib2/axsharp.companion.json | 0 .../tests/integration/{xexpected => expected}/lib2/ix/lib2.csproj | 0 .../{xexpected => expected}/lib2/samples/units/ix/ax/lib2.csproj | 0 .../{xexpected => expected}/lib2/samples/units/ix/tia/lib2.csproj | 0 .../tests/integration/{xexpected => expected}/lib2/src/library.st | 0 .../tests/integration/{xexpected => expected}/lib2/test/test.st | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/apax-lock.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/apax-lock.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/ix/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/ix/app.sln (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/samples/units/ix/ax/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/samples/units/ix/tia/app.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/src/configuration.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/src/program.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/app/test/test.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/build.ps1 (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/ix/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/samples/units/ix/ax/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/samples/units/ix/tia/lib1.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/src/library.g.cs (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib1/test/test.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/.gitignore (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/AXSharp.config.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/apax.yml (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/axsharp.companion.json (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/ix/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/samples/units/ix/ax/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/samples/units/ix/tia/lib2.csproj (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/src/library.st (100%) rename src/AXSharp.compiler/tests/integration/{xexpected => expected}/lib2/test/test.st (100%) diff --git a/src/AXSharp.compiler/tests/integration/xexpected/.gitignore b/src/AXSharp.compiler/tests/integration/expected/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/xexpected/apax-lock.json b/src/AXSharp.compiler/tests/integration/expected/apax-lock.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/apax-lock.json rename to src/AXSharp.compiler/tests/integration/expected/apax-lock.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/apax.yml b/src/AXSharp.compiler/tests/integration/expected/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/.gitignore b/src/AXSharp.compiler/tests/integration/expected/app/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/app/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/expected/app/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/apax-lock.json b/src/AXSharp.compiler/tests/integration/expected/app/apax-lock.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/apax-lock.json rename to src/AXSharp.compiler/tests/integration/expected/app/apax-lock.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/apax.yml b/src/AXSharp.compiler/tests/integration/expected/app/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/app/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/expected/app/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/expected/app/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.csproj b/src/AXSharp.compiler/tests/integration/expected/app/ix/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.csproj rename to src/AXSharp.compiler/tests/integration/expected/app/ix/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.sln b/src/AXSharp.compiler/tests/integration/expected/app/ix/app.sln similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/ix/app.sln rename to src/AXSharp.compiler/tests/integration/expected/app/ix/app.sln diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/ax/app.csproj b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/ax/app.csproj rename to src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/ax/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/tia/app.csproj b/src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/samples/units/ix/tia/app.csproj rename to src/AXSharp.compiler/tests/integration/expected/app/samples/units/ix/tia/app.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/src/configuration.st b/src/AXSharp.compiler/tests/integration/expected/app/src/configuration.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/src/configuration.st rename to src/AXSharp.compiler/tests/integration/expected/app/src/configuration.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/src/program.st b/src/AXSharp.compiler/tests/integration/expected/app/src/program.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/src/program.st rename to src/AXSharp.compiler/tests/integration/expected/app/src/program.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/app/test/test.st b/src/AXSharp.compiler/tests/integration/expected/app/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/app/test/test.st rename to src/AXSharp.compiler/tests/integration/expected/app/test/test.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/build.ps1 b/src/AXSharp.compiler/tests/integration/expected/build.ps1 similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/build.ps1 rename to src/AXSharp.compiler/tests/integration/expected/build.ps1 diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/.gitignore b/src/AXSharp.compiler/tests/integration/expected/lib1/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/lib1/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/expected/lib1/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/apax.yml b/src/AXSharp.compiler/tests/integration/expected/lib1/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/lib1/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/expected/lib1/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/expected/lib1/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/ix/lib1.csproj b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/ix/lib1.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib1/ix/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/ax/lib1.csproj b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/ax/lib1.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/ax/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/tia/lib1.csproj b/src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/samples/units/ix/tia/lib1.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib1/samples/units/ix/tia/lib1.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/src/library.g.cs similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.g.cs rename to src/AXSharp.compiler/tests/integration/expected/lib1/src/library.g.cs diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.st b/src/AXSharp.compiler/tests/integration/expected/lib1/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/src/library.st rename to src/AXSharp.compiler/tests/integration/expected/lib1/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib1/test/test.st b/src/AXSharp.compiler/tests/integration/expected/lib1/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib1/test/test.st rename to src/AXSharp.compiler/tests/integration/expected/lib1/test/test.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/.gitignore b/src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/.gitignore rename to src/AXSharp.compiler/tests/integration/expected/lib2/.gitignore diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/AXSharp.config.json b/src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/AXSharp.config.json rename to src/AXSharp.compiler/tests/integration/expected/lib2/AXSharp.config.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/apax.yml b/src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/apax.yml rename to src/AXSharp.compiler/tests/integration/expected/lib2/apax.yml diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/axsharp.companion.json b/src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/axsharp.companion.json rename to src/AXSharp.compiler/tests/integration/expected/lib2/axsharp.companion.json diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/ix/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/ix/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/ix/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/ax/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/ax/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/ax/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/tia/lib2.csproj b/src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/samples/units/ix/tia/lib2.csproj rename to src/AXSharp.compiler/tests/integration/expected/lib2/samples/units/ix/tia/lib2.csproj diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/src/library.st b/src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/src/library.st rename to src/AXSharp.compiler/tests/integration/expected/lib2/src/library.st diff --git a/src/AXSharp.compiler/tests/integration/xexpected/lib2/test/test.st b/src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st similarity index 100% rename from src/AXSharp.compiler/tests/integration/xexpected/lib2/test/test.st rename to src/AXSharp.compiler/tests/integration/expected/lib2/test/test.st From 83e84c5fea312ed2907f4d3e3c4891b097e3a849 Mon Sep 17 00:00:00 2001 From: TK <61820360+TomKovac@users.noreply.github.com> Date: Thu, 19 Feb 2026 08:45:14 +0100 Subject: [PATCH 15/15] wip --- .../expected/app/ix/.g/Configurations.g.cs | 29 +++ .../app/ix/.g/Onliners/configuration.g.cs | 6 + .../expected/app/ix/.g/Onliners/program.g.cs | 6 + .../app/ix/.g/POCO/configuration.g.cs | 7 + .../expected/app/ix/.g/POCO/program.g.cs | 7 + .../expected/app/ix/.g/PlcResources.g.cs | 26 ++ .../expected/lib1/ix/.g/Configurations.g.cs | 0 .../expected/lib1/ix/.g/Onliners/library.g.cs | 241 ++++++++++++++++++ .../expected/lib1/ix/.g/POCO/library.g.cs | 19 ++ .../expected/lib1/ix/.g/PlcResources.g.cs | 26 ++ .../expected/lib2/ix/.g/Configurations.g.cs | 0 .../expected/lib2/ix/.g/Onliners/library.g.cs | 241 ++++++++++++++++++ .../expected/lib2/ix/.g/POCO/library.g.cs | 19 ++ .../expected/lib2/ix/.g/PlcResources.g.cs | 26 ++ 14 files changed, 653 insertions(+) create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs create mode 100644 src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs new file mode 100644 index 00000000..2087ba97 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Configurations.g.cs @@ -0,0 +1,29 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +public partial class appTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { get; } + public lib1.MyClass lib1_MyClass { get; } + public lib2.MyClass lib2_MyClass { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } + + public appTwinController(AXSharp.Connector.ConnectorAdapter adapter) + { + this.Connector = adapter.GetConnector(adapter.Parameters); + lib1_MyClass = new lib1.MyClass(this.Connector, "", "lib1_MyClass"); + lib2_MyClass = new lib2.MyClass(this.Connector, "", "lib2_MyClass"); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/configuration.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs new file mode 100644 index 00000000..6c546f63 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/Onliners/program.g.cs @@ -0,0 +1,6 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/configuration.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs new file mode 100644 index 00000000..e23d372b --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/POCO/program.g.cs @@ -0,0 +1,7 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs new file mode 100644 index 00000000..19ebced9 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/app/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace app +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(app.PlcTranslator)); + var resource = assembly.GetType("app.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Configurations.g.cs new file mode 100644 index 00000000..e69de29b diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs new file mode 100644 index 00000000..502c8cd8 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/Onliners/library.g.cs @@ -0,0 +1,241 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace lib1 +{ + public partial class MyClass : AXSharp.Connector.ITwinObject + { + public OnlinerString MyString { get; } + public OnlinerInt MyInt { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); + MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + await this.ReadAsync(priority); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib1.MyClass plain) + { + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.lib1.MyClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.lib1.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass(); + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.lib1.MyClass plain) + { + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.lib1.MyClass plain) + { + MyString.Shadow = plain.MyString; + MyInt.Shadow = plain.MyInt; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.lib1.MyClass plain, global::Pocos.lib1.MyClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.MyString != MyString.LastValue) + somethingChanged = true; + if (plain.MyInt != MyInt.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.lib1.MyClass CreateEmptyPoco() + { + return new global::Pocos.lib1.MyClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::lib1.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs new file mode 100644 index 00000000..38abe0b0 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/POCO/library.g.cs @@ -0,0 +1,19 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace lib1 + { + public partial class MyClass : AXSharp.Connector.IPlain + { + public MyClass() + { + } + + public string MyString { get; set; } = string.Empty; + public Int16 MyInt { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs new file mode 100644 index 00000000..11ebf3de --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib1/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace lib1 +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(lib1.PlcTranslator)); + var resource = assembly.GetType("lib1.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Configurations.g.cs new file mode 100644 index 00000000..e69de29b diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs new file mode 100644 index 00000000..d22b70dc --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/Onliners/library.g.cs @@ -0,0 +1,241 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace lib2 +{ + public partial class MyClass : AXSharp.Connector.ITwinObject + { + public OnlinerString MyString { get; } + public OnlinerInt MyInt { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + MyString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "MyString", "MyString"); + MyInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "MyInt", "MyInt"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + await this.ReadAsync(priority); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(global::Pocos.lib2.MyClass plain) + { + plain.MyString = MyString.LastValue; + plain.MyInt = MyInt.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.lib2.MyClass plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(global::Pocos.lib2.MyClass plain) + { +#pragma warning disable CS0612 + MyString.LethargicWrite(plain.MyString); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + MyInt.LethargicWrite(plain.MyInt); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass(); + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.lib2.MyClass plain) + { + plain.MyString = MyString.Shadow; + plain.MyInt = MyInt.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.lib2.MyClass plain) + { + MyString.Shadow = plain.MyString; + MyInt.Shadow = plain.MyInt; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(global::Pocos.lib2.MyClass plain, global::Pocos.lib2.MyClass latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.MyString != MyString.LastValue) + somethingChanged = true; + if (plain.MyInt != MyInt.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.lib2.MyClass CreateEmptyPoco() + { + return new global::Pocos.lib2.MyClass(); + } + + private IList Children { get; } = new List(); + + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + public AXSharp.Connector.Localizations.Translator Interpreter => global::lib2.PlcTranslator.Instance; + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs new file mode 100644 index 00000000..9c8c66ac --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/POCO/library.g.cs @@ -0,0 +1,19 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace lib2 + { + public partial class MyClass : AXSharp.Connector.IPlain + { + public MyClass() + { + } + + public string MyString { get; set; } = string.Empty; + public Int16 MyInt { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs new file mode 100644 index 00000000..c869b240 --- /dev/null +++ b/src/AXSharp.compiler/tests/integration/expected/lib2/ix/.g/PlcResources.g.cs @@ -0,0 +1,26 @@ + +using System.Reflection; +using AXSharp.Connector.Localizations; + +namespace lib2 +{ + public sealed class PlcTranslator : Translator + { + private static readonly PlcTranslator instance = new PlcTranslator(); + + public static PlcTranslator Instance + { + get + { + return instance; + } + } + + private PlcTranslator() + { + var assembly = Assembly.GetAssembly(typeof(lib2.PlcTranslator)); + var resource = assembly.GetType("lib2.Resources.PlcStringResources"); + this.SetLocalizationResource(resource, assembly); + } + } +} \ No newline at end of file