├── .git-blame-ignore-revs ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ ├── dotnet.yml │ └── release.yml ├── .gitignore ├── EDSEditor.sln ├── EDSEditorGUI ├── .gitignore ├── App.config ├── DeviceInfoView.Designer.cs ├── DeviceInfoView.cs ├── DeviceInfoView.resx ├── DeviceODView.Designer.cs ├── DeviceODView.cs ├── DeviceODView.resx ├── DevicePDOView2.Designer.cs ├── DevicePDOView2.cs ├── DevicePDOView2.resx ├── DeviceView.Designer.cs ├── DeviceView.cs ├── DeviceView.resx ├── EDSEditorGUI.csproj ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Index_8287_16x.ico ├── InsertObjects.Designer.cs ├── InsertObjects.cs ├── InsertObjects.resx ├── ListViewEx.cs ├── Microsoft.mshtml.dll ├── ModuleInfo.Designer.cs ├── ModuleInfo.cs ├── ModuleInfo.resx ├── MyTabUserControl.cs ├── MyTabUserControl.resx ├── NewIndex.Designer.cs ├── NewIndex.cs ├── NewIndex.resx ├── NewItem.Designer.cs ├── NewItem.cs ├── NewItem.resx ├── Preferences.Designer.cs ├── Preferences.cs ├── Preferences.resx ├── Profiles │ ├── DS301_profile.xpd │ ├── DS301_profile_old.xpd │ ├── DS401_profile.xpd │ └── DSP302-NMTMaster.xpd ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ReportView.Designer.cs ├── ReportView.cs ├── ReportView.resx ├── Resources │ ├── 305_Close_16x16_72.png │ ├── Close_6519.png │ ├── Compile_191.png │ ├── DriverTemplate_32x.png │ ├── EventLog_5735.png │ ├── ExporttoScript_9881.png │ ├── GenerateAll.png │ ├── GenericVSEditor_9905.png │ ├── Index_8287_16x.png │ ├── InsertColumn_5626.png │ ├── ListBox_686.png │ ├── NewFile_6276.png │ ├── Open_6529.png │ ├── PrintPreviewControl_698.png │ ├── PrintSetup_11011.png │ ├── Print_11009.png │ ├── Remove_16xLG.png │ ├── Save.png │ ├── Save_6530.png │ ├── action_add_16xLG.png │ ├── move_to_bottom.png │ ├── move_to_top.png │ └── notebook_16xLG.png ├── TableLayoutDB.cs ├── UpdateODViewEventArgs.cs ├── Warnings.Designer.cs ├── Warnings.cs ├── Warnings.resx ├── app.manifest ├── packages.config └── style.css ├── EDSEditorGUI2 ├── .gitignore ├── App.axaml ├── App.axaml.cs ├── Assets │ └── avalonia-logo.ico ├── Converter │ └── NewIndexMultiConvert.cs ├── EDSEditorGUI2.csproj ├── Extensions.cs ├── Icons.axaml ├── Mapper │ └── ProtobufferViewModelMapper.cs ├── Program.cs ├── ViewLocator.cs ├── ViewModels │ ├── Device.cs │ ├── DeviceCommissioning.cs │ ├── DeviceInfo.cs │ ├── FileInfo.cs │ ├── MainWindowViewModel.cs │ ├── ObjectDictionary.cs │ ├── OdObject.cs │ ├── OdSubObject.cs │ └── ViewModelBase.cs ├── Views │ ├── DeviceInfoView.axaml │ ├── DeviceInfoView.axaml.cs │ ├── DeviceODView.axaml │ ├── DeviceODView.axaml.cs │ ├── DevicePDOView.axaml │ ├── DevicePDOView.axaml.cs │ ├── DeviceView.axaml │ ├── DeviceView.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── ODIndexRangeView.axaml │ └── ODIndexRangeView.axaml.cs └── app.manifest ├── EDSSharp ├── App.config ├── EDSSharp.csproj ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── GUITests ├── .gitignore ├── GUITests.csproj ├── MappingTests.cs └── ViewModels_OdObjects.cs ├── Images ├── ODDetails.png ├── ODDetailsEdit.png ├── ODList.png └── newod.png ├── Index_8287_16x.ico ├── License-GPLv3.txt ├── Makefile ├── README.md ├── Tests ├── CLITest.cs ├── EDSMappingTests.cs ├── EDSParserTests.cs ├── ExporterTests.cs ├── ExporterTestsV4.cs ├── PDOHelperTests.cs ├── Properties │ └── AssemblyInfo.cs ├── Tests.csproj ├── XDDImportExportTest.cs ├── minimal_project.xdd └── packages.config ├── build └── index.html ├── libEDSsharp ├── CanOpenEDS.cs ├── CanOpenEDSMapping.cs ├── CanOpenNodeExporter.cs ├── CanOpenNodeExporter_V4.cs ├── CanOpenXDD.cs ├── CanOpenXDD_1_1.cs ├── CanOpenXSD_1_0.cs ├── CanOpenXSD_1_1.cs ├── DocumentationGenHtml.cs ├── DocumentationGenMarkup.cs ├── ExporterFactory.cs ├── Filetypes.cs ├── IExporter.cs ├── IFileExporter.cs ├── NetworkPDOreport.cs ├── PDOHelper.cs ├── Properties │ ├── Resources.Designer.cs │ └── Resources.resx ├── StringUnescape.cs ├── Warnings.cs ├── eds.cs ├── extensions.cs ├── libEDSsharp.csproj └── proto │ ├── .gitignore │ └── CanOpen.proto ├── pic1.jpg ├── pic2.jpg ├── pic3.jpg ├── pic4.jpg └── setup.nsi /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # .git-blame-ignore-revs 2 | 3 | # normalise line endings 4 | 6336108d916fe2fe8167255257c71adf2cac062f 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Explicitly declare text files you want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.cs text 7 | *.csproj text 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Version used** 21 | Information about what version you found the bug in 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Screenshots** 27 | If applicable, add screenshots to help explain your problem. 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | 32 | **files upload** 33 | Add any files that will help to reproduce the problem 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/dotnet.yml: -------------------------------------------------------------------------------- 1 | name: .NET 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | dotnet: [net481, net8] 14 | configuration: [Debug, Release] 15 | 16 | runs-on: windows-latest 17 | # runs-on: ubuntu-latest # Error: setup-msbuild can only be run on Windows runners 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 0 23 | - name: Setup .NET 24 | uses: microsoft/setup-msbuild@v2 25 | - name: C# problem matcher 26 | run: | 27 | Invoke-WebRequest "https://raw.githubusercontent.com/actions/setup-dotnet/main/.github/csc.json" -OutFile "csc.json" 28 | echo "::add-matcher::csc.json" 29 | # uses: actions/setup-dotnet@v2 30 | # with: 31 | # dotnet-version: 5.0.x 32 | # - name: Restore dependencies 33 | # run: dotnet restore 34 | - name: Add Packages 35 | run: | 36 | dotnet restore 37 | - name: Build 38 | # run: make all # builds the Debug configuration 39 | run: | 40 | msbuild -p:Build${{ matrix.dotnet }}=true /property:Configuration=${{ matrix.configuration }} 41 | # run: dotnet build --no-restore 42 | - name: Test 43 | run: | 44 | dotnet test --no-build --verbosity normal Tests\bin\${{ matrix.configuration }}\${{ matrix.dotnet }}*\tests.dll 45 | - name: GUITest 46 | if: matrix.dotnet == 'net8' 47 | run: | 48 | dotnet test --no-build --verbosity normal GUITests\bin\${{ matrix.configuration }}\${{ matrix.dotnet }}*\GUITests.dll 49 | - name: Upload Artifact 50 | uses: actions/upload-artifact@v4 51 | with: 52 | name: EDSEditor_${{ matrix.dotnet }} 53 | path: | 54 | EDSEditorGUI\bin\Release\ 55 | EDSSharp\bin\Release\ 56 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: make release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*.*.*" 7 | 8 | jobs: 9 | build: 10 | runs-on: windows-latest 11 | permissions: 12 | contents: write 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | with: 17 | fetch-depth: 0 18 | - name: Setup .NET 19 | uses: microsoft/setup-msbuild@v2 20 | - name: Add Packages 21 | run: | 22 | dotnet restore 23 | - name: Build 24 | run: | 25 | msbuild /property:Configuration=Release 26 | - name: Check for release tag 27 | run: | 28 | $release = "${{ github.ref_name }}" -match "v[\d]*[.][\d]*[.][\d]*$" 29 | $prerelease = If ($release) {"false"} else {"true"} 30 | echo "prerelease=$prerelease" >> $env:GITHUB_ENV 31 | - name: Make release package 32 | run: | 33 | $tag = "${{ github.ref_name }}" 34 | $filename = "CANopenEditor-$tag-binary.zip" 35 | Compress-Archive -CompressionLevel Optimal -Path "EDSEditorGUI\bin\Release\*","EDSSharp\bin\Release\*" -DestinationPath $filename 36 | echo "binary_name=$filename" >> $env:GITHUB_ENV 37 | - name: make release 38 | uses: softprops/action-gh-release@v2 39 | with: 40 | prerelease: ${{ env.prerelease }} 41 | files: | 42 | ${{ env.binary_name }} 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /libEDSsharp/obj 2 | /libEDSsharp/bin 3 | /EDSEditorGUI/obj 4 | /EDSEditorGUI/bin 5 | /Cia306Tester/obj 6 | /libEDSsharp/bin 7 | /*.suo 8 | /libEDSsharp/obj 9 | /EDSEditorGUI/obj/Release 10 | /EDSEditorGUI/bin/Release 11 | /.vs/EDSEditorGUI/v14/*.suo 12 | /.vs/EDSEditor/v14/*.suo 13 | edseditor-Setup.exe 14 | /Tests/bin 15 | /Tests/obj 16 | *.exe 17 | /.vs 18 | *.suo 19 | /EDSSharp/bin/Debug 20 | /EDSSharp/obj 21 | /EDSSharp/bin/Release 22 | /EDSEditorGUI/bin/*.zip 23 | /Backup 24 | /SourceGrid_4.21 25 | /packages/ 26 | *.bak 27 | -------------------------------------------------------------------------------- /EDSEditor.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.329 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSEditorGUI", "EDSEditorGUI\EDSEditorGUI.csproj", "{13D2D8ED-242B-4283-BF14-AA79FE875F7C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libEDSsharp", "libEDSsharp\libEDSsharp.csproj", "{CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{2A479BF3-7628-409B-8A29-9314C308445E}" 11 | ProjectSection(ProjectDependencies) = postProject 12 | {8B7A7545-6257-44BF-8868-F429E1B72C77} = {8B7A7545-6257-44BF-8868-F429E1B72C77} 13 | EndProjectSection 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSSharp", "EDSSharp\EDSSharp.csproj", "{8B7A7545-6257-44BF-8868-F429E1B72C77}" 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSEditorGUI2", "EDSEditorGUI2\EDSEditorGUI2.csproj", "{F175A47B-8BB8-480F-8D31-AF802086B8B4}" 18 | EndProject 19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUITests", "GUITests\GUITests.csproj", "{9B9B5461-1864-484D-A49D-D39422DA16E0}" 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Any CPU = Debug|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {13D2D8ED-242B-4283-BF14-AA79FE875F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {13D2D8ED-242B-4283-BF14-AA79FE875F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {13D2D8ED-242B-4283-BF14-AA79FE875F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {13D2D8ED-242B-4283-BF14-AA79FE875F7C}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {2A479BF3-7628-409B-8A29-9314C308445E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {2A479BF3-7628-409B-8A29-9314C308445E}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {F175A47B-8BB8-480F-8D31-AF802086B8B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {F175A47B-8BB8-480F-8D31-AF802086B8B4}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {F175A47B-8BB8-480F-8D31-AF802086B8B4}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {F175A47B-8BB8-480F-8D31-AF802086B8B4}.Release|Any CPU.Build.0 = Release|Any CPU 47 | {9B9B5461-1864-484D-A49D-D39422DA16E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 48 | {9B9B5461-1864-484D-A49D-D39422DA16E0}.Debug|Any CPU.Build.0 = Debug|Any CPU 49 | {9B9B5461-1864-484D-A49D-D39422DA16E0}.Release|Any CPU.ActiveCfg = Release|Any CPU 50 | {9B9B5461-1864-484D-A49D-D39422DA16E0}.Release|Any CPU.Build.0 = Release|Any CPU 51 | EndGlobalSection 52 | GlobalSection(SolutionProperties) = preSolution 53 | HideSolutionNode = FALSE 54 | EndGlobalSection 55 | GlobalSection(ExtensibilityGlobals) = postSolution 56 | SolutionGuid = {E8D4F345-888A-449F-A933-E6B3B4743FE5} 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /EDSEditorGUI/.gitignore: -------------------------------------------------------------------------------- 1 | version.txt 2 | EDSEditorGUI.csproj.user 3 | -------------------------------------------------------------------------------- /EDSEditorGUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 0 15 | 16 | 17 | 65535 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /EDSEditorGUI/DeviceInfoView.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EDSEditorGUI/DevicePDOView2.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /EDSEditorGUI/DeviceView.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of libEDSsharp. 3 | 4 | libEDSsharp is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | libEDSsharp is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with libEDSsharp. If not, see . 16 | 17 | Copyright(c) 2016 - 2019 Robin Cornelius 18 | */ 19 | 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Windows.Forms; 23 | using libEDSsharp; 24 | 25 | namespace ODEditor 26 | { 27 | public partial class DeviceView : MyTabUserControl 28 | { 29 | 30 | readonly public EDSsharp eds; 31 | readonly private List network; 32 | 33 | public event EventHandler UpdateODViewForEDS; 34 | 35 | public DeviceView(EDSsharp eds_target, List network) 36 | { 37 | eds = eds_target; 38 | this.network = network; 39 | 40 | InitializeComponent(); 41 | 42 | this.deviceODView1.network = network; 43 | this.deviceODView1.UpdateODViewForEDS += DeviceODView1_UpdateODView; 44 | 45 | foreach (TabPage tp in tabControl1.TabPages) 46 | { 47 | foreach(Object o in tp.Controls) 48 | { 49 | if (o is MyTabUserControl) 50 | { 51 | MyTabUserControl t = (MyTabUserControl)o; 52 | 53 | t.UpdateDeviceInfo += dispatch_updatedevice; 54 | t.UpdateOD += dispatch_updateOD; 55 | t.UpdatePDOs += dispatch_updatePDOinfo; 56 | } 57 | } 58 | } 59 | 60 | devicePDOView1.Init(true); 61 | devicePDOView2.Init(false); 62 | 63 | } 64 | 65 | private void DeviceODView1_UpdateODView(object sender, UpdateODViewEventArgs e) 66 | { 67 | EventHandler handler = UpdateODViewForEDS; 68 | if(handler != null) 69 | { 70 | handler(this, e); 71 | } 72 | } 73 | 74 | #region UpdateDispatchEvents 75 | 76 | // This region handles update requests that are dispatched to the various user controls on the tabs 77 | 78 | public void dispatch_updatedevice() 79 | { 80 | if (eds == null) 81 | return; 82 | 83 | deviceInfoView.eds = eds; 84 | deviceInfoView.populatedeviceinfo(); 85 | 86 | 87 | moduleInfo1.eds = eds; 88 | moduleInfo1.populatemoduleinfo(); 89 | } 90 | 91 | public void dispatch_updatePDOinfo() 92 | { 93 | if (eds == null) 94 | return; 95 | 96 | devicePDOView1.eds = eds; 97 | devicePDOView1.UpdatePDOinfo(); 98 | 99 | devicePDOView2.eds = eds; 100 | devicePDOView2.UpdatePDOinfo(); 101 | 102 | } 103 | 104 | public void dispatch_updateOD() 105 | { 106 | if (eds == null) 107 | return; 108 | 109 | deviceODView1.PopulateObjectLists(eds); 110 | deviceODView1.PopulateSubList(); 111 | deviceODView1.PopulateObject(); 112 | } 113 | 114 | #endregion 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /EDSEditorGUI/EDSEditorGUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net481 4 | net8.0-windows 5 | net481;net8.0-windows 6 | true 7 | WinExe 8 | ODEditor 9 | EDSEditor 10 | false 11 | publish\ 12 | true 13 | Disk 14 | false 15 | Foreground 16 | 7 17 | Days 18 | false 19 | false 20 | true 21 | 0 22 | 1.0.0.%2a 23 | false 24 | true 25 | false 26 | true 27 | true 28 | true 29 | SystemAware 30 | 31 | 32 | Index_8287_16x.ico 33 | 34 | 35 | app.manifest 36 | 37 | 38 | $(NoWarn);CA1416 39 | 40 | 41 | 42 | False 43 | True 44 | .\Microsoft.mshtml.dll 45 | 46 | 47 | 48 | 49 | UserControl 50 | 51 | 52 | UserControl 53 | 54 | 55 | UserControl 56 | 57 | 58 | UserControl 59 | 60 | 61 | Component 62 | 63 | 64 | UserControl 65 | 66 | 67 | UserControl 68 | 69 | 70 | Component 71 | 72 | 73 | PreserveNewest 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | False 82 | Microsoft .NET Framework 4.8 %28x86 und x64%29 83 | true 84 | 85 | 86 | False 87 | .NET Framework 3.5 SP1 88 | false 89 | 90 | 91 | 92 | 93 | 94 | Always 95 | 96 | 97 | PreserveNewest 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | git describe --tags --long --dirty > "$(MSBuildProjectDirectory)$([System.IO.Path]::DirectorySeparatorChar)version.txt" || exit 0 109 | 110 | -------------------------------------------------------------------------------- /EDSEditorGUI/Index_8287_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Index_8287_16x.ico -------------------------------------------------------------------------------- /EDSEditorGUI/Microsoft.mshtml.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Microsoft.mshtml.dll -------------------------------------------------------------------------------- /EDSEditorGUI/ModuleInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using libEDSsharp; 11 | 12 | namespace ODEditor 13 | { 14 | public partial class ModuleInfo : MyTabUserControl 15 | { 16 | public EDSsharp eds = null; 17 | 18 | public ModuleInfo() 19 | { 20 | InitializeComponent(); 21 | 22 | if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime) 23 | { 24 | // Design time logic 25 | return; 26 | } 27 | 28 | Invalidated += ModuleInfo_Invalidated; 29 | 30 | } 31 | 32 | private void ModuleInfo_Invalidated(object sender, InvalidateEventArgs e) 33 | { 34 | 35 | 36 | 37 | } 38 | 39 | public void populatemoduleinfo() 40 | { 41 | if (eds == null) 42 | return; 43 | 44 | textBox_nrsupportedmodules.Text = eds.sm.NrOfEntries.ToString(); 45 | 46 | this.listView_modules.Items.Clear(); 47 | 48 | 49 | foreach(KeyValuePair kvp in eds.modules) 50 | { 51 | Module m = kvp.Value; 52 | UInt16 modindex = kvp.Key; 53 | 54 | libEDSsharp.ModuleInfo mi = m.mi; 55 | ListViewItem lvi2 = new ListViewItem(String.Format("{0}", kvp.Key)); 56 | lvi2.SubItems.Add(string.Format("{0}", mi.ProductName)); 57 | lvi2.SubItems.Add(string.Format("{0}", mi.ProductVersion)); 58 | lvi2.SubItems.Add(string.Format("{0}", mi.ProductRevision)); 59 | lvi2.SubItems.Add(string.Format("{0}", mi.OrderCode)); 60 | 61 | 62 | if (eds.cm.connectedmodulelist.Count > 0) 63 | { 64 | if (eds.cm.connectedmodulelist.ContainsKey(kvp.Key)) 65 | { 66 | lvi2.BackColor = Color.Green; 67 | } 68 | else 69 | { 70 | lvi2.BackColor = Color.Tomato; 71 | } 72 | } 73 | 74 | 75 | listView_modules.Items.Add(lvi2); 76 | 77 | } 78 | 79 | } 80 | 81 | private void listView_modules_MouseClick(object sender, MouseEventArgs e) 82 | { 83 | if (listView_modules.SelectedItems.Count != 1) 84 | return; 85 | 86 | listView_extends.Items.Clear(); 87 | 88 | UInt16 index = Convert.ToUInt16(listView_modules.SelectedItems[0].Text, 10); 89 | 90 | ModuleSubExtends mse = eds.modules[index].mse; 91 | 92 | foreach (UInt16 sindex in mse.objectlist.Values) 93 | { 94 | ListViewItem lvi = null; 95 | 96 | if (eds.ods.ContainsKey(sindex)) 97 | { 98 | lvi = new ListViewItem(string.Format("0x{0:x4}",sindex)); 99 | lvi.SubItems.Add(eds.ods[sindex].parameter_name); 100 | } 101 | else 102 | { 103 | if (eds.modules[index].modulesubext.ContainsKey(sindex)) 104 | { 105 | lvi = new ListViewItem(string.Format("0x{0:x4}", sindex)); 106 | lvi.SubItems.Add(eds.modules[index].modulesubext[sindex].parameter_name); 107 | 108 | } 109 | else 110 | { 111 | lvi = new ListViewItem(string.Format("0x{0:x4}", sindex)); 112 | lvi.SubItems.Add("** FAULT OD NOT FOUND **"); 113 | } 114 | } 115 | 116 | listView_extends.Items.Add(lvi); 117 | 118 | 119 | } 120 | 121 | 122 | textBox_modulecomments.Clear(); 123 | 124 | if (eds.modules.ContainsKey(index)) 125 | { 126 | ModuleComments mc = eds.modules[index].mc; 127 | 128 | foreach (string s in mc.comments) 129 | { 130 | textBox_modulecomments.AppendText(s + "\r\n"); 131 | } 132 | } 133 | 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /EDSEditorGUI/ModuleInfo.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EDSEditorGUI/MyTabUserControl.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of libEDSsharp. 3 | 4 | libEDSsharp is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | libEDSsharp is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with libEDSsharp. If not, see . 16 | 17 | Copyright(c) 2016 - 2019 Robin Cornelius 18 | */ 19 | 20 | using System; 21 | using System.Collections.Generic; 22 | using System.ComponentModel; 23 | using System.Drawing; 24 | using System.Data; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Threading.Tasks; 28 | using System.Windows.Forms; 29 | using System.Globalization; 30 | 31 | 32 | namespace ODEditor 33 | { 34 | public class MyTabUserControl : UserControl 35 | { 36 | #region events 37 | 38 | public delegate void UpdatePDOs_Handler(); 39 | public event UpdatePDOs_Handler UpdatePDOs; 40 | 41 | public void doUpdatePDOs() 42 | { 43 | if (UpdatePDOs != null) 44 | UpdatePDOs(); 45 | } 46 | 47 | public delegate void UpdateDeviceInfo_Handler(); 48 | public event UpdateDeviceInfo_Handler UpdateDeviceInfo; 49 | 50 | public void doUpdateDeviceInfo() 51 | { 52 | if (UpdateDeviceInfo != null) 53 | UpdateDeviceInfo(); 54 | } 55 | 56 | public delegate void UpdateOD_Handler(); 57 | public event UpdateOD_Handler UpdateOD; 58 | 59 | public void doUpdateOD() 60 | { 61 | if (UpdateOD != null) 62 | UpdateOD(); 63 | } 64 | 65 | #endregion 66 | 67 | private void InitializeComponent() 68 | { 69 | 70 | 71 | this.SuspendLayout(); 72 | // 73 | // MyTabUserControl 74 | // 75 | this.Name = "MyTabUserControl"; 76 | this.Size = new System.Drawing.Size(357, 262); 77 | this.ResumeLayout(false); 78 | 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /EDSEditorGUI/MyTabUserControl.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EDSEditorGUI/NewIndex.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of libEDSsharp. 3 | 4 | libEDSsharp is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | libEDSsharp is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with libEDSsharp. If not, see . 16 | 17 | Copyright(c) 2016 - 2019 Robin Cornelius 18 | */ 19 | 20 | using System; 21 | using System.Windows.Forms; 22 | using libEDSsharp; 23 | 24 | namespace ODEditor 25 | { 26 | public partial class NewIndex : Form 27 | { 28 | readonly EDSsharp eds; 29 | public ODentry od = null; 30 | 31 | public NewIndex(EDSsharp eds, UInt16 index) 32 | { 33 | this.eds = eds; 34 | 35 | InitializeComponent(); 36 | 37 | numericUpDown_index.Value = index; 38 | 39 | DialogResult = DialogResult.Cancel; 40 | } 41 | 42 | private void Button_cancel_Click(object sender, EventArgs e) 43 | { 44 | Close(); 45 | } 46 | 47 | private void Button_create_Click(object sender, EventArgs e) 48 | { 49 | UInt16 index = (UInt16) numericUpDown_index.Value; 50 | if (eds.ods.ContainsKey(index)) 51 | { 52 | MessageBox.Show(String.Format("Index 0x{0:X4} already exists in OD", index)); 53 | return; 54 | } 55 | 56 | string name = textBox_name.Text; 57 | if (name == "") 58 | { 59 | MessageBox.Show("Please specify a name"); 60 | return; 61 | } 62 | 63 | ObjectType objectType; 64 | if (radioButton_var.Checked) 65 | objectType = ObjectType.VAR; 66 | else if (radioButton_array.Checked) 67 | objectType = ObjectType.ARRAY; 68 | else if (radioButton_record.Checked) 69 | objectType = ObjectType.RECORD; 70 | else 71 | { 72 | MessageBox.Show("Please specify the Object Type"); 73 | return; 74 | } 75 | 76 | // create OD entry 77 | if (objectType == ObjectType.VAR) 78 | { 79 | od = new ODentry 80 | { 81 | parameter_name = name, 82 | Index = index, 83 | objecttype = objectType, 84 | datatype = DataType.UNSIGNED32, 85 | accesstype = EDSsharp.AccessType.rw, 86 | defaultvalue = "0" 87 | }; 88 | } 89 | else 90 | { 91 | od = new ODentry 92 | { 93 | parameter_name = name, 94 | Index = index, 95 | objecttype = objectType, 96 | }; 97 | 98 | od.subobjects.Add(0, new ODentry 99 | { 100 | parent = od, 101 | parameter_name = "Highest sub-index supported", 102 | objecttype = ObjectType.VAR, 103 | datatype = DataType.UNSIGNED8, 104 | accesstype = EDSsharp.AccessType.ro, 105 | defaultvalue = "0x01" 106 | }); 107 | 108 | od.subobjects.Add(1, new ODentry 109 | { 110 | parent = od, 111 | parameter_name = "Sub Object 1", 112 | objecttype = ObjectType.VAR, 113 | datatype = DataType.UNSIGNED32, 114 | accesstype = EDSsharp.AccessType.rw, 115 | defaultvalue = "0" 116 | }); 117 | } 118 | 119 | eds.ods.Add(od.Index, od); 120 | 121 | DialogResult = DialogResult.OK; 122 | Close(); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /EDSEditorGUI/NewItem.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ODEditor 2 | { 3 | partial class NewItem 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.button_create = new System.Windows.Forms.Button(); 32 | this.button_cancel = new System.Windows.Forms.Button(); 33 | this.label2 = new System.Windows.Forms.Label(); 34 | this.textBox_name = new System.Windows.Forms.TextBox(); 35 | this.SuspendLayout(); 36 | // 37 | // button_create 38 | // 39 | this.button_create.Location = new System.Drawing.Point(15, 86); 40 | this.button_create.Name = "button_create"; 41 | this.button_create.Size = new System.Drawing.Size(108, 37); 42 | this.button_create.TabIndex = 2; 43 | this.button_create.Text = "Create"; 44 | this.button_create.UseVisualStyleBackColor = true; 45 | this.button_create.Click += new System.EventHandler(this.button_create_Click); 46 | // 47 | // button_cancel 48 | // 49 | this.button_cancel.Location = new System.Drawing.Point(153, 86); 50 | this.button_cancel.Name = "button_cancel"; 51 | this.button_cancel.Size = new System.Drawing.Size(108, 37); 52 | this.button_cancel.TabIndex = 3; 53 | this.button_cancel.Text = "Cancel"; 54 | this.button_cancel.UseVisualStyleBackColor = true; 55 | this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click); 56 | // 57 | // label2 58 | // 59 | this.label2.AutoSize = true; 60 | this.label2.Location = new System.Drawing.Point(12, 38); 61 | this.label2.Name = "label2"; 62 | this.label2.Size = new System.Drawing.Size(35, 13); 63 | this.label2.TabIndex = 9; 64 | this.label2.Text = "Name"; 65 | // 66 | // textBox_name 67 | // 68 | this.textBox_name.Location = new System.Drawing.Point(53, 35); 69 | this.textBox_name.Name = "textBox_name"; 70 | this.textBox_name.Size = new System.Drawing.Size(208, 20); 71 | this.textBox_name.TabIndex = 1; 72 | this.textBox_name.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_name_KeyPress); 73 | // 74 | // NewItem 75 | // 76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 78 | this.ClientSize = new System.Drawing.Size(285, 139); 79 | this.Controls.Add(this.textBox_name); 80 | this.Controls.Add(this.label2); 81 | this.Controls.Add(this.button_cancel); 82 | this.Controls.Add(this.button_create); 83 | this.Name = "NewItem"; 84 | this.Text = "Add item"; 85 | this.ResumeLayout(false); 86 | this.PerformLayout(); 87 | 88 | } 89 | 90 | #endregion 91 | 92 | private System.Windows.Forms.Button button_create; 93 | private System.Windows.Forms.Button button_cancel; 94 | private System.Windows.Forms.Label label2; 95 | private System.Windows.Forms.TextBox textBox_name; 96 | } 97 | } -------------------------------------------------------------------------------- /EDSEditorGUI/NewItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of libEDSsharp. 3 | 4 | libEDSsharp is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | libEDSsharp is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with libEDSsharp. If not, see . 16 | 17 | Copyright(c) 2016 - 2019 Robin Cornelius 18 | Copyright(c) 2017 Neuberger Gebäudeautomation martin.wagner@neuberger.net> 19 | */ 20 | 21 | using System; 22 | using System.Windows.Forms; 23 | 24 | namespace ODEditor 25 | { 26 | public partial class NewItem : Form 27 | { 28 | public string name; 29 | 30 | public NewItem(string title) 31 | { 32 | InitializeComponent(); 33 | Text = title; 34 | 35 | DialogResult = DialogResult.Cancel; 36 | } 37 | 38 | private void Create() 39 | { 40 | name = textBox_name.Text; 41 | 42 | if (name == "") 43 | { 44 | MessageBox.Show("Please specify a name"); 45 | } 46 | else 47 | { 48 | DialogResult = DialogResult.OK; 49 | Close(); 50 | } 51 | } 52 | 53 | private void button_cancel_Click(object sender, EventArgs e) 54 | { 55 | Close(); 56 | } 57 | 58 | private void button_create_Click(object sender, EventArgs e) 59 | { 60 | Create(); 61 | } 62 | 63 | private void textBox_name_KeyPress(object sender, KeyPressEventArgs e) 64 | { 65 | if (e.KeyChar == 0x1B) 66 | { 67 | Close(); 68 | } 69 | else if (e.KeyChar == '\r') 70 | { 71 | Create(); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /EDSEditorGUI/NewItem.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EDSEditorGUI/Preferences.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using libEDSsharp; 11 | 12 | namespace ODEditor 13 | { 14 | public partial class Preferences : Form 15 | { 16 | public Preferences() 17 | { 18 | InitializeComponent(); 19 | 20 | comboBox_exporter.DataSource = Enum.GetValues(typeof(ExporterFactory.Exporter)); 21 | 22 | comboBox_exporter.SelectedItem = (ExporterFactory.Exporter)Properties.Settings.Default.ExporterType; 23 | 24 | UInt32 mask = Properties.Settings.Default.WarningMask; 25 | 26 | if ((mask & 0x01) == 0x01) 27 | checkBox_genericwarning.Checked = true; 28 | if ((mask & 0x02) == 0x02) 29 | checkBox_renamewarning.Checked = true; 30 | if ((mask & 0x04) == 0x04) 31 | checkBox_buildwarning.Checked = true; 32 | if ((mask & 0x08) == 0x08) 33 | checkBox_stringwarning.Checked = true; 34 | if ((mask & 0x10) == 0x10) 35 | checkBox_structwarning.Checked = true; 36 | 37 | 38 | } 39 | 40 | private void button_close_Click(object sender, EventArgs e) 41 | { 42 | this.Close(); 43 | } 44 | 45 | private void button_save_Click(object sender, EventArgs e) 46 | { 47 | 48 | ExporterFactory.Exporter exporter; 49 | Enum.TryParse(comboBox_exporter.SelectedValue.ToString(), out exporter); 50 | Properties.Settings.Default.ExporterType = (int)exporter; 51 | 52 | UInt32 mask = 0xFFE0; 53 | 54 | if (checkBox_genericwarning.Checked) 55 | mask |= 0x01; 56 | if (checkBox_renamewarning.Checked) 57 | mask |= 0x02; 58 | if (checkBox_buildwarning.Checked) 59 | mask |= 0x04; 60 | if (checkBox_stringwarning.Checked) 61 | mask |= 0x08; 62 | if (checkBox_structwarning.Checked) 63 | mask |= 0x10; 64 | 65 | Properties.Settings.Default.WarningMask = mask; 66 | 67 | Warnings.warning_mask = mask; 68 | 69 | 70 | Properties.Settings.Default.Save(); 71 | this.Close(); 72 | } 73 | 74 | private void checkBox1_CheckedChanged(object sender, EventArgs e) 75 | { 76 | 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /EDSEditorGUI/Preferences.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EDSEditorGUI/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of libEDSsharp. 3 | 4 | libEDSsharp is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | libEDSsharp is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with libEDSsharp. If not, see . 16 | 17 | Copyright(c) 2016 - 2019 Robin Cornelius 18 | */ 19 | 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Threading.Tasks; 24 | using System.Windows.Forms; 25 | 26 | namespace ODEditor 27 | { 28 | static class Program 29 | { 30 | /// 31 | /// The main entry point for the application. 32 | /// 33 | [STAThread] 34 | static void Main() 35 | { 36 | Application.EnableVisualStyles(); 37 | Application.SetCompatibleTextRenderingDefault(false); 38 | Application.Run(new ODEditor_MainForm()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /EDSEditorGUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("EDSEditorGUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EDSEditorGUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7fc05717-0248-41a8-9cb8-34f6fc499471")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /EDSEditorGUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.42000 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ODEditor.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.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 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 29 | public int ExporterType { 30 | get { 31 | return ((int)(this["ExporterType"])); 32 | } 33 | set { 34 | this["ExporterType"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("65535")] 41 | public uint WarningMask { 42 | get { 43 | return ((uint)(this["WarningMask"])); 44 | } 45 | set { 46 | this["WarningMask"] = value; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /EDSEditorGUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 0 7 | 8 | 9 | 65535 10 | 11 | 12 | -------------------------------------------------------------------------------- /EDSEditorGUI/ReportView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.IO; 4 | using mshtml; 5 | 6 | namespace ODEditor 7 | { 8 | public partial class ReportView : Form 9 | { 10 | public ReportView(string pathtohtml) 11 | { 12 | InitializeComponent(); 13 | 14 | 15 | 16 | webBrowser1.Url = new Uri(pathtohtml); 17 | 18 | webBrowser1.Navigated += WebBrowser1_Navigated; 19 | 20 | 21 | } 22 | 23 | private void WebBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) 24 | { 25 | 26 | //Try to load a css override from ~/.edseditor/style.css first then fallback to installed default 27 | 28 | string csspath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".edseditor"); 29 | csspath = Path.Combine(csspath, "style.css"); 30 | 31 | if(!File.Exists(csspath)) 32 | { 33 | csspath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "style.css"); 34 | } 35 | 36 | if (!File.Exists(csspath)) 37 | return; 38 | 39 | string text = System.IO.File.ReadAllText(csspath); 40 | 41 | mshtml.HTMLDocument CurrentDocument = (HTMLDocument)webBrowser1.Document.DomDocument; 42 | mshtml.IHTMLStyleSheet styleSheet = CurrentDocument.createStyleSheet("", 0); 43 | styleSheet.cssText = text; 44 | } 45 | 46 | private void toolStripButton_print_Click(object sender, EventArgs e) 47 | { 48 | webBrowser1.ShowPrintDialog(); 49 | } 50 | 51 | private void toolStripButton_preview_Click(object sender, EventArgs e) 52 | { 53 | webBrowser1.ShowPrintPreviewDialog(); 54 | } 55 | 56 | private void toolStripButton_save_Click(object sender, EventArgs e) 57 | { 58 | webBrowser1.ShowSaveAsDialog(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /EDSEditorGUI/ReportView.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/305_Close_16x16_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/305_Close_16x16_72.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Close_6519.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Close_6519.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Compile_191.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Compile_191.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/DriverTemplate_32x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/DriverTemplate_32x.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/EventLog_5735.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/EventLog_5735.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/ExporttoScript_9881.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/ExporttoScript_9881.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/GenerateAll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/GenerateAll.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/GenericVSEditor_9905.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/GenericVSEditor_9905.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Index_8287_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Index_8287_16x.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/InsertColumn_5626.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/InsertColumn_5626.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/ListBox_686.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/ListBox_686.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/NewFile_6276.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/NewFile_6276.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Open_6529.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Open_6529.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/PrintPreviewControl_698.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/PrintPreviewControl_698.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/PrintSetup_11011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/PrintSetup_11011.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Print_11009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Print_11009.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Remove_16xLG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Remove_16xLG.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Save.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/Save_6530.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/Save_6530.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/action_add_16xLG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/action_add_16xLG.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/move_to_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/move_to_bottom.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/move_to_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/move_to_top.png -------------------------------------------------------------------------------- /EDSEditorGUI/Resources/notebook_16xLG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI/Resources/notebook_16xLG.png -------------------------------------------------------------------------------- /EDSEditorGUI/TableLayoutDB.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Windows.Forms; 3 | 4 | namespace ODEditor 5 | { 6 | /// 7 | /// Double Buffered layout panel - removes flicker during resize operations. 8 | /// 9 | public partial class DBLayoutPanel : TableLayoutPanel 10 | { 11 | public DBLayoutPanel() 12 | { 13 | //InitializeComponent(); 14 | SetStyle(ControlStyles.AllPaintingInWmPaint | 15 | ControlStyles.OptimizedDoubleBuffer | 16 | ControlStyles.UserPaint, true); 17 | } 18 | 19 | public DBLayoutPanel(IContainer container) 20 | { 21 | container.Add(this); 22 | //InitializeComponent(); 23 | SetStyle(ControlStyles.AllPaintingInWmPaint | 24 | ControlStyles.OptimizedDoubleBuffer | 25 | ControlStyles.UserPaint, true); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /EDSEditorGUI/UpdateODViewEventArgs.cs: -------------------------------------------------------------------------------- 1 | using libEDSsharp; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ODEditor 9 | { 10 | public class UpdateODViewEventArgs : EventArgs 11 | { 12 | public EDSsharp EDS { get; set; } 13 | 14 | public UpdateODViewEventArgs(EDSsharp eds) 15 | { 16 | EDS = eds; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /EDSEditorGUI/Warnings.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ODEditor 2 | { 3 | partial class WarningsFrm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WarningsFrm)); 32 | this.textBox1 = new System.Windows.Forms.TextBox(); 33 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 34 | this.button_close = new System.Windows.Forms.Button(); 35 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 36 | this.splitContainer1.Panel1.SuspendLayout(); 37 | this.splitContainer1.Panel2.SuspendLayout(); 38 | this.splitContainer1.SuspendLayout(); 39 | this.SuspendLayout(); 40 | // 41 | // textBox1 42 | // 43 | this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; 44 | this.textBox1.Location = new System.Drawing.Point(0, 0); 45 | this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 46 | this.textBox1.Multiline = true; 47 | this.textBox1.Name = "textBox1"; 48 | this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 49 | this.textBox1.Size = new System.Drawing.Size(1580, 589); 50 | this.textBox1.TabIndex = 0; 51 | // 52 | // splitContainer1 53 | // 54 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 55 | this.splitContainer1.Location = new System.Drawing.Point(0, 0); 56 | this.splitContainer1.Name = "splitContainer1"; 57 | this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; 58 | // 59 | // splitContainer1.Panel1 60 | // 61 | this.splitContainer1.Panel1.Controls.Add(this.textBox1); 62 | // 63 | // splitContainer1.Panel2 64 | // 65 | this.splitContainer1.Panel2.Controls.Add(this.button_close); 66 | this.splitContainer1.Size = new System.Drawing.Size(1580, 667); 67 | this.splitContainer1.SplitterDistance = 589; 68 | this.splitContainer1.TabIndex = 1; 69 | // 70 | // button_close 71 | // 72 | this.button_close.Location = new System.Drawing.Point(29, 21); 73 | this.button_close.Name = "button_close"; 74 | this.button_close.Size = new System.Drawing.Size(119, 41); 75 | this.button_close.TabIndex = 0; 76 | this.button_close.Text = "Close"; 77 | this.button_close.UseVisualStyleBackColor = true; 78 | this.button_close.Click += new System.EventHandler(this.button_close_Click); 79 | // 80 | // WarningsFrm 81 | // 82 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 | this.ClientSize = new System.Drawing.Size(1580, 667); 85 | this.Controls.Add(this.splitContainer1); 86 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 87 | this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 88 | this.Name = "WarningsFrm"; 89 | this.Text = "Warnings"; 90 | this.splitContainer1.Panel1.ResumeLayout(false); 91 | this.splitContainer1.Panel1.PerformLayout(); 92 | this.splitContainer1.Panel2.ResumeLayout(false); 93 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 94 | this.splitContainer1.ResumeLayout(false); 95 | this.ResumeLayout(false); 96 | 97 | } 98 | 99 | #endregion 100 | 101 | private System.Windows.Forms.TextBox textBox1; 102 | private System.Windows.Forms.SplitContainer splitContainer1; 103 | private System.Windows.Forms.Button button_close; 104 | } 105 | } -------------------------------------------------------------------------------- /EDSEditorGUI/Warnings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using libEDSsharp; 11 | 12 | namespace ODEditor 13 | { 14 | public partial class WarningsFrm : Form 15 | { 16 | public WarningsFrm() 17 | { 18 | InitializeComponent(); 19 | 20 | foreach(string s in Warnings.warning_list) 21 | { 22 | textBox1.AppendText(s+"\r\n"); 23 | } 24 | } 25 | 26 | private void button_close_Click(object sender, EventArgs e) 27 | { 28 | this.Close(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /EDSEditorGUI/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /EDSEditorGUI/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /EDSEditorGUI/style.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | width: 670px; 4 | } 5 | 6 | 7 | H1,H2,H3,p { 8 | color: #333333; 9 | font-family: Tahoma, Geneva, sans-serif; 10 | } 11 | 12 | 13 | table a:link { 14 | color: #666; 15 | font-weight: bold; 16 | text-decoration:none; 17 | } 18 | table a:visited { 19 | color: #999999; 20 | font-weight:bold; 21 | text-decoration:none; 22 | } 23 | table a:active, 24 | table a:hover { 25 | color: #bd5a35; 26 | text-decoration:underline; 27 | } 28 | table { 29 | font-family:Arial, Helvetica, sans-serif; 30 | color:#666; 31 | font-size:12px; 32 | text-shadow: 1px 1px 0px #fff; 33 | background:#eaebec; 34 | margin:20px; 35 | border:#ccc 1px solid; 36 | 37 | -moz-border-radius:3px; 38 | -webkit-border-radius:3px; 39 | border-radius:3px; 40 | 41 | -moz-box-shadow: 0 1px 2px #d1d1d1; 42 | -webkit-box-shadow: 0 1px 2px #d1d1d1; 43 | box-shadow: 0 1px 2px #d1d1d1; 44 | } 45 | table th { 46 | padding:5px 5px 5px 5px; 47 | border-top:1px solid #fafafa; 48 | border-bottom:1px solid #e0e0e0; 49 | 50 | background: #ededed; 51 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb)); 52 | background: -moz-linear-gradient(top, #ededed, #ebebeb); 53 | } 54 | table th:first-child { 55 | text-align: left; 56 | padding-left:20px; 57 | } 58 | table tr:first-child th:first-child { 59 | -moz-border-radius-topleft:3px; 60 | -webkit-border-top-left-radius:3px; 61 | border-top-left-radius:3px; 62 | } 63 | table tr:first-child th:last-child { 64 | -moz-border-radius-topright:3px; 65 | -webkit-border-top-right-radius:3px; 66 | border-top-right-radius:3px; 67 | } 68 | table tr { 69 | text-align: center; 70 | padding-left:20px; 71 | } 72 | table td:first-child { 73 | text-align: left; 74 | padding-left:20px; 75 | border-left: 0; 76 | } 77 | table td { 78 | padding:5px; 79 | border-top: 1px solid #ffffff; 80 | border-bottom:1px solid #e0e0e0; 81 | border-left: 1px solid #e0e0e0; 82 | 83 | background: #fafafa; 84 | background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa)); 85 | background: -moz-linear-gradient(top, #fbfbfb, #fafafa); 86 | } 87 | table tr.even td { 88 | background: #f6f6f6; 89 | background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); 90 | background: -moz-linear-gradient(top, #f8f8f8, #f6f6f6); 91 | } 92 | table tr:last-child td { 93 | border-bottom:0; 94 | } 95 | table tr:last-child td:first-child { 96 | -moz-border-radius-bottomleft:3px; 97 | -webkit-border-bottom-left-radius:3px; 98 | border-bottom-left-radius:3px; 99 | } 100 | table tr:last-child td:last-child { 101 | -moz-border-radius-bottomright:3px; 102 | -webkit-border-bottom-right-radius:3px; 103 | border-bottom-right-radius:3px; 104 | } 105 | table tr:hover td { 106 | background: #f2f2f2; 107 | background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); 108 | background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); 109 | } 110 | 111 | .receivers 112 | { 113 | width: 90%; 114 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/.gitignore: -------------------------------------------------------------------------------- 1 | /obj/* 2 | /bin/* 3 | -------------------------------------------------------------------------------- /EDSEditorGUI2/App.axaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /EDSEditorGUI2/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Data.Core.Plugins; 4 | using Avalonia.Markup.Xaml; 5 | using EDSEditorGUI2.ViewModels; 6 | using EDSEditorGUI2.Views; 7 | 8 | namespace EDSEditorGUI2; 9 | 10 | public partial class App : Application 11 | { 12 | public override void Initialize() 13 | { 14 | AvaloniaXamlLoader.Load(this); 15 | } 16 | 17 | public override void OnFrameworkInitializationCompleted() 18 | { 19 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 20 | { 21 | // Line below is needed to remove Avalonia data validation. 22 | // Without this line you will get duplicate validations from both Avalonia and CT 23 | BindingPlugins.DataValidators.RemoveAt(0); 24 | desktop.MainWindow = new MainWindow 25 | { 26 | DataContext = new MainWindowViewModel(), 27 | }; 28 | } 29 | 30 | base.OnFrameworkInitializationCompleted(); 31 | } 32 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/Assets/avalonia-logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/EDSEditorGUI2/Assets/avalonia-logo.ico -------------------------------------------------------------------------------- /EDSEditorGUI2/Converter/NewIndexMultiConvert.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data; 2 | using Avalonia.Data.Converters; 3 | using Avalonia.Media.Immutable; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Globalization; 7 | using System.Linq; 8 | 9 | namespace EDSEditorGUI2.Converter; 10 | 11 | public class NewIndexRequest(int index, string name, LibCanOpen.OdObject.Types.ObjectType type) 12 | { 13 | public int Index { get; } = index; 14 | public string Name { get; } = name; 15 | public LibCanOpen.OdObject.Types.ObjectType Type { get; } = type; 16 | } 17 | 18 | public sealed class NewIndexMultiConvert : IMultiValueConverter 19 | { 20 | public object? Convert(IList values, Type targetType, object? parameter, CultureInfo culture) 21 | { 22 | // Ensure all bindings are provided and attached to correct target type 23 | if (values?.Count != 3 || !targetType.IsAssignableFrom(typeof(ImmutableSolidColorBrush))) 24 | throw new NotSupportedException(); 25 | 26 | if (values[0] is not string rawindex || 27 | values[1] is not string name || 28 | values[2] is not int typeIndex) 29 | return BindingOperations.DoNothing; 30 | 31 | int index = int.Parse(rawindex, NumberStyles.HexNumber); 32 | 33 | var typeValues = Enum.GetNames(typeof(LibCanOpen.OdObject.Types.ObjectType)).Skip(1).ToArray(); 34 | bool parseOk = Enum.TryParse(typeValues[typeIndex], out LibCanOpen.OdObject.Types.ObjectType type); 35 | 36 | if (parseOk) 37 | { 38 | var indexRequest = new NewIndexRequest(index, name, type); 39 | return indexRequest; 40 | } 41 | else 42 | { 43 | return BindingOperations.DoNothing; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /EDSEditorGUI2/EDSEditorGUI2.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net8.0 5 | enable 6 | true 7 | app.manifest 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EDSEditorGUI2 4 | { 5 | public static class StringExtensions 6 | { 7 | /// 8 | /// Convert different types of hex/dec string to integer 9 | /// 10 | public static UInt16 ToInteger(this String val) 11 | { 12 | return (UInt16)Convert.ToInt32(val, 16); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Icons.axaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | M3.7547787,12.4995322 L20.2466903,12.4995322 C20.6609039,12.4995322 20.9966903,12.1637458 20.9966903,11.7495322 C20.9966903,11.3353187 20.6609039,10.9995322 20.2466903,10.9995322 L3.7547787,10.9995322 C3.34056514,10.9995322 3.0047787,11.3353187 3.0047787,11.7495322 C3.0047787,12.1637458 3.34056514,12.4995322 3.7547787,12.4995322 Z 17 | M14.5,13 L14.5,3.75378577 C14.5,3.33978577 14.164,3.00378577 13.75,3.00378577 C13.336,3.00378577 13,3.33978577 13,3.75378577 L13,13 L3.75387573,13 C3.33987573,13 3.00387573,13.336 3.00387573,13.75 C3.00387573,14.164 3.33987573,14.5 3.75387573,14.5 L13,14.5 L13,23.7523651 C13,24.1663651 13.336,24.5023651 13.75,24.5023651 C14.164,24.5023651 14.5,24.1663651 14.5,23.7523651 L14.5,14.5 L23.7498262,14.5030754 C24.1638262,14.5030754 24.4998262,14.1670754 24.4998262,13.7530754 C24.4998262,13.3390754 24.1638262,13.0030754 23.7498262,13.0030754 L14.5,13 Z 18 | M3 5.75C3 4.23122 4.23122 3 5.75 3H15.7145C16.5764 3 17.4031 3.34241 18.0126 3.9519L20.0481 5.98744C20.6576 6.59693 21 7.42358 21 8.28553V18.25C21 19.7688 19.7688 21 18.25 21H5.75C4.23122 21 3 19.7688 3 18.25V5.75ZM5.75 4.5C5.05964 4.5 4.5 5.05964 4.5 5.75V18.25C4.5 18.9404 5.05964 19.5 5.75 19.5H6V14.25C6 13.0074 7.00736 12 8.25 12H15.75C16.9926 12 18 13.0074 18 14.25V19.5H18.25C18.9404 19.5 19.5 18.9404 19.5 18.25V8.28553C19.5 7.8214 19.3156 7.37629 18.9874 7.0481L16.9519 5.01256C16.6918 4.75246 16.3582 4.58269 16 4.52344V7.25C16 8.49264 14.9926 9.5 13.75 9.5H9.25C8.00736 9.5 7 8.49264 7 7.25V4.5H5.75ZM16.5 19.5V14.25C16.5 13.8358 16.1642 13.5 15.75 13.5H8.25C7.83579 13.5 7.5 13.8358 7.5 14.25V19.5H16.5ZM8.5 4.5V7.25C8.5 7.66421 8.83579 8 9.25 8H13.75C14.1642 8 14.5 7.66421 14.5 7.25V4.5H8.5Z 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Mapper/ProtobufferViewModelMapper.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Google.Protobuf.WellKnownTypes; 3 | using LibCanOpen; 4 | using System; 5 | 6 | namespace EDSEditorGUI2.Mapper 7 | { 8 | public partial class ProtobufferViewModelMapper 9 | { 10 | public static ViewModels.Device MapFromProtobuffer(CanOpenDevice source) 11 | { 12 | var config = new MapperConfiguration(cfg => 13 | { 14 | cfg.CreateMap().ConvertUsing(ts => ts.ToDateTime()); 15 | cfg.CreateMap() 16 | .ForMember(dest => dest.FileVersion, opt => opt.MapFrom(src => src.FileVersion)) 17 | .ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description)) 18 | .ForMember(dest => dest.CreationTime, opt => opt.MapFrom(src => src.CreationTime)) 19 | .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy)) 20 | .ForMember(dest => dest.ModificationTime, opt => opt.MapFrom(src => src.ModificationTime)) 21 | .ForMember(dest => dest.ModifiedBy, opt => opt.MapFrom(src => src.ModifiedBy)); 22 | cfg.CreateMap, ViewModels.ObjectDictionary>().ConvertUsing(); 23 | cfg.CreateMap() 24 | .ForMember(dest => dest.FileInfo, opt => opt.MapFrom(src => src.FileInfo)) 25 | .ForMember(dest => dest.DeviceInfo, opt => opt.MapFrom(src => src.DeviceInfo)) 26 | .ForMember(dest => dest.DeviceCommissioning, opt => opt.MapFrom(src => src.DeviceCommissioning)) 27 | .ForMember(dest => dest.Objects, opt => opt.MapFrom(src => src.Objects)); 28 | cfg.CreateMap(); 29 | cfg.CreateMap(); 30 | }); 31 | config.AssertConfigurationIsValid(); 32 | var mapper = config.CreateMapper(); 33 | var result = mapper.Map(source); 34 | return result; 35 | } 36 | public class ODConverter : ITypeConverter, ViewModels.ObjectDictionary>, 37 | ITypeConverter< ViewModels.ObjectDictionary, Google.Protobuf.Collections.MapField> 38 | { 39 | public ViewModels.ObjectDictionary Convert(Google.Protobuf.Collections.MapField source, ViewModels.ObjectDictionary destination, ResolutionContext context) 40 | { 41 | var config = new MapperConfiguration(cfg => 42 | { 43 | cfg.CreateMap(); 44 | cfg.CreateMap(); 45 | }); 46 | config.AssertConfigurationIsValid(); 47 | var mapper = config.CreateMapper(); 48 | 49 | destination = []; 50 | foreach (var item in source) 51 | { 52 | destination.Add(item.Key, mapper.Map(item.Value)); 53 | } 54 | return destination; 55 | } 56 | public Google.Protobuf.Collections.MapField Convert(ViewModels.ObjectDictionary source, Google.Protobuf.Collections.MapField destination, ResolutionContext context) 57 | { 58 | var config = new MapperConfiguration(cfg => 59 | { 60 | cfg.CreateMap(); 61 | cfg.CreateMap(); 62 | }); 63 | config.AssertConfigurationIsValid(); 64 | var mapper = config.CreateMapper(); 65 | 66 | destination = []; 67 | foreach (var item in source) 68 | { 69 | destination.Add(item.Key, mapper.Map(item.Value)); 70 | } 71 | return destination; 72 | } 73 | } 74 | 75 | public static CanOpenDevice MapToProtobuffer(ViewModels.Device source) 76 | { 77 | var config = new MapperConfiguration(cfg => 78 | { 79 | //TODO 80 | }); 81 | config.AssertConfigurationIsValid(); 82 | var mapper = config.CreateMapper(); 83 | var result = mapper.Map(source); 84 | return result; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace EDSEditorGUI2; 5 | 6 | sealed class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .WithInterFont() 20 | .LogToTrace(); 21 | } 22 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewLocator.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Controls.Templates; 3 | using EDSEditorGUI2.ViewModels; 4 | using System; 5 | 6 | namespace EDSEditorGUI2; 7 | 8 | public class ViewLocator : IDataTemplate 9 | { 10 | 11 | public Control? Build(object? data) 12 | { 13 | if (data is null) 14 | return null; 15 | 16 | var name = data.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); 17 | var type = Type.GetType(name); 18 | 19 | if (type != null) 20 | { 21 | var control = (Control)Activator.CreateInstance(type)!; 22 | control.DataContext = data; 23 | return control; 24 | } 25 | 26 | return new TextBlock { Text = "Not Found: " + name }; 27 | } 28 | 29 | public bool Match(object? data) 30 | { 31 | return data is ViewModelBase; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/Device.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | 3 | namespace EDSEditorGUI2.ViewModels 4 | { 5 | public partial class Device : ObservableObject 6 | { 7 | public Device() 8 | { 9 | } 10 | 11 | [ObservableProperty] 12 | private FileInfo _fileInfo = new(); 13 | 14 | [ObservableProperty] 15 | private DeviceInfo _deviceInfo = new(); 16 | 17 | [ObservableProperty] 18 | private DeviceCommissioning _deviceCommissioning = new(); 19 | 20 | [ObservableProperty] 21 | private ObjectDictionary _objects = new(); 22 | 23 | public void OnClickCommand() 24 | { 25 | // do something 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/DeviceCommissioning.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System; 3 | 4 | namespace EDSEditorGUI2.ViewModels; 5 | 6 | public partial class DeviceCommissioning : ObservableObject 7 | { 8 | [ObservableProperty] 9 | private UInt32 _nodeId; 10 | 11 | [ObservableProperty] 12 | private string _nodeName = string.Empty; 13 | 14 | [ObservableProperty] 15 | private UInt32 _baudrate; 16 | } 17 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/DeviceInfo.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | 3 | namespace EDSEditorGUI2.ViewModels; 4 | 5 | public partial class DeviceInfo : ObservableObject 6 | { 7 | [ObservableProperty] 8 | string _vendorName = string.Empty; 9 | 10 | [ObservableProperty] 11 | string _productName = string.Empty; 12 | 13 | [ObservableProperty] 14 | bool _baudRate10; 15 | 16 | [ObservableProperty] 17 | bool _baudRate20; 18 | 19 | [ObservableProperty] 20 | bool _baudRate50; 21 | 22 | [ObservableProperty] 23 | bool _baudRate125; 24 | 25 | [ObservableProperty] 26 | bool _baudRate250; 27 | 28 | [ObservableProperty] 29 | bool _baudRate500; 30 | 31 | [ObservableProperty] 32 | bool _baudRate800; 33 | 34 | [ObservableProperty] 35 | bool _baudRate1000; 36 | 37 | [ObservableProperty] 38 | bool _baudRateAuto; 39 | 40 | [ObservableProperty] 41 | bool _lssSlave; 42 | 43 | [ObservableProperty] 44 | bool _lssMaster; 45 | } 46 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/FileInfo.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using System; 3 | 4 | namespace EDSEditorGUI2.ViewModels; 5 | 6 | public partial class FileInfo : ObservableObject 7 | { 8 | [ObservableProperty] 9 | private string _fileVersion = string.Empty; 10 | 11 | [ObservableProperty] 12 | private string _description = string.Empty; 13 | 14 | [ObservableProperty] 15 | private DateTime _creationTime; 16 | 17 | [ObservableProperty] 18 | private string _createdBy = string.Empty; 19 | 20 | [ObservableProperty] 21 | private DateTime _modificationTime; 22 | 23 | [ObservableProperty] 24 | private string _modifiedBy = string.Empty; 25 | } 26 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using EDSEditorGUI2.Mapper; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace EDSEditorGUI2.ViewModels; 6 | 7 | public partial class MainWindowViewModel : ViewModelBase 8 | { 9 | int Counter = 0; 10 | public void AddNewDevice(object sender) 11 | { 12 | var device = new LibCanOpen.CanOpenDevice 13 | { 14 | DeviceInfo = new() 15 | { 16 | ProductName = "New Product" + Counter.ToString() 17 | }, 18 | }; 19 | 20 | Counter++; 21 | 22 | //string dir = Environment.OSVersion.Platform == PlatformID.Win32NT ? "\\" : "/"; 23 | //eds.projectFilename = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + dir + "project"; 24 | 25 | //DeviceView device = new DeviceView(eds, network); 26 | //device.UpdateODViewForEDS += Device_UpdateODViewForEDS; 27 | 28 | //eds.OnDataDirty += Eds_onDataDirty; 29 | 30 | //device.Dock = DockStyle.Fill; 31 | //device.dispatch_updateOD(); 32 | 33 | var DeviceView = ProtobufferViewModelMapper.MapFromProtobuffer(device); 34 | Network.Add(DeviceView); 35 | } 36 | #pragma warning disable CA1822 // Mark members as static 37 | public string Greeting => "Welcome to Avalonia!"; 38 | #pragma warning restore CA1822 // Mark members as static 39 | public ObservableCollection Network { get; set; } = []; 40 | 41 | [ObservableProperty] 42 | public Device? selectedDevice; 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/OdSubObject.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using static LibCanOpen.OdSubObject.Types; 3 | 4 | namespace EDSEditorGUI2.ViewModels; 5 | 6 | public partial class OdSubObject : ObservableObject 7 | { 8 | [ObservableProperty] 9 | private string _name = string.Empty; 10 | 11 | [ObservableProperty] 12 | private string _alias = string.Empty; 13 | 14 | [ObservableProperty] 15 | private DataType _dataType; 16 | 17 | [ObservableProperty] 18 | private AccessSDO _sdo; 19 | 20 | [ObservableProperty] 21 | private AccessPDO _pdo; 22 | 23 | [ObservableProperty] 24 | private AccessSRDO _srdo; 25 | 26 | [ObservableProperty] 27 | private string _defaultValue = string.Empty; 28 | 29 | [ObservableProperty] 30 | private string _actualValue = string.Empty; 31 | 32 | [ObservableProperty] 33 | private string _lowLimit = string.Empty; 34 | 35 | [ObservableProperty] 36 | string _highLimit = string.Empty; 37 | 38 | [ObservableProperty] 39 | private uint _stringLengthMin; 40 | } 41 | -------------------------------------------------------------------------------- /EDSEditorGUI2/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | 3 | namespace EDSEditorGUI2.ViewModels; 4 | 5 | public class ViewModelBase : ObservableObject 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DeviceInfoView.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | LSS Slave 23 | Master 24 | 25 | 26 | Baudrates 27 | 10 kbit/s. 28 | 20 kbit/s. 29 | 50 kbit/s. 30 | 125 kbit/s. 31 | 250 kbit/s. 32 | 500 kbit/s. 33 | 800 kbit/s. 34 | 1000 kbit/s. 35 | auto 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DeviceInfoView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace EDSEditorGUI2.Views; 4 | 5 | public partial class DeviceInfoView : UserControl 6 | { 7 | public DeviceInfoView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DeviceODView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using LibCanOpen; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Linq; 8 | 9 | namespace EDSEditorGUI2.Views; 10 | 11 | public partial class DeviceODView : UserControl 12 | { 13 | private List _odViews = []; 14 | public DeviceODView() 15 | { 16 | InitializeComponent(); 17 | ODView_Com.grid.SelectionChanged += IndexGridSelectionChanged; 18 | ODView_Manufacture.grid.SelectionChanged += IndexGridSelectionChanged; 19 | ODView_Device.grid.SelectionChanged += IndexGridSelectionChanged; 20 | 21 | subindexGrid.SelectionChanged += subindexGridSelectionChanged; 22 | 23 | _odViews.Add(ODView_Com.grid); 24 | _odViews.Add(ODView_Manufacture.grid); 25 | _odViews.Add(ODView_Device.grid); 26 | 27 | foreach (var v in Enum.GetNames(typeof(OdSubObject.Types.DataType))) 28 | { 29 | combo_datatype.Items.Add(v); 30 | } 31 | 32 | foreach (var v in Enum.GetNames(typeof(OdSubObject.Types.AccessSDO))) 33 | { 34 | combo_sdo.Items.Add(v); 35 | } 36 | 37 | foreach (var v in Enum.GetNames(typeof(OdSubObject.Types.AccessPDO))) 38 | { 39 | combo_pdo.Items.Add(v); 40 | } 41 | 42 | foreach (var v in Enum.GetNames(typeof(OdSubObject.Types.AccessSRDO))) 43 | { 44 | combo_srdo.Items.Add(v); 45 | } 46 | } 47 | 48 | private void IndexGridSelectionChanged(object? sender, SelectionChangedEventArgs e) 49 | { 50 | if (sender is DataGrid s && DataContext is ViewModels.ObjectDictionary dc) 51 | { 52 | if (s.SelectedItem is KeyValuePair selected) 53 | { 54 | dc.SelectedObject = selected; 55 | foreach (var dg in _odViews) 56 | { 57 | if (dg != s) 58 | { 59 | dg.SelectedItem = null; 60 | subindexGrid.SelectedItem = null; 61 | } 62 | } 63 | } 64 | } 65 | } 66 | private void subindexGridSelectionChanged(object? sender, SelectionChangedEventArgs e) 67 | { 68 | if (sender is DataGrid s && DataContext is ViewModels.ObjectDictionary dc) 69 | { 70 | if (s.SelectedItem is KeyValuePair selected) 71 | { 72 | dc.SelectedSubObject = selected; 73 | dc.SelectedSubObjects.Clear(); 74 | foreach (var row in s.SelectedItems) 75 | { 76 | if (row is KeyValuePair subObj) 77 | { 78 | dc.SelectedSubObjects.Add(subObj); 79 | } 80 | } 81 | } 82 | } 83 | } 84 | private void ContextMenuSubObjectAddClick(object? sender, RoutedEventArgs e) 85 | { 86 | if (DataContext is ViewModels.ObjectDictionary dc) 87 | { 88 | var selectedObj = dc.SelectedObject.Value; 89 | ObservableCollection> selection = []; 90 | 91 | foreach (var row in dc.SelectedSubObjects) 92 | { 93 | selectedObj.AddSubEntry(row); 94 | } 95 | } 96 | } 97 | private void ContextMenuSubObjectRemoveClick(object? sender, RoutedEventArgs e) 98 | { 99 | bool renumber = sender == contextMenu_subObject_removeSubItemToolStripMenuItem; 100 | 101 | if (DataContext is ViewModels.ObjectDictionary dc) 102 | { 103 | var selectedObject = dc.SelectedObject.Value; 104 | 105 | //Clone the list because we cant modify the list we iterate on 106 | var selectedObj = dc.SelectedSubObjects.ToList(); 107 | foreach (var item in selectedObj) 108 | { 109 | selectedObject.RemoveSubEntry(item, renumber); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DevicePDOView.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | Invalid 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Zoom: 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DevicePDOView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Media; 3 | using System.Collections.Generic; 4 | 5 | namespace EDSEditorGUI2.Views; 6 | 7 | public partial class DevicePDOView : UserControl 8 | { 9 | private List _bitColumns = []; 10 | public DevicePDOView() 11 | { 12 | InitializeComponent(); 13 | 14 | CreateMappingBitsAndBytesIndication(); 15 | Zoom.Value = 100; 16 | } 17 | 18 | void CreateMappingBitsAndBytesIndication() 19 | { 20 | //Bits 21 | for (int i = 0; i < 64; i++) 22 | { 23 | var indication = new TextBlock 24 | { 25 | Text = i.ToString(), 26 | VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center, 27 | TextWrapping = TextWrapping.Wrap, 28 | }; 29 | if ((i % 8) == 0) 30 | { 31 | indication.Foreground = Brushes.Red; 32 | } 33 | AddToMappingGrid(indication, 0, 3 + i); 34 | 35 | var newColumn = new ColumnDefinition(new GridLength(10 * 1.0)); 36 | _bitColumns.Add(newColumn); 37 | 38 | MappingGrid.ColumnDefinitions.Add(newColumn); 39 | } 40 | //Bytes 41 | for (int i = 0; i < 8; i++) 42 | { 43 | var indication = new TextBlock 44 | { 45 | Text = $"Byte {i}", 46 | HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center, 47 | 48 | TextWrapping = TextWrapping.Wrap, 49 | }; 50 | AddToMappingGrid(indication, 1, 3 + (i*8), 8); 51 | } 52 | } 53 | void AddToMappingGrid(Control element, int row,int column, int columnspam = 1) 54 | { 55 | Grid.SetRow(element, row); 56 | Grid.SetColumn(element, column); 57 | Grid.SetColumnSpan(element, columnspam); 58 | MappingGrid.Children.Add(element); 59 | } 60 | 61 | private void Zoom_PropertyChanged(object? sender, Avalonia.AvaloniaPropertyChangedEventArgs e) 62 | { 63 | if (e.Property.Name == "Value") 64 | { 65 | decimal newValue = Zoom.Value ?? 0; 66 | ChangeMappingZoom((double)newValue); 67 | } 68 | } 69 | /// 70 | /// Changes the zoom level on pdo mapping 71 | /// 72 | /// zoom level in percent 73 | private void ChangeMappingZoom(double zoomPercent) 74 | { 75 | var zoom = zoomPercent / 100; 76 | foreach (var column in _bitColumns) 77 | { 78 | column.Width = new GridLength(10 * zoom); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DeviceView.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | This is tab 3 content 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/DeviceView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace EDSEditorGUI2.Views; 4 | 5 | public partial class DeviceView : UserControl 6 | { 7 | public DeviceView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 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 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace EDSEditorGUI2.Views; 4 | 5 | public partial class MainWindow : Window 6 | { 7 | public MainWindow() 8 | { 9 | InitializeComponent(); 10 | } 11 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/ODIndexRangeView.axaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 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 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /EDSEditorGUI2/Views/ODIndexRangeView.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Interactivity; 4 | using DialogHostAvalonia; 5 | using EDSEditorGUI2.Converter; 6 | using LibCanOpen; 7 | using System; 8 | using System.Linq; 9 | 10 | namespace EDSEditorGUI2.Views; 11 | 12 | public partial class ODIndexRangeView : UserControl 13 | { 14 | public ODIndexRangeView() 15 | { 16 | InitializeComponent(); 17 | var values = Enum.GetNames(typeof(OdObject.Types.ObjectType)).Skip(1).ToArray(); 18 | type.ItemsSource = values; 19 | 20 | grid.LoadingRow += GridLoadingRow; 21 | } 22 | 23 | /// 24 | /// Hides rows with indexes that is not in min&max range 25 | /// 26 | /// sender object 27 | /// event param 28 | private void GridLoadingRow(object? sender, DataGridRowEventArgs e) 29 | { 30 | if(e.Row.DataContext != null) 31 | { 32 | var dc = (System.Collections.Generic.KeyValuePair)e.Row.DataContext; 33 | int index = int.Parse(dc.Key, System.Globalization.NumberStyles.HexNumber); 34 | int min = Convert.ToInt32(MinIndex, 16); 35 | int max = Convert.ToInt32(MaxIndex, 16); 36 | e.Row.IsVisible = (min <= index && index <= max); 37 | } 38 | } 39 | 40 | public static readonly StyledProperty HeadingProperty = 41 | AvaloniaProperty.Register(nameof(HeadingProperty)); 42 | public string Heading 43 | { 44 | get { return GetValue(HeadingProperty); } 45 | set { SetValue(HeadingProperty, value); HeadingText.Text = value; } 46 | } 47 | 48 | public static readonly StyledProperty MinIndexProperty = 49 | AvaloniaProperty.Register(nameof(MinIndexProperty)); 50 | public string MinIndex 51 | { 52 | get { return GetValue(MinIndexProperty); } 53 | set { SetValue(MinIndexProperty, value); } 54 | } 55 | 56 | public static readonly StyledProperty MaxIndexProperty = 57 | AvaloniaProperty.Register(nameof(MaxIndexProperty)); 58 | public string MaxIndex 59 | { 60 | get { return GetValue(MaxIndexProperty); } 61 | set { SetValue(MaxIndexProperty, value); } 62 | } 63 | 64 | private async void AddIndex(object? sender, RoutedEventArgs e) 65 | { 66 | await DialogHost.Show(Resources["NewIndexDialog"]!, "NoAnimationDialogHost", OnDialogClosing); 67 | } 68 | 69 | private void OnDialogClosing(object? sender, DialogClosingEventArgs e) 70 | { 71 | if (e.Parameter != null) 72 | { 73 | if (DataContext is ViewModels.ObjectDictionary dc && e.Parameter is NewIndexRequest param) 74 | { 75 | dc.AddIndex(param.Index, param.Name, param.Type); 76 | } 77 | } 78 | } 79 | 80 | private async void RemoveIndex(object? sender, RoutedEventArgs e) 81 | { 82 | await DialogHost.Show(Resources["NewIndexDialog"]!, "NoAnimationDialogHost"); 83 | } 84 | 85 | private void DataGrid_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e) 86 | { 87 | } 88 | } -------------------------------------------------------------------------------- /EDSEditorGUI2/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /EDSSharp/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /EDSSharp/EDSSharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net481 4 | net8.0 5 | net481;net8.0 6 | Exe 7 | false 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /EDSSharp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("EDSSharp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EDSSharp")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8b7a7545-6257-44bf-8868-f429e1b72c77")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /GUITests/.gitignore: -------------------------------------------------------------------------------- 1 | /obj 2 | /bin 3 | 4 | -------------------------------------------------------------------------------- /GUITests/GUITests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | false 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /GUITests/MappingTests.cs: -------------------------------------------------------------------------------- 1 | using EDSEditorGUI2.Mapper; 2 | using LibCanOpen; 3 | 4 | namespace GUITests 5 | { 6 | public class MappingTests 7 | { 8 | [Fact] 9 | public void MappingFromProtobuffer() 10 | { 11 | // testing for exception in the mapping assert. 12 | var sut = new CanOpenDevice(); 13 | ProtobufferViewModelMapper.MapFromProtobuffer(sut); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GUITests/ViewModels_OdObjects.cs: -------------------------------------------------------------------------------- 1 | using EDSEditorGUI2.ViewModels; 2 | 3 | namespace GUITests 4 | { 5 | public class ViewModels_OdObjects 6 | { 7 | private OdObject sut; 8 | public ViewModels_OdObjects() 9 | { 10 | sut = new OdObject(); 11 | sut.SubObjects.Add(new KeyValuePair("0", new OdSubObject 12 | { 13 | Name = "Highest sub-index supported", 14 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned8, 15 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Ro, 16 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 17 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 18 | DefaultValue = "0x01" 19 | })); 20 | sut.SubObjects.Add(new KeyValuePair("1", new OdSubObject() 21 | { 22 | Name = "Sub Object 1", 23 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 24 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 25 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 26 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 27 | DefaultValue = "0" 28 | })); 29 | sut.SubObjects.Add(new KeyValuePair("2", new OdSubObject() 30 | { 31 | Name = "Sub Object 2", 32 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 33 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 34 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 35 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 36 | DefaultValue = "0" 37 | })); 38 | } 39 | 40 | [Fact] 41 | public void AddSubEntry_VarType() 42 | { 43 | sut = new OdObject(); 44 | sut.ObjectType = LibCanOpen.OdObject.Types.ObjectType.Var; 45 | sut.SubObjects.Add(new KeyValuePair("0", new OdSubObject 46 | { 47 | Name = "variableTest", 48 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 49 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 50 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 51 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 52 | DefaultValue = "0" 53 | })); 54 | sut.AddSubEntry(sut.SubObjects[0]); 55 | Assert.Single(sut.SubObjects); 56 | } 57 | 58 | [Fact] 59 | public void AddSubEntry_RecordType() 60 | { 61 | sut.ObjectType = LibCanOpen.OdObject.Types.ObjectType.Record; 62 | sut.AddSubEntry(sut.SubObjects[1]); 63 | Assert.Equal(4, sut.SubObjects.Count); 64 | Assert.Equal("0x03", sut.SubObjects[0].Value.DefaultValue); 65 | } 66 | 67 | [Theory] 68 | [InlineData(false)] 69 | [InlineData(true)] 70 | public void RemoveSubEntry_VarType(bool renumber) 71 | { 72 | sut = new OdObject(); 73 | sut.ObjectType = LibCanOpen.OdObject.Types.ObjectType.Var; 74 | sut.SubObjects.Add(new KeyValuePair("0x01", new OdSubObject 75 | { 76 | Name = "variableTest", 77 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 78 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 79 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 80 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 81 | DefaultValue = "0" 82 | })); 83 | 84 | var result = sut.RemoveSubEntry(sut.SubObjects[0], renumber); 85 | Assert.False(result); 86 | } 87 | [Fact] 88 | public void RemoveSubEntry_RecordType() 89 | { 90 | sut = new OdObject(); 91 | sut.ObjectType = LibCanOpen.OdObject.Types.ObjectType.Record; 92 | sut.SubObjects.Add(new KeyValuePair("0x00", new OdSubObject 93 | { 94 | Name = "variableTest0", 95 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 96 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 97 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 98 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 99 | DefaultValue = "0x01" 100 | })); 101 | sut.SubObjects.Add(new KeyValuePair("0x01", new OdSubObject 102 | { 103 | Name = "variableTest1", 104 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 105 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 106 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 107 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 108 | DefaultValue = "0" 109 | })); 110 | sut.SubObjects.Add(new KeyValuePair("0x02", new OdSubObject 111 | { 112 | Name = "variableTest2", 113 | DataType = LibCanOpen.OdSubObject.Types.DataType.Unsigned32, 114 | Sdo = LibCanOpen.OdSubObject.Types.AccessSDO.Rw, 115 | Pdo = LibCanOpen.OdSubObject.Types.AccessPDO.No, 116 | Srdo = LibCanOpen.OdSubObject.Types.AccessSRDO.No, 117 | DefaultValue = "0" 118 | })); 119 | 120 | var result = sut.RemoveSubEntry(sut.SubObjects[1], false); 121 | Assert.True(result); 122 | } 123 | } 124 | } -------------------------------------------------------------------------------- /Images/ODDetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/Images/ODDetails.png -------------------------------------------------------------------------------- /Images/ODDetailsEdit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/Images/ODDetailsEdit.png -------------------------------------------------------------------------------- /Images/ODList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/Images/ODList.png -------------------------------------------------------------------------------- /Images/newod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/Images/newod.png -------------------------------------------------------------------------------- /Index_8287_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/Index_8287_16x.ico -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Requires mono-devel and msbuild: 2 | # https://www.mono-project.com/download/stable/ 3 | 4 | APP := EDSEditorGUI 5 | 6 | all: 7 | msbuild $(APP) 8 | 9 | clean: 10 | $(RM) -r $(APP)/bin 11 | 12 | install: 13 | cp -Tr $(APP)/bin/Debug /opt/EDSEditor 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CANopenEditor 2 | ============= 3 | CANopenEditor is a fork from https://github.com/robincornelius/libedssharp, author Robin Cornelius. 4 | Its homepage is https://github.com/CANopenNode/CANopenEditor 5 | 6 | CANopen Object Dictionary Editor: 7 | - Imports: CANopen electronic data sheets in EDS or XDD format. 8 | - Exports: CANopen electronic data sheets in EDS or XDD format, documentation, CANopenNode C source files. 9 | - GUI editor for CANopen Object Dictionary, Device information, etc. 10 | 11 | CANopen is the internationally standardized (EN 50325-4) ([CiA301](http://can-cia.org/standardization/technical-documents)) higher-layer protocol for embedded control system built on top of CAN. For more information on CANopen see http://www.can-cia.org/ 12 | 13 | [CANopenNode](https://github.com/CANopenNode/CANopenNode) is free and open source CANopen Stack 14 | 15 | 16 | EDSSharp 17 | -------- 18 | 19 | A C# CanOpen EDS (Electronic Data Sheet) library and GUI editor 20 | 21 | This application is designed to load/save/edit and create EDS/DCF/XDC file for 22 | CanOpen and also to generate the object dictionary for CanOpenNode 23 | CO_OD.c and CO_OD.h) to aid development of CanOpenNode devices. 24 | 25 | EDS (Electronic Data Sheet) files are text files that define CanOpen Devices. 26 | DCF (Device Configuration File) files are text files that define configured 27 | CanOpenDevices XDD files are an XML version of EDS files 28 | 29 | EDS/DCF are fully defined in the DSP306 standard by the can open standards 30 | body CiA. 31 | 32 | The EDS editor on its own is useful without the CanOpenNode specific export and 33 | as of the 0.6-XDD-alpha version the editor can also load/save XDD files. 34 | The GUI also shows PDO mappings and can generate reports 35 | of multiple devices that are loaded into the software. 36 | 37 | The core library can be used without the GUI to implement eds/xdd loading/saving 38 | and parsing etc in other projects. 39 | 40 | Please consider this code experimental and beta quality. 41 | It is a work in progress and is rapidly changing. 42 | 43 | Every attempt has been made to comply with the revelant DSP306 and other 44 | standards and esd files from multile sources have been tested for loading and 45 | saving as been (at times) validated for errors using EDS conformance tools. 46 | 47 | With many thanks to the following contributors for spotting my mistakes and 48 | improving the code 49 | * s-fuchs 50 | * martinwag 51 | * trojanobelix 52 | * many others... 53 | 54 | Library 55 | ------- 56 | 57 | * Read EDS/DCF/XDC file and parse contents to approprate classes 58 | * Dump EDS/DCF classes via ToString() 59 | * Save EDS/DCF classes back to EDS file 60 | * Export C and H files in CanOpenNode format CO_OD.c and CO_OD.h 61 | * EDS/DCF supports modules 62 | * EDS/DCF supports compactPDO (read only) 1* 63 | * EDS/DCF supports implict PDO (read only) 1* 64 | * EDS/DCF supports CompactSubOb (read only) 1* 65 | * Supports loading/saving of all EDS/DCF module information 66 | 67 | 1* read only in this context means the EDS/DCF is fully expanded but the compact 68 | forms is not written back, only the expanded form will be saved. 69 | 70 | GUI 71 | --- 72 | * Open multiple devices 73 | * Open EDS/DCF/XDC files 74 | * Save EDS/DCF/XDC files 75 | * View OD Entries and explore the Object Dictionary 76 | * Add new OD entries 77 | * Delete exisiting OD entries 78 | * Create new Devices 79 | * Add default profiles 80 | * Create profiles that can be added to any project (just save the device xml file to the profiles/ 81 | directory, only include the minimum number of objects that you want to auto insert) This will auto add to insert menu 82 | * Edit Device and File Info sections 83 | * Set RX/TX PDO mappings easily from dropdown lists of avaiable objects 84 | * Add and remove new PDO entries (communication paramaters and mapping) in a single button push 85 | * Save groups of EDS/XML files as a network objects with abality to set concrete node IDs 86 | * View report of all configured PDO across the network 87 | * View modules and module details present within EDS files 88 | * View/edit actual object values for device configuring/DCF files 89 | * Support for loading XDD files (CanOpen offical XML) 90 | * Support for saving XDD files (CanOpen offical XML) 91 | * Some module info is displayed in GUI showing avaiable modules (eds) and 92 | configured modules (dcf) and what OD entries they reference. Full details such 93 | as subobj extension and fixed subobj are not currently displayed and unless 94 | there is demand probably will not ever be. 95 | 96 | TODO 97 | ---- 98 | 99 | * Ensure and validate all XDD is loading/save correctly (Looking good so far) 100 | * Add extra Gui fields for accessing extra XDD paramaters not in EDS 101 | (all common ones are done, a few special/edge cases remain) 102 | * Look at XDC files and see if we can save config changes and allow editing and 103 | network setup here in the app, partial support is implemented by supporting 104 | DCF files 105 | 106 | 107 | BUGS 108 | ---- 109 | 110 | If you find any, please open a bug report on github and attach any files you 111 | have created/opened etc. 112 | 113 | Pictures 114 | -------- 115 | 116 | ![alt tag](pic1.jpg) 117 | ![alt tag](pic2.jpg) 118 | ![alt tag](pic3.jpg) 119 | ![alt tag](pic4.jpg) 120 | -------------------------------------------------------------------------------- /Tests/CLITest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using Xunit; 5 | 6 | namespace Tests 7 | { 8 | public class CliTest : libEDSsharp.EDSsharp 9 | { 10 | string RunEDSSharp(string arguments) 11 | { 12 | File.Delete("Legacy.c"); 13 | File.Delete("Legacy.h"); 14 | File.Delete("V4.c"); 15 | File.Delete("V4.h"); 16 | File.Delete("file.eds"); 17 | File.Delete("file.xpd"); 18 | 19 | Process p = new Process(); 20 | p.StartInfo.UseShellExecute = false; 21 | p.StartInfo.RedirectStandardOutput = true; 22 | p.StartInfo.FileName = "EDSSharp.exe"; 23 | p.StartInfo.Arguments = arguments; 24 | p.Start(); 25 | string output = p.StandardOutput.ReadToEnd(); 26 | p.WaitForExit(); 27 | return output; 28 | } 29 | 30 | [Fact] 31 | public void XddToCanOpenNodeLegacy() 32 | { 33 | RunEDSSharp("--type CanOpenNode --infile minimal_project.xdd --outfile Legacy"); 34 | string[] files = Directory.GetFiles(".", "Legacy.*"); 35 | Assert.Equal(2, files.Length); 36 | } 37 | [Fact] 38 | public void XddToCanOpenNodeV4() 39 | { 40 | RunEDSSharp("--type CanOpenNodeV4 --infile minimal_project.xdd --outfile V4"); 41 | string[] files = Directory.GetFiles(".", "V4.*"); 42 | Assert.Equal(2, files.Length); 43 | } 44 | [Fact] 45 | public void OnlySingleExporterByExtensionPossible() 46 | { 47 | RunEDSSharp("--infile minimal_project.xdd --outfile file.eds"); 48 | string[] files = Directory.GetFiles(".", "file.eds"); 49 | Assert.Single(files); 50 | } 51 | [Fact] 52 | public void MultipleExporterByExtensionPossibleWithoutType() 53 | { 54 | //this should fail 55 | RunEDSSharp("--infile minimal_project.xdd --outfile file.xdd"); 56 | string[] files = Directory.GetFiles(".", "file.xdd"); 57 | Assert.Empty(files); 58 | } 59 | [Fact] 60 | public void MultipleExporterByExtensionPossibleWithType() 61 | { 62 | RunEDSSharp("--type CanOpenXDDv1.1 --infile minimal_project.xdd --outfile file.nxdd"); 63 | string[] files = Directory.GetFiles(".", "file.nxdd"); 64 | Assert.Single(files); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Tests/PDOHelperTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | using libEDSsharp; 4 | 5 | namespace Tests 6 | { 7 | public class PDOHelperTests : libEDSsharp.EDSsharp 8 | { 9 | 10 | [Fact] 11 | public void Test_TPDO() 12 | { 13 | 14 | PDOHelper pdo = new PDOHelper(this); 15 | 16 | //configure a new slot 17 | PDOSlot slot = new PDOSlot(); 18 | pdo.pdoslots.Add(slot); 19 | 20 | slot.COB = 0x180; 21 | slot.ConfigurationIndex = 0x1800; 22 | slot.transmissiontype = 254; 23 | slot.inhibit = 10; 24 | slot.eventtimer = 20; 25 | slot.syncstart = 30; 26 | 27 | 28 | //fill it with some dummy entries 29 | ODentry od; 30 | tryGetODEntry(0x0002, out od); 31 | slot.Mapping.Add(od); 32 | 33 | tryGetODEntry(0x0003, out od); 34 | slot.Mapping.Add(od); 35 | 36 | tryGetODEntry(0x0004, out od); 37 | slot.Mapping.Add(od); 38 | 39 | pdo.buildmappingsfromlists(true); 40 | 41 | //check configuration object exists 42 | ODentry comparamOD; 43 | 44 | if (!tryGetODEntry(0x1800, out comparamOD)) 45 | { 46 | throw new Exception("Communication paramaters not generated"); 47 | } 48 | 49 | ODentry mappingOD; 50 | 51 | if (!tryGetODEntry(0x1a00, out mappingOD)) 52 | { 53 | throw new Exception("Mapping paramaters not generated"); 54 | } 55 | 56 | if (comparamOD.subobjects.Count != 6) 57 | throw new Exception("Wrong number of sub objects generated"); 58 | 59 | if(comparamOD.Nosubindexes!=6) 60 | throw new Exception("Wrong number of sub objects generated"); 61 | 62 | if (comparamOD.subobjects[1].datatype != DataType.UNSIGNED32) 63 | throw new Exception("Wrong data type for COB"); 64 | if (comparamOD.subobjects[2].datatype != DataType.UNSIGNED8) 65 | throw new Exception("Wrong data type for Transmission type"); 66 | if (comparamOD.subobjects[3].datatype != DataType.UNSIGNED16) 67 | throw new Exception("Wrong data type for Inhibit time"); 68 | if (comparamOD.subobjects[5].datatype != DataType.UNSIGNED16) 69 | throw new Exception("Wrong data type for Event timer"); 70 | if (comparamOD.subobjects[6].datatype != DataType.UNSIGNED8) 71 | throw new Exception("Wrong data type for Sync Start"); 72 | 73 | if (comparamOD.subobjects[1].defaultvalue != "0x180") //180 hex 74 | throw new Exception("TPDO COB wrong"); 75 | if (comparamOD.subobjects[2].defaultvalue != "254") 76 | throw new Exception("TPDO transmission type wrong"); 77 | if (comparamOD.subobjects[3].defaultvalue != "10") 78 | throw new Exception("TPDO inhibit wrong"); 79 | if (comparamOD.subobjects[5].defaultvalue != "20") 80 | throw new Exception("TPDO event timer wrong"); 81 | if (comparamOD.subobjects[6].defaultvalue != "30") 82 | throw new Exception("TPDO sync start wrong"); 83 | 84 | } 85 | 86 | [Fact] 87 | public void Test_RPDO() 88 | { 89 | 90 | PDOHelper pdo = new PDOHelper(this); 91 | 92 | //configure a new slot 93 | PDOSlot slot = new PDOSlot(); 94 | pdo.pdoslots.Add(slot); 95 | 96 | slot.COB = 0x401; 97 | slot.ConfigurationIndex = 0x1400; 98 | 99 | slot.transmissiontype = 254; 100 | slot.inhibit = 10; 101 | slot.eventtimer = 20; 102 | slot.syncstart = 30; 103 | 104 | 105 | //fill it with some dummy entries 106 | ODentry od; 107 | tryGetODEntry(0x0002, out od); 108 | slot.Mapping.Add(od); 109 | 110 | tryGetODEntry(0x0003, out od); 111 | slot.Mapping.Add(od); 112 | 113 | tryGetODEntry(0x0004, out od); 114 | slot.Mapping.Add(od); 115 | 116 | pdo.buildmappingsfromlists(true); 117 | 118 | //check configuration object exists 119 | ODentry comparamOD; 120 | 121 | if (!tryGetODEntry(0x1400, out comparamOD)) 122 | { 123 | throw new Exception("Communication paramaters not generated"); 124 | } 125 | 126 | ODentry mappingOD; 127 | 128 | if (!tryGetODEntry(0x1600, out mappingOD)) 129 | { 130 | throw new Exception("Mapping paramaters not generated"); 131 | } 132 | 133 | if (comparamOD.subobjects.Count != 4) 134 | throw new Exception("Wrong number of sub objects generated"); 135 | 136 | if (comparamOD.Nosubindexes != 4) 137 | throw new Exception("Wrong number of sub objects generated"); 138 | 139 | if (comparamOD.subobjects[1].datatype != DataType.UNSIGNED32) 140 | throw new Exception("Wrong data type for COB"); 141 | if (comparamOD.subobjects[2].datatype != DataType.UNSIGNED8) 142 | throw new Exception("Wrong data type for Transmission type"); 143 | if (comparamOD.subobjects[5].datatype != DataType.UNSIGNED16) 144 | throw new Exception("Wrong data type for Transmission type"); 145 | 146 | if (comparamOD.subobjects[1].defaultvalue != "0x401") //481 hex 147 | throw new Exception("TPDO COB wrong"); 148 | if (comparamOD.subobjects[2].defaultvalue != "254") 149 | throw new Exception("TPDO transmission type wrong"); 150 | if (comparamOD.subobjects[5].defaultvalue != "20") 151 | throw new Exception("TPDO event timer wrong default value"); 152 | } 153 | 154 | 155 | 156 | 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2a479bf3-7628-409b-8a29-9314c308445e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Tests/Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net481 4 | net8.0 5 | net481;net8.0 6 | Library 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Always 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | all 30 | runtime; build; native; contentfiles; analyzers; buildtransitive 31 | 32 | 33 | all 34 | runtime; build; native; contentfiles; analyzers; buildtransitive 35 | 36 | 37 | -------------------------------------------------------------------------------- /Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenEDS Editor auto build page 4 | 5 | 6 |

