C# / .NET SDK #
Update client for .NET applications using HttpClient.
Files #
sdk/csharp/DmsiUpdateClient.cs
sdk/csharp/examples/WpfExample.cs
Requirements #
- .NET Framework 4.6+ or .NET Core 2.0+
System.Net.Http.HttpClientNewtonsoft.JsonorSystem.Text.Json
Basic Usage #
using DmsiUpdateServer;
var client = new DmsiUpdateClient(
apiUrl: "https://yoursite.com",
productId: 42
);
// Check for update
var result = await client.CheckUpdateAsync(
licenseKey: "XXXX-XXXX-XXXX-XXXX",
currentVersion: "1.0.0",
channel: "stable"
);
if (result != null && result.UpdateAvailable)
{
Console.WriteLine($"Update available: {result.Version}");
// result.DownloadUrl contains the signed download URL
}
Available Methods #
| Method | Description |
|---|---|
CheckUpdateAsync(licenseKey, currentVersion, channel, environment) | Check for available update |
GetVersionInfoAsync(licenseKey, version) | Get metadata for a specific version |
ListVersionsAsync(licenseKey, channel) | List available versions |
GetStatusAsync() | Server health check |
DownloadAsync(url, destinationPath, expectedHash, progressCallback) | Download file with progress |
WPF Integration #
See sdk/csharp/examples/WpfExample.cs for a complete WPF example showing:
- Background Task update checking on application startup
- Progress dialog during download
- Hash verification after download
- Application restart after update
Download with Progress #
var success = await client.DownloadAsync(
url: result.DownloadUrl,
destinationPath: Path.GetTempPath() + "update.zip",
expectedHash: result.FileHash,
progressCallback: (percent) => {
// Update progress bar
Dispatcher.Invoke(() => progressBar.Value = percent);
}
);
