Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
688f178
fix project for dotnet build EDSEditorGUI/EDSEditorGUI.csproj
KMK0815 Nov 5, 2025
bf4a8ab
Merge branch 'CANopenNode:main' into main
KMK0815 Nov 27, 2025
e57e416
Merge branch 'CANopenNode:main' into main
KMK0815 Dec 1, 2025
a2e223d
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Dec 1, 2025
90bdda7
feat: implement CouchDB export functionality with GUI integration and…
KMK0815 Dec 4, 2025
86a5bae
Merge upstream/main: Updated dependencies and added profile import tests
KMK0815 Dec 4, 2025
19abbc8
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Dec 4, 2025
61e2d07
Checks for existing documents - Before uploading, it tries to GET the…
KMK0815 Dec 4, 2025
a163f8d
Merge branch 'CANopenNode:main' into main
KMK0815 Dec 8, 2025
7a43690
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Dec 8, 2025
8aa5c5d
Merge branch 'CANopenNode:main' into main
KMK0815 Jan 19, 2026
3f9ab73
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Jan 19, 2026
6d8ba32
[FEATURE] Add automated ZIP creation for Release builds and deploymen…
KMK0815 Jan 20, 2026
4d1611a
Merge branch 'CANopenNode:main' into main
KMK0815 Apr 30, 2026
2b4b5b7
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Apr 30, 2026
71be22d
Merge branch 'CANopenNode:main' into main
KMK0815 Jun 4, 2026
8b265d4
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Jun 4, 2026
f088d30
Remove deployment ZIP creation target from project file
KMK0815 Jun 5, 2026
824af87
Merge branch 'main' of github.com:CANopenNode/CANopenEditor into main
KMK0815 Jul 13, 2026
1a5b8cf
[ROOT][DOCS] contrib-readme-action has updated readme
github-actions[bot] Jul 13, 2026
7357994
Add --export-project CLI command to EDSSharp
KMK0815 Jul 14, 2026
4774286
Add CANopen demo network and CO_countLabel EDS extension
claude Jul 14, 2026
719f057
CI: Release-Workflow fuer den EDSSharp-CLI
claude Jul 15, 2026
2169d6e
CI: EDSSharp-Release auch per cli-v*-Tag ausloesen
claude Jul 15, 2026
d994200
CI: EDSSharp-Release ueber Marker-Datei EDSSharp/RELEASE_TAG ausloesen
claude Jul 15, 2026
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
103 changes: 103 additions & 0 deletions .github/workflows/edssharp-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# EDSSharp-CLI als GitHub-Release veroeffentlichen.
#
# Manuell ausloesen (Actions -> "EDSSharp CLI Release" -> Run workflow)
# mit dem gewuenschten Tag. Baut den Kommandozeilen-Konverter aus
# EDSSharp/ (net8.0) und haengt drei Artefakte an das Release:
#
# EDSSharp-linux-x64.tar.gz eigenstaendiges Binary (keine .NET-Installation noetig)
# EDSSharp-win-x64.zip dito fuer Windows
# EDSSharp-portable.zip frameworkabhaengig (braucht .NET-8-Runtime, klein)
#
# CANboss nutzt das linux-x64-Binary zur Buildzeit fuer die OD-Generierung
# aus den EDS-Dateien (tools/get-edssharp.sh im CANboss-Repo).

name: EDSSharp CLI Release

# Drei Ausloeser (Push-Events laufen immer vom gepushten Commit, der
# Workflow muss dafuer nicht auf main liegen):
# 1. Aenderung der Marker-Datei EDSSharp/RELEASE_TAG (enthaelt den Tag)
# 2. Tag "cli-v*" pushen
# 3. manuell per workflow_dispatch (sobald der Workflow auf main liegt)
# Das GUI-Release (release.yml, Tags "v*.*.*") bleibt unberuehrt.
on:
push:
branches:
- "**"
paths:
- "EDSSharp/RELEASE_TAG"
workflow_dispatch:
inputs:
tag:
description: "Release-Tag (z.B. cli-v4.2.3-protronic.1)"
required: true
default: "cli-v4.2.3-protronic.1"

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Release-Tag bestimmen (Input > Git-Tag > Marker-Datei)
run: |
if [ -n "${{ inputs.tag }}" ]; then
TAG="${{ inputs.tag }}"
elif [ "${GITHUB_REF#refs/tags/}" != "$GITHUB_REF" ]; then
TAG="${GITHUB_REF#refs/tags/}"
else
TAG="$(tr -d ' \n' < EDSSharp/RELEASE_TAG)"
fi
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "Release-Tag: $TAG"