openEDS editor auto build

7 |

Below you will find the latest build link from travis-ci built using mono 6.10.0

8 |

OpenEDSEditor-latest.zip

9 |

The last build log can be found at

10 |

https://travis-ci.org/github/robincornelius/libedssharp

11 |

Enjoy!

12 |

 

13 |

 

14 | 15 | -------------------------------------------------------------------------------- /libEDSsharp/CanOpenEDS.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/libEDSsharp/CanOpenEDS.cs -------------------------------------------------------------------------------- /libEDSsharp/ExporterFactory.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace libEDSsharp 3 | { 4 | /// 5 | /// Factory for making different canopennode exporter 6 | /// 7 | public static class ExporterFactory 8 | { 9 | /// 10 | /// CanOpenNode exporter types 11 | /// 12 | public enum Exporter 13 | { 14 | /// 15 | /// CanOpenNode exporter v4 (latest) 16 | /// 17 | CANOPENNODE_V4 = 0, 18 | /// 19 | /// CanOpenNode exporter for v1-3 (legacy) 20 | /// 21 | CANOPENNODE_LEGACY = 1 22 | } 23 | 24 | /// 25 | /// Returns exporter based on ex parameter 26 | /// 27 | /// what exporter version you want. Default is CANOPENNODE_LEGACY 28 | /// A exporter 29 | public static IExporter getExporter(Exporter ex = Exporter.CANOPENNODE_LEGACY) 30 | { 31 | IExporter exporter; 32 | 33 | switch (ex) 34 | { 35 | default: 36 | case Exporter.CANOPENNODE_V4: 37 | exporter = new CanOpenNodeExporter_V4(); 38 | break; 39 | 40 | case Exporter.CANOPENNODE_LEGACY: 41 | exporter = new CanOpenNodeExporter(); 42 | break; 43 | } 44 | 45 | 46 | return exporter; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /libEDSsharp/Filetypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using static libEDSsharp.ExporterDescriptor; 5 | 6 | namespace libEDSsharp 7 | { 8 | /// 9 | /// Unified interface to all filetypes supported by the library 10 | /// 11 | public class Filetypes 12 | { 13 | /// 14 | /// Returns description of all the different filetypes that can be exported to 15 | /// 16 | /// optional filter to filter out different types of exporters 17 | /// list of file exporter that matches the filter 18 | public static ExporterDescriptor[] GetExporters(ExporterFlags flags = 0) 19 | { 20 | var exporters = new List(); 21 | foreach (Type mytype in System.Reflection.Assembly.GetExecutingAssembly().GetTypes() 22 | .Where(mytype => mytype.GetInterfaces().Contains(typeof(IFileExporter)))) 23 | { 24 | var exporterClass = (IFileExporter)Activator.CreateInstance(mytype); 25 | var classExporters = exporterClass.GetExporters(); 26 | foreach (var exporter in classExporters) 27 | { 28 | if (((exporter.Flags & flags) > 0) || flags == 0) 29 | { 30 | exporters.Add(exporter); 31 | } 32 | 33 | } 34 | } 35 | return exporters.ToArray(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /libEDSsharp/IExporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace libEDSsharp 8 | { 9 | /// 10 | /// Interface for exporting CanOpenNode OD files 11 | /// 12 | public interface IExporter 13 | { 14 | /// 15 | /// Export file(s) 16 | /// 17 | /// filepath, .c and .h will be added to this to make the mulitiple files 18 | /// The eds that will be exported 19 | void export(string filepath, EDSsharp eds); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libEDSsharp/IFileExporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace libEDSsharp 5 | { 6 | /// 7 | /// Includes all info about a exporter that is needed to show user and call it 8 | /// 9 | public class ExporterDescriptor 10 | { 11 | /// 12 | /// Export eds(s) to file(s) 13 | /// 14 | /// path path that should indicate where and what name the outputed file(s) should have 15 | /// list of eds(s) not all support multiple edss, in that case use the first 16 | public delegate void ExportFunc(string filepath, List edss); 17 | [Flags] 18 | public enum ExporterFlags 19 | { 20 | /// 21 | /// True if exporter will expect multiple edss 22 | /// 23 | MultipleNodeSupport = 1, 24 | /// 25 | /// Documentation related 26 | /// 27 | Documentation = 2, 28 | /// 29 | /// CanOpenNode related 30 | /// 31 | CanOpenNode = 3, 32 | } 33 | /// 34 | /// short human readable description 35 | /// 36 | public string Description { get; } 37 | /// 38 | /// What file extension the exported file(s) will have 39 | /// 40 | public string[] Filetypes { get; } 41 | /// 42 | /// Used to indicated different types of exporters 43 | /// 44 | public ExporterFlags Flags { get; } 45 | /// 46 | /// The function that is exporting to file 47 | /// 48 | public ExportFunc Func { get; } 49 | /// 50 | /// constructor that sets all the values 51 | /// 52 | /// short human readable description 53 | /// What file extension the exported file(s) will have 54 | /// Used to indicated different types of exporters 55 | /// The function that is exporting to file 56 | public ExporterDescriptor(string description, string[] filetypes, ExporterFlags flags, ExportFunc func) 57 | { 58 | Description = description; 59 | Filetypes = filetypes; 60 | Flags = flags; 61 | Func = func; 62 | } 63 | } 64 | /// 65 | /// Interface for exporters 66 | /// 67 | public interface IFileExporter 68 | { 69 | /// 70 | /// Fetches all the different fileexporter types the class supports 71 | /// 72 | /// List of the different exporters the class supports 73 | ExporterDescriptor[] GetExporters(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /libEDSsharp/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.42000 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace libEDSsharp.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. 17 | /// 18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert 19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. 20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen 21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 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("libEDSsharp.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle 51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. 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 | -------------------------------------------------------------------------------- /libEDSsharp/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | -------------------------------------------------------------------------------- /libEDSsharp/StringUnescape.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace libEDSsharp 8 | { 9 | /// 10 | /// Provides string escape and unescape functions 11 | /// 12 | public static class StringUnescape 13 | { 14 | /// 15 | /// Convert litteral special characters like null and tab etc. into there escape sequence '\0' '\t' 16 | /// 17 | /// the spesial character to convert into escape sequence 18 | /// a string containing the escape sequence or c if noe escape sequence was found 19 | public static string Escape(char c) 20 | { 21 | switch (c) 22 | { 23 | case '\0': 24 | return @"\0"; 25 | case '\n': 26 | return @"\n"; 27 | case '\r': 28 | return @"\r"; 29 | case '\t': 30 | return @"\t"; 31 | case '\a': 32 | return @"\a"; 33 | case '\b': 34 | return @"\b"; 35 | case '\f': 36 | return @"\f"; 37 | case '\v': 38 | return @"\v"; 39 | 40 | default: 41 | return c.ToString(); 42 | } 43 | } 44 | 45 | public static string Unescape(this string txt) 46 | { 47 | if (string.IsNullOrEmpty(txt)) { return txt; } 48 | StringBuilder retval = new StringBuilder(txt.Length); 49 | for (int ix = 0; ix < txt.Length;) 50 | { 51 | int jx = txt.IndexOf('\\', ix); 52 | if (jx < 0 || jx == txt.Length - 1) jx = txt.Length; 53 | retval.Append(txt, ix, jx - ix); 54 | if (jx >= txt.Length) break; 55 | switch (txt[jx + 1]) 56 | { 57 | case 'n': retval.Append('\n'); break; // Line feed 58 | case 'r': retval.Append('\r'); break; // Carriage return 59 | case 't': retval.Append('\t'); break; // Tab 60 | case '0': retval.Append('\0'); break; // Null 61 | case 'a': retval.Append('\a'); break; // Bell 62 | case 'b': retval.Append('\b'); break; // Backspace 63 | case 'f': retval.Append('\f'); break; // Form feed 64 | case 'v': retval.Append('\v'); break; // Vertical tab 65 | case '\\': retval.Append('\\'); break; // Don't escape 66 | default: // Unrecognized, copy as-is 67 | retval.Append('\\').Append(txt[jx + 1]); break; 68 | } 69 | ix = jx + 2; 70 | } 71 | return retval.ToString(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /libEDSsharp/Warnings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace libEDSsharp 8 | { 9 | /// 10 | /// Logger class used to report problems with import/export 11 | /// 12 | public static class Warnings 13 | { 14 | /// 15 | /// type of warnings 16 | /// 17 | public enum warning_class 18 | { 19 | /// 20 | /// Generic warning 21 | /// 22 | WARNING_GENERIC = 0x01, 23 | /// 24 | /// index/subindex rename warnings 25 | /// 26 | WARNING_RENAME = 0x02, 27 | /// 28 | /// problem with index/subindexes that are needed to make canopennode functions work 29 | /// 30 | WARNING_BUILD = 0x04, 31 | /// 32 | /// Problem with strings variable export 33 | /// 34 | WARNING_STRING = 0x08, 35 | /// 36 | /// Problem with struct/record export 37 | /// 38 | WARNING_STRUCT = 0x10, 39 | } 40 | 41 | /// 42 | /// List of warnings 43 | /// 44 | public static List warning_list = new List(); 45 | /// 46 | /// bit mask used to stop messages being added to the list 47 | /// 48 | public static UInt32 warning_mask = 0xffff; 49 | 50 | /// 51 | /// Add warning to the list of warnings 52 | /// 53 | /// string to report 54 | /// type of warning (filter usage) 55 | public static void AddWarning(string warning,warning_class c = warning_class.WARNING_GENERIC) 56 | { 57 | if (((UInt32)c & warning_mask) != 0) 58 | { 59 | warning_list.Add(warning); 60 | } 61 | } 62 | } 63 | 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /libEDSsharp/extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace libEDSsharp 8 | { 9 | /// 10 | /// Helper functions to convert integral values into hexadecimal string 11 | /// 12 | public static class extensions 13 | { 14 | /// 15 | /// returns a string containing the value as hexadecimal 16 | /// 17 | /// the value 18 | /// hexadecimal string representing the value 19 | public static string ToHexString(this byte val) 20 | { 21 | return String.Format("0x{0:x}", val); 22 | } 23 | /// 24 | /// returns a string containing the value as hexadecimal 25 | /// 26 | /// the value 27 | /// hexadecimal string representing the value 28 | public static string ToHexString(this UInt16 val) 29 | { 30 | return String.Format("0x{0:x}",val); 31 | } 32 | /// 33 | /// returns a string containing the value as hexadecimal 34 | /// 35 | /// the value 36 | /// hexadecimal string representing the value 37 | public static string ToHexString(this UInt32 val) 38 | { 39 | return String.Format("0x{0:x}", val); 40 | } 41 | 42 | } 43 | 44 | /// 45 | /// String extension methodes 46 | /// 47 | public static class StringExtensions 48 | { 49 | /// 50 | /// Performs a case insensitive Contain function 51 | /// 52 | /// the string to look in 53 | /// the string to look for 54 | /// comparison methode 55 | /// true if substring is found in str 56 | /// substring was null 57 | /// comp methode was not a valid argument 58 | /// This can be replaced with native .net function in .net core 59 | /// 60 | public static bool Contains(this String str, String substring, 61 | StringComparison comp) 62 | { 63 | if (substring == null) 64 | throw new ArgumentNullException("substring", 65 | "substring cannot be null."); 66 | else if (!Enum.IsDefined(typeof(StringComparison), comp)) 67 | throw new ArgumentException("comp is not a member of StringComparison", 68 | "comp"); 69 | 70 | return str.IndexOf(substring, comp) >= 0; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /libEDSsharp/libEDSsharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net481 4 | net8.0 5 | net481;net8.0 6 | Library 7 | true 8 | 9 | 10 | 11 | 12 | 13 | libEDSsharp 14 | Copyright © 2016 15 | libEDSsharp 16 | 1.0.0.0 17 | 1.0.0.0 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | $(gitInfo) 27 | 28 | 29 | 30 | 31 | docs\libEDSsharp.xml 32 | 33 | 34 | 35 | True 36 | True 37 | Resources.resx 38 | 39 | 40 | 41 | 42 | ResXFileCodeGenerator 43 | Resources.Designer.cs 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /libEDSsharp/proto/.gitignore: -------------------------------------------------------------------------------- 1 | *.cs 2 | -------------------------------------------------------------------------------- /pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/pic1.jpg -------------------------------------------------------------------------------- /pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/pic2.jpg -------------------------------------------------------------------------------- /pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/pic3.jpg -------------------------------------------------------------------------------- /pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CANopenNode/CANopenEditor/9bdecb90573aaa6160dd4d220ce6cabe024edced/pic4.jpg -------------------------------------------------------------------------------- /setup.nsi: -------------------------------------------------------------------------------- 1 | ; example1.nsi 2 | ; 3 | ; This script is perhaps one of the simplest NSIs you can make. All of the 4 | ; optional settings are left to their default settings. The installer simply 5 | ; prompts the user asking them where to install, and drops a copy of example1.nsi 6 | ; there. 7 | 8 | ;-------------------------------- 9 | 10 | 11 | !include "MUI2.nsh" 12 | !include "x64.nsh" ; Macros for x64 machines 13 | 14 | ; The name of the installer 15 | Name "OpenEdsEditor" 16 | 17 | ; The file to write 18 | OutFile "edseditor-Setup.exe" 19 | 20 | ; Show install details 21 | ShowInstDetails show 22 | 23 | ; The default installation directory 24 | InstallDir "$PROGRAMFILES\OpenEdsEditor\" 25 | 26 | ; Request application privileges for Windows Vista 27 | ;RequestExecutionLevel Admin 28 | 29 | SetOverwrite on 30 | 31 | 32 | !define MUI_HEADERIMAGE 33 | !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ; optional 34 | !define MUI_ABORTWARNING 35 | 36 | ;-------------------------------- 37 | 38 | ; Pages 39 | 40 | 41 | !insertmacro MUI_PAGE_LICENSE "License-GPLv3.txt" 42 | !insertmacro MUI_PAGE_COMPONENTS 43 | !insertmacro MUI_PAGE_DIRECTORY 44 | !insertmacro MUI_PAGE_INSTFILES 45 | 46 | !insertmacro MUI_UNPAGE_CONFIRM 47 | !insertmacro MUI_UNPAGE_INSTFILES 48 | 49 | 50 | 51 | ;Page instfiles 52 | 53 | ; The stuff to install 54 | Section "OpenEdsEditor" Secopeneds ;No components page, name is not important 55 | 56 | ; Set output path to the installation directory. 57 | SetOutPath $INSTDIR 58 | 59 | ; Put file there 60 | File EDSEditorGUI\bin\Release\EDSEditor.exe 61 | File EDSEditorGUI\bin\Release\EDSEditor.exe.config 62 | File EDSEditorGUI\bin\Release\*.dll 63 | File EDSEditorGUI\bin\Release\style.css 64 | File Index_8287_16x.ico 65 | File License-GPLv3.txt 66 | 67 | SetOutPath $INSTDIR\Profiles 68 | File EDSEditorGUI\Profiles\* 69 | 70 | SetShellVarContext all 71 | CreateDirectory "$SMPROGRAMS\OpenEDSEditor" 72 | CreateShortCut "$SMPROGRAMS\OpenEDSEditor\OpenEDSEditor.lnk" $INSTDIR\EDSEditor.exe "" $INSTDIR\Index_8287_16x.ico 0 73 | 74 | ;Create uninstaller 75 | WriteUninstaller "$INSTDIR\Uninstall.exe" 76 | 77 | CreateShortCut "$SMPROGRAMS\OpenEDSEditor\Uninstall.lnk" $INSTDIR\Uninstall.exe 78 | 79 | SectionEnd ; end the section 80 | 81 | ;Language strings 82 | LangString DESC_Secopeneds ${LANG_ENGLISH} "The Open EDS editor" 83 | 84 | 85 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 86 | !insertmacro MUI_DESCRIPTION_TEXT ${Secopeneds} $(DESC_Secopeneds) 87 | !insertmacro MUI_FUNCTION_DESCRIPTION_END 88 | 89 | 90 | Function .onInit 91 | 92 | ;Extract InstallOptions files 93 | ;$PLUGINSDIR will automatically be removed when the installer closes 94 | 95 | InitPluginsDir 96 | 97 | Push $0 98 | Pop $0 99 | 100 | FunctionEnd 101 | 102 | 103 | Section "Uninstall" 104 | 105 | ;ADD YOUR OWN FILES HERE... 106 | 107 | Delete "$INSTDIR\*" 108 | Delete "$INSTDIR\Profiles\*" 109 | RMDir "$INSTDIR\Profiles" 110 | RMDir "$INSTDIR" 111 | 112 | SetShellVarContext all 113 | 114 | Delete "$SMPROGRAMS\OpenEDSEditor\OpenEDSEditor.lnk" 115 | RMDir "$SMPROGRAMS\OpenEDSEditor" 116 | 117 | SectionEnd 118 | 119 | 120 | --------------------------------------------------------------------------------