This directory contains example plugins demonstrating various patterns and capabilities of the CoseSignTool plugin system.
A minimal plugin that demonstrates:
- Basic plugin structure
- Simple command implementation
- Command-line argument handling
- File I/O operations
Location: examples/HelloWorldPlugin/
Commands:
hello- Simple greeting command with optional parameters
An intermediate plugin that demonstrates:
- Multiple commands in one plugin
- File validation and processing
- Error handling patterns
- Async operations
Location: examples/FileProcessorPlugin/
Commands:
hash- Calculate file hashescopy- Copy files with validationinfo- Display file information
An advanced plugin that demonstrates:
- HTTP client integration
- Authentication patterns
- Configuration management
- Complex error handling
Location: examples/ServiceIntegrationPlugin/
Commands:
upload- Upload files to a servicedownload- Download files from a servicestatus- Check service status
To build all example plugins:
# From the repository root
dotnet build examples/To build a specific example:
# From the repository root
dotnet build examples/HelloWorldPlugin/- Build the examples
- Deploy plugins using the enhanced subdirectory architecture:
Enhanced Subdirectory Deployment (Recommended):
# Create plugin subdirectories
mkdir plugins/HelloWorld.Plugin
mkdir plugins/FileProcessor.Plugin
mkdir plugins/ServiceIntegration.Plugin
# Windows - Copy plugins to subdirectories
copy examples\HelloWorldPlugin\bin\Debug\net8.0\*.* plugins\HelloWorld.Plugin\
copy examples\FileProcessorPlugin\bin\Debug\net8.0\*.* plugins\FileProcessor.Plugin\
copy examples\ServiceIntegrationPlugin\bin\Debug\net8.0\*.* plugins\ServiceIntegration.Plugin\
# Linux/macOS - Copy plugins to subdirectories
cp examples/HelloWorldPlugin/bin/Debug/net8.0/* plugins/HelloWorld.Plugin/
cp examples/FileProcessorPlugin/bin/Debug/net8.0/* plugins/FileProcessor.Plugin/
cp examples/ServiceIntegrationPlugin/bin/Debug/net8.0/* plugins/ServiceIntegration.Plugin/Legacy Flat Deployment (Backward Compatibility):
# Windows - Copy just plugin DLLs
copy examples\HelloWorldPlugin\bin\Debug\net8.0\HelloWorld.Plugin.dll plugins\
copy examples\FileProcessorPlugin\bin\Debug\net8.0\FileProcessor.Plugin.dll plugins\
# Linux/macOS - Copy just plugin DLLs
cp examples/HelloWorldPlugin/bin/Debug/net8.0/HelloWorld.Plugin.dll plugins/
cp examples/FileProcessorPlugin/bin/Debug/net8.0/FileProcessor.Plugin.dll plugins/- Run CoseSignTool to see the new commands:
CoseSignTool --helpBenefits of Subdirectory Deployment:
- Each example plugin is isolated with its own dependencies
- Easy to add/remove individual plugins
- No dependency conflicts between examples
Beginner: Start with HelloWorldPlugin to understand basic concepts
Intermediate: Study FileProcessorPlugin for practical file operations
Advanced: Examine ServiceIntegrationPlugin for real-world service integration
Each example includes unit tests demonstrating:
- Command execution testing
- Error case handling
- Mocking external dependencies
- Async operation testing
Run tests for all examples:
dotnet test examples/- Proper error handling and return codes
- Input validation and sanitization
- Resource management and disposal
- Cancellation token support
- Configuration pattern usage
- Security considerations
- Performance optimization
When adding new examples:
- Follow the established directory structure
- Include comprehensive documentation
- Add unit tests for all functionality
- Demonstrate specific patterns or capabilities
- Update this README with the new example
For more detailed plugin development information, see:
- Plugins.md - Complete plugin documentation
- PluginQuickStart.md - Quick start guide