Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ebc961a
Merge branch 'pr/n22_fix-workflow' into feature
trojanobelix Dec 6, 2022
bd65db6
Merge branch 'pr/n19_bugfix-array-of-strings-export' into feature
trojanobelix Dec 6, 2022
7b8ceba
Extend dirty-notification with an option to save instantly rather tha…
uniederer Dec 15, 2022
5ef3e83
Make message more explicit
uniederer Dec 15, 2022
813788a
Add autosave option
uniederer Dec 15, 2022
6e83ea2
Merge branch 'pr/n44_feature/allow_instant_save' into feature
trojanobelix Dec 15, 2022
bb60e06
Merge branch 'feature' of https://github.com/CANopenNode/CANopenEdito…
trojanobelix Dec 15, 2022
9f5048d
Merge branch 'bugfix' into feature
trojanobelix Jan 10, 2023
44860c7
Merge branch 'bugfix' into feature
trojanobelix Jan 30, 2023
2326320
Merge branch 'bugfix' into feature
trojanobelix Jul 6, 2023
ba45e03
Add/extend some exception catches to provide more information what wa…
trojanobelix Dec 1, 2024
e6472ec
Merge remote-tracking branch 'Github_origin/main' into feature
trojanobelix Jan 14, 2025
0c97545
Merge remote-tracking branch 'Github_origin/ExeptionCatch' into feature
trojanobelix Jan 14, 2025
5cb1bda
Unified header for Exporter legacy/V4
trojanobelix Jan 14, 2025
f959354
Merge remote-tracking branch 'trojanobelix/feature' into ExeptionCatch
trojanobelix Jan 14, 2025
b995b39
Update EDSEditorGUI/Form1.cs
trojanobelix Mar 10, 2025
760a177
Update EDSEditorGUI/Form1.cs
trojanobelix Mar 10, 2025
d7f774b
Merge remote-tracking branch 'trojanobelix/feature' into feature
trojanobelix Mar 25, 2025
bd326c5
Merge remote-tracking branch 'origin/main' into feature
trojanobelix Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions EDSEditorGUI/EDSEditorGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="SourceGrid" Version="4.4.0" Condition="'$(TargetFramework)' == 'net481'"/>
<PackageReference Include="SourceGrid-huanlin" Version="6.0.10" Condition="'$(TargetFramework)' == 'net8.0-windows'"/>
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0-windows'"/>
<PackageReference Include="SourceGrid" Version="4.4.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0-windows'" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
<PackageReference Include="SourceGrid-mehmetulukaya">
<Version>8.0.11</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<PreBuildEvent>git describe --tags --long --dirty &gt; "$(MSBuildProjectDirectory)$([System.IO.Path]::DirectorySeparatorChar)version.txt" || exit 0</PreBuildEvent>
</PropertyGroup>
Expand Down
5 changes: 4 additions & 1 deletion EDSEditorGUI/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 47 additions & 16 deletions EDSEditorGUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ You should have received a copy of the GNU General Public License
using System.Windows.Forms;
using System.IO;
using libEDSsharp;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
//using static System.Windows.Forms.VisualStyles.VisualStyleElement;
//using SourceGrid.Cells.Controllers;
//using ToolTip = System.Windows.Forms.ToolTip;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove the commented code?


