Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
29 changes: 29 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Default: treat as text, normalize to LF in the repository
* text=auto eol=lf

# Typical source files (explicit, but the default already covers these)
*.c text eol=lf
*.cpp text eol=lf
*.h text eol=lf
*.py text eol=lf
*.js text eol=lf
*.ts text eol=lf
*.sh text eol=lf
*.yaml text eol=lf
*.yml text eol=lf
*.json text eol=lf
*.css text eol=lf
*.cs text eol=lf


# Windows-native scripts that often *must* be CRLF in the working tree
# (repo still stores LF; checkout converts to CRLF)
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=lf

# Binary files (never touch line endings)
*.png -text
*.jpg -text
*.zip -text
*.pdf -text
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ internal static class CsFormatting
{
public static string FormatCode(this string code)
{
return CSharpSyntaxTree.ParseText(code).GetRoot().NormalizeWhitespace().SyntaxTree.GetText().ToString();
return CSharpSyntaxTree.ParseText(code).GetRoot().NormalizeWhitespace(eol:"\n").SyntaxTree.GetText().ToString();
}
}
4 changes: 4 additions & 0 deletions src/AXSharp.compiler/src/ixc/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
"axopen-traversal-in-tepmplates": {
"commandName": "Project",
"workingDirectory": "C:\\W\\Develop\\gh\\inxton\\simatic-ax\\axopen.templates\\axopen\\src\\traversals\\apax"
},
"ixc_data": {
"commandName": "Project",
"workingDirectory": "D:\\github\\Inxton\\axopen\\src\\data\\tests\\AXOpen.Data.Tests_L1\\ax"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AXSharp.Compiler.CsTests
// AXSharp.Compiler.CsTests
// Copyright (c) 2023 MTS spol. s r.o., and Contributors. All Rights Reserved.
// Contributors: https://github.com/inxton/axsharp/graphs/contributors
// See the LICENSE file in the repository root for more information.
Expand Down Expand Up @@ -352,4 +352,4 @@ public string GetMethodName()
var name = method.Name;
return name;
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"app.csproj"}
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"app.csproj"}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
<PackageReference Include="AXSharp.Connector" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
</ItemGroup>

<ItemGroup>
<Compile Include=".g\**" />
</ItemGroup>

<ItemGroup>
<Folder Include=".meta\" />
<Content Include=".meta\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\..\lib1\samples\units\ix\ax\lib1.csproj" />
<ProjectReference Include="..\..\..\..\..\lib2\samples\units\ix\ax\lib2.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
<PackageReference Include="AXSharp.Connector" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
</ItemGroup>

<ItemGroup>
<Compile Include=".g\**" />
</ItemGroup>

<ItemGroup>
<Folder Include=".meta\" />
<Content Include=".meta\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\..\lib1\samples\units\ix\tia\lib1.csproj" />
<ProjectReference Include="..\..\..\..\..\lib2\samples\units\ix\tia\lib2.csproj" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions src/AXSharp.compiler/tests/integration/expected/build.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
cd lib1
dotnet run --project ..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0
dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0
dotnet build ./ix/lib1.csproj
cd ..

cd lib2
dotnet run --project ..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0
dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0
dotnet build ./ix/lib2.csproj
cd ..

cd app
dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net7.0
dotnet run --project ..\..\..\..\src\ixc\AXSharp.ixc.csproj --framework net10.0
dotnet build ./ix/app.csproj
cd ..
cd ..

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"lib1.csproj"}
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"lib1.csproj"}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string
PostConstruct(parent, readableTail, symbolTail);
}

public async virtual Task<T> OnlineToPlain<T>()
public async virtual Task<T> OnlineToPlain<T>(eAccessPriority priority = eAccessPriority.Normal)
{
return await (dynamic)this.OnlineToPlainAsync();
return await (dynamic)this.OnlineToPlainAsync(priority);
}

public async Task<global::Pocos.lib1.MyClass> OnlineToPlainAsync()
public async Task<global::Pocos.lib1.MyClass> OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal)
{
global::Pocos.lib1.MyClass plain = new global::Pocos.lib1.MyClass();
await this.ReadAsync<IgnoreOnPocoOperation>();
await this.ReadAsync<IgnoreOnPocoOperation>(priority);
plain.MyString = MyString.LastValue;
plain.MyInt = MyInt.LastValue;
return plain;
Expand All @@ -62,20 +62,20 @@ public async virtual Task<T> OnlineToPlain<T>()
return plain;
}

public async virtual Task PlainToOnline<T>(T plain)
public async virtual Task PlainToOnline<T>(T plain, eAccessPriority priority = eAccessPriority.Normal)
{
await this.PlainToOnlineAsync((dynamic)plain);
await this.PlainToOnlineAsync((dynamic)plain, priority);
}

public async Task<IEnumerable<ITwinPrimitive>> PlainToOnlineAsync(global::Pocos.lib1.MyClass plain)
public async Task<IEnumerable<ITwinPrimitive>> PlainToOnlineAsync(global::Pocos.lib1.MyClass plain, eAccessPriority priority = eAccessPriority.Normal)
{
#pragma warning disable CS0612
MyString.LethargicWrite(plain.MyString);
#pragma warning restore CS0612
#pragma warning disable CS0612
MyInt.LethargicWrite(plain.MyInt);
#pragma warning restore CS0612
return await this.WriteAsync<IgnoreOnPocoOperation>();
return await this.WriteAsync<IgnoreOnPocoOperation>(priority);
}

[Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")]
Expand Down Expand Up @@ -218,6 +218,11 @@ public AXSharp.Connector.ITwinObject GetParent()

public System.String GetAttributeName(System.Globalization.CultureInfo culture)
{
if (string.IsNullOrEmpty(_attributeName))
{
return SymbolTail;
}

return this.Translate(_attributeName, culture).Interpolate(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public static PlcTranslator Instance

private PlcTranslator()
{
var defaultResourceType = Assembly.GetAssembly(typeof(lib1.PlcTranslator))
.GetType("lib1.Resources.PlcStringResources");
this.SetLocalizationResource(defaultResourceType);
var assembly = Assembly.GetAssembly(typeof(lib1.PlcTranslator));
var resource = assembly.GetType("lib1.Resources.PlcStringResources");
this.SetLocalizationResource(resource, assembly);
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
<PackageReference Include="AXSharp.Connector" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
</ItemGroup>

<ItemGroup>
<Compile Include=".g\**" />
</ItemGroup>

<ItemGroup>
<Folder Include=".meta\" />
<Content Include=".meta\**" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
<PackageReference Include="AXSharp.Connector" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
</ItemGroup>

<ItemGroup>
<Compile Include=".g\**" />
</ItemGroup>

<ItemGroup>
<Folder Include=".meta\" />
<Content Include=".meta\**" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"ProjectFile":"lib2.csproj"}
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"SkipDependencyCompilation":false,"TargetPlatfromMoniker":"ax","ProjectFile":"lib2.csproj"}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public MyClass(AXSharp.Connector.ITwinObject parent, string readableTail, string
PostConstruct(parent, readableTail, symbolTail);
}

public async virtual Task<T> OnlineToPlain<T>()
public async virtual Task<T> OnlineToPlain<T>(eAccessPriority priority = eAccessPriority.Normal)
{
return await (dynamic)this.OnlineToPlainAsync();
return await (dynamic)this.OnlineToPlainAsync(priority);
}

public async Task<global::Pocos.lib2.MyClass> OnlineToPlainAsync()
public async Task<global::Pocos.lib2.MyClass> OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal)
{
global::Pocos.lib2.MyClass plain = new global::Pocos.lib2.MyClass();
await this.ReadAsync<IgnoreOnPocoOperation>();
await this.ReadAsync<IgnoreOnPocoOperation>(priority);
plain.MyString = MyString.LastValue;
plain.MyInt = MyInt.LastValue;
return plain;
Expand All @@ -62,20 +62,20 @@ public async virtual Task<T> OnlineToPlain<T>()
return plain;
}

public async virtual Task PlainToOnline<T>(T plain)
public async virtual Task PlainToOnline<T>(T plain, eAccessPriority priority = eAccessPriority.Normal)
{
await this.PlainToOnlineAsync((dynamic)plain);
await this.PlainToOnlineAsync((dynamic)plain, priority);
}

public async Task<IEnumerable<ITwinPrimitive>> PlainToOnlineAsync(global::Pocos.lib2.MyClass plain)
public async Task<IEnumerable<ITwinPrimitive>> PlainToOnlineAsync(global::Pocos.lib2.MyClass plain, eAccessPriority priority = eAccessPriority.Normal)
{
#pragma warning disable CS0612
MyString.LethargicWrite(plain.MyString);
#pragma warning restore CS0612
#pragma warning disable CS0612
MyInt.LethargicWrite(plain.MyInt);
#pragma warning restore CS0612
return await this.WriteAsync<IgnoreOnPocoOperation>();
return await this.WriteAsync<IgnoreOnPocoOperation>(priority);
}

[Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")]
Expand Down Expand Up @@ -218,6 +218,11 @@ public AXSharp.Connector.ITwinObject GetParent()

public System.String GetAttributeName(System.Globalization.CultureInfo culture)
{
if (string.IsNullOrEmpty(_attributeName))
{
return SymbolTail;
}

return this.Translate(_attributeName, culture).Interpolate(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public static PlcTranslator Instance

private PlcTranslator()
{
var defaultResourceType = Assembly.GetAssembly(typeof(lib2.PlcTranslator))
.GetType("lib2.Resources.PlcStringResources");
this.SetLocalizationResource(defaultResourceType);
var assembly = Assembly.GetAssembly(typeof(lib2.PlcTranslator));
var resource = assembly.GetType("lib2.Resources.PlcStringResources");
this.SetLocalizationResource(resource, assembly);
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AXSharp.Abstractions" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
<PackageReference Include="AXSharp.Connector" Version="0.22.0-330-new-feature-poco-property-of-datetime-has-different-default-value-than-plc.299" />
</ItemGroup>

<ItemGroup>
<Compile Include=".g\**" />
</ItemGroup>

<ItemGroup>
<Folder Include=".meta\" />
<Content Include=".meta\**" />
</ItemGroup>
</Project>
Loading