diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ISourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ISourceBuilder.cs index 26c14b00..76109140 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ISourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ISourceBuilder.cs @@ -40,4 +40,6 @@ public interface ISourceBuilder /// Get the semantic compilation for this builder. /// public Compilation Compilation { get; } + + eCommAccessibility TypeCommAccessibility { get; } } \ No newline at end of file diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/eCommAccessibility.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/eCommAccessibility.cs new file mode 100644 index 00000000..d2c8ebef --- /dev/null +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/eCommAccessibility.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AXSharp.Compiler.Core +{ + public enum eCommAccessibility + { + None, + ReadWrite, + ReadOnly, + } +} diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs index a7ef0f1d..0ee67555 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs @@ -29,7 +29,7 @@ public static class SemanticsHelpers public static bool IsMemberEligibleForTranspile(this IFieldDeclaration field, ISourceBuilder sourceBuilder, string coBuilder = "") { return field.AccessModifier == AccessModifier.Public - && field.Type.IsTypeEligibleForTranspile(sourceBuilder) + && field.IsEligibleForTranspile(sourceBuilder) && !IsToBeOmitted(field, sourceBuilder, coBuilder); } @@ -75,28 +75,72 @@ private static bool IsToBeOmitted(this IStorageDeclaration fieldDeclaration, ISo /// /// Determines whether the member or type is eligible for generation. /// - /// + /// /// - /// - public static bool IsTypeEligibleForTranspile(this ITypeDeclaration typeDeclaration, ISourceBuilder sourceBuilder) + /// True when the type is eligible + public static bool IsEligibleForTranspile(this IFieldDeclaration fieldDeclaration, ISourceBuilder sourceBuilder) + { + var type = fieldDeclaration.Type; + return !(type is IReferenceTypeDeclaration) + && + fieldDeclaration.IsAvailableForComm(sourceBuilder) + && + (type is IScalarTypeDeclaration || + type is IStringTypeDeclaration || + type is IStructuredTypeDeclaration || + type is INamedValueTypeDeclaration || + sourceBuilder.Compilation.GetSemanticTree().Types.Any(p => + p.FullyQualifiedName == type.FullyQualifiedName)); + } + + /// + /// Determines whether the member or type is eligible for generation. + /// + /// + /// + /// True when the type is eligible + public static bool IsEligibleForTranspile(this IVariableDeclaration variableDeclaration, ISourceBuilder sourceBuilder) { - var asArray = typeDeclaration as IArrayTypeDeclaration; - var singleDimensionalArray = asArray is null || asArray.Dimensions.Count == 1; + var type = variableDeclaration.Type; + return !(type is IReferenceTypeDeclaration) + && + variableDeclaration.IsAvailableForComm(sourceBuilder) + && + (type is IScalarTypeDeclaration || + type is IStringTypeDeclaration || + type is IStructuredTypeDeclaration || + type is INamedValueTypeDeclaration || + sourceBuilder.Compilation.GetSemanticTree().Types.Any(p => + p.FullyQualifiedName == type.FullyQualifiedName)); + } - var isEligibleType = !(typeDeclaration is IReferenceTypeDeclaration) + /// + /// Determines whether the member is eligible for generation. + /// + /// + /// Source builder + /// + public static bool IsEligibleForTranspile(this IArrayTypeDeclaration arrayTypeDeclaration, ISourceBuilder sourceBuilder) + { + var singleDimensionalArray = arrayTypeDeclaration.Dimensions.Count == 1; + + var isEligibleType = !(arrayTypeDeclaration.ElementTypeAccess.Type is IReferenceTypeDeclaration) + && + arrayTypeDeclaration.IsAvailableForComm(sourceBuilder) && - (typeDeclaration is IScalarTypeDeclaration || - typeDeclaration is IStringTypeDeclaration || - typeDeclaration is IStructuredTypeDeclaration || - typeDeclaration is INamedValueTypeDeclaration || + (arrayTypeDeclaration.ElementTypeAccess.Type is IScalarTypeDeclaration || + arrayTypeDeclaration.ElementTypeAccess.Type is IStringTypeDeclaration || + arrayTypeDeclaration.ElementTypeAccess.Type is IStructuredTypeDeclaration || + arrayTypeDeclaration.ElementTypeAccess.Type is INamedValueTypeDeclaration || sourceBuilder.Compilation.GetSemanticTree().Types.Any(p => - p.FullyQualifiedName == typeDeclaration.FullyQualifiedName)); + p.FullyQualifiedName == arrayTypeDeclaration.ElementTypeAccess.Type.FullyQualifiedName)); return isEligibleType && singleDimensionalArray; } + /// /// Determines whether the member is eligible for generation. /// @@ -107,7 +151,7 @@ typeDeclaration is INamedValueTypeDeclaration || public static bool IsMemberEligibleForTranspile(this IVariableDeclaration variable, ISourceBuilder sourceBuilder, string coBuilder = "") { return variable.IsInGlobalMemory - && variable.Type.IsTypeEligibleForTranspile(sourceBuilder) + && variable.IsEligibleForTranspile(sourceBuilder) && !IsToBeOmitted(variable, sourceBuilder, coBuilder); } @@ -135,15 +179,60 @@ public static bool IsMemberEligibleForConstructor(this IVariableDeclaration vari return variable.IsMemberEligibleForTranspile(sourceBuilder, coBuilder); } - /// - /// Determines whether the member is eligible for generation. - /// - /// - /// Source builder - /// + private static bool IsAvailableForComm(this IDeclaration declaration, ISourceBuilder sourceBuilder) + { + var pragmaReadWrite = "S7.extern=ReadWrite".ToLower(); + var pragmaRead = "S7.extern=ReadOnly".ToLower(); + return declaration.Pragmas.Any(p => + { + var prgma = p.Content.ToLower().Replace(" ", string.Empty, StringComparison.InvariantCulture); + return (prgma == pragmaReadWrite || prgma == pragmaRead); + }) || (sourceBuilder.TypeCommAccessibility == eCommAccessibility.ReadOnly || sourceBuilder.TypeCommAccessibility == eCommAccessibility.ReadWrite); + } + internal static bool IsAvailableReadOnlyForComm(this IDeclaration declaration) + { + var pargmaContent = "S7.extern=Read".ToLower(); + return declaration.Pragmas.Any(p => + { + var prgma = p.Content.ToLower().Replace(" ", string.Empty, StringComparison.InvariantCulture); + return (prgma == pargmaContent); + }); + } + private static bool IsAvailableReadWriteForComm(this IDeclaration declaration) + { + var pargmaContent = "S7.extern=ReadWrite".ToLower(); + return declaration.Pragmas.Any(p => + { + var prgma = p.Content.ToLower().Replace(" ", string.Empty, StringComparison.InvariantCulture); + return (prgma == pargmaContent); + }); + } + + public static eCommAccessibility GetCommAccessibility(this IDeclaration declaration) + { + + if (declaration.IsAvailableReadOnlyForComm()) + { + return eCommAccessibility.ReadOnly; + } + + if (declaration.IsAvailableReadWriteForComm()) + { + return eCommAccessibility.ReadWrite; + } + + return eCommAccessibility.None; + } + + + + + + public static bool IsMemberEligibleForConstructor(this IArrayTypeDeclaration arrayTypeDeclaration, ISourceBuilder sourceBuilder) { - return arrayTypeDeclaration.ElementTypeAccess.Type.IsTypeEligibleForTranspile(sourceBuilder); + return IsEligibleForTranspile(arrayTypeDeclaration, sourceBuilder); + } /// diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs index 967ca34b..35105da0 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerMemberBuilder.cs @@ -72,7 +72,7 @@ public void CreateFieldDeclaration(IFieldDeclaration fieldDeclaration, IxNodeVis AddToSource("{get;}"); break; case IArrayTypeDeclaration array: - if (array.ElementTypeAccess.Type.IsTypeEligibleForTranspile(SourceBuilder)) + if (array.IsEligibleForTranspile(SourceBuilder)) { AddToSource($"{fieldDeclaration.AccessModifier.Transform()} "); fieldDeclaration.Type.Accept(visitor, this); @@ -161,7 +161,7 @@ public void CreateVariableDeclaration(IVariableDeclaration semantics, IxNodeVisi AddToSource("{get;}"); break; case IArrayTypeDeclaration array: - if (array.ElementTypeAccess.Type.IsTypeEligibleForTranspile(SourceBuilder)) + if (array.IsEligibleForTranspile(SourceBuilder)) { AddToSource($"public"); semantics.Type.Accept(visitor, this); diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerOnlineToPlainBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerOnlineToPlainBuilder.cs index 667fc36d..3e6e7928 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerOnlineToPlainBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerOnlineToPlainBuilder.cs @@ -54,6 +54,7 @@ public void CreateVariableDeclaration(IVariableDeclaration variableDeclaration, } } + internal void CreateAssignment(ITypeDeclaration typeDeclaration, IDeclaration declaration) { switch (typeDeclaration) @@ -68,18 +69,23 @@ internal void CreateAssignment(ITypeDeclaration typeDeclaration, IDeclaration de AddToSource($"#pragma warning restore CS0612\n"); break; case IArrayTypeDeclaration arrayTypeDeclaration: - switch (arrayTypeDeclaration.ElementTypeAccess.Type) + if (arrayTypeDeclaration.IsMemberEligibleForConstructor(SourceBuilder)) { - case IClassDeclaration classDeclaration: - case IStructuredTypeDeclaration structuredTypeDeclaration: - AddToSource($"#pragma warning disable CS0612\n"); - AddToSource($"plain.{declaration.Name} = {declaration.Name}.Select(async p => await p.{MethodNameNoac}Async()).Select(p => p.Result).ToArray();"); - AddToSource($"#pragma warning restore CS0612\n"); - break; - case IScalarTypeDeclaration scalarTypeDeclaration: - case IStringTypeDeclaration stringTypeDeclaration: - AddToSource($"plain.{declaration.Name} = {declaration.Name}.Select(p => p.LastValue).ToArray();"); - break; + switch (arrayTypeDeclaration.ElementTypeAccess.Type) + { + case IClassDeclaration classDeclaration: + case IStructuredTypeDeclaration structuredTypeDeclaration: + AddToSource($"#pragma warning disable CS0612\n"); + AddToSource( + $"plain.{declaration.Name} = {declaration.Name}.Select(async p => await p.{MethodNameNoac}Async()).Select(p => p.Result).ToArray();"); + AddToSource($"#pragma warning restore CS0612\n"); + break; + case IScalarTypeDeclaration scalarTypeDeclaration: + case IStringTypeDeclaration stringTypeDeclaration: + AddToSource( + $"plain.{declaration.Name} = {declaration.Name}.Select(p => p.LastValue).ToArray();"); + break; + } } break; case IReferenceTypeDeclaration referenceTypeDeclaration: diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToOnlineBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToOnlineBuilder.cs index 199f3e35..fd6ca8ec 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToOnlineBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToOnlineBuilder.cs @@ -69,25 +69,30 @@ private void CreateAssignment(ITypeDeclaration typeDeclaration, IDeclaration dec AddToSource($"#pragma warning restore CS0612\n"); break; case IArrayTypeDeclaration arrayTypeDeclaration: - - switch (arrayTypeDeclaration.ElementTypeAccess.Type) + if (arrayTypeDeclaration.IsMemberEligibleForConstructor(SourceBuilder)) { - case IClassDeclaration classDeclaration: - case IStructuredTypeDeclaration structuredTypeDeclaration: - AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); - AddToSource($"#pragma warning disable CS0612\n"); - AddToSource($"{declaration.Name}.Select(p => p.{MethodNameNoac}Async(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); - AddToSource($"#pragma warning restore CS0612\n"); - break; - case IScalarTypeDeclaration scalarTypeDeclaration: - case IStringTypeDeclaration stringTypeDeclaration: - AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); - AddToSource($"#pragma warning disable CS0612\n"); - AddToSource($"{declaration.Name}.Select(p => p.LethargicWrite(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); - AddToSource($"#pragma warning restore CS0612\n"); - break; + switch (arrayTypeDeclaration.ElementTypeAccess.Type) + { + case IClassDeclaration classDeclaration: + case IStructuredTypeDeclaration structuredTypeDeclaration: + AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); + AddToSource($"#pragma warning disable CS0612\n"); + AddToSource( + $"{declaration.Name}.Select(p => p.{MethodNameNoac}Async(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); + AddToSource($"#pragma warning restore CS0612\n"); + break; + case IScalarTypeDeclaration scalarTypeDeclaration: + case IStringTypeDeclaration stringTypeDeclaration: + AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); + AddToSource($"#pragma warning disable CS0612\n"); + AddToSource( + $"{declaration.Name}.Select(p => p.LethargicWrite(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); + AddToSource($"#pragma warning restore CS0612\n"); + break; + } } + break; case IReferenceTypeDeclaration referenceTypeDeclaration: break; diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToShadowBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToShadowBuilder.cs index 7574fa66..e23b1ea6 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToShadowBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerPlainToShadowBuilder.cs @@ -67,20 +67,25 @@ private void CreateAssignment(ITypeDeclaration typeDeclaration, IDeclaration dec break; case IArrayTypeDeclaration arrayTypeDeclaration: - - switch (arrayTypeDeclaration.ElementTypeAccess.Type) + if (arrayTypeDeclaration.IsMemberEligibleForConstructor(SourceBuilder)) { - case IClassDeclaration classDeclaration: - case IStructuredTypeDeclaration structuredTypeDeclaration: - AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); - AddToSource($"{declaration.Name}.Select(p => p.{MethodName}Async(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); - break; - case IScalarTypeDeclaration scalarTypeDeclaration: - case IStringTypeDeclaration stringTypeDeclaration: - AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); - AddToSource($"{declaration.Name}.Select(p => p.Shadow = plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++]).ToArray();"); - break; + switch (arrayTypeDeclaration.ElementTypeAccess.Type) + { + case IClassDeclaration classDeclaration: + case IStructuredTypeDeclaration structuredTypeDeclaration: + AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); + AddToSource( + $"{declaration.Name}.Select(p => p.{MethodName}Async(plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++])).ToArray();"); + break; + case IScalarTypeDeclaration scalarTypeDeclaration: + case IStringTypeDeclaration stringTypeDeclaration: + AddToSource($"var _{declaration.Name}_i_FE8484DAB3 = 0;"); + AddToSource( + $"{declaration.Name}.Select(p => p.Shadow = plain.{declaration.Name}[_{declaration.Name}_i_FE8484DAB3++]).ToArray();"); + break; + } } + break; case IReferenceTypeDeclaration referenceTypeDeclaration: break; diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerShadowToPlainBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerShadowToPlainBuilder.cs index 714ada20..3a0ede03 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerShadowToPlainBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerPlainerShadowToPlainBuilder.cs @@ -66,18 +66,24 @@ internal void CreateAssignment(ITypeDeclaration typeDeclaration, IDeclaration de AddToSource($" plain.{declaration.Name} = await {declaration.Name}.{MethodName}Async();"); break; case IArrayTypeDeclaration arrayTypeDeclaration: - switch (arrayTypeDeclaration.ElementTypeAccess.Type) + if (arrayTypeDeclaration.IsMemberEligibleForConstructor(SourceBuilder)) { - case IClassDeclaration classDeclaration: - case IStructuredTypeDeclaration structuredTypeDeclaration: - AddToSource($"plain.{declaration.Name} = {declaration.Name}.Select(async p => await p.{MethodName}Async()).Select(p => p.Result).ToArray();"); - break; - case IScalarTypeDeclaration scalarTypeDeclaration: - case IStringTypeDeclaration stringTypeDeclaration: - - AddToSource($"plain.{declaration.Name} = {declaration.Name}.Select(p => p.Shadow).ToArray();"); - break; + switch (arrayTypeDeclaration.ElementTypeAccess.Type) + { + case IClassDeclaration classDeclaration: + case IStructuredTypeDeclaration structuredTypeDeclaration: + AddToSource( + $"plain.{declaration.Name} = {declaration.Name}.Select(async p => await p.{MethodName}Async()).Select(p => p.Result).ToArray();"); + break; + case IScalarTypeDeclaration scalarTypeDeclaration: + case IStringTypeDeclaration stringTypeDeclaration: + + AddToSource( + $"plain.{declaration.Name} = {declaration.Name}.Select(p => p.Shadow).ToArray();"); + break; + } } + break; case IReferenceTypeDeclaration referenceTypeDeclaration: break; diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs index 5c841f88..a4be891c 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs @@ -92,11 +92,15 @@ private string ReplaceGenericSignature(IClassDeclaration? classDeclaration) return genericSignature; } + public eCommAccessibility TypeCommAccessibility { get; private set; } + /// public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSyntax, IClassDeclaration classDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = classDeclaration.GetCommAccessibility(); + classDeclarationSyntax.UsingDirectives.ToList().ForEach(p => p.Visit(visitor, this)); var generic = classDeclaration.GetGenericAttributes(); @@ -161,6 +165,8 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource( $"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{"); AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); @@ -173,6 +179,8 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy /// public void CreateConfigDeclaration(IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace} : ITwinController {{"); AddToSource(@$"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); AddToSource(CsOnlinerConstructorBuilder.Create(visitor, configurationDeclaration, Project, this).Output); @@ -184,6 +192,8 @@ public void CreateEnumTypeDeclaration(IEnumTypeDeclarationSyntax enumTypeDeclara ITypeDeclaration typeDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource($"public enum {enumTypeDeclarationSyntax.Name.Text} {{"); AddToSource(string.Join("\n,", enumTypeDeclarationSyntax.EnumValues.Select(p => p.Name.Text))); AddToSource("}"); @@ -193,6 +203,8 @@ public void CreateEnumTypeDeclaration(IEnumTypeDeclarationSyntax enumTypeDeclara public void CreateNamedValueTypeDeclaration(INamedValueTypeDeclarationSyntax namedValueTypeDeclarationSyntax, INamedValueTypeDeclaration namedValueTypeDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource( $"public enum {namedValueTypeDeclarationSyntax.Name.Text} : {namedValueTypeDeclarationSyntax.Type.TransformType()} {{"); @@ -242,6 +254,8 @@ public void CreateInterfaceDeclaration(IInterfaceDeclarationSyntax interfaceDecl IInterfaceDeclaration interfaceDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource($"{interfaceDeclaration.AccessModifier.Transform()} partial interface {interfaceDeclaration.Name} {{}}"); } @@ -256,6 +270,8 @@ public void CreateStructuredType(IStructTypeDeclarationSyntax structTypeDeclarat IStructuredTypeDeclaration structuredTypeDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = structuredTypeDeclaration.GetCommAccessibility(); + AddToSource(structuredTypeDeclaration.Pragmas.AddAttributes()); AddToSource( $"{structuredTypeDeclaration.AccessModifier.Transform()}partial class {structTypeDeclarationSyntax.Name.Text}"); diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs index 95e384ca..ec2e592a 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs @@ -40,6 +40,8 @@ public CsPlainSourceBuilder(AXSharpProject project, /// public Compilation Compilation { get; } + public eCommAccessibility TypeCommAccessibility { get; private set; } + private StringBuilder _sourceBuilder { get; } = new(); @@ -48,6 +50,8 @@ public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSynta IClassDeclaration classDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = classDeclaration.GetCommAccessibility(); + classDeclarationSyntax.UsingDirectives.ToList().ForEach(p => p.Visit(visitor, this)); AddToSource($"{classDeclaration.AccessModifier.Transform()}partial class {classDeclaration.Name}"); @@ -92,7 +96,7 @@ public void CreateFieldDeclaration(IFieldDeclaration fieldDeclaration, IxNodeVis switch (fieldDeclaration.Type) { case IArrayTypeDeclaration arrayType: - if (arrayType.ElementTypeAccess.Type.IsTypeEligibleForTranspile(this)) + if (arrayType.IsEligibleForTranspile(this)) { fieldDeclaration.Pragmas.AddAttributes(); AddToSource($"{fieldDeclaration.AccessModifier.Transform()}"); @@ -171,6 +175,8 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IConfigurationDeclaration configurationDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = eCommAccessibility.None; + AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController{{"); configurationDeclaration.Variables.ToList().ForEach(p => p.Accept(visitor, this)); AddToSource("}"); @@ -232,7 +238,7 @@ public void CreateVariableDeclaration(IVariableDeclaration fieldDeclaration, IxN switch (fieldDeclaration.Type) { case IArrayTypeDeclaration arrayType: - if (arrayType.ElementTypeAccess.Type.IsTypeEligibleForTranspile(this)) + if (arrayType.IsEligibleForTranspile(this)) { fieldDeclaration.Pragmas.AddAttributes(); AddToSource($"public"); @@ -279,6 +285,8 @@ public void CreateStructuredType(IStructTypeDeclarationSyntax structTypeDeclarat IStructuredTypeDeclaration structuredTypeDeclaration, IxNodeVisitor visitor) { + TypeCommAccessibility = structuredTypeDeclaration.GetCommAccessibility(); + AddToSource( $"{structuredTypeDeclaration.AccessModifier.Transform()}partial class {structTypeDeclarationSyntax.Name.Text} "); AddToSource("{"); @@ -319,7 +327,7 @@ public void CreateInterfaceDeclaration(IInterfaceDeclaration interfaceDeclaratio /// public void CreateArrayTypeDeclaration(IArrayTypeDeclaration arrayTypeDeclaration, IxNodeVisitor visitor) { - if (arrayTypeDeclaration.ElementTypeAccess.Type.IsTypeEligibleForTranspile(this)) return; + if (arrayTypeDeclaration.IsEligibleForTranspile(this)) return; arrayTypeDeclaration.ElementTypeAccess.Type.Accept(visitor, this); AddToSource("[]"); diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs index 8812b015..737099ee 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Pragmas/PragmaExtensions.cs @@ -157,6 +157,11 @@ public static string AddAnnotations(this IDeclaration declaration) sb.AppendLine($"{declaration.Name}.MakeReadOnly();"); break; } + + if (declaration.IsAvailableReadOnlyForComm()) + { + sb.AppendLine($"{declaration.Name}.MakeReadOnly();"); + } } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj index b5e09d89..51b9e24e 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj @@ -59,6 +59,18 @@ + + + PreserveNewest + + + + + + Always + + + PreserveNewest @@ -391,9 +403,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -440,5 +452,8 @@ Always + + Always + 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 c06487a2..52058070 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs @@ -265,6 +265,15 @@ public void class_generic_extension() CompareOutputs(memberName); } + [Fact] + public void mixed_access() + { + var memberName = GetMethodName(); + CompareOutputs(memberName); + } + + + private void CompareOutputs(string memberName) { var sourceFile = Path.Combine(testFolder, $@"samples\units\src\{memberName}.st"); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs new file mode 100644 index 00000000..75b51b17 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/mixed_access.g.cs @@ -0,0 +1,1383 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; + +public partial class unitsTwinController : ITwinController +{ + public AXSharp.Connector.Connector Connector { 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; } + + public unitsTwinController(AXSharp.Connector.ConnectorAdapter adapter, object[] parameters) + { + this.Connector = adapter.GetConnector(parameters); + 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); + 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 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() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.Motor plain = new Pocos.Motor(); + await this.ReadAsync(); + 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() + { + Pocos.Motor plain = new 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(Pocos.Motor plain) + { + plain.Run = Run.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.Motor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#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(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() + { + Pocos.Motor plain = new Pocos.Motor(); + plain.Run = Run.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.Motor plain) + { + Run.Shadow = plain.Run; + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.Motor CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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; } + + 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); + s2 = new struct2(this, "s2", "s2"); + parent.AddChild(this); + parent.AddKid(this); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.struct1 plain = new Pocos.struct1(); + await this.ReadAsync(); +#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() + { + Pocos.struct1 plain = new Pocos.struct1(); +#pragma warning disable CS0612 + plain.s2 = await s2._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(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) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.struct1 plain) + { +#pragma warning disable CS0612 + await this.s2._PlainToOnlineNoacAsync(plain.s2); +#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(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() + { + Pocos.struct1 plain = new Pocos.struct1(); + plain.s2 = await s2.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.struct1 plain) + { + await this.s2.PlainToShadowAsync(plain.s2); + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.struct1 CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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; } + + 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); + s3 = new struct3(this, "s3", "s3"); + parent.AddChild(this); + parent.AddKid(this); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.struct2 plain = new Pocos.struct2(); + await this.ReadAsync(); +#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() + { + Pocos.struct2 plain = new Pocos.struct2(); +#pragma warning disable CS0612 + plain.s3 = await s3._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(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) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.struct2 plain) + { +#pragma warning disable CS0612 + await this.s3._PlainToOnlineNoacAsync(plain.s3); +#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(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() + { + Pocos.struct2 plain = new Pocos.struct2(); + plain.s3 = await s3.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.struct2 plain) + { + await this.s3.PlainToShadowAsync(plain.s3); + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.struct2 CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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; } + + 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); + s4 = new struct4(this, "s4", "s4"); + parent.AddChild(this); + parent.AddKid(this); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.struct3 plain = new Pocos.struct3(); + await this.ReadAsync(); +#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() + { + Pocos.struct3 plain = new Pocos.struct3(); +#pragma warning disable CS0612 + plain.s4 = await s4._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + protected async Task OnlineToPlainAsync(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) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.struct3 plain) + { +#pragma warning disable CS0612 + await this.s4._PlainToOnlineNoacAsync(plain.s4); +#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(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() + { + Pocos.struct3 plain = new Pocos.struct3(); + plain.s4 = await s4.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.struct3 plain) + { + await this.s4.PlainToShadowAsync(plain.s4); + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.struct3 CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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; } + + 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); + s5 = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "s5", "s5"); + parent.AddChild(this); + parent.AddKid(this); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.struct4 plain = new Pocos.struct4(); + await this.ReadAsync(); + 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() + { + Pocos.struct4 plain = new Pocos.struct4(); + plain.s5 = s5.LastValue; + return plain; + } + + protected async Task OnlineToPlainAsync(Pocos.struct4 plain) + { + plain.s5 = s5.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.struct4 plain) + { +#pragma warning disable CS0612 + s5.LethargicWrite(plain.s5); +#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(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() + { + Pocos.struct4 plain = new Pocos.struct4(); + plain.s5 = s5.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.struct4 plain) + { + s5.Shadow = plain.s5; + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.struct4 CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.AbstractMotor plain = new Pocos.AbstractMotor(); + await this.ReadAsync(); + 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() + { + Pocos.AbstractMotor plain = new 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(Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(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 + 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(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() + { + Pocos.AbstractMotor plain = new Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.AbstractMotor CreateEmptyPoco() + { + return new 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) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, 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() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public new async Task OnlineToPlainAsync() + { + Pocos.GenericMotor plain = new Pocos.GenericMotor(); + await this.ReadAsync(); +#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() + { + Pocos.GenericMotor plain = new 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(Pocos.GenericMotor plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.GenericMotor plain) + { + await base._PlainToOnlineNoacAsync(plain); + 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(Pocos.GenericMotor plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + Pocos.GenericMotor plain = new Pocos.GenericMotor(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.GenericMotor plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new Pocos.GenericMotor CreateEmptyPoco() + { + return new 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() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public new async Task OnlineToPlainAsync() + { + Pocos.SpecificMotorA plain = new Pocos.SpecificMotorA(); + await this.ReadAsync(); +#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() + { + Pocos.SpecificMotorA plain = new 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(Pocos.SpecificMotorA plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.SpecificMotorA plain) + { + await base._PlainToOnlineNoacAsync(plain); + 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(Pocos.SpecificMotorA plain) + { + await base._PlainToOnlineNoacAsync(plain); + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + Pocos.SpecificMotorA plain = new Pocos.SpecificMotorA(); + await base.ShadowToPlainAsync(plain); + return plain; + } + + protected async Task ShadowToPlainAsync(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(Pocos.SpecificMotorA plain) + { + await base.PlainToShadowAsync(plain); + return this.RetrievePrimitives(); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new Pocos.SpecificMotorA CreateEmptyPoco() + { + return new Pocos.SpecificMotorA(); + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs new file mode 100644 index 00000000..5ec06fdf --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/mixed_access.g.cs @@ -0,0 +1,57 @@ +using System; + +namespace Pocos +{ + public partial class unitsTwinController + { + public Boolean MotorOn { get; set; } + + public Int16 MotorState { get; set; } + + public Motor Motor1 { get; set; } = new Motor(); + public Motor Motor2 { get; set; } = new Motor(); + public struct1 s1 { get; set; } = new struct1(); + public struct4 s4 { get; set; } = new struct4(); + public SpecificMotorA mot1 { get; set; } = new SpecificMotorA(); + } + + public partial class Motor : AXSharp.Connector.IPlain + { + public Boolean Run { get; set; } + } + + public partial class struct1 + { + public struct2 s2 { get; set; } = new struct2(); + } + + public partial class struct2 + { + public struct3 s3 { get; set; } = new struct3(); + } + + public partial class struct3 + { + public struct4 s4 { get; set; } = new struct4(); + } + + public partial class struct4 + { + public Int16 s5 { get; set; } + } + + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public Boolean Run { get; set; } + + public Boolean ReverseDirection { get; set; } + } + + public partial class GenericMotor : AbstractMotor, AXSharp.Connector.IPlain + { + } + + public partial class SpecificMotorA : GenericMotor, AXSharp.Connector.IPlain + { + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/array_declaration.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/array_declaration.st index cfbb35fc..91f2b21c 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/array_declaration.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/array_declaration.st @@ -1,4 +1,5 @@ NAMESPACE ArrayDeclarationSimpleNamespace + {S7.extern=ReadWrite} CLASS array_declaration_class VAR PUBLIC primitive : ARRAY[1..100] OF INT; @@ -8,7 +9,7 @@ NAMESPACE ArrayDeclarationSimpleNamespace primitive_multidim : ARRAY[1..100, 0..100, 0..300] OF INT; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS some_complex_type VAR diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_all_primitives.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_all_primitives.st index 6fb713e1..d80e1a9e 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_all_primitives.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_all_primitives.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS class_all_primitives VAR PUBLIC myBOOL : BOOL ; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extended_by_known_type.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extended_by_known_type.st index f9813598..5c0a5287 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extended_by_known_type.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extended_by_known_type.st @@ -3,6 +3,7 @@ USING Simatic.Ax.StatePattern; NAMESPACE Simatic.Ax.StateFramework + {S7.extern=ReadWrite} CLASS State1Transition EXTENDS AbstractState METHOD PUBLIC OVERRIDE OnEntry @@ -25,6 +26,7 @@ END_NAMESPACE NAMESPACE Simatic.Ax.StateFramework + {S7.extern=ReadWrite} CLASS ABSTRACT AbstractState IMPLEMENTS IState, IStateMuteable VAR PUBLIC diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends.st index bf1f7a91..a93a906e 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends.st @@ -1,7 +1,9 @@ +{S7.extern=ReadWrite} CLASS PUBLIC Extended EXTENDS Extendee END_CLASS +{S7.extern=ReadWrite} CLASS PUBLIC Extendee END_CLASS \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends_and_implements.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends_and_implements.st index a1be5eae..da3ff088 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends_and_implements.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_extends_and_implements.st @@ -1,7 +1,9 @@ +{S7.extern=ReadWrite} CLASS PUBLIC ExtendsAndImplements EXTENDS ExtendeeExtendsAndImplements IMPLEMENTS IImplementation1, IImplementation2 END_CLASS +{S7.extern=ReadWrite} CLASS PUBLIC ExtendeeExtendsAndImplements END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_generic_extension.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_generic_extension.st index 547ff3f8..f61f80fe 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_generic_extension.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_generic_extension.st @@ -1,10 +1,11 @@ NAMESPACE Generics {#ix-generic: where TOnline : ITwinObject} + {S7.extern=ReadWrite} CLASS PUBLIC Extender END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC Extendee EXTENDS Extender VAR PUBLIC {#ix-generic:TOnline} @@ -14,6 +15,7 @@ NAMESPACE Generics END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS PUBLIC Extendee2 EXTENDS Extender VAR PUBLIC {#ix-generic:TOnline} @@ -22,6 +24,7 @@ NAMESPACE Generics END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS SomeType END_IF; END_NAMESPACE diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements.st index 916493ef..d504d3b3 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS PUBLIC _NULL_CONTEXT IMPLEMENTS IContext END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements_multiple.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements_multiple.st index a7e4b491..0dbb7c45 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements_multiple.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_implements_multiple.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS PUBLIC _NULL_CONTEXT_MULTIPLE IMPLEMENTS IContext_Multiple, IObject_Multiple END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_internal.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_internal.st index b0eb1e4f..eee4f3b5 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_internal.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_internal.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS INTERNAL ClassWithComplexTypes END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_no_access_modifier.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_no_access_modifier.st index ab4d7c71..6a769734 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_no_access_modifier.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_no_access_modifier.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS NoAccessModifierClass END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_complex_members.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_complex_members.st index 1622baf3..1df8b797 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_complex_members.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_complex_members.st @@ -1,10 +1,12 @@ NAMESPACE ClassWithComplexTypesNamespace + {S7.extern=ReadWrite} CLASS PUBLIC ClassWithComplexTypes VAR PUBLIC myComplexType : ComplexType1; END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS PUBLIC ComplexType1 END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_non_public_members.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_non_public_members.st index 9cbf8620..b74ce4e8 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_non_public_members.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_non_public_members.st @@ -1,4 +1,5 @@ NAMESPACE ClassWithNonTraspilableMemberssNamespace + {S7.extern=ReadWrite} CLASS PUBLIC ClassWithNonTraspilableMembers VAR PUBLIC myComplexType : ComplexType1; @@ -14,7 +15,7 @@ NAMESPACE ClassWithNonTraspilableMemberssNamespace myBooool1 : BOOL; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC ComplexType1 END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_pragmas.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_pragmas.st index d4ef7cf9..a004c86a 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_pragmas.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_pragmas.st @@ -1,8 +1,10 @@ NAMESPACE ClassWithPragmasNamespace {#ix-attr:[Container(Layout.Stack)]} + {S7.extern=ReadWrite} CLASS PUBLIC ClassWithPragmas VAR PUBLIC {#ix-attr:[Container(Layout.Wrap)]} + {S7.extern=ReadWrite} myComplexType : ComplexType1; END_VAR END_CLASS diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_primitive_members.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_primitive_members.st index c7fd3e56..0fdf83bb 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_primitive_members.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_primitive_members.st @@ -1,4 +1,5 @@ NAMESPACE ClassWithPrimitiveTypesNamespace + {S7.extern=ReadWrite} CLASS PUBLIC ClassWithPrimitiveTypes VAR PUBLIC myBOOL : BOOL ; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_using_directives.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_using_directives.st index ca938ac2..b367c520 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_using_directives.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_using_directives.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS INTERNAL ClassWithUsingDirectives USING SimpleFirstLevelNamespace, SimpleQualifiedNamespace.Qualified; USING HelloLevelOne.HelloLevelTwo; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/compileromitsattribute.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/compileromitsattribute.st index d38431ba..115a81b9 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/compileromitsattribute.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/compileromitsattribute.st @@ -1,4 +1,5 @@ NAMESPACE CompilerOmmits + {S7.extern=ReadWrite} CLASS ClassWithArrays VAR PUBLIC {#ix-attr:[CompilerOmitsAttribute()]} @@ -12,7 +13,7 @@ NAMESPACE CompilerOmmits END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC Complex VAR PUBLIC HelloString : STRING; @@ -22,6 +23,7 @@ NAMESPACE CompilerOmmits END_NAMESPACE NAMESPACE Enums + {S7.extern=ReadWrite} CLASS ClassWithEnums VAR PUBLIC colors : Colors; @@ -41,6 +43,7 @@ NAMESPACE Enums END_NAMESPACE NAMESPACE misc + {S7.extern=ReadWrite} CLASS PUBLIC VariousMembers VAR PUBLIC _SomeClass : SomeClass; @@ -48,7 +51,7 @@ NAMESPACE misc END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS SomeClass VAR PUBLIC SomeClassVariable : STRING; @@ -56,9 +59,11 @@ NAMESPACE misc END_CLASS TYPE + {S7.extern=ReadWrite} Motor : STRUCT isRunning : BOOL; END_STRUCT; + {S7.extern=ReadWrite} Vehicle : STRUCT m : Motor; displacement : INT; @@ -67,6 +72,7 @@ NAMESPACE misc END_NAMESPACE NAMESPACE UnknownArraysShouldNotBeTraspiled + {S7.extern=ReadWrite} CLASS ClassWithArrays VAR PUBLIC _complexKnown : ARRAY[0..10] OF Complex; @@ -76,7 +82,7 @@ NAMESPACE UnknownArraysShouldNotBeTraspiled END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC Complex VAR PUBLIC HelloString : STRING; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st index 293c03f6..37321911 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/configuration.st @@ -3,55 +3,92 @@ CONFIGURATION MyConfiguration PROGRAM P1 WITH Main: MyProgram; VAR_GLOBAL + {S7.extern=ReadWrite} Complex : ComplexForConfig; + {S7.extern=ReadWrite} myBOOL : BOOL ; + {S7.extern=ReadWrite} myBYTE : BYTE ; + {S7.extern=ReadWrite} myWORD : WORD ; + {S7.extern=ReadWrite} myDWORD : DWORD ; + {S7.extern=ReadWrite} myLWORD : LWORD ; + {S7.extern=ReadWrite} mySINT : SINT ; + {S7.extern=ReadWrite} myINT : INT ; + {S7.extern=ReadWrite} myDINT : DINT ; + {S7.extern=ReadWrite} myLINT : LINT ; + {S7.extern=ReadWrite} myUSINT : USINT ; + {S7.extern=ReadWrite} myUINT : UINT ; + {S7.extern=ReadWrite} myUDINT : UDINT ; + {S7.extern=ReadWrite} myULINT : ULINT ; + {S7.extern=ReadWrite} myREAL : REAL ; + {S7.extern=ReadWrite} myLREAL : LREAL ; + {S7.extern=ReadWrite} myTIME : TIME ; + {S7.extern=ReadWrite} myLTIME : LTIME ; + {S7.extern=ReadWrite} myDATE : DATE ; + {S7.extern=ReadWrite} myLDATE : LDATE ; + {S7.extern=ReadWrite} myTIME_OF_DAY : TIME_OF_DAY ; + {S7.extern=ReadWrite} myLTIME_OF_DAY : LTIME_OF_DAY ; + {S7.extern=ReadWrite} myDATE_AND_TIME : DATE_AND_TIME ; + {S7.extern=ReadWrite} myLDATE_AND_TIME : LDATE_AND_TIME; + {S7.extern=ReadWrite} myCHAR : CHAR ; + {S7.extern=ReadWrite} myWCHAR : WCHAR ; + {S7.extern=ReadWrite} mySTRING : STRING ; + {S7.extern=ReadWrite} myWSTRING : WSTRING ; + {S7.extern=ReadWrite} {#ix-attr:[ReadOnce()]} myWSTRING_readOnce : WSTRING ; {#ix-attr:[ReadOnly()]} + {S7.extern=ReadWrite} myWSTRING_readOnly : WSTRING ; {#ix-attr:[ReadOnce()]} + {S7.extern=ReadWrite} cReadOnce : ComplexForConfig; {#ix-attr:[ReadOnly()]} + {S7.extern=ReadWrite} cReadOnly : ComplexForConfig; + {S7.extern=ReadWrite} Colorss : Colorss; + {S7.extern=ReadWrite} Colorsss : Colorsss; + {S7.extern=ReadWrite} {#ix-attr:[CompilerOmitsAttribute()]} _must_be_omitted_everywhere : BOOL; + {S7.extern=ReadWrite} {#ix-attr:[CompilerOmitsAttribute("Onliner")]} _must_be_omitted_in_onliner : BOOL; + {S7.extern=ReadWrite} {#ix-attr:[CompilerOmitsAttribute("POCO")]} _must_be_omitted_in_poco : BOOL; END_VAR END_CONFIGURATION - +{S7.extern=ReadWrite} CLASS PUBLIC ComplexForConfig VAR PUBLIC myBOOL : BOOL ; @@ -94,9 +131,11 @@ TYPE END_TYPE TYPE + {S7.extern=ReadWrite} Motor : STRUCT isRunning : BOOL; END_STRUCT; + {S7.extern=ReadWrite} Vehicle : STRUCT m : Motor; displacement : INT; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonce.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonce.st index 2f8f05a3..ed95fb66 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonce.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonce.st @@ -1,4 +1,5 @@ NAMESPACE makereadonce + {S7.extern=ReadWrite} CLASS PUBLIC MembersWithMakeReadOnce VAR PUBLIC {#ix-attr:[ReadOnce()]} @@ -10,7 +11,7 @@ NAMESPACE makereadonce someotherComplexMember : ComplexMember; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC ComplexMember VAR PUBLIC someMember : STRING; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonly.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonly.st index 9689ea70..a0abd175 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonly.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/makereadonly.st @@ -1,4 +1,5 @@ NAMESPACE makereadonly + {S7.extern=ReadWrite} CLASS PUBLIC MembersWithMakeReadOnly VAR PUBLIC {#ix-attr:[ReadOnly()]} @@ -10,7 +11,7 @@ NAMESPACE makereadonly someotherComplexMember : ComplexMember; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC ComplexMember VAR PUBLIC someMember : STRING; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/misc.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/misc.st index 53b1afb1..a8945f2f 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/misc.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/misc.st @@ -1,4 +1,5 @@ NAMESPACE Enums +{S7.extern=ReadWrite} CLASS ClassWithEnums VAR PUBLIC colors : Colors; @@ -18,6 +19,7 @@ NAMESPACE Enums END_NAMESPACE NAMESPACE misc +{S7.extern=ReadWrite} CLASS PUBLIC VariousMembers VAR PUBLIC _SomeClass : SomeClass; @@ -25,7 +27,7 @@ NAMESPACE misc END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS SomeClass VAR PUBLIC SomeClassVariable : STRING; @@ -33,9 +35,11 @@ NAMESPACE misc END_CLASS TYPE + {S7.extern=ReadWrite} Motor : STRUCT isRunning : BOOL; END_STRUCT; + {S7.extern=ReadWrite} Vehicle : STRUCT m : Motor; displacement : INT; @@ -44,6 +48,7 @@ NAMESPACE misc END_NAMESPACE NAMESPACE UnknownArraysShouldNotBeTraspiled + {S7.extern=ReadWrite} CLASS ClassWithArrays VAR PUBLIC _complexKnown : ARRAY[0..10] OF Complex; @@ -53,7 +58,7 @@ NAMESPACE UnknownArraysShouldNotBeTraspiled END_CLASS - + {S7.extern=ReadWrite} CLASS PUBLIC Complex VAR PUBLIC HelloString : STRING; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/mixed_access.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/mixed_access.st new file mode 100644 index 00000000..cc1be691 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/mixed_access.st @@ -0,0 +1,72 @@ +CONFIGURATION config + VAR_GLOBAL + {S7.extern=ReadWrite} + MotorOn : BOOL; // variable can be read and written + + {S7.extern=ReadOnly} + MotorState: INT; // variable can only be read + + MotorFlags: UINT; // variable is not accessible by an external system (default: hidden) + + {S7.extern=ReadWrite} + Motor1 : Motor; // the variables in Motor1 be read and written if enabled + + {S7.extern=ReadOnly} + Motor2 : Motor; // the variables in Motor2 be only read if enabled + + {S7.extern=ReadWrite} + s1 : struct1; + {S7.extern=ReadWrite} + s4 : struct4; + + {S7.extern=ReadWrite} + mot1 : SpecificMotorA; + END_VAR +END_CONFIGURATION + +CLASS Motor + VAR PUBLIC + {S7.extern=ReadWrite} + Run : BOOL; + ReverseDirection : BOOL; + END_VAR + VAR INTERNAL + {S7.extern=ReadOnly} + ActualVelocity : LReal; + END_VAR + // ... +END_CLASS + +TYPE + struct1 : STRUCT {S7.extern=ReadWrite} s2 : struct2; END_STRUCT; + struct2 : STRUCT {S7.extern=ReadOnly} s3 : struct3; END_STRUCT; + struct3 : STRUCT {S7.extern=ReadWrite} s4 : struct4; END_STRUCT; + struct4 : STRUCT {S7.extern=ReadWrite} s5 : INT; END_STRUCT; +END_TYPE + +{S7.extern=ReadWrite} +CLASS ABSTRACT AbstractMotor + VAR PUBLIC + Run : BOOL; + ReverseDirection : BOOL; + END_VAR + ... +END_CLASS + +{S7.extern=ReadWrite} +CLASS GenericMotor EXTENDS AbstractMotor + VAR INTERNAL + {S7.extern=ReadOnly} + ActualVelocity : LReal; + END_VAR + ... +END_CLASS + +{S7.extern=ReadWrite} +CLASS SpecificMotorA EXTENDS GenericMotor + VAR INTERNAL + {S7.extern=ReadWrite} + MaxAcceleration : LReal; + END_VAR + ... +END_CLASS \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/ref_to_simple.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/ref_to_simple.st index 36a854d6..9a6aa2ee 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/ref_to_simple.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/ref_to_simple.st @@ -1,11 +1,13 @@ NAMESPACE RefToSimple + {S7.extern=ReadWrite} CLASS ref_to_simple VAR PUBLIC a : REF_TO INT; b : REF_TO referenced; END_VAR END_CLASS - + + {S7.extern=ReadWrite} CLASS referenced VAR PUBLIC b : INT; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class.st index a68a3472..e6064eb5 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class.st @@ -1,2 +1,3 @@ -CLASS PUBLIC simple_class +{S7.extern=ReadWrite} +CLASS PUBLIC simple_class END_CLASS \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class_within_namespace.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class_within_namespace.st index 76446bbf..fa9e7cac 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class_within_namespace.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/simple_empty_class_within_namespace.st @@ -1,4 +1,5 @@ NAMESPACE sampleNamespace + {S7.extern=ReadWrite} CLASS PUBLIC simple_empty_class_within_namespace END_CLASS END_NAMESPACE \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/struct_simple.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/struct_simple.st index 696880c4..8e81ed49 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/struct_simple.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/struct_simple.st @@ -1,7 +1,9 @@ TYPE + {S7.extern=ReadWrite} Motor : STRUCT isRunning : BOOL; END_STRUCT; + {S7.extern=ReadWrite} Vehicle : STRUCT m : Motor; displacement : INT; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values.st index 140a0cac..af7e87f2 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values.st @@ -6,7 +6,8 @@ NAMESPACE NamedValuesNamespace LBLUE := 23 ); END_TYPE - + + {S7.extern=ReadWrite} CLASS PUBLIC using_type_named_values VAR PUBLIC LColors : LightColors; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values_literals.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values_literals.st index 5f1bc9da..c6b40457 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values_literals.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_named_values_literals.st @@ -9,6 +9,7 @@ NAMESPACE Simatic.Ax.StateFramework ) := STATUS_NO_ERR; END_TYPE + {S7.extern=ReadWrite} CLASS PUBLIC using_type_named_values VAR PUBLIC LColors : StateControllerStatus; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_with_enum.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_with_enum.st index 1cf1ef4c..41c03a52 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_with_enum.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/type_with_enum.st @@ -24,6 +24,7 @@ NAMESPACE Simatic.Ax.StateFramework Condition : (GT, EQ, LT, NE, GE, LE); END_TYPE + {S7.extern=ReadWrite} CLASS CompareGuardLint IMPLEMENTS IGuard VAR PUBLIC Value : REF_TO LINT; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_name_attributes.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_name_attributes.st index 11843d34..a86c43a5 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_name_attributes.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_name_attributes.st @@ -1,9 +1,11 @@ NAMESPACE TypeWithNameAttributes TYPE {#ix-attr:[Container(Layout.Wrap)]} + {S7.extern=ReadWrite} Motor : STRUCT isRunning : BOOL; END_STRUCT; + {S7.extern=ReadWrite} Vehicle : STRUCT m : Motor; displacement : INT; @@ -11,6 +13,7 @@ NAMESPACE TypeWithNameAttributes END_TYPE {#ix-prop:public string AttributeName} + {S7.extern=ReadWrite} CLASS NoAccessModifierClass VAR PUBLIC SomeClassVariable : STRING; diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_property_attributes.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_property_attributes.st index 30ca6834..470c9b70 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_property_attributes.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/types_with_property_attributes.st @@ -1,6 +1,7 @@ NAMESPACE TypesWithPropertyAttributes {#ix-prop:public string Description} {#ix-set:Description = "Some added property name value"} + {S7.extern=ReadWrite} CLASS SomeAddedProperties VAR PUBLIC {#ix-set:AttributeName = "Pocitadlo"} diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/test/test.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/test/test.st index 82bb243b..d1a79018 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/test/test.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/test/test.st @@ -3,6 +3,7 @@ USING AxUnit; NAMESPACE MyTest {TestFixture} + {S7.extern=ReadWrite} CLASS MyTestFixture {Test} METHOD PUBLIC MyTestMethod diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/IxProjectTests.cs b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/IxProjectTests.cs index 5a5c8fdf..19f213a6 100644 --- a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/IxProjectTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/IxProjectTests.cs @@ -89,6 +89,7 @@ public MockBuilder(AXSharpProject project, Compilation compilation) public string OutputFileSuffix => ".py"; public string BuilderType => "Mock"; public Compilation Compilation { get; } + public eCommAccessibility TypeCommAccessibility { get; } = eCommAccessibility.ReadWrite; #region ICombineThreeVisitor /// diff --git a/src/AXSharp.compiler/tests/integration/actual/app/src/configuration.st b/src/AXSharp.compiler/tests/integration/actual/app/src/configuration.st index d007c620..5dee9d82 100644 --- a/src/AXSharp.compiler/tests/integration/actual/app/src/configuration.st +++ b/src/AXSharp.compiler/tests/integration/actual/app/src/configuration.st @@ -3,7 +3,9 @@ CONFIGURATION MyConfiguration PROGRAM P1 WITH Main: MyProgram; VAR_GLOBAL + {S7.extern=ReadWrite} lib1_MyClass : lib1.MyClass; + {S7.extern=ReadWrite} lib2_MyClass : lib2.MyClass; END_VAR END_CONFIGURATION diff --git a/src/AXSharp.compiler/tests/integration/actual/app/test/test.st b/src/AXSharp.compiler/tests/integration/actual/app/test/test.st index 82bb243b..d1a79018 100644 --- a/src/AXSharp.compiler/tests/integration/actual/app/test/test.st +++ b/src/AXSharp.compiler/tests/integration/actual/app/test/test.st @@ -3,6 +3,7 @@ USING AxUnit; NAMESPACE MyTest {TestFixture} + {S7.extern=ReadWrite} CLASS MyTestFixture {Test} METHOD PUBLIC MyTestMethod diff --git a/src/AXSharp.compiler/tests/integration/actual/lib1/src/library.st b/src/AXSharp.compiler/tests/integration/actual/lib1/src/library.st index 0a325855..aeac64f5 100644 --- a/src/AXSharp.compiler/tests/integration/actual/lib1/src/library.st +++ b/src/AXSharp.compiler/tests/integration/actual/lib1/src/library.st @@ -1,5 +1,5 @@ NAMESPACE lib1 - + {S7.extern=ReadWrite} CLASS PUBLIC MyClass VAR PUBLIC MyString : STRING; diff --git a/src/AXSharp.compiler/tests/integration/actual/lib1/test/test.st b/src/AXSharp.compiler/tests/integration/actual/lib1/test/test.st index b43340ec..96f33008 100644 --- a/src/AXSharp.compiler/tests/integration/actual/lib1/test/test.st +++ b/src/AXSharp.compiler/tests/integration/actual/lib1/test/test.st @@ -4,6 +4,7 @@ USING MyLibrary; NAMESPACE MyTest {TestFixture} + {S7.extern=ReadWrite} CLASS MyTestFixture VAR PROTECTED diff --git a/src/AXSharp.compiler/tests/integration/actual/lib2/src/library.st b/src/AXSharp.compiler/tests/integration/actual/lib2/src/library.st index d94c021e..afec9373 100644 --- a/src/AXSharp.compiler/tests/integration/actual/lib2/src/library.st +++ b/src/AXSharp.compiler/tests/integration/actual/lib2/src/library.st @@ -1,5 +1,6 @@ NAMESPACE lib2 + {S7.extern=ReadWrite} CLASS PUBLIC MyClass VAR PUBLIC MyString : STRING; diff --git a/src/AXSharp.compiler/tests/integration/actual/lib2/test/test.st b/src/AXSharp.compiler/tests/integration/actual/lib2/test/test.st index b43340ec..96f33008 100644 --- a/src/AXSharp.compiler/tests/integration/actual/lib2/test/test.st +++ b/src/AXSharp.compiler/tests/integration/actual/lib2/test/test.st @@ -4,6 +4,7 @@ USING MyLibrary; NAMESPACE MyTest {TestFixture} + {S7.extern=ReadWrite} CLASS MyTestFixture VAR PROTECTED diff --git a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json index 8da9f677..4ee8c260 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json +++ b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json @@ -242,32 +242,9 @@ "integrity": "sha512-2Pj/Encd6bUgsRfXyj3rA4YOUpRroqwzODKU37T95dMNle+BpFXYS3V88FYJyTdOgSrJik4VVdV1AFzH7NUQ8g==" }, "@ax/sld": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-0.15.9.tgz", - "integrity": "sha512-Moqh0zbGNcpD88Z3uax2iXL0exnjsgXQodaZXiIFy5CrQaJzM3X/EzEHKBXQ8q+Xr8hs/Q6fWTUkkbDezVBZ6Q==", - "dependencies": { - "@ax/sld-linux-x64": "0.15.9", - "@ax/sld-win-x64": "0.15.9" - } - }, - "@ax/sld-linux-x64": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld-linux-x64/-/sld-linux-x64-0.15.9.tgz", - "integrity": "sha512-jChM/HtZIP+nfMdkKYpkDkllg+tGkK9Y8qpVmCUjmliJ1nyO2mprVMRJKI9Q3m81mGdzpuD+vew4Vgx2e6xptw==", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ] - }, - "@ax/sld-win-x64": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld-win-x64/-/sld-win-x64-0.15.9.tgz", - "integrity": "sha512-NYPJWNaNAZAL3t33gRb6cI9n1rvogbyrbb/Y0agBnvjY+MBqNxviyizFyMsloql//vZwKKl674TPFx4FFWcYDg==", - "os": [ - "win32" - ], + "version": "2.0.5", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-2.0.5.tgz", + "integrity": "sha512-upa0HyRVdYyzNu6j7E+gTAnpzP2mfZxvo+0jbm8H6Ci9ergL56SHaCVBC35PnociMZpdZ5d1/LTy6f8lwpDxXA==", "cpu": [ "x64" ] diff --git a/src/AXSharp.connectors/tests/ax-test-project/apax.yml b/src/AXSharp.connectors/tests/ax-test-project/apax.yml index 1bef8b06..0a4668c7 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/apax.yml +++ b/src/AXSharp.connectors/tests/ax-test-project/apax.yml @@ -9,7 +9,7 @@ targets: devDependencies: "@ax/sdk": ^4.0.8 "@ax/stc": ^5.4.89 - "@ax/sld": ^0.15.9 + "@ax/sld": ^2.0.5 scripts: postbuild: dotnet run --project ..//..//..//AXSharp.compiler//src//ixc//AXSharp.ixc.csproj --framework diff --git a/src/AXSharp.connectors/tests/ax-test-project/go.ps1 b/src/AXSharp.connectors/tests/ax-test-project/go.ps1 index 3e93b0b0..59231866 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/go.ps1 +++ b/src/AXSharp.connectors/tests/ax-test-project/go.ps1 @@ -4,4 +4,5 @@ $targetIP $targetInput apax install apax build -apax sld --accept-security-disclaimer -t $targetIP -i $targetInput -r --default-server-interface \ No newline at end of file +#apax sld --accept-security-disclaimer -t $targetIP -i $targetInput -r --default-server-interface +apax sld load -t $targetIP -i $targetInput -r --accept-security-disclaimer \ No newline at end of file diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItem.st b/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItem.st index d9d9f092..fc5c3a4e 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItem.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItem.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS complexArrayItem VAR PUBLIC itemBOOL : BOOL ; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItemNested.st b/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItemNested.st index ab917e2a..a5953186 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItemNested.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/complexArrayItemNested.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS complexArrayItemNested VAR PUBLIC nesteditemBOOL : BOOL ; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st b/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st index 066fc1c7..505cecef 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/configuration.st @@ -9,53 +9,83 @@ CONFIGURATION MyConfiguration //myArrayString: ARRAY[0..10] OF STRING; // myArrayComplex: ARRAY[0..10] OF complexArrayItem; - + {S7.extern=ReadWrite} mins : full_of_primitives; + {S7.extern=ReadWrite} maxs : full_of_primitives; + {S7.extern=ReadWrite} minsmatch : full_of_primitives_match; + {S7.extern=ReadWrite} maxsmatch : full_of_primitives_match; - + {S7.extern=ReadWrite} myBOOL : BOOL := TRUE ; + {S7.extern=ReadWrite} myBYTE : BYTE ; + {S7.extern=ReadWrite} myWORD : WORD ; + {S7.extern=ReadWrite} myDWORD : DWORD ; + {S7.extern=ReadWrite} myLWORD : LWORD ; + {S7.extern=ReadWrite} mySINT : SINT ; + {S7.extern=ReadWrite} myINT : INT ; + {S7.extern=ReadWrite} myDINT : DINT ; + {S7.extern=ReadWrite} myLINT : LINT ; + {S7.extern=ReadWrite} myUSINT : USINT ; + {S7.extern=ReadWrite} myUINT : UINT ; + {S7.extern=ReadWrite} myUDINT : UDINT ; + {S7.extern=ReadWrite} myULINT : ULINT ; + {S7.extern=ReadWrite} myREAL : REAL ; + {S7.extern=ReadWrite} myLREAL : LREAL ; + {S7.extern=ReadWrite} myTIME : TIME ; + {S7.extern=ReadWrite} myLTIME : LTIME ; + {S7.extern=ReadWrite} myDATE : DATE ; + {S7.extern=ReadWrite} myLDATE : LDATE ; + {S7.extern=ReadWrite} myTIME_OF_DAY : TIME_OF_DAY ; + {S7.extern=ReadWrite} myLTIME_OF_DAY : LTIME_OF_DAY ; + {S7.extern=ReadWrite} myDATE_AND_TIME : DATE_AND_TIME ; + {S7.extern=ReadWrite} myLDATE_AND_TIME : LDATE_AND_TIME; + {S7.extern=ReadWrite} myCHAR : CHAR ; + {S7.extern=ReadWrite} myWCHAR : WCHAR ; + {S7.extern=ReadWrite} mySTRING : STRING ; + {S7.extern=ReadWrite} myWSTRING : WSTRING ; - + {S7.extern=ReadWrite} myColors : Colors; + {S7.extern=ReadWrite} Hierarchy : hierarchy; // Issues //GH_PKTu_ix_56_Base: GH.PKTu.ix_56.Base; // GH_PKTu_ix_56_FirstInheritance : GH.PKTu.ix_56.FirstInheritance; - + {S7.extern=ReadWrite} GH_PKTu_ix_56_SecondInheritance : GH.PKTu.ix_56.SecondInheritance; END_VAR END_CONFIGURATION diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives.st b/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives.st index b2411872..ba0569c0 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS full_of_primitives VAR PUBLIC myBOOL : BOOL ; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives_match.st b/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives_match.st index b0b1112d..deca9061 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives_match.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/full_of_primitives_match.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS full_of_primitives_match VAR PUBLIC diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy.st b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy.st index fbe5c107..142b49a3 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS hierarchy VAR PUBLIC item : hierarchy_2; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_0.st b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_0.st index b7133cca..5bb22f06 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_0.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_0.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS hierarchy_0 VAR PUBLIC item_member_property_1 : full_of_primitives; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_2.st b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_2.st index 9f63cee2..ffce90b7 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_2.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_2.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS hierarchy_2 VAR PUBLIC item_member_property_1 : hierarchy_0; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_4.st b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_4.st index 27008385..6fabd869 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_4.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_4.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS hierarchy_4 VAR PUBLIC item_member_property_1 : hierarchy_2; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_6.st b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_6.st index 1da2f56e..a431fc77 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_6.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/hierarchy_6.st @@ -1,3 +1,4 @@ +{S7.extern=ReadWrite} CLASS hierarchy_6 VAR PUBLIC item_member_property_1 : hierarchy_4; diff --git a/src/AXSharp.connectors/tests/ax-test-project/src/issues/GH-PKTu-ix_56.st b/src/AXSharp.connectors/tests/ax-test-project/src/issues/GH-PKTu-ix_56.st index e566a4f8..92d6eb55 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/src/issues/GH-PKTu-ix_56.st +++ b/src/AXSharp.connectors/tests/ax-test-project/src/issues/GH-PKTu-ix_56.st @@ -1,13 +1,13 @@ // https://github.com/ix-ax/axsharp/issues/56 NAMESPACE GH.PKTu.ix_56 - + {S7.extern=ReadWrite} CLASS ComplexMember VAR PUBLIC Counter : INT; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS Base VAR PUBLIC baseMember : STRING; @@ -15,7 +15,7 @@ NAMESPACE GH.PKTu.ix_56 BaseDavid : DavidBase; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS FirstInheritance EXTENDS Base VAR PUBLIC FirstInheritanceMember : STRING; @@ -23,7 +23,7 @@ NAMESPACE GH.PKTu.ix_56 FirstDavid : DavidBase; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS SecondInheritance EXTENDS FirstInheritance VAR PUBLIC SecondInheritanceMember : STRING; @@ -31,13 +31,13 @@ NAMESPACE GH.PKTu.ix_56 SecodnDavid : DavidBase; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS PedroBase VAR PUBLIC p : STRING; END_VAR END_CLASS - + {S7.extern=ReadWrite} CLASS DavidBase EXTENDS PedroBase VAR PUBLIC d : STRING; diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AXTool/Properties/launchSettings.json b/src/AXSharp.tools/src/AXSharp.TIA2AXTool/Properties/launchSettings.json index e105d394..73c31f8b 100644 --- a/src/AXSharp.tools/src/AXSharp.TIA2AXTool/Properties/launchSettings.json +++ b/src/AXSharp.tools/src/AXSharp.TIA2AXTool/Properties/launchSettings.json @@ -19,6 +19,10 @@ "luki": { "commandName": "Project", "commandLineArgs": "-i 10.10.10.150 -o c:\\_TiaDataAx\\test.json -d DB_DataToTestAX" + }, + "axwebapitests": { + "commandName": "Project", + "commandLineArgs": "-i 192.168.0.10 -o c:\\W\\trash\\test.json -d TGlobalVariablesDB" } } } diff --git a/src/tests.integrations/integrated/src/ax/apax-lock.json b/src/tests.integrations/integrated/src/ax/apax-lock.json index 8da9f677..4ee8c260 100644 --- a/src/tests.integrations/integrated/src/ax/apax-lock.json +++ b/src/tests.integrations/integrated/src/ax/apax-lock.json @@ -242,32 +242,9 @@ "integrity": "sha512-2Pj/Encd6bUgsRfXyj3rA4YOUpRroqwzODKU37T95dMNle+BpFXYS3V88FYJyTdOgSrJik4VVdV1AFzH7NUQ8g==" }, "@ax/sld": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-0.15.9.tgz", - "integrity": "sha512-Moqh0zbGNcpD88Z3uax2iXL0exnjsgXQodaZXiIFy5CrQaJzM3X/EzEHKBXQ8q+Xr8hs/Q6fWTUkkbDezVBZ6Q==", - "dependencies": { - "@ax/sld-linux-x64": "0.15.9", - "@ax/sld-win-x64": "0.15.9" - } - }, - "@ax/sld-linux-x64": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld-linux-x64/-/sld-linux-x64-0.15.9.tgz", - "integrity": "sha512-jChM/HtZIP+nfMdkKYpkDkllg+tGkK9Y8qpVmCUjmliJ1nyO2mprVMRJKI9Q3m81mGdzpuD+vew4Vgx2e6xptw==", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ] - }, - "@ax/sld-win-x64": { - "version": "0.15.9", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld-win-x64/-/sld-win-x64-0.15.9.tgz", - "integrity": "sha512-NYPJWNaNAZAL3t33gRb6cI9n1rvogbyrbb/Y0agBnvjY+MBqNxviyizFyMsloql//vZwKKl674TPFx4FFWcYDg==", - "os": [ - "win32" - ], + "version": "2.0.5", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-2.0.5.tgz", + "integrity": "sha512-upa0HyRVdYyzNu6j7E+gTAnpzP2mfZxvo+0jbm8H6Ci9ergL56SHaCVBC35PnociMZpdZ5d1/LTy6f8lwpDxXA==", "cpu": [ "x64" ] diff --git a/src/tests.integrations/integrated/src/ax/apax.yml b/src/tests.integrations/integrated/src/ax/apax.yml index e291eece..533e6118 100644 --- a/src/tests.integrations/integrated/src/ax/apax.yml +++ b/src/tests.integrations/integrated/src/ax/apax.yml @@ -8,7 +8,7 @@ targets: - swcpu devDependencies: "@ax/sdk": ^4.0.8 - "@ax/sld": ^0.15.9 + "@ax/sld": ^2.0.5 "@ax/stc": ^5.4.89 variables: @@ -24,5 +24,4 @@ scripts: - apax build # Here you will need to set the argumen -t to your plc OP and -i to platfrom you are dowloading to # --default-server-interface is a must if you are using WebAPI - - apax sld --accept-security-disclaimer -t $AXTARGET -i - $AXTARGETPLATFORMINPUT -r --default-server-interface + - apax sld load --accept-security-disclaimer -t $AXTARGET -i $AXTARGETPLATFORMINPUT -r diff --git a/src/tests.integrations/integrated/src/ax/src/configuration.st b/src/tests.integrations/integrated/src/ax/src/configuration.st index d3a4f288..2ca6497b 100644 --- a/src/tests.integrations/integrated/src/ax/src/configuration.st +++ b/src/tests.integrations/integrated/src/ax/src/configuration.st @@ -3,50 +3,83 @@ CONFIGURATION MyConfiguration TASK Main(Interval := T#10ms, Priority := 1); PROGRAM P1 WITH Main: MyProgram; - VAR_GLOBAL + VAR_GLOBAL + {S7.extern=ReadWrite} Monster : MonsterData.Monster; + {S7.extern=ReadWrite} OnlineToPlain_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} PlainToOnline_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} OnlineToShadowAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ShadowToOnlineAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectOnlineToPlain_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectPlainToOnline_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectOnlineToShadowAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectShadowToOnlineAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ShadowToPlainAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} PlainToShadowAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectShadowToPlainAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} ITwinObjectPlainToShadowAsync_should_copy_entire_structure : MonsterData.Monster; + {S7.extern=ReadWrite} Pokus : Pokus; + {S7.extern=ReadWrite} RealMonster : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} OnlineToShadow_should_copy : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} ShadowToOnline_should_copy : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} OnlineToPlain_should_copy: RealMonsterData.RealMonster; + {S7.extern=ReadWrite} PlainToOnline_should_copy: RealMonsterData.RealMonster; + + {S7.extern=ReadWrite} ITwinObjectOnlineToShadow_should_copy : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} ITwinObjectShadowToOnline_should_copy : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} ITwinObjectOnlineToPlain_should_copy: RealMonsterData.RealMonster; + {S7.extern=ReadWrite} ITwinObjectPlainToOnline_should_copy: RealMonsterData.RealMonster; + {S7.extern=ReadWrite} p_online_shadow: all_primitives; + {S7.extern=ReadWrite} p_shadow_online: all_primitives; + {S7.extern=ReadWrite} p_online_plain: all_primitives; + {S7.extern=ReadWrite} p_plain_online: all_primitives; + {S7.extern=ReadWrite} p_shadow_plain: all_primitives; + {S7.extern=ReadWrite} p_plain_shadow: all_primitives; + {S7.extern=ReadWrite} StartPolling_should_update_cyclic_property : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} StartPolling_ConcurentOverload : RealMonsterData.RealMonster; + {S7.extern=ReadWrite} GH_ISSUE_183 : GH_ISSUE_183.GH_ISSUE_183_1; END_VAR END_CONFIGURATION diff --git a/src/tests.integrations/integrated/src/ax/src/dataswapping/all_primitives.st b/src/tests.integrations/integrated/src/ax/src/dataswapping/all_primitives.st index 2f377a85..97e5f27b 100644 --- a/src/tests.integrations/integrated/src/ax/src/dataswapping/all_primitives.st +++ b/src/tests.integrations/integrated/src/ax/src/dataswapping/all_primitives.st @@ -1,3 +1,5 @@ + +{S7.extern=ReadWrite} CLASS all_primitives VAR PUBLIC myBOOL : BOOL ; diff --git a/src/tests.integrations/integrated/src/ax/src/dataswapping/moster.st b/src/tests.integrations/integrated/src/ax/src/dataswapping/moster.st index 3e7cea26..6ebafaab 100644 --- a/src/tests.integrations/integrated/src/ax/src/dataswapping/moster.st +++ b/src/tests.integrations/integrated/src/ax/src/dataswapping/moster.st @@ -1,4 +1,5 @@ NAMESPACE MonsterData + {S7.extern=ReadWrite} CLASS MonsterBase VAR PUBLIC Description : STRING; @@ -13,12 +14,14 @@ NAMESPACE MonsterData Description_tobeignoredbypocooperations : STRING; END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS Monster EXTENDS MonsterBase VAR PUBLIC DriveA : DriveBase; END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS DriveBase VAR PUBLIC Position : LREAL; diff --git a/src/tests.integrations/integrated/src/ax/src/dataswapping/realmonster.st b/src/tests.integrations/integrated/src/ax/src/dataswapping/realmonster.st index 39853034..fdc2a97d 100644 --- a/src/tests.integrations/integrated/src/ax/src/dataswapping/realmonster.st +++ b/src/tests.integrations/integrated/src/ax/src/dataswapping/realmonster.st @@ -1,4 +1,5 @@ NAMESPACE RealMonsterData + {S7.extern=ReadWrite} CLASS RealMonsterBase VAR PUBLIC Description : STRING; @@ -11,12 +12,14 @@ NAMESPACE RealMonsterData END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS RealMonster EXTENDS RealMonsterBase VAR PUBLIC DriveA : DriveBaseNested; END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS DriveBaseNested VAR PUBLIC Position : LREAL; @@ -27,6 +30,7 @@ NAMESPACE RealMonsterData END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS NestedLevelOne VAR PUBLIC Position : LREAL; @@ -37,6 +41,7 @@ NAMESPACE RealMonsterData END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS NestedLevelTwo VAR PUBLIC Position : LREAL; @@ -47,6 +52,7 @@ NAMESPACE RealMonsterData END_VAR END_CLASS + {S7.extern=ReadWrite} CLASS NestedLevelThree VAR PUBLIC Position : LREAL; diff --git a/src/tests.integrations/integrated/src/ax/src/issues/GH_ISSUE_183.st b/src/tests.integrations/integrated/src/ax/src/issues/GH_ISSUE_183.st index 3a41ab77..93e3de86 100644 --- a/src/tests.integrations/integrated/src/ax/src/issues/GH_ISSUE_183.st +++ b/src/tests.integrations/integrated/src/ax/src/issues/GH_ISSUE_183.st @@ -1,4 +1,5 @@ NAMESPACE GH_ISSUE_183 + {S7.extern=ReadWrite} CLASS GH_ISSUE_183_1 VAR PUBLIC NonZeroBasedArray : ARRAY[10..30] OF BYTE; diff --git a/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs b/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs index c2b62ecb..7f738fa1 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/.g/Onliners/configuration.g.cs @@ -150,8 +150,6 @@ public integratedTwinController(AXSharp.Connector.ConnectorAdapter adapter) public partial class Pokus : AXSharp.Connector.ITwinObject { - public Nested Nested { get; } - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); public Pokus(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) @@ -162,7 +160,6 @@ public Pokus(AXSharp.Connector.ITwinObject parent, string readableTail, string s this.@Parent = parent; HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); - Nested = new Nested(this, "Nested", "Nested"); parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -177,9 +174,6 @@ public async virtual Task OnlineToPlain() { Pocos.Pokus plain = new Pocos.Pokus(); await this.ReadAsync(); -#pragma warning disable CS0612 - plain.Nested = await Nested._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 return plain; } @@ -188,9 +182,6 @@ public async virtual Task OnlineToPlain() public async Task _OnlineToPlainNoacAsync() { Pocos.Pokus plain = new Pocos.Pokus(); -#pragma warning disable CS0612 - plain.Nested = await Nested._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 return plain; } @@ -198,9 +189,6 @@ public async virtual Task OnlineToPlain() [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] protected async Task _OnlineToPlainNoacAsync(Pocos.Pokus plain) { -#pragma warning disable CS0612 - plain.Nested = await Nested._OnlineToPlainNoacAsync(); -#pragma warning restore CS0612 return plain; } @@ -211,9 +199,6 @@ public async virtual Task PlainToOnline(T plain) public async Task> PlainToOnlineAsync(Pocos.Pokus plain) { -#pragma warning disable CS0612 - await this.Nested._PlainToOnlineNoacAsync(plain.Nested); -#pragma warning restore CS0612 return await this.WriteAsync(); } @@ -221,9 +206,6 @@ public async Task> PlainToOnlineAsync(Pocos.Pokus pl [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public async Task _PlainToOnlineNoacAsync(Pocos.Pokus plain) { -#pragma warning disable CS0612 - await this.Nested._PlainToOnlineNoacAsync(plain.Nested); -#pragma warning restore CS0612 } public async virtual Task ShadowToPlain() @@ -234,13 +216,11 @@ public async virtual Task ShadowToPlain() public async Task ShadowToPlainAsync() { Pocos.Pokus plain = new Pocos.Pokus(); - plain.Nested = await Nested.ShadowToPlainAsync(); return plain; } protected async Task ShadowToPlainAsync(Pocos.Pokus plain) { - plain.Nested = await Nested.ShadowToPlainAsync(); return plain; } @@ -251,7 +231,6 @@ public async virtual Task PlainToShadow(T plain) public async Task> PlainToShadowAsync(Pocos.Pokus plain) { - await this.Nested.PlainToShadowAsync(plain.Nested); return this.RetrievePrimitives(); } @@ -342,12 +321,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture) public partial class Nested : AXSharp.Connector.ITwinObject { - public OnlinerString SomeString { get; } - - public OnlinerInt SomeInt { get; } - - public OnlinerByte SomeByte { get; } - partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); public Nested(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) @@ -358,9 +331,6 @@ public Nested(AXSharp.Connector.ITwinObject parent, string readableTail, string this.@Parent = parent; HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); - SomeString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeString", "SomeString"); - SomeInt = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "SomeInt", "SomeInt"); - SomeByte = @Connector.ConnectorAdapter.AdapterFactory.CreateBYTE(this, "SomeByte", "SomeByte"); parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -375,9 +345,6 @@ public async virtual Task OnlineToPlain() { Pocos.Nested plain = new Pocos.Nested(); await this.ReadAsync(); - plain.SomeString = SomeString.LastValue; - plain.SomeInt = SomeInt.LastValue; - plain.SomeByte = SomeByte.LastValue; return plain; } @@ -386,9 +353,6 @@ public async virtual Task OnlineToPlain() public async Task _OnlineToPlainNoacAsync() { Pocos.Nested plain = new Pocos.Nested(); - plain.SomeString = SomeString.LastValue; - plain.SomeInt = SomeInt.LastValue; - plain.SomeByte = SomeByte.LastValue; return plain; } @@ -396,9 +360,6 @@ public async virtual Task OnlineToPlain() [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] protected async Task _OnlineToPlainNoacAsync(Pocos.Nested plain) { - plain.SomeString = SomeString.LastValue; - plain.SomeInt = SomeInt.LastValue; - plain.SomeByte = SomeByte.LastValue; return plain; } @@ -409,15 +370,6 @@ public async virtual Task PlainToOnline(T plain) public async Task> PlainToOnlineAsync(Pocos.Nested plain) { -#pragma warning disable CS0612 - SomeString.LethargicWrite(plain.SomeString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - SomeInt.LethargicWrite(plain.SomeInt); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - SomeByte.LethargicWrite(plain.SomeByte); -#pragma warning restore CS0612 return await this.WriteAsync(); } @@ -425,15 +377,6 @@ public async Task> PlainToOnlineAsync(Pocos.Nested p [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public async Task _PlainToOnlineNoacAsync(Pocos.Nested plain) { -#pragma warning disable CS0612 - SomeString.LethargicWrite(plain.SomeString); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - SomeInt.LethargicWrite(plain.SomeInt); -#pragma warning restore CS0612 -#pragma warning disable CS0612 - SomeByte.LethargicWrite(plain.SomeByte); -#pragma warning restore CS0612 } public async virtual Task ShadowToPlain() @@ -444,17 +387,11 @@ public async virtual Task ShadowToPlain() public async Task ShadowToPlainAsync() { Pocos.Nested plain = new Pocos.Nested(); - plain.SomeString = SomeString.Shadow; - plain.SomeInt = SomeInt.Shadow; - plain.SomeByte = SomeByte.Shadow; return plain; } protected async Task ShadowToPlainAsync(Pocos.Nested plain) { - plain.SomeString = SomeString.Shadow; - plain.SomeInt = SomeInt.Shadow; - plain.SomeByte = SomeByte.Shadow; return plain; } @@ -465,9 +402,6 @@ public async virtual Task PlainToShadow(T plain) public async Task> PlainToShadowAsync(Pocos.Nested plain) { - SomeString.Shadow = plain.SomeString; - SomeInt.Shadow = plain.SomeInt; - SomeByte.Shadow = plain.SomeByte; return this.RetrievePrimitives(); } diff --git a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs index 0f3c6bb6..12b25fe7 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs @@ -42,14 +42,9 @@ public partial class integratedTwinController public partial class Pokus : AXSharp.Connector.IPlain { - public Nested Nested { get; set; } = new Nested(); } public partial class Nested : AXSharp.Connector.IPlain { - public string SomeString { get; set; } = string.Empty; - public Int16 SomeInt { get; set; } - - public Byte SomeByte { get; set; } } } \ No newline at end of file