namespace ODEditor
{
Expand Down Expand Up @@ -189,6 +191,12 @@ private void openEDSfile(string path,InfoSection.Filetype ft)
{
EDSsharp eds = new EDSsharp();

if (!File.Exists(path))
{
MessageBox.Show("File " +path + "\ndoes not exist.");
return;
}

eds.Loadfile(path);

DeviceView device = new DeviceView(eds, network);
Expand Down Expand Up @@ -327,6 +335,11 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)

private void openXDDfile(string path)
{
if (!File.Exists(path))
{
MessageBox.Show("File " + path + "\ndoes not exist.");
return;
}
try
{
EDSsharp eds;
Expand Down Expand Up @@ -1329,34 +1342,52 @@ private void preferencesToolStripMenuItem_Click(object sender, EventArgs e)

private void tabControl1_MouseClick(object sender, MouseEventArgs e)
{
TabPage tp;
if (e.Button == MouseButtons.Right)
{
for (int i = 0; i <= tabControl1.TabCount - 1; i++)
{
if (tabControl1.GetTabRect(i).Contains(e.Location))
{
tp = tabControl1.TabPages[i];

DialogResult dialogResult = MessageBox.Show(tabControl1.TabPages[i].Text, "Close file?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{

DeviceView device = (DeviceView)tabControl1.TabPages[i].Controls[0];

if (device.eds.Dirty == true)
{
if (MessageBox.Show("All unsaved changes will be lost\n continue?", "Unsaved changes", MessageBoxButtons.YesNo) == DialogResult.No)
return;
}

network.Remove(device.eds);

tabControl1.TabPages.Remove(tabControl1.TabPages[i]);
DeviceView device = (DeviceView)tabControl1.TabPages[i].Controls[0];
if (device.eds.Dirty == true)
{
if (MessageBox.Show("All unsaved changes will be lost\n continue?", "Unsaved changes", MessageBoxButtons.YesNo) == DialogResult.No)
return;
}
network.Remove(device.eds);
tabControl1.TabPages.Remove(tabControl1.TabPages[i]);
}
}
}
}
}
private void tabControl1_MouseHover(object sender, EventArgs e)
{

TabControl tabControl = sender as TabControl;
Point mousePosition = tabControl.PointToClient(Cursor.Position);
for (int i = 0; i < tabControl.TabCount; i++)
{
Rectangle tabRect = tabControl.GetTabRect(i);
if (tabRect.Contains(mousePosition))
{
ToolTip toolTip = new ToolTip();
// Set up the delays for the ToolTip.

toolTip.AutoPopDelay = 5000;
toolTip.InitialDelay = 1000;
toolTip.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip.ShowAlways = true;
DeviceView device = (DeviceView)tabControl1.TabPages[i].Controls[0];
toolTip.SetToolTip(tabControl, device.eds.projectFilename);
break;
}
}
}

}
}
2 changes: 1 addition & 1 deletion EDSEditorGUI/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
gqUTTxJHNd2gfCHts8Z5i7NeLLN6n/yF4ayxvMR1qkHEsYBFyBChoowNFOEgRrtBio0knUst/AOeXyaX
Sq4NMHLMowQdiucH/4Pfs7VzE+N+UlgC2l9c92MYCO0CtYrrfh+7bu0ECD4DV0bDX6oC05+kVxpa9Ajo
2QYurhuaugdc7gD9T6ZiKZ4UpBJyOeD9jL4pA/TeAp2r/tzq5zh9AFI0q8QNcHAIjOQpe63Fuzua5/bn
HW9+kH4AMgFyjcd8GS4AAAAJcEhZcwAACw4AAAsOAUC+4UEAAAAHdElNRQfkCwILIglO4xvLAAAAD3RF
HW9+kH4AMgFyjcd8GS4AAAAJcEhZcwAACwwAAAsMAT9AIsgAAAAHdElNRQfkCwILIglO4xvLAAAAD3RF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a little help with the changes here :D

WHRDb21tZW50AENBTm9wZW7cllV1AAAC8UlEQVRYR9WWz2sTQRTHkx6SQy5RxFv1JDGHogiVIkqFEqLE
QigetKY3iSUpPYh/gD8uoQiJIEKJ0UNNRZKjTaQiHozePAk21eagCC20NdW1plTa8X3f7mw3cZNuzSr6
hQ+8zn6/M29nZts6/hWdIu4T4xZJE2cJ23QvGAyKRCJhCXgp80CN2qNxTAyVP5QZZVXhn6H5mRlGCl5k
Expand Down
9 changes: 7 additions & 2 deletions libEDSsharp/CanOpenEDS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
public partial class InfoSection
{
public virtual void Parse(Dictionary<string, string> section, string sectionname)

Check warning on line 31 in libEDSsharp/CanOpenEDS.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.Parse(Dictionary<string, string>, string)'
{
this.section = section;

Expand Down Expand Up @@ -84,7 +84,7 @@
}
}

public partial class MandatoryObjects : SupportedObjects

Check warning on line 87 in libEDSsharp/CanOpenEDS.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'MandatoryObjects'
{
public MandatoryObjects(Dictionary<string, string> section)
: this()
Expand Down Expand Up @@ -825,8 +825,13 @@
int lineno = 1;
foreach (string linex in System.IO.File.ReadLines(filename))
{
Parseline(linex, lineno);
lineno++;
try
{
Parseline(linex, lineno);
lineno++;
}
catch (Exception) { Warnings.warning_list.Add("Failed to open file \n" + filename);}

}

di = new DeviceInfo(eds["DeviceInfo"]);
Expand Down
38 changes: 17 additions & 21 deletions libEDSsharp/CanOpenNodeExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,22 @@ This file was automatically generated by CANopenEditor {0}
https://github.com/CANopenNode/CANopenEditor

DON'T EDIT THIS FILE MANUALLY !!!!
*******************************************************************************/", this.gitVersion));
*******************************************************************************", this.gitVersion));
file.WriteLine(" FILE INFO:");
file.WriteLine(string.Format(" FileName: {0}", Path.GetFileName(eds.projectFilename)));
file.WriteLine(string.Format(" FileVersion: {0}", eds.fi.FileVersion));
file.WriteLine(string.Format(" CreationTime: {0}", eds.fi.CreationTime));
file.WriteLine(string.Format(" CreationDate: {0}", eds.fi.CreationDate));
file.WriteLine(string.Format(" CreatedBy: {0}", eds.fi.CreatedBy));

file.WriteLine("");
file.WriteLine(" DEVICE INFO:");
file.WriteLine(string.Format(" VendorName: {0}", eds.di.VendorName));
file.WriteLine(string.Format(" VendorNumber: {0}", eds.di.VendorNumber));
file.WriteLine(string.Format(" ProductName: {0}", eds.di.ProductName));
file.WriteLine(string.Format(" ProductNumber: {0}", eds.di.ProductNumber));
file.WriteLine("*******************************************************************************/");
file.WriteLine("");
}

private void export_h(string filename)
Expand Down Expand Up @@ -503,28 +518,9 @@ CANopen DATA TYPES

");

file.WriteLine("/*******************************************************************************");
file.WriteLine(" FILE INFO:");
file.WriteLine(string.Format(" FileName: {0}", Path.GetFileName(eds.projectFilename)));
file.WriteLine(string.Format(" FileVersion: {0}", eds.fi.FileVersion));
file.WriteLine(string.Format(" CreationTime: {0}", eds.fi.CreationTime));
file.WriteLine(string.Format(" CreationDate: {0}", eds.fi.CreationDate));
file.WriteLine(string.Format(" CreatedBy: {0}", eds.fi.CreatedBy));
file.WriteLine("*******************************************************************************/");
file.WriteLine("");
file.WriteLine("");

file.WriteLine("/*******************************************************************************");
file.WriteLine(" DEVICE INFO:");
file.WriteLine(string.Format(" VendorName: {0}", eds.di.VendorName));
file.WriteLine(string.Format(" VendorNumber: {0}", eds.di.VendorNumber));
file.WriteLine(string.Format(" ProductName: {0}", eds.di.ProductName));
file.WriteLine(string.Format(" ProductNumber: {0}", eds.di.ProductNumber));
file.WriteLine("*******************************************************************************/");
file.WriteLine("");
file.WriteLine("");

file.WriteLine(@"/*******************************************************************************
file.WriteLine(@"/*******************************************************************************
FEATURES
*******************************************************************************/");

Expand Down
27 changes: 26 additions & 1 deletion libEDSsharp/CanOpenNodeExporter_V4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,33 @@ This file was automatically generated by CANopenEditor {0}
https://github.com/CANopenNode/CANopenEditor

DON'T EDIT THIS FILE MANUALLY, UNLESS YOU KNOW WHAT YOU ARE DOING !!!!
*******************************************************************************/
*******************************************************************************

File info:
File Names: {1}.h; {1}.c
Project File: {2}
File Version: {3}

Created: {4}
Created By: {5}
Modified: {6}
Modified By: {7}

Device Info:
Vendor Name: {8}
Vendor ID: {9}
Product Name: {10}
Product ID: {11}

Description: {12}
*******************************************************************************/",
gitVersion, odname,
Path.GetFileName(eds.projectFilename), eds.fi.FileVersion,
eds.fi.CreationDateTime, eds.fi.CreatedBy, eds.fi.ModificationDateTime, eds.fi.ModifiedBy,
eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber,
eds.fi.Description));

file.WriteLine(string.Format(@"
#define OD_DEFINITION
#include ""301/CO_ODinterface.h""
#include ""{1}.h""
Expand Down
10 changes: 9 additions & 1 deletion libEDSsharp/CanOpenXDD_1_1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,16 @@ public EDSsharp ReadXML(string file)
dev = (ISO15745ProfileContainer)serializer.Deserialize(reader);
reader.Close();
}
catch (Exception)
catch (Exception e)
{
if (e is System.InvalidOperationException)
{
Warnings.warning_list.Add(String.Format("{0} {1} Action aborted!", e.Message, e.InnerException.Message));
}
else
{
Warnings.warning_list.Add(String.Format("{0} Action aborted!", e.ToString()));
}
return null;
}

Expand Down
Loading