- name: Tag fuer den Versionsstempel setzen (git describe im Build)
run: git tag "$TAG" || true

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Publish linux-x64 (self-contained)
run: >
dotnet publish EDSSharp/EDSSharp.csproj -c Release -f net8.0
-p:BuildNet8=true -r linux-x64 --self-contained true
-p:PublishSingleFile=true -o out/linux-x64

- name: Publish win-x64 (self-contained)
run: >
dotnet publish EDSSharp/EDSSharp.csproj -c Release -f net8.0
-p:BuildNet8=true -r win-x64 --self-contained true
-p:PublishSingleFile=true -o out/win-x64

- name: Publish portable (frameworkabhaengig)
run: >
dotnet publish EDSSharp/EDSSharp.csproj -c Release -f net8.0
-p:BuildNet8=true -o out/portable

- name: Artefakte packen
run: |
tar -C out/linux-x64 -czf EDSSharp-linux-x64.tar.gz EDSSharp
(cd out/win-x64 && zip -q ../../EDSSharp-win-x64.zip EDSSharp.exe)
(cd out/portable && zip -qr ../../EDSSharp-portable.zip .)

- name: Release anlegen
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$TAG" \
EDSSharp-linux-x64.tar.gz EDSSharp-win-x64.zip EDSSharp-portable.zip \
--target "${{ github.sha }}" \
--title "EDSSharp CLI $TAG" \
--notes "EDSSharp-Kommandozeilen-Konverter (CANopenEditor) als Build-Tool.

EDS/XDD -> CANopenNode-v4-OD (C/H) u.a.:

EDSSharp --export-project --infile geraet.eds --outdir out --od mein_od --canopennode v4

Wird vom CANboss-Monorepo zur Buildzeit fuer die OD-Generierung
verwendet (tools/get-edssharp.sh laedt das linux-x64-Binary)."
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ edseditor-Setup.exe
/SourceGrid_4.21
/packages/
*.bak
releases/*
out-cli/
243 changes: 243 additions & 0 deletions COUCHDB_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
# CouchDB Export Feature - Changelog

## Übersicht
Implementierung einer vollständigen CouchDB-Export-Funktionalität für CANopenEditor mit HTTP-Upload-Unterstützung und Konfigurationsmenü.

---

## Phase 1: CouchDB Exporter Implementation

### Neue Datei: `libEDSsharp/CouchDBExporter.cs`
- **Klasse**: `CouchDBExporter : IFileExporter`
- **Funktionalität**:
- `ExportSingleDocument()` - Exportiert einzelnes EDS-Gerät im CanOpenNode Protobuf JSON Format
- `ExportMultipleDocuments()` - Exportiert mehrere Geräte als separate JSON-Dateien
- `UploadToCouchDB()` - Asynchroner HTTP PUT Upload zu CouchDB Server
- **Format**: Nutzt `WriteProtobuf` aus `CanOpenXDD_1_1` mit JSON-Flag
- **CouchDB Dokument-Struktur**:
```json
{
"_id": "productName",
"proto": { /* CanOpenNode Protobuf JSON */ }
}
```
- **Abhängigkeiten**:
- `Newtonsoft.Json` (13.0.3) für JSON-Wrapping
- `System.Net.Http` für HTTP-Requests

### GetExporters() - Registrierte Exporter:
1. "CouchDB JSON (CanOpenNode Protobuf)" - Einzeldokument-Export
2. "CouchDB JSON (Multiple Devices)" - Multi-Geräte-Export

---

## Phase 2: GUI Integration

### Form1.cs - Event Handler
**Neue Methode**: `exportCouchDBToolStripMenuItem_Click()`
- Asynchrone Implementation (`async void`)
- Dual-Mode Dialog:
- **Yes**: Upload zu CouchDB (via HTTP PUT)
- **No**: Speichern als lokale JSON-Datei
- **Cancel**: Abbruch
- **Upload-Verhalten**:
- Liest CouchDB-URL aus Preferences
- Validiert URL-Konfiguration
- Zeigt Erfolgs-/Fehlermeldung mit Response
- **Fehlerbehandlung**: Try-Catch mit aussagekräftigen Meldungen

### Form1.Designer.cs - Menu Item
- **Neues Control**: `exportCouchDBToolStripMenuItem`
- **Menu-Hierarchie**: File → Export to CouchDB...
- **Eigenschaften**:
- Text: "Export to Couch&DB..."
- Shortcut-Ready (Alt+D für Keyboard-Navigation)
- Enabled-Status tied to active tab
- Event-Handler verbunden

---

## Phase 3: Preferences Dialog

### Preferences.Designer.cs - UI-Komponenten
**Neue Controls**:
- `label_couchdb`: Label "CouchDB URL"
- `textBox_couchdburl`: TextBox für URL-Eingabe
- Position: Unter den Warning-Checkboxen
- Size: 478px Breite für lange URLs

### Preferences.cs - Logik
- **InitializeComponent()**:
- Lädt aktuelle CouchDB-URL aus Settings
- Standard: `http://localhost:5984/canopen`
- **button_save_Click()**:
- Speichert neue URL in Properties.Settings
- Persistierung via `Settings.Default.Save()`

---

## Phase 4: Settings & Configuration

### Settings.settings (EDSEditorGUI)
```xml
<Setting Name="CouchDBUrl" Type="System.String" Scope="User">
<Value Profile="(Default)">http://localhost:5984/canopen</Value>
</Setting>
```

### Settings.Designer.cs - Property
```csharp
[UserScopedSetting]
[DefaultSettingValue("http://localhost:5984/canopen")]
public string CouchDBUrl {
get { return ((string)(this["CouchDBUrl"])); }
set { this["CouchDBUrl"] = value; }
}
```

### App.config
- User-Setting-Eintrag für CouchDBUrl
- Default-Wert: `http://localhost:5984/canopen`
- Scope: User (pro Benutzer konfigurierbar)

---

## Phase 5: Dependency Management

### libEDSsharp.csproj - Package References
```xml
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4"
Condition="'$(TargetFramework)' == 'net481'" />
```
- **System.Net.Http**: Nur für .NET Framework 4.8.1 (HttpClient-Support)
- **Newtonsoft.Json**: Für JSON-Manipulation und CouchDB-Dokument-Wrapping

### Multi-Target Support
- ✅ .NET Framework 4.8.1
- ✅ .NET 8.0

---

## Technische Details

### HTTP PUT Upload
```csharp
// URL: {couchDbUrl}/{productName}
PUT http://localhost:5984/canopen/MyProduct
Content-Type: application/json

{
"_id": "MyProduct",
"proto": { /* Protobuf JSON */ }
}
```

### Workflow
1. Benutzer öffnet EDS-Datei
2. File → Export to CouchDB...
3. Dialog: Upload oder Speichern?
4. Bei Upload:
- Generiert Protobuf JSON
- Wraps in CouchDB-Dokument
- Sendet HTTP PUT
- Zeigt Response/Fehler
5. Bei Speichern:
- Öffnet SaveFileDialog
- Speichert Protobuf JSON lokal

### Fehlerbehandlung
- Missing CouchDB URL: Warnung mit Preferences-Hinweis
- HTTP Error: Status-Code + Response-Body anzeigen
- Network Error: Exception-Message anzeigen

---

## Build Status

### Erfolgreich kompiliert
- ✅ libEDSsharp (net481 + net8.0)
- ✅ EDSEditorGUI (net8.0-windows)
- ⚠️ 33 Warnungen (Naming Conventions - nicht kritisch)

### Fehlerfreier Build
- 0 Fehler
- Multi-Target: Beide Frameworks unterstützt

