From 9398dd6ab954341c92bfa82745642ab9e6e34b5d Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:26:05 +0100 Subject: [PATCH 1/3] Create draft PR for #364 From 9353cbdbfe278ef47b8bee6afe75838148cba789 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:42:58 +0100 Subject: [PATCH 2/3] Add Capacity property to OnlinerString and OnlinerWString Added a new integer property `Capacity` to both `OnlinerString` and `OnlinerWString` classes to represent the declared size of the strings. Updated the `AddMemberInitialization` method in the `CsOnlinerConstructorBuilder` class to set the `Capacity` property after initializing the field using `ConnectorAdapter.AdapterFactory.Create`. --- .../Onliner/CsOnlinerConstructorBuilder.cs | 2 ++ .../AXSharp.Connector/ValueTypes/Onlines/OnlinerString.cs | 6 ++++++ .../AXSharp.Connector/ValueTypes/Onlines/OnlinerWString.cs | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs index eaba5a7e..a6a6b643 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerConstructorBuilder.cs @@ -360,6 +360,8 @@ private void AddMemberInitialization(IStringTypeDeclaration type, IStorageDeclar AddToSource($"{field.Name}"); AddToSource($"= @Connector.ConnectorAdapter.AdapterFactory.Create{IecToAdapterExtensions.ToAdapterType(type)}"); AddToSource($"(this, \"{field.GetAttributeNameValue(field.Name)}\", \"{field.Name}\");"); + AddToSource($"{field.Name}.Capacity = {type.Capacity};"); + } // We get warning here about unused method, it is false positive, but we will need to investigate further the object hierarchy. diff --git a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerString.cs b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerString.cs index 09e33eb3..7b34229f 100644 --- a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerString.cs +++ b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerString.cs @@ -93,4 +93,10 @@ public override async Task SetAsync(string value) return value; }); } + + /// + /// Gets or sets the capacity of the . + /// Or, the declared size of the string. + /// + public int Capacity { get; set; } } \ No newline at end of file diff --git a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerWString.cs b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerWString.cs index 95099f51..eab69342 100644 --- a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerWString.cs +++ b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerWString.cs @@ -113,4 +113,10 @@ public override async Task SetAsync(string value) return value; }); } + + /// + /// Gets or sets the capacity of the . + /// Or, the declared size of the string. + /// + public int Capacity { get; set; } } \ No newline at end of file From 44b494f57db4cd40993ed6195d2ed1c890a0ac83 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:12:26 +0100 Subject: [PATCH 3/3] Add new string properties and set capacities to appropriate value - Modified `WebApiString.cs` and `WebApiWString.cs` to truncate string values given the capacity declareted in the target controller. - Set capacity of various string members to appropriate values across multiple classes. --- .../ax/.g/Onliners/class_all_primitives.g.cs | 36 +++++++++++++++++++ .../class_extended_by_known_type.g.cs | 1 + .../class_with_primitive_members.g.cs | 2 ++ .../.g/Onliners/compileromitsattribute.g.cs | 3 ++ .../ax/.g/Onliners/configuration.g.cs | 2 ++ .../expected/ax/.g/Onliners/makereadonce.g.cs | 4 +++ .../expected/ax/.g/Onliners/makereadonly.g.cs | 4 +++ .../units/expected/ax/.g/Onliners/misc.g.cs | 2 ++ .../Onliners/types_with_name_attributes.g.cs | 1 + .../ax/.g/POCO/class_all_primitives.g.cs | 2 ++ .../samples/units/expected/ax/units.csproj | 21 +++++++++++ .../tia/.g/Onliners/class_all_primitives.g.cs | 36 +++++++++++++++++++ .../class_extended_by_known_type.g.cs | 1 + .../class_with_primitive_members.g.cs | 2 ++ .../.g/Onliners/compileromitsattribute.g.cs | 3 ++ .../tia/.g/Onliners/configuration.g.cs | 2 ++ .../tia/.g/Onliners/makereadonce.g.cs | 4 +++ .../tia/.g/Onliners/makereadonly.g.cs | 4 +++ .../units/expected/tia/.g/Onliners/misc.g.cs | 2 ++ .../Onliners/types_with_name_attributes.g.cs | 1 + .../tia/.g/POCO/class_all_primitives.g.cs | 2 ++ .../samples/units/expected/tia/units.csproj | 21 +++++++++++ .../samples/units/src/class_all_primitives.st | 2 ++ .../BuiltInWrappers/WebApiString.cs | 4 +-- .../BuiltInWrappers/WebApiWString.cs | 4 +-- 25 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs index a6bd7f84..a15f7ce5 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_all_primitives.g.cs @@ -29,6 +29,8 @@ public partial class class_all_primitives : AXSharp.Connector.ITwinObject public OnlinerDateTime myDATE_AND_TIME { get; } public OnlinerString mySTRING { get; } public OnlinerWString myWSTRING { get; } + public OnlinerString mySTRING_25 { get; } + public OnlinerWString myWSTRING_55 { get; } partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); @@ -61,7 +63,13 @@ public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readabl myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; + mySTRING_25 = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING_25", "mySTRING_25"); + mySTRING_25.Capacity = 25; + myWSTRING_55 = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING_55", "myWSTRING_55"); + myWSTRING_55.Capacity = 55; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -98,6 +106,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -128,6 +138,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -157,6 +169,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -232,6 +246,12 @@ public async Task> PlainToOnlineAsync(global::Pocos. #pragma warning restore CS0612 #pragma warning disable CS0612 myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING_25.LethargicWrite(plain.mySTRING_25); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING_55.LethargicWrite(plain.myWSTRING_55); #pragma warning restore CS0612 return await this.WriteAsync(); } @@ -305,6 +325,12 @@ public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives pla #pragma warning restore CS0612 #pragma warning disable CS0612 myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING_25.LethargicWrite(plain.mySTRING_25); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING_55.LethargicWrite(plain.myWSTRING_55); #pragma warning restore CS0612 } @@ -338,6 +364,8 @@ public async virtual Task ShadowToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; plain.mySTRING = mySTRING.Shadow; plain.myWSTRING = myWSTRING.Shadow; + plain.mySTRING_25 = mySTRING_25.Shadow; + plain.myWSTRING_55 = myWSTRING_55.Shadow; return plain; } @@ -365,6 +393,8 @@ public async virtual Task ShadowToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; plain.mySTRING = mySTRING.Shadow; plain.myWSTRING = myWSTRING.Shadow; + plain.mySTRING_25 = mySTRING_25.Shadow; + plain.myWSTRING_55 = myWSTRING_55.Shadow; return plain; } @@ -397,6 +427,8 @@ public async Task> PlainToShadowAsync(global::Pocos. myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; mySTRING.Shadow = plain.mySTRING; myWSTRING.Shadow = plain.myWSTRING; + mySTRING_25.Shadow = plain.mySTRING_25; + myWSTRING_55.Shadow = plain.myWSTRING_55; return this.RetrievePrimitives(); } @@ -461,6 +493,10 @@ public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives somethingChanged = true; if (plain.myWSTRING != myWSTRING.LastValue) somethingChanged = true; + if (plain.mySTRING_25 != mySTRING_25.LastValue) + somethingChanged = true; + if (plain.myWSTRING_55 != myWSTRING_55.LastValue) + somethingChanged = true; plain = latest; return somethingChanged; }); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs index d6a63b53..03105924 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_extended_by_known_type.g.cs @@ -156,6 +156,7 @@ public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, PreConstruct(parent, readableTail, symbolTail); StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); + StateName.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs index ddbb9d53..7e6eafad 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_primitive_members.g.cs @@ -73,7 +73,9 @@ public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string read myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs index da7c3a82..4e73de5e 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/compileromitsattribute.g.cs @@ -245,6 +245,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); @@ -960,6 +961,7 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -1864,6 +1866,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs index 49aedcf2..d9d1b18a 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/configuration.g.cs @@ -72,7 +72,9 @@ public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTai myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; myMotor = new Motor(this, "myMotor", "myMotor"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs index 893901e6..8b82476b 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonce.g.cs @@ -28,8 +28,10 @@ public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string read HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.Capacity = 254; makeReadOnceMember.MakeReadOnce(); someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); makeReadComplexMember.MakeReadOnce(); someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); @@ -299,7 +301,9 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someMember.Capacity = 254; someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs index 13438aa7..6b5e3d76 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/makereadonly.g.cs @@ -28,8 +28,10 @@ public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string read HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.Capacity = 254; makeReadOnceMember.MakeReadOnly(); someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); makeReadComplexMember.MakeReadOnly(); someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); @@ -299,7 +301,9 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someMember.Capacity = 254; someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs index bec932e8..e190b101 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/misc.g.cs @@ -508,6 +508,7 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -1412,6 +1413,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs index 7fbaae04..c7144d01 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/types_with_name_attributes.g.cs @@ -471,6 +471,7 @@ public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readab HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs index b8b47eef..ef395085 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_all_primitives.g.cs @@ -32,5 +32,7 @@ public class_all_primitives() public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1); public string mySTRING { get; set; } = string.Empty; public string myWSTRING { get; set; } = string.Empty; + public string mySTRING_25 { get; set; } = string.Empty; + public string myWSTRING_55 { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj new file mode 100644 index 00000000..8a383de2 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/units.csproj @@ -0,0 +1,21 @@ + + + net9.0;net8.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs index a6bd7f84..a15f7ce5 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_all_primitives.g.cs @@ -29,6 +29,8 @@ public partial class class_all_primitives : AXSharp.Connector.ITwinObject public OnlinerDateTime myDATE_AND_TIME { get; } public OnlinerString mySTRING { get; } public OnlinerWString myWSTRING { get; } + public OnlinerString mySTRING_25 { get; } + public OnlinerWString myWSTRING_55 { get; } partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); @@ -61,7 +63,13 @@ public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readabl myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY"); myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; + mySTRING_25 = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING_25", "mySTRING_25"); + mySTRING_25.Capacity = 25; + myWSTRING_55 = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING_55", "myWSTRING_55"); + myWSTRING_55.Capacity = 55; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -98,6 +106,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -128,6 +138,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -157,6 +169,8 @@ public async virtual Task OnlineToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue; plain.mySTRING = mySTRING.LastValue; plain.myWSTRING = myWSTRING.LastValue; + plain.mySTRING_25 = mySTRING_25.LastValue; + plain.myWSTRING_55 = myWSTRING_55.LastValue; return plain; } @@ -232,6 +246,12 @@ public async Task> PlainToOnlineAsync(global::Pocos. #pragma warning restore CS0612 #pragma warning disable CS0612 myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING_25.LethargicWrite(plain.mySTRING_25); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING_55.LethargicWrite(plain.myWSTRING_55); #pragma warning restore CS0612 return await this.WriteAsync(); } @@ -305,6 +325,12 @@ public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives pla #pragma warning restore CS0612 #pragma warning disable CS0612 myWSTRING.LethargicWrite(plain.myWSTRING); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + mySTRING_25.LethargicWrite(plain.mySTRING_25); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + myWSTRING_55.LethargicWrite(plain.myWSTRING_55); #pragma warning restore CS0612 } @@ -338,6 +364,8 @@ public async virtual Task ShadowToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; plain.mySTRING = mySTRING.Shadow; plain.myWSTRING = myWSTRING.Shadow; + plain.mySTRING_25 = mySTRING_25.Shadow; + plain.myWSTRING_55 = myWSTRING_55.Shadow; return plain; } @@ -365,6 +393,8 @@ public async virtual Task ShadowToPlain() plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow; plain.mySTRING = mySTRING.Shadow; plain.myWSTRING = myWSTRING.Shadow; + plain.mySTRING_25 = mySTRING_25.Shadow; + plain.myWSTRING_55 = myWSTRING_55.Shadow; return plain; } @@ -397,6 +427,8 @@ public async Task> PlainToShadowAsync(global::Pocos. myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME; mySTRING.Shadow = plain.mySTRING; myWSTRING.Shadow = plain.myWSTRING; + mySTRING_25.Shadow = plain.mySTRING_25; + myWSTRING_55.Shadow = plain.myWSTRING_55; return this.RetrievePrimitives(); } @@ -461,6 +493,10 @@ public async Task DetectsAnyChangeAsync(global::Pocos.class_all_primitives somethingChanged = true; if (plain.myWSTRING != myWSTRING.LastValue) somethingChanged = true; + if (plain.mySTRING_25 != mySTRING_25.LastValue) + somethingChanged = true; + if (plain.myWSTRING_55 != myWSTRING_55.LastValue) + somethingChanged = true; plain = latest; return somethingChanged; }); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs index d6a63b53..03105924 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_extended_by_known_type.g.cs @@ -156,6 +156,7 @@ public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail, PreConstruct(parent, readableTail, symbolTail); StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID"); StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName"); + StateName.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs index ddbb9d53..7e6eafad 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_primitive_members.g.cs @@ -73,7 +73,9 @@ public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string read myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs index da7c3a82..4e73de5e 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/compileromitsattribute.g.cs @@ -245,6 +245,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); @@ -960,6 +961,7 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -1864,6 +1866,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs index 49aedcf2..d9d1b18a 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/configuration.g.cs @@ -72,7 +72,9 @@ public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTai myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR"); myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR"); mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING"); + mySTRING.Capacity = 254; myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING"); + myWSTRING.Capacity = 254; myMotor = new Motor(this, "myMotor", "myMotor"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs index 893901e6..8b82476b 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonce.g.cs @@ -28,8 +28,10 @@ public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string read HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.Capacity = 254; makeReadOnceMember.MakeReadOnce(); someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); makeReadComplexMember.MakeReadOnce(); someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); @@ -299,7 +301,9 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someMember.Capacity = 254; someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs index 13438aa7..6b5e3d76 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/makereadonly.g.cs @@ -28,8 +28,10 @@ public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string read HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember"); + makeReadOnceMember.Capacity = 254; makeReadOnceMember.MakeReadOnly(); someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember"); makeReadComplexMember.MakeReadOnly(); someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember"); @@ -299,7 +301,9 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail, HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember"); + someMember.Capacity = 254; someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember"); + someOtherMember.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs index bec932e8..e190b101 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/misc.g.cs @@ -508,6 +508,7 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); @@ -1412,6 +1413,7 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString"); + HelloString.Capacity = 254; Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id"); parent.AddChild(this); parent.AddKid(this); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs index 7fbaae04..c7144d01 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/types_with_name_attributes.g.cs @@ -471,6 +471,7 @@ public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readab HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); PreConstruct(parent, readableTail, symbolTail); SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable"); + SomeClassVariable.Capacity = 254; parent.AddChild(this); parent.AddKid(this); PostConstruct(parent, readableTail, symbolTail); diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs index 422a2a2d..6fe0f8ba 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_all_primitives.g.cs @@ -32,5 +32,7 @@ public class_all_primitives() public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1990, 1, 1); public string mySTRING { get; set; } = string.Empty; public string myWSTRING { get; set; } = string.Empty; + public string mySTRING_25 { get; set; } = string.Empty; + public string myWSTRING_55 { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj new file mode 100644 index 00000000..8a383de2 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/units.csproj @@ -0,0 +1,21 @@ + + + net9.0;net8.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file 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 d80e1a9e..66a9c4ba 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 @@ -28,5 +28,7 @@ CLASS class_all_primitives // myWCHAR : WCHAR ; mySTRING : STRING ; myWSTRING : WSTRING ; + mySTRING_25 : STRING[25] ; + myWSTRING_55 : WSTRING[55] ; END_VAR END_CLASS \ No newline at end of file diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiString.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiString.cs index 87c748de..bcd7c5c4 100644 --- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiString.cs +++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiString.cs @@ -40,7 +40,7 @@ public WebApiString(ITwinObject parent, ApiPlcReadRequest IWebApiPrimitive.PeekPlcReadRequestData => _plcReadRequestData ?? WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName); /// - ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite, _webApiConnector.DBName); + ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite.Substring(0, this.Capacity - 1), _webApiConnector.DBName); /// ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData @@ -78,6 +78,6 @@ public override async Task GetAsync() /// public override async Task SetAsync(string value) { - return await _webApiConnector.WriteAsync(this, value); + return await _webApiConnector.WriteAsync(this, value.Substring(0, this.Capacity - 1)); } } \ No newline at end of file diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiWString.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiWString.cs index df81f147..3bf5ee8a 100644 --- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiWString.cs +++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiWString.cs @@ -40,7 +40,7 @@ public WebApiWString(ITwinObject parent, ApiPlcReadRequest IWebApiPrimitive.PeekPlcReadRequestData => _plcReadRequestData ?? WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName); /// - ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite, _webApiConnector.DBName); + ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite.Substring(0, this.Capacity - 1), _webApiConnector.DBName); /// ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData @@ -79,6 +79,6 @@ public override async Task GetAsync() /// public override async Task SetAsync(string value) { - return await _webApiConnector.WriteAsync(this, value); + return await _webApiConnector.WriteAsync(this, value.Substring(0, this.Capacity - 1)); } } \ No newline at end of file