Files
EngineeringSync 04ae8a0aae Initial commit: EngineeringSync v1.0.0
Vollständige Implementierung des EngineeringSync-Middleware-Tools:
- Windows Service (Kestrel :5050) mit FileSystemWatcher + SignalR
- WPF Tray-App mit PendingChanges- und Projektverwaltungs-Fenster
- Setup-Wizard (8-Schritte-Installer)
- SQLite/EF Core Datenschicht (WAL-Modus)
- SHA-256-basiertes Debouncing (2s Fenster)
- Backup-System mit konfigurierbarer Aufbewahrung

Bugfixes & Verbesserungen:
- BUG-1: AppDbContext OnConfiguring invertierte Bedingung behoben
- BUG-2: Event-Handler-Leak in TrayApp (Fenster-Singleton-Pattern)
- BUG-3: ProjectConfigChanged SignalR-Signal in allen CRUD-Endpoints
- BUG-5: Rename-Sync löscht alte Datei im Simulations-Ordner
- BUG-6: Doppeltes Dispose von SignalR verhindert
- BUG-7: Registry-Deinstallation nur EngineeringSync-Eintrag entfernt
- S1: Path-Traversal-Schutz via SafeCombine() im SyncManager
- E1: FSW Buffer 64KB + automatischer Re-Scan bei Overflow
- E2: Retry-Logik (3x) für gesperrte Dateien mit exponentiellem Backoff
- E4: Channel.Writer.TryComplete() beim Shutdown
- C2: HubMethodNames-Konstanten statt Magic Strings
- E3: Pagination in Changes-API (page/pageSize Query-Parameter)
- A1: Fire-and-Forget mit try/catch + Logging

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 21:52:26 +01:00

83 lines
2.3 KiB
C#

using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.ServiceProcess;
using System.Windows;
using Microsoft.Win32;
namespace EngineeringSync.Setup;
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
if (e.Args.Length > 0 && e.Args[0].Equals("/uninstall", StringComparison.OrdinalIgnoreCase))
{
RunUninstall();
Shutdown();
return;
}
var window = new Views.WizardWindow();
window.Show();
}
private void RunUninstall()
{
var serviceName = "EngineeringSync";
try
{
var sc = new ServiceController(serviceName);
if (sc.Status != ServiceControllerStatus.Stopped)
{
sc.Stop();
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
}
}
catch { }
try
{
Process.Start(new ProcessStartInfo
{
FileName = "sc",
Arguments = "delete EngineeringSync",
UseShellExecute = false,
CreateNoWindow = true
})?.WaitForExit();
}
catch { }
try
{
using var runKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
runKey?.DeleteValue("EngineeringSync.TrayApp", false);
}
catch { }
try
{
Registry.LocalMachine.DeleteSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EngineeringSync", false);
}
catch { }
var desktop = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);
var linkPath = Path.Combine(desktop, "EngineeringSync.lnk");
if (File.Exists(linkPath))
File.Delete(linkPath);
var startMenu = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu),
"Programs", "EngineeringSync");
if (Directory.Exists(startMenu))
Directory.Delete(startMenu, true);
var msg = "EngineeringSync wurde erfolgreich deinstalliert.";
MessageBox.Show(msg, "Deinstallation", MessageBoxButton.OK, MessageBoxImage.Information);
}
}