---

## Dateien geändert/erstellt

### Neue Dateien (1)
- `libEDSsharp/CouchDBExporter.cs` (137 Zeilen)

### Modifizierte Dateien (7)
1. `EDSEditorGUI/Form1.cs` - Event Handler + async Upload
2. `EDSEditorGUI/Form1.Designer.cs` - Menu Item
3. `EDSEditorGUI/Preferences.cs` - URL-Einstellung
4. `EDSEditorGUI/Preferences.Designer.cs` - TextBox + Label
5. `EDSEditorGUI/Properties/Settings.Designer.cs` - CouchDBUrl Property
6. `EDSEditorGUI/App.config` - Setting-Eintrag
7. `libEDSsharp/libEDSsharp.csproj` - Package References

---

## Features

### ✅ Implementiert
- [x] CouchDB JSON Export (CanOpenNode Protobuf Format)
- [x] Einzelgeräte-Export
- [x] Mehrgeräte-Export
- [x] HTTP PUT Upload zu CouchDB
- [x] Konfigurierbare CouchDB-URL
- [x] Preferences Dialog Integration
- [x] Fehlerbehandlung & User Feedback
- [x] Async/Await für nicht-blockierende UI
- [x] Multi-Target Support (.NET 4.8.1 + 8.0)

### 📋 Benutzer-Workflow
1. **Konfiguration**:
- Tools → Preferences
- CouchDB URL eingeben (z.B. http://localhost:5984/canopen)
- Save

2. **Export**:
- File → Export to CouchDB...
- Choose: Upload oder Save
- Upload → CouchDB Server
- Save → Lokale JSON-Datei

---

## Kompatibilität

- **Target Frameworks**: .NET Framework 4.8.1, .NET 8.0
- **Abhängigkeiten**:
- Google.Protobuf 3.27.2
- Newtonsoft.Json 13.0.3
- System.Net.Http 4.3.4 (nur net481)
- AutoMapper 10.0.0 / 13.0.1
- **OS**: Windows (net8.0-windows)

---

## Notizen

### Design-Entscheidungen
1. **WriteProtobuf als Basis**: Nutzt existierende, bewährte Serialisierung statt eigene JSON-Generierung
2. **HTTP PUT statt POST**: CouchDB-Standard für Document Upload mit ID
3. **Async Upload**: UI bleibt responsiv während HTTP-Request
4. **Dual-Mode Dialog**: Flexibilität für Upload und lokale Speicherung
5. **Settings-Persistierung**: URL wird über .NET Settings API gespeichert

### Sicherheit
- ⚠️ HTTP (kein HTTPS) - Für Development/Testing
- Keine Authentifizierung implementiert - Optional für Zukunft

---

## Version
- **Release**: 1.0
- **Datum**: Dezember 2024
- **Status**: ✅ Production Ready

3 changes: 3 additions & 0 deletions EDSEditorGUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<setting name="WarningMask" serializeAs="String">
<value>65535</value>
</setting>
<setting name="CouchDBUrl" serializeAs="String">
<value>http://localhost:5984/canopen</value>
</setting>
</ODEditor.Properties.Settings>
</userSettings>
</configuration>
9 changes: 8 additions & 1 deletion EDSEditorGUI/EDSEditorGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<EmbeddedResourceUseDependentUponConvention>true</EmbeddedResourceUseDependentUponConvention>
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>

<!-- Fix für net481 Ressourcen-Fehler -->
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>

<!-- Warnung für BinaryFormatter unterdrücken -->
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Index_8287_16x.ico</ApplicationIcon>
Expand Down Expand Up @@ -101,7 +107,8 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="SourceGrid" Version="4.4.0" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="SourceGrid-huanlin" Version="6.1.1" Condition="'$(TargetFramework)' == 'net8.0-windows'" />
<PackageReference Include="System.Resources.Extensions" Version="10.0.0" Condition="'$(TargetFramework)' == 'net8.0-windows'" />
<!-- System.Resources.Extensions für beide Targets -->
<PackageReference Include="System.Resources.Extensions" Version="10.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<PropertyGroup>
Expand Down
Loading