├── .gitattributes ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── LICENSE.md ├── README.md └── Sources ├── AdsSecureSamples └── AdsSecureConsoleApp │ ├── .vscode │ ├── launch.json │ └── tasks.json │ ├── AdsSecureConsoleApp.csproj │ ├── AdsSecureConsoleApp.sln │ ├── ArgParser.cs │ ├── Certs │ ├── RootCA.key │ ├── RootCA.pem │ ├── RootCA.srl │ ├── SourceIPC.crt │ ├── SourceIPC.csr │ ├── SourceIPC.key │ ├── TargetIPC.crt │ ├── TargetIPC.csr │ ├── TargetIPC.key │ ├── WrongRootCA.key │ └── WrongRootCA.pem │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ └── README.md ├── BaseSamples ├── .vscode │ ├── launch.json │ └── tasks.json ├── AccessByVarName │ ├── AccessByVarName.cs │ └── S02_AccessByVarName.csproj ├── EventReading │ ├── Form1.cs │ ├── Form1.resx │ └── S03_EventReading.csproj ├── Heartbeat │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── S50_Heartbeat.csproj ├── MethodCall │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── S30_MethodCall.csproj ├── PLCStartStop │ ├── PLCStartStop.cs │ └── S20_PLCStartStop.csproj ├── Reactive │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── S80_Reactive.csproj ├── ReadArray │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ └── S12_ReadArray.csproj ├── ReadVariableDeclaration │ ├── Form1.cs │ ├── Form1.resx │ └── S21_ReadVariableDeclaration.csproj ├── ReadWriteAnyType │ ├── Form1.cs │ ├── Form1.resx │ └── S14_ReadWriteAnyType.csproj ├── ReadWriteDateTime │ ├── Form1.cs │ └── S11_ReadWriteDateTime.csproj ├── ReadWriteFlag │ ├── Form1.cs │ ├── Form1.resx │ └── S01_ReadWriteFlag.csproj ├── ReadWriteString │ ├── Form1.cs │ ├── Form1.resx │ └── S10_ReadWriteString.csproj ├── SamplePlc │ ├── 00_TwinCAT_Demo_PLC.tsproj │ └── PLC │ │ ├── DUTs │ │ ├── PLCStruct.TcDUT │ │ ├── TComplexStruct.TcDUT │ │ └── TSimpleStruct.TcDUT │ │ ├── GVLs │ │ └── GVL.TcGVL │ │ ├── PLC.plcproj │ │ ├── PLC.tmc │ │ ├── POUs │ │ ├── FB_Math.TcPOU │ │ └── MAIN.TcPOU │ │ ├── PlcTask.TcTTO │ │ └── Version │ │ └── Global_Version.TcGVL ├── Server │ ├── AdsSampleServer.cs │ ├── NotificationRequestEntry.cs │ ├── Program.cs │ ├── S60_Server.csproj │ └── Worker.cs ├── SumReadWrite │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ └── S22_AdsSumReadWrite.csproj ├── TF6000_ADS_DOTNET_V5_BaseSamples.sln ├── TcStateChange │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ └── S23_TcStateChange.csproj ├── TwinCAT_Demo_PLC │ ├── PLC │ │ ├── DUTs │ │ │ ├── MYSTRUCT.TcDUT │ │ │ ├── MyComplexStruct.TcDUT │ │ │ ├── PLCStruct.TcDUT │ │ │ ├── TComplexStruct.TcDUT │ │ │ └── TSimpleStruct.TcDUT │ │ ├── GVLs │ │ │ └── GVL.TcGVL │ │ ├── PLC.plcproj │ │ ├── POUs │ │ │ ├── FB_Math.TcPOU │ │ │ └── MAIN.TcPOU │ │ ├── PlcTask.TcTTO │ │ └── Version │ │ │ └── Global_Version.TcGVL │ └── TwinCAT_Demo_PLC.tsproj ├── WPFConnectionObserver │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── S40_WPFConnectionObserver.csproj └── WriteStruct │ ├── Form1.cs │ ├── Form1.resx │ └── S13_WriteStruct.csproj ├── ClientSamples ├── AdsCli │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── AdsCli.sln │ ├── Dockerfile │ ├── README.md │ └── src │ │ ├── AdsCli.csproj │ │ ├── AdsCommand.cs │ │ ├── ArgsParser.cs │ │ ├── Logger.cs │ │ └── Programm.cs ├── AdsOverMqttApp │ ├── .gitignore │ ├── .vscode │ │ └── launch.json │ ├── AdsOverMqttApp.sln │ ├── Overview.drawio │ ├── Overview.svg │ ├── README.md │ └── src │ │ ├── AdsOverMqttApp.csproj │ │ ├── HostedService.cs │ │ ├── Program.cs │ │ ├── appSettings.json │ │ └── settings.env └── WpfAdsSession │ ├── WpfAdsSession.sln │ └── WpfAdsSession │ ├── App.xaml │ ├── App.xaml.cs │ ├── DataTypeTemplateSelector.cs │ ├── DataTypesControl.xaml │ ├── DataTypesControl.xaml.cs │ ├── DataTypesViewModel.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Resources │ ├── Alias.ico │ ├── Array.ico │ ├── DataType.ico │ ├── Enum.ico │ ├── Primitive.ico │ ├── String.ico │ ├── Struct.ico │ └── Symbol.ico │ ├── SymbolTemplateSelector.cs │ ├── SymbolsControl.xaml │ ├── SymbolsControl.xaml.cs │ ├── SymbolsViewModel.cs │ ├── SymbolsWindow.xaml │ ├── SymbolsWindow.xaml.cs │ └── WpfAdsSession.csproj ├── DockerSamples ├── .dockerignore ├── .vscode │ ├── launch.json │ └── tasks.json ├── AdsClient │ ├── AdsClient.csproj │ ├── Dockerfile │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Worker.cs ├── AdsRouterConsole │ ├── AdsRouterConsole.csproj │ ├── Dockerfile │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Worker.cs ├── AdsServer │ ├── AdsServer.cs │ ├── AdsServer.csproj │ ├── Dockerfile │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Worker.cs ├── DockerSample.sln ├── MQTTConfiguration.drawio ├── MQTTConfiguration.svg ├── NuGet.Config ├── PwshClient │ ├── Dockerfile │ └── init.ps1 ├── ReadMe.md ├── RouterConsoleConfiguration.drawio ├── RouterConsoleConfiguration.svg ├── config-mqtt.env ├── config-routerconsole.env ├── docker-compose.mqtt.yml ├── docker-compose.routerconsole.yml └── simple-mosquitto.conf ├── ManagementSamples └── PwshBroadcastSearch │ ├── Program.cs │ ├── PwshBroadcastSearch.csproj │ └── PwshBroadcastSearch.sln ├── ProviderSamples └── CustomSessionProvider │ ├── CustomSessionProvider.csproj │ ├── CustomSessionProvider.sln │ ├── CustomSymbolProvider.cs │ └── ReadMe.md ├── RouterSamples ├── AdsRouterAndClientConsoleApp │ ├── AdsRouterAndClientConsoleApp.sln │ ├── AdsRouterAndClientConsoleApp │ │ ├── AdsRouterAndClientConsoleApp.csproj │ │ ├── Program.cs │ │ ├── Services │ │ │ ├── AdsBaseService.cs │ │ │ ├── ClientService1.cs │ │ │ ├── ClientService2.cs │ │ │ └── RouterService.cs │ │ └── appsettings.json │ └── ReadMe.md ├── AdsRouterConsoleApp │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ ├── settings.json │ │ └── tasks.json │ ├── AdsRouterConsoleApp.sln │ ├── Dockerfile │ ├── README.md │ ├── docs │ │ ├── run-as-docker-container.md │ │ └── run-beneath-TwinCATRouter.md │ └── src │ │ ├── AdsRouterConsoleApp.csproj │ │ ├── Program.cs │ │ ├── Worker.cs │ │ ├── appSettings.json │ │ ├── settings-bridged-network.env │ │ └── settings-host-network.env ├── AdsRouterWpfApp │ ├── AdsRouterWpfApp.csproj │ ├── AdsRouterWpfApp.sln │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ └── ReadMe.md └── ReadMe.md └── ServerSamples ├── AdsServerSample ├── AdsServerConsoleApp.png ├── AdsServerConsoleApp │ ├── AdsSampleServer.cs │ ├── AdsServerConsoleApp.csproj │ ├── App.config │ ├── Logger.cs │ ├── NotificationRequestEntry.cs │ ├── Program.cs │ └── Worker.cs ├── AdsServerSample.sln ├── AdsServerTester.png ├── AdsServerTester │ ├── AdsSampleServerTester.Designer.cs │ ├── AdsSampleServerTester.cs │ ├── AdsSampleServerTester.resx │ ├── AdsServerTester.csproj │ └── app.config └── ReadMe.md └── AdsSymbolicServerSample ├── AdsSymbolicServer.cs ├── AdsSymbolicServerSample.csproj ├── AdsSymbolicServerSample.sln ├── Program.cs ├── Properties └── launchSettings.json └── ReadMe.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | // Use IntelliSense to find out which attributes exist for C# debugging 6 | // Use hover for the description of the existing attributes 7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 8 | "name": "AdsSymbolServer ConsoleApp", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceFolder}/Sources/ServerSamples/AdsSymbolicServerSample/bin/Debug/net6.0/AdsSymbolicServerSample.dll", 14 | "args": [], 15 | "cwd": "${workspaceFolder}/Sources/ServerSamples/AdsSymbolicServerSample", 16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console 17 | "console": "integratedTerminal", 18 | "stopAtEntry": false 19 | }, 20 | { 21 | // Use IntelliSense to find out which attributes exist for C# debugging 22 | // Use hover for the description of the existing attributes 23 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 24 | "name": "AdsSecure ConsoleApp", 25 | "type": "coreclr", 26 | "request": "launch", 27 | "preLaunchTask": "build", 28 | // If you have changed target frameworks, make sure to update the program path. 29 | "program": "${workspaceFolder}/Sources/AdsSecureSamples/AdsSecureConsoleApp/bin/Debug/net6.0/AdsSecureConsoleApp.dll", 30 | "args": [], 31 | "cwd": "${workspaceFolder}/Sources/AdsSecureSamples/AdsSecureConsoleApp", 32 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console 33 | "console": "internalConsole", 34 | "stopAtEntry": false 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build AdsSecureSamples", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/Sources/AdsSecureSamples/AdsSecureConsoleApp/AdsSecureConsoleApp.csproj", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "build AdsServer", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "build", 22 | "${workspaceFolder}/Sources/DockerSamples/AdsServer/AdsServer.csproj", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile", 27 | "group": { 28 | "kind": "build", 29 | "isDefault": true 30 | } 31 | }, 32 | { 33 | "label": "publish", 34 | "command": "dotnet", 35 | "type": "process", 36 | "args": [ 37 | "publish", 38 | "${workspaceFolder}/Sources/AdsSecureSamples/AdsSecureConsoleApp/AdsSecureConsoleApp.csproj", 39 | "/property:GenerateFullPaths=true", 40 | "/consoleloggerparameters:NoSummary" 41 | ], 42 | "problemMatcher": "$msCompile" 43 | }, 44 | { 45 | "label": "watch", 46 | "command": "dotnet", 47 | "type": "process", 48 | "args": [ 49 | "watch", 50 | "run", 51 | "--project", 52 | "${workspaceFolder}/Sources/AdsSecureSamples/AdsSecureConsoleApp/AdsSecureConsoleApp.csproj" 53 | ], 54 | "problemMatcher": "$msCompile" 55 | } 56 | ] 57 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD Zero Clause License 2 | 3 | Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About this repository 2 | This repository contains official sample code for the product TF6000|TwinCAT ADS .NET V6 offered by [Beckhoff Automation](https://www.beckhoff.com). The sample code is provided as-is under the Zero-Clause BSD license. 3 | 4 | # How to get support 5 | Should you have any questions regarding the provided sample code, please contact your local Beckhoff support team. Contact information can be found on the official Beckhoff website at https://www.beckhoff.com/contact/. 6 | 7 | # Further information 8 | Further information about this sample code can be found on the [Beckhoff Information System](https://infosys.beckhoff.com) in the [ADS .NET V6 documentation](https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads.net/index.html&id=3120360106606588270). 9 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | // Use IntelliSense to find out which attributes exist for C# debugging 6 | // Use hover for the description of the existing attributes 7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 8 | "name": ".NET Core Launch (console)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceFolder}/bin/Debug/net5.0/AdsSecureConsoleApp.dll", 14 | "args": [], 15 | "cwd": "${workspaceFolder}", 16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console 17 | "console": "internalConsole", 18 | "stopAtEntry": false 19 | }, 20 | { 21 | "name": ".NET Core Attach", 22 | "type": "coreclr", 23 | "request": "attach" 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/AdsSecureConsoleApp.csproj", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "publish", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "publish", 22 | "${workspaceFolder}/AdsSecureConsoleApp.csproj", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile" 27 | }, 28 | { 29 | "label": "watch", 30 | "command": "dotnet", 31 | "type": "process", 32 | "args": [ 33 | "watch", 34 | "run", 35 | "${workspaceFolder}/AdsSecureConsoleApp.csproj", 36 | "/property:GenerateFullPaths=true", 37 | "/consoleloggerparameters:NoSummary" 38 | ], 39 | "problemMatcher": "$msCompile" 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/AdsSecureConsoleApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | disable 7 | 8 | 9 | 10 | False 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/AdsSecureConsoleApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31515.178 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdsSecureConsoleApp", "AdsSecureConsoleApp.csproj", "{555C2D83-C7EC-4D64-AA5A-B61F4AF07376}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {555C2D83-C7EC-4D64-AA5A-B61F4AF07376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {555C2D83-C7EC-4D64-AA5A-B61F4AF07376}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {555C2D83-C7EC-4D64-AA5A-B61F4AF07376}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {555C2D83-C7EC-4D64-AA5A-B61F4AF07376}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {502F694D-6F0B-4BE5-B90F-89B816B2A52A} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/ArgParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using TwinCAT.Ads; 8 | 9 | namespace AdsSecureConsoleApp 10 | { 11 | public static class ArgParser 12 | { 13 | /// 14 | /// Parses the arguments. 15 | /// 16 | /// The arguments. 17 | /// AmsAddress. 18 | public static bool TryParse(string[] args, out AmsAddress address, out string ipOrHostName) 19 | { 20 | bool ret = false; 21 | AmsNetId netId = null; 22 | int port = -1; 23 | IPAddress ip; 24 | 25 | address = null; 26 | ipOrHostName = null; 27 | 28 | if (args != null && args.Length == 3) 29 | { 30 | ret = true; 31 | ret &= AmsNetId.TryParse(args[0], out netId); 32 | ret &= int.TryParse(args[1], out port); 33 | 34 | if (!string.IsNullOrEmpty(args[2])) 35 | { 36 | if (IPAddress.TryParse(args[2], out ip)) 37 | { 38 | ipOrHostName = ip.ToString(); 39 | } 40 | else 41 | { 42 | ipOrHostName= args[2]; 43 | } 44 | 45 | } 46 | else 47 | ret = false; 48 | 49 | } 50 | else 51 | { 52 | ret = false; 53 | } 54 | 55 | if (ret) 56 | { 57 | address = new AmsAddress(netId, port); 58 | } 59 | return ret; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/RootCA.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA7nxfpTuEb/vsnLrzF+7Yi6DN8KFiZjsbq88K/GIE7PPRbtdv 3 | VQvI6UUIVhUTi40Qu5rcDPxAY1x5Txq1yqi+o6gaKwIgPo/6an4AVOXIlJvBTgIo 4 | doKYw249QNI0OEYT7V2FQAfMzVaTLzVC2auIKPc9f8Zxgc7gmEwvdn2j9j3jsxEh 5 | 5mBuf+fh4wg7vMYhS7Q2X/3D6cgXeWBd12KuiWbrx0ZGHeFEFE1oGfoVOQuV2qT3 6 | 2xmvjRsjrzn34wi/oDesL3tHpeBv9y3vI7errwt6mfsIBeYFMqRadH68KVqn4/Rw 7 | 13lPceMRFF8C2Q2RBAKps/QKAJ71iDQiqzDrTwIDAQABAoI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7L1s8g7ES0U3vCXXbcA1NErfvd 24 | pMacDikCgYA9/RiQpVsU7/r/KQbVc/g0K54BMnwqPSqOcw9YiCbDeYZsKdVkdr5J 25 | zykyNzioOMl/95DWk7b7+5bv1TY1uls4+PpLtkzl2K9EN07rrGKt808WVLM8YsUA 26 | OQXebgIdNaen4Gq3NbJItLdp0ehdm4u+qo8HAHPTYmIED/PWsKFkyg== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/RootCA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDjzCCAnegAwIBAgIULoxUT8ves7P+ftlFpdVrG7yOUTMwDQYJKoZIhvcNAQEL 3 | BQAwVzELMAkGA1UEBhMCREUxDDAKBgNVBAgMA05SVzENMAsGA1UEBwwEVmVybDEL 4 | MAkGA1UECgwCQmsxDTALBgNVBAsMBFRDUE0xDzANBgNVBAMMBlJvb3RDQTAeFw0y 5 | MTExMjYxNjM3NDRaFw0zMTEwMDUxNjM3NDRaMFcxCzAJBgNVBAYTAkRFMQwwCgYD 6 | VQQIDANOUlcxDTALBgNVBAcMBFZlcmwxCzAJBgNVBAoMAkJrMQ0wCwYDVQQLDARU 7 | Q1BNMQ8wDQYDVQQDDAZSb290Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK 8 | AoIBAQDufF+lO4Rv++ycuvMX7tiLoM3woWJmOxurzwr8YgTs89Fu129VC8jpRQhW 9 | FROLjRC7mtwM/EBjXHlPGrXKqL6jqBorAiA+j/pqfgBU5ciUm8FOAih2gpjDbj1A 10 | 0jQ4RhPtXYVAB8zNVpMvNULZq4go9z1/xnGBzuCYTC92faP2PeOzESHmYG5/5+Hj 11 | CDu8xiFLtDZf/cPpyBd5YF3XYq6JZuvHRkYd4UQUTWgZ+hU5C5XapPfbGa+NGyOv 12 | OffjCL+gN6wve0el4G/3Le8jt6uvC3qZ+wgF5gUypFp0frwpWqfj9HDXeU9x4xEU 13 | XwLZDZEEAqmz9AoAnvWINCKrMOtPAgMBAAGjUzBRMB0GA1UdDgQWBBSVMYnuU5Z0 14 | +hyFBvsLmH0mEdR/LTAfBgNVHSMEGDAWgBSVMYnuU5Z0+hyFBvsLmH0mEdR/LTAP 15 | BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQA+MlgRpl49RmtDZyYW 16 | GayI3kstGq/YUYEI+5lkNXuJ8mWd36WzGBTDaQHALsxkXpkwv0V8ed7bGyJT4iOh 17 | wIdMaOU49e5uY1M7pjB3O/mI+Q2LJD6D8z1ENk4jK0H4EyYUsyNn5Tc5Uc8YCMxb 18 | P8bevlpCjDTYmeVcBREWc7M2P6nIW7IDjx9RaJO7nHgQFHtRtG+lpJwC2NcQhoGm 19 | 3joECM5rQZt7jPY8SR9loo9iqR824zRAC2E+glDrd9cSlt8MV825wHed6W/6Cfsm 20 | +X21yG7Z0ghzyba3WdKh9ByeIxFM6CYgTSfpn3ySowX/5vj4UUodMqbrWKjU8nn5 21 | ASqJ 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/RootCA.srl: -------------------------------------------------------------------------------- 1 | 3164A8F8486394D1D6448395D8C3E98808A4172F 2 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/SourceIPC.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDODCCAiACFDFkqPhIY5TR1kSDldjD6YgIpBcuMA0GCSqGSIb3DQEBCwUAMFcx 3 | CzAJBgNVBAYTAkRFMQwwCgYDVQQIDANOUlcxDTALBgNVBAcMBFZlcmwxCzAJBgNV 4 | BAoMAkJrMQ0wCwYDVQQLDARUQ1BNMQ8wDQYDVQQDDAZSb290Q0EwHhcNMjExMTI2 5 | MTYzODAwWhcNMjIxMTIxMTYzODAwWjBaMQswCQYDVQQGEwJERTEMMAoGA1UECAwD 6 | TlJXMQ0wCwYDVQQHDARWZXJsMQswCQYDVQQKDAJCazENMAsGA1UECwwEVENQTTES 7 | MBAGA1UEAwwJU291cmNlSVBDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC 8 | AQEA5QRND9VwXGuSM9AW7SsWPpLbCToi8MB1qOS/MZ25wJQUjblH+oeF4qHep5oe 9 | vSYE+dDkiDHQ2wqgnSL1sT0c0hd80GrUFDVwO65O/T2YNX2fw/dGCD8kfvdpIECE 10 | lQ+n8OFu55mhEauHHMEUV0tWlXS8Li5zVws+bkdGlJu4d3rnSDUmVSVtiNI801K5 11 | IBtBwHA6Mhs/0k2DCMaOk949NpzVUUhNLo83r6Zj3vC1gjXZetoMplly2gY4NRos 12 | Yxorr95WKcTPHBzsJcUvMqGKEHTkLnbG7DfTw4fPPack7uewFb2sbKVnJdkiGOAC 13 | oYZl9XQoPQWUIhMOylYU/Q2eTQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBWxQ9A 14 | vtlKEpL5N/+h/4xahywayygRNMN6GAoZM2NE1OAm/nBNFbk6AS1hhczYppFG4f7U 15 | VqELjK0oUB9xUMCEidxDFOm3PDjtTu2h2Nx0C4LlT/YvEsX9WR+3Du7nZ+Z0+jd9 16 | v0jwbRn/t9xPOOZswo1I/p/OtQXH4tdbcWozG0pKeTpubkmMaBgFXUDv5ePPxrlH 17 | Gr+E6MYtlrZtDxEywt2JC2KK7Snr/528FBvArTdaS0B75nE28EuBiRDxs88iThql 18 | TKKtRdrkm/zqNYOYnTIQl5iXfyZrNFTPhrF+GpCGwyWqOLihQLoRNYb5B0q8d4vJ 19 | IcPKu8e1NRUosGUE 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/SourceIPC.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIICnzCCAYcCAQAwWjELMAkGA1UEBhMCREUxDDAKBgNVBAgMA05SVzENMAsGA1UE 3 | BwwEVmVybDELMAkGA1UECgwCQmsxDTALBgNVBAsMBFRDUE0xEjAQBgNVBAMMCVNv 4 | dXJjZUlQQzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOUETQ/VcFxr 5 | kjPQFu0rFj6S2wk6IvDAdajkvzGducCUFI25R/qHheKh3qeaHr0mBPnQ5Igx0NsK 6 | oJ0i9bE9HNIXfNBq1BQ1cDuuTv09mDV9n8P3Rgg/JH73aSBAhJUPp/DhbueZoRGr 7 | hxzBFFdLVpV0vC4uc1cLPm5HRpSbuHd650g1JlUlbYjSPNNSuSAbQcBwOjIbP9JN 8 | gwjGjpPePTac1VFITS6PN6+mY97wtYI12XraDKZZctoGODUaLGMaK6/eVinEzxwc 9 | 7CXFLzKhihB05C52xuw308OHzz2nJO7nsBW9rGylZyXZIhjgAqGGZfV0KD0FlCIT 10 | DspWFP0Nnk0CAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4IBAQBnVMeONd/i+szJIbxR 11 | S+OlO69eO0N3zfRmdA6zC/6ZwMeTchVm2vA0t+iklHSuwqc/PATMvRVxnyoKEEPV 12 | apPwtgCtwHej0x0ILyZjQyp865VefNAzbpxhChd641IymyiQ1sUTY/avvb4WRNzy 13 | A2bpIZmt3UgE0oYeg5h5Gs91IEPIm07NYl6h+AvVnZRKBKDkAzfnjJdB7g4fupZM 14 | ueVcR5D6U1/epBET7Dk6S/FBeSHuwesAfMVRUQj9podNkxpm6YAuzEMgjAfigvDl 15 | 5ZAcomskMzw4btwLMj03+4n06IE4hpWVFCT+wIINIPS0cGlBkBjHKUCnrjFTqEYf 16 | YW9b 17 | -----END CERTIFICATE REQUEST----- 18 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/SourceIPC.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA5QRND9VwXGuSM9A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iuoJehy6hbZ1XppHWKauECgYBIzSX4gCTmGnOoTxqLbxzE 19 | XFmByoNQQ1q2JeeKVDJdsZghd2SqpBIgy4C9eHmNY72P7V9iBOtIwxpuw/lLxAvp 20 | Px6ngtcSGwd7y9PDMcT9wE+a0sl1DqiOcxtlcmKZXsnPnGXnWUJCUkwVBE8+VF54 21 | yQsuAMVRUnqrwPGSnPhrcQKBgQDG6WTkmD3umEJTPVrtwgD6J3dABsc63bQP2isR 22 | VkVNXBgcDRaJ4mXP5FtoZbF8eU6nXtU2FZ5AseZrDyskthtD5llgM/2/eX53v3AM 23 | OS67wfI7ZA6hNWRcRvhs4w+gJ0NffzPrgWY6JWzFe/mvZCYuKmPvF1PFOubKowIG 24 | VMF8YQKBgE85Ht4dyEoNrVH+WlrCl9xB6HWdkXMl2ZFh+YFJlKwEUuheto4nTdWn 25 | p8rc2I9y9PX7u8kNYAKb9ppsX/Cq+0j89ahJl0QJkZZZYCIK1dHtpHUxNLgoWKyR 26 | 2iP8DpIry0uuIoi/VkoG/M1c9+w4Ojn2x9E3a7PIBK7M4H1F6w1e 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/TargetIPC.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDODCCAiACFDFkqPhIY5TR1kSDldjD6YgIpBcvMA0GCSqGSIb3DQEBCwUAMFcx 3 | CzAJBgNVBAYTAkRFMQwwCgYDVQQIDANOUlcxDTALBgNVBAcMBFZlcmwxCzAJBgNV 4 | BAoMAkJrMQ0wCwYDVQQLDARUQ1BNMQ8wDQYDVQQDDAZSb290Q0EwHhcNMjExMTI2 5 | MTY1MzI2WhcNMjIxMTIxMTY1MzI2WjBaMQswCQYDVQQGEwJERTEMMAoGA1UECAwD 6 | TlJXMQ0wCwYDVQQHDARWZXJsMQswCQYDVQQKDAJCazENMAsGA1UECwwEVENQTTES 7 | MBAGA1UEAwwJVGFyZ2V0SVBDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC 8 | AQEAr5IYzvd2Mbv/iuvDWdzSHLvhRzHtL+qKIDHViYhL2bsMfpweQHCrIsBvK6uY 9 | GezH91JndnqDnHLDf2mbtxMfFk4FWtUZ6nCuHiWpgW+91ujEClZ31YwLDsjonc1E 10 | Ev3q2481O6IiZdGIIPiuwaQD4D0kKL3pZAXKDn25E3YljofI5xWXQXhKwbk/z28m 11 | OJXLI+ezI7mtvmJsm0RDkkmiEfVcf3HBdt09kIyei0YJPhrM0XA1Yuo+C19LIxT5 12 | K7pssQ21aFh/ev06/qTOhFrFxDQZIkkmJ4Ipvsr1vrk9WERN+FyOaFb4uT3H+lIX 13 | kBYGwyqRjPTVOByR3z2NmXO+JQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBcV+AY 14 | hvGd1Bpa2t0+oGxNJwf4m4GCVYVNPduG6KcdWge0EdsLahpkWmH2Mlm6cvH2+apM 15 | o3+71Bu3JrptZ/BVKERFxkiaeCg8CM+xuFuiU7T6oKwY3fc7IiHacZGWcAql0lEy 16 | X2jQjtQ1E2j2z3f4dEuMg8KNrEeV5CRtHKUp9kgiVNwTA/TEcIIh/ddVGDmJN7r4 17 | qqyndm4GCmcgdKudWTjM9wEZxjBbiZiPMVDrFLaQC/FdkXZFUBrMX5hBff0ZP/Vd 18 | M/yoshjrgYkQqmuUcuE8bP6NrG7oWvtMdczEwKXUh8chlSxaVYE4/qYURQ92rE+Z 19 | aY4g20J2OonoX2Wx 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/TargetIPC.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIICnzCCAYcCAQAwWjELMAkGA1UEBhMCREUxDDAKBgNVBAgMA05SVzENMAsGA1UE 3 | BwwEVmVybDELMAkGA1UECgwCQmsxDTALBgNVBAsMBFRDUE0xEjAQBgNVBAMMCVRh 4 | cmdldElQQzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK+SGM73djG7 5 | /4rrw1nc0hy74Ucx7S/qiiAx1YmIS9m7DH6cHkBwqyLAbyurmBnsx/dSZ3Z6g5xy 6 | w39pm7cTHxZOBVrVGepwrh4lqYFvvdboxApWd9WMCw7I6J3NRBL96tuPNTuiImXR 7 | iCD4rsGkA+A9JCi96WQFyg59uRN2JY6HyOcVl0F4SsG5P89vJjiVyyPnsyO5rb5i 8 | bJtEQ5JJohH1XH9xwXbdPZCMnotGCT4azNFwNWLqPgtfSyMU+Su6bLENtWhYf3r9 9 | Ov6kzoRaxcQ0GSJJJieCKb7K9b65PVhETfhcjmhW+Lk9x/pSF5AWBsMqkYz01Tgc 10 | kd89jZlzviUCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4IBAQBDbOJAuAEBjr/onEqx 11 | hw0yod5k2lS2cxfkF6tM1gg10gMmwU65AjP2godeGhu2y2HCt68oNDd1skysCkJO 12 | iBQVTfGFx6x7MzoRnmE1XRRy5dDS+F28hrTAHgviNgNPXHoVkX1hZhLnMPdrvNaB 13 | gyEXMSvt5RX7Y9ohqmwWWRfOGld1e+UsVF7kuw0pIgpLELy1jgx7Io9FECySNMUG 14 | ldvxCs09LX0QQezwFLiKCFWPsJQocG72snymJS0grngPZB8/HXzT8z2ag1VLrBMd 15 | txGjo8P0NH7A1yyBrEhI3SBQQv1SjRsSj11q37m2eEbUwJvIaGyCdKpmabFurrC2 16 | cHt/ 17 | -----END CERTIFICATE REQUEST----- 18 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/TargetIPC.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEAr5IYzvd2Mbv/iuvDWdzSHLvhRzHtL+qKIDHViYhL2bsMfpwe 3 | QHCrIsBvK6uYGezH91JndnqDnHLDf2mbtxMfFk4F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+V8NAJNJ24EJprMbAXin5yUTnZ2Zxw8 20 | TFNXGjjeTXPwcbAqb2vYV7ECJRflNGaA+p8Bm8bMlHfrNYKdIYv74+Da6YH57b+N 21 | cHhJGPtAif1dSNksoSHwQcsCgYEAnyiGOv6SYKVm5br3CDctc1RbOiyBkLIABzqp 22 | 9RwAwBlYDxjpf6kRlIUDKT1bHhZ61QFqXxDQTKOFu4+3SjNbwtNBCz+HCuRDMXUf 23 | mUUiO8InWJCy74abzUE3wGRGSQJ/s3LVYd0aOdEY28Rx3rcbTNt3aWXqhfixK4qU 24 | DE4xnX0CgYEApe1n7G3w9sTyZrDYSfFHjaLGXfDmyKD7i9qvRA2NapPE/qNzuhrC 25 | WVjdDUQCVeOgEuPsVSx3pBYDtRwNQAFQbwS1yex9f+Qyy7JNbOSU7h20Z+H3xz/Q 26 | zk68pAYMp2A+t++za1z3XC9G13RLi5sxe3hyDe8vCBvfAnGNCcb9dus= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/WrongRootCA.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAx4vwp88gYxwN5jqUdxtobpJ56QVnwhbY7oeQd+XcPycdUTPx 3 | olK/lMYkjqisv6OwWKTBJjLTrczGeg37DzYtoTa6Av7wIOdMT/odUCxJM0PWwpUa 4 | EXQerCkPDsJL9AcMGMy88efPMurYhSv1dzJgDfzSiWoU+yI9EmntLk0tjLP6P2Z2 5 | AhLt5gRXGiZnYpYAi7/C+LOz1v9luUBZ207D5RfnS24gvMPBHpxfXv6opjMumDlv 6 | /BBwD3mo0t+zYsHSzYuDwyrf7XWdZmgU6ObJk/oY73HVJDvq+uQ0XvQDK5oFlW3+ 7 | C/NEUH7mBrQRkMXfnqyN3gDeL4voJOkq5gNmGwIDAQABAoIBAQC13+mfuZyGWOqe 8 | PiRVjyiXJ3BwH9obQCHG/s6BS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gYA3/TIWd9dp8xLp1AQb+e2n/x2NSvpwwNuNVYivYpndGEtZKi8sIYGe 25 | wX3+JquWwYx1n9i7FUw4+DnWOYf7mgt0/6L8KmW0N548xZ1zRmQLtWvJXzIJGQMJ 26 | ory3dRuT61CsKW19jU34gvU4h3kNp0gTdr2ImvXRJekEiEcAheLLBw== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Certs/WrongRootCA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDmTCCAoGgAwIBAgIUBUFgxVsj94RMfG9VRdEnMbnRy3gwDQYJKoZIhvcNAQEL 3 | BQAwXDELMAkGA1UEBhMCREUxDDAKBgNVBAgMA05SVzENMAsGA1UEBwwEVmVybDEL 4 | MAkGA1UECgwCQmsxDTALBgNVBAsMBFRDUE0xFDASBgNVBAMMC1dyb25nUm9vdENB 5 | MB4XDTIxMTEyOTEyMjYwMVoXDTMxMTAwODEyMjYwMVowXDELMAkGA1UEBhMCREUx 6 | DDAKBgNVBAgMA05SVzENMAsGA1UEBwwEVmVybDELMAkGA1UECgwCQmsxDTALBgNV 7 | BAsMBFRDUE0xFDASBgNVBAMMC1dyb25nUm9vdENBMIIBIjANBgkqhkiG9w0BAQEF 8 | AAOCAQ8AMIIBCgKCAQEAx4vwp88gYxwN5jqUdxtobpJ56QVnwhbY7oeQd+XcPycd 9 | UTPxolK/lMYkjqisv6OwWKTBJjLTrczGeg37DzYtoTa6Av7wIOdMT/odUCxJM0PW 10 | wpUaEXQerCkPDsJL9AcMGMy88efPMurYhSv1dzJgDfzSiWoU+yI9EmntLk0tjLP6 11 | P2Z2AhLt5gRXGiZnYpYAi7/C+LOz1v9luUBZ207D5RfnS24gvMPBHpxfXv6opjMu 12 | mDlv/BBwD3mo0t+zYsHSzYuDwyrf7XWdZmgU6ObJk/oY73HVJDvq+uQ0XvQDK5oF 13 | lW3+C/NEUH7mBrQRkMXfnqyN3gDeL4voJOkq5gNmGwIDAQABo1MwUTAdBgNVHQ4E 14 | FgQUJYsmB+RTHNp3VHug+B6iodHI8UQwHwYDVR0jBBgwFoAUJYsmB+RTHNp3VHug 15 | +B6iodHI8UQwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEARFrI 16 | 2UDoOi2/2WEL9CNJ4f+9q92xmi/lOmL+NBNRoDj7gYsIG/PzwX+idm1xanO7wGca 17 | Pufq8aGTgK1f4eRNdx986apTFQ+dzSrOLoHJvc7e1EIdneWCVhEzVz+/0G5zikRD 18 | agJ1ZjLj7N6WNdviYFbb8EvxY29yBH0kjrr8UCNOC0uwwhMz5deK3Cw5hWyDnWWz 19 | p5MfVvouhzi2jHKIINhf5tWxhmB9OU+97H02Vr++dDiwJQiuGV41rnG12xkA9eUQ 20 | ceTFLVIXa+e7oyZxMZV+WC+nG6FApVAV2Hn7nuSK2xnVe8FLw1OzV6iioZMFXqRI 21 | Tb3cOEnlLuwCqOJb3g== 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /Sources/AdsSecureSamples/AdsSecureConsoleApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | //"AdsSecureConsoleApp": { 4 | // "commandName": "Project", 5 | // "commandLineArgs": "172.17.60.197.1.1 10000 172.17.60.197" 6 | //} 7 | } 8 | } -------------------------------------------------------------------------------- /Sources/BaseSamples/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | // Use IntelliSense to find out which attributes exist for C# debugging 6 | // Use hover for the description of the existing attributes 7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 8 | "name": ".NET Core Launch (console)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceFolder}/MethodCall/bin/Debug/net5.0-windows/30_MethodCall.dll", 14 | "args": [], 15 | "cwd": "${workspaceFolder}/MethodCall", 16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console 17 | "console": "internalConsole", 18 | "stopAtEntry": false 19 | }, 20 | { 21 | "name": ".NET Core Attach", 22 | "type": "coreclr", 23 | "request": "attach" 24 | } 25 | ] 26 | } -------------------------------------------------------------------------------- /Sources/BaseSamples/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/MethodCall/30_MethodCall.csproj", 11 | "/property:GenerateFullPaths=true", 12 | "/consoleloggerparameters:NoSummary" 13 | ], 14 | "problemMatcher": "$msCompile" 15 | }, 16 | { 17 | "label": "publish", 18 | "command": "dotnet", 19 | "type": "process", 20 | "args": [ 21 | "publish", 22 | "${workspaceFolder}/MethodCall/30_MethodCall.csproj", 23 | "/property:GenerateFullPaths=true", 24 | "/consoleloggerparameters:NoSummary" 25 | ], 26 | "problemMatcher": "$msCompile" 27 | }, 28 | { 29 | "label": "watch", 30 | "command": "dotnet", 31 | "type": "process", 32 | "args": [ 33 | "watch", 34 | "run", 35 | "--project", 36 | "${workspaceFolder}/MethodCall/30_MethodCall.csproj" 37 | ], 38 | "problemMatcher": "$msCompile" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /Sources/BaseSamples/AccessByVarName/AccessByVarName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using TwinCAT.Ads; 7 | 8 | namespace S02_AccessByVarName 9 | { 10 | class AccessByVarName 11 | { 12 | static void Main(string[] args) 13 | { 14 | //Create a new instance of class AdsClient 15 | AdsClient tcClient = new AdsClient(); 16 | 17 | uint iHandle = 0; 18 | uint iValue = 0; 19 | 20 | try 21 | { 22 | //Connect to local PLC - Port 851 23 | tcClient.Connect(851); 24 | 25 | //Get the handle of the PLC variable "nCounter" 26 | iHandle = tcClient.CreateVariableHandle("MAIN.nCounter"); 27 | Console.WriteLine("Press Enter five times to end"); 28 | for(int i = 0; i < 5; i++) 29 | { 30 | //Use the handle to read PLCVar 31 | byte[] readData = new byte[sizeof(UInt32)]; 32 | tcClient.Read(iHandle, readData.AsMemory()); 33 | MemoryStream dataStream = new MemoryStream(readData); 34 | BinaryReader binReader = new BinaryReader(dataStream); 35 | iValue = binReader.ReadUInt32(); 36 | Console.WriteLine("Value: " + iValue); 37 | Console.ReadKey(); 38 | } 39 | 40 | //Reset PLC variable to zero 41 | tcClient.WriteAny(iHandle, 0); 42 | } 43 | catch (Exception ex) 44 | { 45 | Console.WriteLine(ex.Message); 46 | Console.ReadKey(); 47 | } 48 | finally 49 | { 50 | tcClient.DeleteVariableHandle(iHandle); 51 | tcClient.Dispose(); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Sources/BaseSamples/AccessByVarName/S02_AccessByVarName.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | AccessByVarName 5 | AccessByVarName 6 | net80 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/EventReading/S03_EventReading.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Heartbeat/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Setting ComVisible to false makes the types in this assembly not visible 6 | // to COM components. If you need to access a type in this assembly from 7 | // COM, set the ComVisible attribute to true on that type. 8 | [assembly: ComVisible(false)] 9 | 10 | // The following GUID is for the ID of the typelib if this project is exposed to COM 11 | [assembly: Guid("541c88f4-a88a-46c5-bbe4-40c9a37a270d")] 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Heartbeat/S50_Heartbeat.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | $(MSBuildProjectName.Replace(" ", "_")) 5 | net80 6 | 7 | 8 | S50_Heartbeat.Program 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | using TwinCAT.Ads; 12 | 13 | namespace S30_MethodCall 14 | { 15 | 16 | public partial class Form1 : Form 17 | { 18 | AdsClient tcClient = null; 19 | 20 | //Update the AMSNetId for your target 21 | AmsNetId targetAmsNetId = AmsNetId.Local; 22 | 23 | public Form1() 24 | { 25 | InitializeComponent(); 26 | } 27 | private void Form1_Load(object sender, EventArgs e) 28 | { 29 | //Create a new instance of class AdsClient 30 | tcClient = new AdsClient(); 31 | 32 | //Connect to target PLC - Port 851 33 | tcClient.Connect(targetAmsNetId, 851); 34 | } 35 | 36 | private void btnMethodCall_Click(object sender, EventArgs e) 37 | { 38 | try 39 | { 40 | //Get the values entered into the form 41 | short first = Convert.ToInt16(tbValueA.Text); 42 | short second = Convert.ToInt16(tbValueB.Text); 43 | 44 | //Add a function block FB_Math in TwinCAT 45 | //Create a method called mAdd on FB_Math, with the following signature 46 | 47 | /* {attribute 'TcRpcEnable'} 48 | METHOD PUBLIC mAdd : INT 49 | VAR_INPUT 50 | i1 : INT := 0; 51 | i2 : INT := 0; 52 | END_VAR 53 | */ 54 | 55 | //Instance the function block in main call it fbMath 56 | 57 | //Call the method mAdd of fbMath in MAIN 58 | short result = (short)tcClient.InvokeRpcMethod("MAIN.fbMath", "mAdd", new object[] { first, second }); 59 | 60 | //Display the result 61 | tbSumAB.Text = result.ToString(); 62 | } 63 | catch (Exception ex) 64 | { 65 | MessageBox.Show(ex.Message); 66 | } 67 | } 68 | 69 | /// 70 | /// Clean up any resources being used. 71 | /// 72 | /// true if managed resources should be disposed; otherwise, false. 73 | protected override void Dispose(bool disposing) 74 | { 75 | if (disposing) 76 | { 77 | // Dispose the Client during Form Cleanup 78 | tcClient.Dispose(); 79 | 80 | if (components != null) 81 | { 82 | components.Dispose(); 83 | } 84 | } 85 | base.Dispose(disposing); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace S30_MethodCall 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Setting ComVisible to false makes the types in this assembly not visible 6 | // to COM components. If you need to access a type in this assembly from 7 | // COM, set the ComVisible attribute to true on that type. 8 | [assembly: ComVisible(false)] 9 | 10 | // The following GUID is for the ID of the typelib if this project is exposed to COM 11 | [assembly: Guid("d79218f5-1e8a-40a1-9314-b11de07a8851")] 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace _30_ADS.NET_MethodCall.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_30_ADS.NET_MethodCall.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace _30_ADS.NET_MethodCall.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sources/BaseSamples/MethodCall/S30_MethodCall.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/PLCStartStop/PLCStartStop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using TwinCAT.Ads; 6 | 7 | namespace S20_PLCStartStop 8 | { 9 | class PLCStartStop 10 | { 11 | static void Main(string[] args) 12 | { 13 | //Create a new instance of class AdsClient 14 | AdsClient tcClient = new AdsClient(); 15 | 16 | try 17 | { 18 | //Connect to local PLC - Runtime 1 - Port 851 19 | tcClient.Connect(851); 20 | 21 | Console.WriteLine(" PLC Run\t[R]"); 22 | Console.WriteLine(" PLC Stop\t[S]"); 23 | Console.WriteLine("\r\nPlease choose \"Run\" or \"Stop\" and confirm with enter.."); 24 | string sInput = Console.ReadLine().ToLower(); 25 | 26 | //Process user input and apply chosen state 27 | do{ 28 | switch (sInput) 29 | { 30 | case "r": tcClient.WriteControl(new StateInfo(AdsState.Run, tcClient.ReadState().DeviceState)); break; 31 | case "s": tcClient.WriteControl(new StateInfo(AdsState.Stop, tcClient.ReadState().DeviceState)); break; 32 | default: Console.WriteLine("Please choose \"Run\" or \"Stop\" and confirm with enter.."); sInput = Console.ReadLine().ToLower(); break; 33 | } 34 | } while (sInput != "r" && sInput != "s"); 35 | } 36 | catch (Exception ex) 37 | { 38 | Console.WriteLine(ex.Message); 39 | Console.ReadKey(); 40 | } 41 | finally 42 | { 43 | tcClient.Dispose(); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/BaseSamples/PLCStartStop/S20_PLCStartStop.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | PLCStartStop 5 | PLCStartStop 6 | net80 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Reactive/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Setting ComVisible to false makes the types in this assembly not visible 6 | // to COM components. If you need to access a type in this assembly from 7 | // COM, set the ComVisible attribute to true on that type. 8 | [assembly: ComVisible(false)] 9 | 10 | // The following GUID is for the ID of the typelib if this project is exposed to COM 11 | [assembly: Guid("ddee523c-f2d5-4d10-9ee8-1801087fbbc4")] 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Reactive/S80_Reactive.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | net80 5 | 6 | 7 | S80_Reactive.Program 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadArray/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace S12_ReadArray 2 | { 3 | public partial class Form1 4 | { 5 | #region Windows Form Designer generated code 6 | /// 7 | /// Required method for Designer support - do not modify 8 | /// the contents of this method with the code editor. 9 | /// 10 | private void InitializeComponent() 11 | { 12 | this.lbArray = new System.Windows.Forms.ListBox(); 13 | this.btnRead = new System.Windows.Forms.Button(); 14 | this.SuspendLayout(); 15 | // 16 | // lbArray 17 | // 18 | this.lbArray.ItemHeight = 16; 19 | this.lbArray.Location = new System.Drawing.Point(19, 9); 20 | this.lbArray.Name = "lbArray"; 21 | this.lbArray.Size = new System.Drawing.Size(173, 244); 22 | this.lbArray.TabIndex = 0; 23 | // 24 | // btnRead 25 | // 26 | this.btnRead.Location = new System.Drawing.Point(19, 277); 27 | this.btnRead.Name = "btnRead"; 28 | this.btnRead.Size = new System.Drawing.Size(173, 26); 29 | this.btnRead.TabIndex = 1; 30 | this.btnRead.Text = "Read"; 31 | this.btnRead.Click += new System.EventHandler(this.btnRead_Click); 32 | // 33 | // Form1 34 | // 35 | this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); 36 | this.ClientSize = new System.Drawing.Size(212, 322); 37 | this.Controls.Add(this.btnRead); 38 | this.Controls.Add(this.lbArray); 39 | this.Name = "Form1"; 40 | this.Text = "Sample12"; 41 | this.Load += new System.EventHandler(this.Form1_Load); 42 | this.ResumeLayout(false); 43 | 44 | } 45 | #endregion 46 | 47 | private System.Windows.Forms.Button btnRead; 48 | private System.ComponentModel.Container components = null; 49 | private System.Windows.Forms.ListBox lbArray; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadArray/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace S12_ReadArray 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadArray/S12_ReadArray.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | S12_ReadArray.Program 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadVariableDeclaration/S21_ReadVariableDeclaration.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadWriteAnyType/S14_ReadWriteAnyType.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadWriteDateTime/S11_ReadWriteDateTime.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadWriteFlag/S01_ReadWriteFlag.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | S01_ReadWriteFlag.Form1 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/ReadWriteString/S10_ReadWriteString.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/00_TwinCAT_Demo_PLC.tsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | PlcTask 8 | 9 | 10 | 11 | 12 | 13 | 14 | PLC Instance 15 | {08500001-0000-0000-F000-000000000064} 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/DUTs/PLCStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/DUTs/TComplexStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/DUTs/TSimpleStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/GVLs/GVL.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/POUs/FB_Math.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/POUs/MAIN.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 60 | 61 | boolVal); 72 | IF boolVal THEN 73 | IF intval > 12 THEN 74 | intval := 0; 75 | END_IF 76 | intVal := intVal + 1; 77 | stringVal := LEFT(Text, intVal); 78 | TON1(IN:= FALSE); 79 | END_IF 80 | 81 | //Sample12 82 | FOR Index := 0 TO 99 DO 83 | PLCArray[Index] := 3500 + INDEX; 84 | END_FOR]]> 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/PlcTask.TcTTO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 10000 6 | 20 7 | 8 | MAIN 9 | 10 | {e1744858-d7d2-49bb-9dd1-d675c73185e6} 11 | {a4e352f1-9bac-45f6-8519-c41c7eb75262} 12 | {00db564b-2301-4548-bca8-31a38e2c32f3} 13 | {23f5e55b-06ee-48f1-a651-6ab1ce027776} 14 | {b61df5c7-99e6-45db-98f9-8809ff94eebe} 15 | 16 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SamplePlc/PLC/Version/Global_Version.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Server/NotificationRequestEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using TwinCAT.Ads; 5 | 6 | namespace S60_Server 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Microsoft.Extensions.Hosting; 3 | using System; 4 | 5 | namespace S60_Server 6 | { 7 | class Program 8 | { 9 | public static void Main(string[] args) 10 | { 11 | CreateHostBuilder(args).Build().Run(); 12 | } 13 | 14 | public static IHostBuilder CreateHostBuilder(string[] args) => 15 | Host.CreateDefaultBuilder(args) 16 | .ConfigureServices((hostContext, services) => 17 | { 18 | services.AddHostedService(); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Server/S60_Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net80 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/Server/Worker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Extensions.Hosting; 7 | using Microsoft.Extensions.Logging; 8 | using TwinCAT.Ads.Server; 9 | 10 | namespace S60_Server 11 | { 12 | 13 | public class ServerWorker : BackgroundService 14 | { 15 | private readonly ILogger _logger; 16 | 17 | public ServerWorker(ILogger logger) 18 | { 19 | _logger = logger; 20 | } 21 | 22 | protected override async Task ExecuteAsync(CancellationToken cancel) 23 | { 24 | // Instantiate the server 25 | AdsSampleServer server = new AdsSampleServer(_logger); 26 | // Connect the server and wait for cancel 27 | await server.ConnectServerAndWaitAsync(cancel); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SumReadWrite/Form1.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | -------------------------------------------------------------------------------- /Sources/BaseSamples/SumReadWrite/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace S22_SumReadWrite 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Sources/BaseSamples/SumReadWrite/S22_AdsSumReadWrite.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | S22_SumReadWrite.Program 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TcStateChange/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace S23_TcStateChange 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | public static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.SetCompatibleTextRenderingDefault(false); 17 | Application.Run(new Form1()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Sources/BaseSamples/TcStateChange/S23_TcStateChange.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net80-windows 5 | true 6 | S23_TcStateChange.Program 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/DUTs/MYSTRUCT.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 13 | 14 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/DUTs/MyComplexStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/DUTs/PLCStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/DUTs/TComplexStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/DUTs/TSimpleStruct.TcDUT: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/GVLs/GVL.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/POUs/FB_Math.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/POUs/MAIN.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 62 | 63 | boolVal); 76 | IF boolVal THEN 77 | IF intval > 12 THEN 78 | intval := 0; 79 | END_IF 80 | intVal := intVal + 1; 81 | stringVal := LEFT(Text, intVal); 82 | TON1(IN:= FALSE); 83 | END_IF 84 | 85 | //Sample12 86 | FOR Index := 0 TO 99 DO 87 | PLCArray[Index] := 3500 + INDEX; 88 | END_FOR 89 | 90 | myComplexStruct.a := true;]]> 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/PlcTask.TcTTO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 10000 6 | 20 7 | 8 | MAIN 9 | 10 | {e1744858-d7d2-49bb-9dd1-d675c73185e6} 11 | {a4e352f1-9bac-45f6-8519-c41c7eb75262} 12 | {00db564b-2301-4548-bca8-31a38e2c32f3} 13 | {23f5e55b-06ee-48f1-a651-6ab1ce027776} 14 | {b61df5c7-99e6-45db-98f9-8809ff94eebe} 15 | 16 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/PLC/Version/Global_Version.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sources/BaseSamples/TwinCAT_Demo_PLC/TwinCAT_Demo_PLC.tsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | PlcTask 8 | 9 | 10 | 11 | 12 | 13 | 14 | PLC Instance 15 | {08500001-0000-0000-F000-000000000064} 16 | 17 | 18 | 0 19 | PlcTask 20 | 21 | #x02010020 22 | 23 | 20 24 | 10000000 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Sources/BaseSamples/WPFConnectionObserver/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Sources/BaseSamples/WPFConnectionObserver/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace S40_WPFConnectionObserver 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sources/BaseSamples/WPFConnectionObserver/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 |