Skip to content

DRY: Export/Import XML vs JSON methods duplicated in both GUI projects (~250 lines) #407

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

Export and Import methods are duplicated per format (XML vs JSON) in both WPF projects:

Servy/Services/ServiceCommands.cs:

  • ExportXmlConfig() vs ExportJsonConfig() — ~25 lines each, differ only in serializer
  • ImportXmlConfig() vs ImportJsonConfig() — ~50 lines each, differ only in deserializer

Servy.Manager/Services/ServiceCommands.cs:

  • ExportServiceToXmlAsync() vs ExportServiceToJsonAsync() — ~23 lines each
  • ImportXmlConfigAsync() vs ImportJsonConfigAsync() — ~42 lines each

Estimated redundant lines: ~250

Suggested fix

Create generic ExportConfigAsync(format, serializer) and ImportConfigAsync(format, deserializer) methods. Each XML/JSON variant becomes a one-liner.

Metadata

Metadata

Assignees

Labels

refactorChanges that improve structure, readability, or maintainability without altering external behavior

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions