("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 | 
117 | 
118 | 
119 | 
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 |
--------------------------------------------------------------------------------