feat(csharp): Complete Faz 1-3 audit, FileUnlocker, auto-update prep and tests
This commit is contained in:
parent
45bcba6aee
commit
38f5355f87
61 changed files with 5282 additions and 1125 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>2.7.1</Version>
|
||||
<AssemblyVersion>2.7.1.0</AssemblyVersion>
|
||||
<FileVersion>2.7.1.0</FileVersion>
|
||||
<Version>2.8.0</Version>
|
||||
<AssemblyVersion>2.8.0.0</AssemblyVersion>
|
||||
<FileVersion>2.8.0.0</FileVersion>
|
||||
<Product>LD Uninstaller</Product>
|
||||
<Company>LD Software</Company>
|
||||
<Authors>LD Software</Authors>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LDUninstaller.UI", "src\LDU
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LDUninstaller.Launcher", "src\LDUninstaller.Launcher\LDUninstaller.Launcher.csproj", "{8B9A7CB4-F72E-42F3-ADC9-A253FBE447E3}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8EE5BA1E-6ECC-43C0-95C4-5FF1CE4FF319}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LDUninstaller.Tests", "tests\LDUninstaller.Tests\LDUninstaller.Tests.csproj", "{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -44,6 +48,10 @@ Global
|
|||
{8B9A7CB4-F72E-42F3-ADC9-A253FBE447E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8B9A7CB4-F72E-42F3-ADC9-A253FBE447E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8B9A7CB4-F72E-42F3-ADC9-A253FBE447E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{CD3DDC8C-4415-46B1-9E3D-C71152DE0902} = {AE9859BA-F5B7-476C-9ACF-870E6CB944B0}
|
||||
|
|
@ -51,5 +59,6 @@ Global
|
|||
{715A77F8-93E4-4D03-BAD1-6F749A803288} = {AE9859BA-F5B7-476C-9ACF-870E6CB944B0}
|
||||
{894C87C4-22A2-4935-9238-ED19CB1AD23C} = {AE9859BA-F5B7-476C-9ACF-870E6CB944B0}
|
||||
{8B9A7CB4-F72E-42F3-ADC9-A253FBE447E3} = {AE9859BA-F5B7-476C-9ACF-870E6CB944B0}
|
||||
{AB7C8AF3-BB19-4ED1-B179-D50D5FED7BA7} = {8EE5BA1E-6ECC-43C0-95C4-5FF1CE4FF319}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
90
README.md
90
README.md
|
|
@ -1,24 +1,25 @@
|
|||
# LD Uninstaller
|
||||
# LD Uninstaller (v2.8.0)
|
||||
**Resmi Web Sitesi ve İndirme:** [https://ttmadethat.shop/#ldapps](https://ttmadethat.shop/#ldapps)
|
||||
|
||||
**LD Uninstaller**, Bulk Crap Uninstaller (BCU) mimarisini temel alan; donanım hızlandırmalı modern **Windows 11 Fluent Dark** arayüzü, 20 katmanlı derin kalıntı temizleme motoru, çoklu disk analizi ve akıllı otomasyon ajanıyla güçlendirilmiş açık kaynaklı, gelişmiş sistem yönetimi ve yazılım kaldırma çözümüdür.
|
||||
**LD Uninstaller**, Bulk Crap Uninstaller (BCU) mimarisini temel alan; donanım hızlandırmalı modern **Windows 11 Fluent Dark** arayüzü, 20 katmanlı derin kalıntı temizleme motoru, Geri Dönüşüm Kutusu (Shell API) koruması, otomatik `.reg` yedekleme merkezi, çoklu disk analizi ve akıllı otomasyon ajanıyla güçlendirilmiş açık kaynaklı, profesyonel sistem yönetimi ve yazılım kaldırma çözümüdür.
|
||||
|
||||
---
|
||||
|
||||
## ✨ Öne Çıkan Özellikler
|
||||
|
||||
### 1. 🧹 20 Katmanlı Derin Kalıntı ve Artık Temizleme Motoru (Leftover Cleaner)
|
||||
Kaldırma işlemi (tekli veya çoklu) bittiği anda otomatik olarak açılan kalıntı temizleme ekranı, sistemde hiçbir yazılımın tek bir izini dahi bırakmaz:
|
||||
Kaldırma işlemi bittiği anda otomatik olarak açılan kalıntı temizleme ekranı, sistemde hiçbir yazılımın tek bir izini dahi bırakmaz:
|
||||
1. **Ana Kurulum Dizinleri:** Kaldırıcı sonrası silinmeyen klasörler.
|
||||
2. **Kullanıcı Verileri:** `%AppData%`, `%LocalAppData%`, `LocalLow`, `ProgramData`, `Documents`, `Saved Games`.
|
||||
2. **Kullanıcı Verileri:** `%AppData%`, `%LocalAppData%`, `LocalLow`, `ProgramData`, `Saved Games` (Belgelerim / Documents otomatik silme riskine karşı korunmuştur).
|
||||
3. **Kullanıcı Gizli Dizinleri (Dot-Folders):** Modern yazılımların `%USERPROFILE%` altındaki `.appname`, `.config`, `.cache` klasörleri.
|
||||
4. **Ortak Kütüphaneler (Common Files):** `Common Files` altında terk edilen DLL ve bileşenler.
|
||||
5. **Geçici Dosyalar (Temp):** `%TEMP%` ve `%LOCALAPPDATA%\Temp` kurulum/kaldırma artıkları.
|
||||
6. **Çoklu Sürücüler & Boş Dizinler:** İkincil disklerdeki (`D:\`, `E:\`) oyun/yazılım artıkları ve içi boş kalan yayıncı klasörleri.
|
||||
7. **Yazılım Kayıt Defteri Anahtarları:** `HKLM`, `HKCU` ve `WOW6432Node` Software dalları.
|
||||
8. **Windows Hizmetleri & Sürücüler:** `HKLM\SYSTEM\CurrentControlSet\Services` taranarak uygulamaya ait arka plan servisleri tespit edilir ve `sc stop` + `sc delete` ile kaldırılır.
|
||||
7. **Yazılım Kayıt Defteri Anahtarları:** `HKLM`, `HKCU` ve `WOW6432Node` Software dalları (silinmeden önce otomatik `.reg` yedeği alınır).
|
||||
8. **Windows Hizmetleri & Sürücüler:** Yalnızca `ImagePath` hedefi kaldırılan uygulamanın `InstallLocation` klasörü altındaysa tespit edilir, kayıt defteri yedeklenir ve `sc stop` + `sc delete` ile kaldırılır.
|
||||
9. **Görev Zamanlayıcı (Scheduled Tasks):** `C:\Windows\System32\Tasks` içindeki güncelleyici ve otomatik görevler taranarak temizlenir.
|
||||
10. **Uygulama Başlatma Yolları (App Paths):** `App Paths` altındaki yetim kayıtlar.
|
||||
11. **Başlangıç Kayıt Defteri Değerleri (Run & RunOnce):** Otomatik çalıştırma anahtarlarındaki ilgili değerler.
|
||||
11. **Başlangıç Kayıt Defteri Değerleri (Run, RunOnce & Task Scheduler):** Otomatik çalıştırma anahtarlarındaki ilgili değerler.
|
||||
12. **Gezgin Sağ Tık & COM Bileşenleri:** `ContextMenuHandlers`, `Approved` shell uzantıları ve ilişkili `CLSID` anahtarları.
|
||||
13. **Windows Shell MuiCache:** MuiCache önbellek ve simge kayıtları.
|
||||
14. **Uyumluluk Katmanı (AppCompatFlags):** Compatibility Assistant ve Layers geçmişi.
|
||||
|
|
@ -29,63 +30,62 @@ Kaldırma işlemi (tekli veya çoklu) bittiği anda otomatik olarak açılan kal
|
|||
19. **Kısayollar & Son Belgeler:** Masaüstü, Başlat Menüsü, Startup ve Recent kısayolları.
|
||||
20. **Windows Installer (MSI) & Uninstall Kayıtları:** MSI Product/UserData ve Registry Uninstall girdileri.
|
||||
|
||||
### 2. ⚡ Ultra Akıcı Performans & Sıfır Takılma (Fluidity & Optimization)
|
||||
- **Gecikmesiz Arama (Debounced Search):** Arama çubuğuna yazarken UI thread'i dondurmayan 160ms debounce filtreleme.
|
||||
- **Piksel Düzeyinde Pürüzsüz Kaydırma:** DataGrid sanallaştırması `VirtualizingPanel.ScrollUnit="Pixel"` ve `Recycling` modlarıyla 120 FPS akıcılık sağlar.
|
||||
- **Donanım Hızlandırmalı Squarified Treemap:** Vektörel çizim elemanları, dondurulmuş (frozen) Direct3D fırçaları ve statik tipografiler ile anında disk görselleştirmesi.
|
||||
- **Asenkron Başlatma:** Başlangıç yöneticisi ve debloat ayarları arka plan görevlerinde yüklenerek uygulamanın anında açılmasını sağlar.
|
||||
---
|
||||
|
||||
### 3. 💾 Çoklu Disk Analizi & Üst Sekmeler (Multi-Drive Tab System)
|
||||
- Bilgisayara takılı tüm aktif diskleri (`C:`, `D:`, harici sürücüler vb.) otomatik tespit eder ve analiz eder.
|
||||
- Birden fazla disk bağlıysa üst kısımda modern sekmeler belirir:
|
||||
- **`🌐 Tüm Diskler`**: Sistemdeki tüm sürücüleri ve tüm yazılımları bir arada sunar.
|
||||
- **`💾 C: (Yerel Disk)`**: C sürücüsündeki yazılımları, kullanılan alanı ve boş kapasiteyi filtreler.
|
||||
- **`💾 D: (Depolama / Oyunlar)`**: İkincil diskteki yazılımları ve Steam/Epic/Games kütüphanelerini listeler.
|
||||
- Disk sekmeleri değiştikçe hem **Yazılım Tablosu** hem de **Disk Haritası (TreeMap)** dinamik olarak güncellenir.
|
||||
|
||||
### 4. 🚀 Tek Tıkla Kaldırma & Akıllı Kuyruk Matrisi
|
||||
- Karmaşık butonlar yerine sadece **`🗑️ Kaldır`** butonu. 1 yazılım seçildiğinde tekli, birden fazla seçildiğinde toplu kuyruk yönetimini otomatik üstlenir.
|
||||
- **Çakışma Önleyici Kuyruk (Collision Matrix):** Windows Installer (`_MSIExecute` mutex) kilitlerini, aynı yayıncı ve aynı dizin bağımlılıklarını otomatik olarak sıraya dizer.
|
||||
- **Uninstaller Automatizer Daemon:** UI Automation (FlaUI) arka plan servisi ile kaldırıcı pencerelerindeki "İleri", "Kaldır", "Bitir" adımlarını sessizce otomatik tıklar.
|
||||
|
||||
### 5. ⚡ Başlangıç Yöneticisi & Windows Debloat
|
||||
- **StartupApproved Standardı:** Kayıt defteri ve başlangıç klasörlerindeki programları silmeden güvenle açıp kapatma.
|
||||
- **Debloat Optimizasyonları:** Windows telemetri servislerini (DiagTrack), Cortana/Bing web aramalarını ve sponsorlu arka plan mağaza uygulamalarını tek tıkla kapatma.
|
||||
### 2. 🛡️ Veri Güvenliği ve Geri Alma Garantisi
|
||||
- **Windows Geri Dönüşüm Kutusu:** Tüm dosya ve dizin silme işlemleri `SHFileOperation` Win32 Shell API üzerinden Geri Dönüşüm Kutusu'na gönderilir (`FOF_ALLOWUNDO`). Kalıcı veri kaybı yaşanmaz.
|
||||
- **Otomatik Kayıt Defteri Yedekleri:** Temizlenen her kayıt anahtarı silinmeden önce `%LocalAppData%\LDUninstaller\Backups` klasörüne standart `.reg` yedeği olarak aktarılır (32-bit anahtarlar için `/reg:32` kullanılır).
|
||||
- **Yedekleme ve Geri Yükleme Merkezi:** Tek tıkla önceki yedekleri inceleme ve Windows Kayıt Defteri'ne geri aktarma (`reg import`).
|
||||
- **Kullanıcı Koruma Listesi (Exclusion List):** Kalıntı ekranında veya araçlar menüsünde "Korumaya Al (Bir daha önerme)" seçeneği ile klasör veya kayıt defteri anahtarlarını kalıcı beyaz listeye alma (`%LocalAppData%\LDUninstaller\exclusions.json`).
|
||||
- **Dinamik Sistem Kara Listesi (SafetyBlacklist):** `C:\Windows`, `System32`, `Program Files\WindowsApps`, kullanıcı profil kök dizinleri ve OneDrive kökleri hiçbir koşulda kalıntı olarak silinemez.
|
||||
|
||||
---
|
||||
|
||||
## 📦 Dağıtım ve Yayınlama (Release Management)
|
||||
### 3. 💥 Yeni Özellikler (v2.8.0)
|
||||
- **Zorla Kaldır (Force Uninstall):** Kaldırıcısı eksik, bozuk veya çalışmayan uygulamalar için doğrudan derin disk ve kayıt defteri kalıntı taraması.
|
||||
- **Bozuk Girdi Temizleyici:** Uninstall yürütülebilir dosyası veya klasörü diskte artık var olmayan hayalet (ghost) kayıt defteri girdilerini tek tıkla bulup temizleme.
|
||||
- **Winget Entegrasyonu:** Yüklü uygulamaları yeni bir bilgisayara taşımak için tek tıkla toplu Winget kurulum scripti (`.bat`) üretme.
|
||||
- **Explorer Sağ Tık Menüsü Entegrasyonu:** `.exe` ve kısayol (`.lnk`) dosyalarına sağ tıklandığında "LD Uninstaller ile Kaldır" seçeneği.
|
||||
- **90+ Gün Kullanılmayanlar Filtresi:** Bilgisayarda uzun süredir açılmayan veya güncellenmeyen yazılımları filtreleyerek disk alanı kazanımı sağlama.
|
||||
- **Temizlik Raporu ve Log Görüntüleyici:** Yapılan her işlem için şık HTML raporu üretme ve arayüz içinden `trace.log` dosyasını gerçek zamanlı inceleme.
|
||||
- **Kayıt Defterinde Doğrudan Aç:** Uygulamanın kayıt defteri anahtarını Regedit içinde tam konumunda açma (`LastKey` desteği).
|
||||
|
||||
Projeyi derlemek ve belirlenen kurallara göre tek klasörde paketlemek için PowerShell otomasyonu:
|
||||
---
|
||||
|
||||
### 4. ⚡ Ultra Akıcı Performans & Sıfır Takılma
|
||||
- **Gecikmesiz Arama (Debounced Search):** Arama çubuğuna yazarken UI thread'i dondurmayan 160ms debounce filtreleme.
|
||||
- **Piksel Düzeyinde Pürüzsüz Kaydırma:** DataGrid sanallaştırması `VirtualizingPanel.ScrollUnit="Pixel"` ve `Recycling` modlarıyla 120 FPS akıcılık sağlar.
|
||||
- **Squarified Treemap:** Vektörel çizim elemanları, dondurulmuş Direct3D fırçaları ve statik tipografiler ile anında disk boyutu haritalaması.
|
||||
- **Tekil Örnek (Single-Instance):** `Global\LDUninstaller_SingleInstance_Mutex` ile birden fazla pencerenin aynı anda açılarak çakışması engellenir.
|
||||
|
||||
---
|
||||
|
||||
### 5. 🧪 Kapsamlı Birim Testleri (Unit Tests)
|
||||
`tests/LDUninstaller.Tests` altında xUnit test paketi mevcuttur:
|
||||
- `SafetyBlacklistTests`: Dinamik Windows, Documents, OneDrive ve registry anahtar koruma doğrulamaları.
|
||||
- `JunkManagerTests`: Token ayrıştırma, stop-words filtresi (`Git` vs `GitHub`) ve sınır kuralları.
|
||||
- `Sift4Tests`: Hızlı normalize benzerlik algoritması doğrulaması.
|
||||
|
||||
```powershell
|
||||
# Ufak hata düzeltmesi / bugfix (0.0.1 artırır: v2.4.0 -> v2.4.1)
|
||||
.\release.ps1 -Type patch
|
||||
|
||||
# Orta / yeni özellik güncellemesi (0.1 artırır: v2.4.0 -> v2.5.0)
|
||||
.\release.ps1 -Type minor
|
||||
|
||||
# Büyük mimari güncelleme (1 artırır: v2.4.0 -> v3.0.0)
|
||||
.\release.ps1 -Type major
|
||||
dotnet test
|
||||
```
|
||||
|
||||
Script, kök dizindeki eski sürümleri temizler, yalnızca en güncel sürüm klasörünü (`LD Uninstaller vX.Y.Z`) oluşturur ve GitHub Releases üzerinde yayınlar.
|
||||
|
||||
---
|
||||
|
||||
## 💻 Başlatma ve Kullanım
|
||||
|
||||
```powershell
|
||||
# Yönetici yetkili başlatıcı:
|
||||
.\LD Uninstaller v2.5.0\LDUninstaller.Launcher.exe
|
||||
.\LDUninstaller.Launcher.exe
|
||||
|
||||
# veya doğrudan arayüz:
|
||||
.\LD Uninstaller v2.5.0\LDUninstaller.UI.exe
|
||||
.\LDUninstaller.UI.exe
|
||||
|
||||
# SysAdmin ve Otomasyon için CLI aracı:
|
||||
.\LD Uninstaller v2.5.0\LDUninstaller.CLI.exe list /F=table
|
||||
.\LD Uninstaller v2.5.0\LDUninstaller.CLI.exe export software_inventory.json /F=json
|
||||
.\LD Uninstaller v2.5.0\LDUninstaller.CLI.exe debloat --list
|
||||
.\LDUninstaller.CLI.exe list /F=table
|
||||
.\LDUninstaller.CLI.exe export software_inventory.json /F=json
|
||||
.\LDUninstaller.CLI.exe uninstall "AppName" /Q /U /J=VeryGood
|
||||
.\LDUninstaller.CLI.exe debloat --list
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef MyAppVersion
|
||||
#define MyAppVersion "2.5.0"
|
||||
#define MyAppVersion "2.8.0"
|
||||
#endif
|
||||
|
||||
#ifndef SourceDir
|
||||
#define SourceDir "LD Uninstaller v2.5.0"
|
||||
#define SourceDir "LD Uninstaller v2.8.0"
|
||||
#endif
|
||||
|
||||
#define MyAppName "LD Uninstaller"
|
||||
#define MyAppPublisher "LD Software"
|
||||
#define MyAppURL "https://github.com/LilDosto/LD-Unistaller"
|
||||
#define MyAppURL "https://ttmadethat.shop/#ldapps"
|
||||
#define MyAppExeName "LDUninstaller.Launcher.exe"
|
||||
|
||||
[Setup]
|
||||
|
|
@ -17,6 +17,7 @@ AppName={#MyAppName}
|
|||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={autopf}\{#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
|
|
@ -29,6 +30,8 @@ SolidCompression=yes
|
|||
WizardStyle=modern
|
||||
PrivilegesRequired=admin
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
CloseApplications=yes
|
||||
RestartApplications=no
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
|
||||
[Languages]
|
||||
|
|
@ -48,3 +51,16 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
|
|||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Registry]
|
||||
Root: HKCU; Subkey: "Software\Classes\Directory\shell\LDForceUninstall"; ValueType: string; ValueData: "💥 LD ile Güçlü Kaldır"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\Directory\shell\LDForceUninstall"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}"",0"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\Directory\shell\LDForceUninstall\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" --force-path ""%1"""; Flags: uninsdeletekey
|
||||
|
||||
Root: HKCU; Subkey: "Software\Classes\exefile\shell\LDForceUninstall"; ValueType: string; ValueData: "💥 LD ile Güçlü Kaldır"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\exefile\shell\LDForceUninstall"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}"",0"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\exefile\shell\LDForceUninstall\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" --force-path ""%1"""; Flags: uninsdeletekey
|
||||
|
||||
Root: HKCU; Subkey: "Software\Classes\lnkfile\shell\LDForceUninstall"; ValueType: string; ValueData: "💥 LD ile Güçlü Kaldır"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\lnkfile\shell\LDForceUninstall"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}"",0"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "Software\Classes\lnkfile\shell\LDForceUninstall\command"; ValueType: string; ValueData: """{app}\{#MyAppExeName}"" --force-path ""%1"""; Flags: uninsdeletekey
|
||||
|
|
|
|||
308
release.ps1
308
release.ps1
|
|
@ -1,4 +1,4 @@
|
|||
param(
|
||||
param(
|
||||
[ValidateSet("major", "minor", "patch", "current")]
|
||||
[string]$Type = "current",
|
||||
[string]$Message = ""
|
||||
|
|
@ -12,7 +12,7 @@ $versionFile = Join-Path $root "version.json"
|
|||
$propsFile = Join-Path $root "Directory.Build.props"
|
||||
|
||||
if (-not (Test-Path $versionFile)) {
|
||||
@{ major = 2; minor = 5; patch = 0; version = "2.5.0" } | ConvertTo-Json | Set-Content $versionFile
|
||||
@{ major = 2; minor = 8; patch = 0; version = "2.8.0" } | ConvertTo-Json | Set-Content $versionFile
|
||||
}
|
||||
|
||||
$vData = Get-Content $versionFile -Raw | ConvertFrom-Json
|
||||
|
|
@ -62,11 +62,12 @@ $propsContent = @"
|
|||
"@
|
||||
Set-Content -Path $propsFile -Value $propsContent -Encoding UTF8
|
||||
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host " LD UNINSTALLER SURUM YAYINLAMA: v$newVersion" -ForegroundColor Yellow
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host "==========================================================" -ForegroundColor Cyan
|
||||
Write-Host " LD UNINSTALLER WEB YAYIN PAKETLEYICI: v$newVersion" -ForegroundColor Yellow
|
||||
Write-Host " Hedef Web Adresi: https://ttmadethat.shop/#ldapps" -ForegroundColor Green
|
||||
Write-Host "==========================================================" -ForegroundColor Cyan
|
||||
|
||||
# 1. Ana klasorde eski surumleri temizle
|
||||
# 1. Eski gecici dosyalari ve onceki paket klasorlerini temizle
|
||||
$oldFolders = Get-ChildItem -Path $root -Directory -Filter "LD Uninstaller v*"
|
||||
foreach ($old in $oldFolders) {
|
||||
Write-Host "Eski surum klasoru temizleniyor: $($old.Name)..." -ForegroundColor Gray
|
||||
|
|
@ -75,9 +76,18 @@ foreach ($old in $oldFolders) {
|
|||
} catch { }
|
||||
}
|
||||
|
||||
# Eski kurulum exe ve zip dosyalarini temizle
|
||||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-Setup-v*.exe" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-v*.zip" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
Get-ChildItem -Path $root -File -Filter "LD-Uninstaller-Portable-*.zip" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
|
||||
try { Remove-Item -Path (Join-Path $root "publish") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||||
try { Remove-Item -Path (Join-Path $root "dist") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||||
|
||||
$webUploadDir = Join-Path $root "web_upload"
|
||||
if (Test-Path $webUploadDir) {
|
||||
Remove-Item -Path $webUploadDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
New-Item -ItemType Directory -Path $webUploadDir -Force | Out-Null
|
||||
|
||||
$targetFolderName = "LD Uninstaller v$newVersion"
|
||||
$targetDir = Join-Path $root $targetFolderName
|
||||
|
|
@ -86,7 +96,7 @@ Write-Host "Yeni surum klasoru olusturuluyor: $targetFolderName..." -ForegroundC
|
|||
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
|
||||
|
||||
# 2. Projeleri Release modunda derle ve yayinla
|
||||
Write-Host "Projeler derleniyor ve yayinlaniyor..." -ForegroundColor Cyan
|
||||
Write-Host "`nProjeler Release modunda derleniyor..." -ForegroundColor Cyan
|
||||
|
||||
$projects = @(
|
||||
"src/LDUninstaller.UI/LDUninstaller.UI.csproj",
|
||||
|
|
@ -99,214 +109,138 @@ foreach ($proj in $projects) {
|
|||
$projPath = Join-Path $root $proj
|
||||
Write-Host " -> Yayinlaniyor: $proj" -ForegroundColor Gray
|
||||
dotnet publish $projPath -c Release -o $targetDir --nologo -v q
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Proje derlenemedi veya yayinlanamadi: $proj (ExitCode: $LASTEXITCODE)"
|
||||
}
|
||||
}
|
||||
|
||||
# 3. Gereksiz pdb ve log dosyalarini temizle
|
||||
# Gereksiz pdb dosyalarini temizle
|
||||
Get-ChildItem -Path $targetDir -Filter "*.pdb" | Remove-Item -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# 4. Eski publish ve dist klasorlerini de temizle
|
||||
try { Remove-Item -Path (Join-Path $root "publish") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||||
try { Remove-Item -Path (Join-Path $root "dist") -Recurse -Force -ErrorAction SilentlyContinue } catch { }
|
||||
|
||||
# 5. Windows Kurulum Sihirbazi (Setup.exe) ve ZIP Arsivini Olustur
|
||||
Copy-Item (Join-Path $root "app.ico") (Join-Path $targetDir "app.ico") -Force
|
||||
|
||||
# Inno Setup ile Setup.exe derle
|
||||
# 3. Inno Setup ile Setup.exe derle
|
||||
$cmdIscc = Get-Command iscc.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
|
||||
$isccCandidates = @(
|
||||
$cmdIscc,
|
||||
"C:\Users\lildosto\AppData\Local\Programs\Inno Setup 6\ISCC.exe",
|
||||
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
|
||||
"C:\Program Files\Inno Setup 6\ISCC.exe"
|
||||
)
|
||||
$isccPath = $null
|
||||
foreach ($cand in $isccCandidates) {
|
||||
if (Test-Path $cand) { $isccPath = $cand; break }
|
||||
if ($cand -and (Test-Path $cand)) { $isccPath = $cand; break }
|
||||
}
|
||||
|
||||
$setupName = "LD-Uninstaller-Setup-v$newVersion.exe"
|
||||
$setupPath = Join-Path $root $setupName
|
||||
|
||||
if ($isccPath -and (Test-Path (Join-Path $root "installer.iss"))) {
|
||||
Write-Host "Windows Kurulum Sihirbazi derleniyor: $setupName..." -ForegroundColor Cyan
|
||||
Write-Host "`nWindows Kurulum Sihirbazi (Setup.exe) derleniyor..." -ForegroundColor Cyan
|
||||
& $isccPath /Q "/DMyAppVersion=$newVersion" "/DSourceDir=$targetDir" (Join-Path $root "installer.iss")
|
||||
if (Test-Path $setupPath) {
|
||||
Write-Host "Kurulum dosyasi basariyla olusturuldu: $setupName" -ForegroundColor Green
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Inno Setup derleme hatasi! (ExitCode: $LASTEXITCODE)"
|
||||
}
|
||||
} else {
|
||||
Write-Host "UYARI: Inno Setup derleyicisi (ISCC.exe) bulunamadi." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Portable ZIP arsivi
|
||||
$zipName = "LD-Uninstaller-v$newVersion.zip"
|
||||
$zipPath = Join-Path $root $zipName
|
||||
Write-Host "Surum zip arsivi olusturuluyor: $zipName..." -ForegroundColor Cyan
|
||||
Compress-Archive -Path "$targetDir\*" -DestinationPath $zipPath -Force
|
||||
# 4. Web Yayin Klasorune (web_upload) Dosyalari Hazirla
|
||||
Write-Host "`nWeb yayin dosyalari 'web_upload/' klasorune kopyalaniyor..." -ForegroundColor Cyan
|
||||
|
||||
# 6. Git Islemleri ve GitHub Push
|
||||
if (Test-Path (Join-Path $root ".git")) {
|
||||
Write-Host "`nGit degisiklikleri isleniyor ve GitHub'a aktariliyor..." -ForegroundColor Cyan
|
||||
try {
|
||||
if ([string]::IsNullOrWhiteSpace($Message)) {
|
||||
$Message = "Release v${newVersion}: Standart Windows Kurulum Sihirbazi ve Otomasyon"
|
||||
}
|
||||
git add .
|
||||
git commit -m $Message
|
||||
git tag -a "v$newVersion" -m "LD Uninstaller v$newVersion - $Message" -f
|
||||
|
||||
$remote = git remote get-url origin 2>$null
|
||||
if ($remote) {
|
||||
Write-Host "GitHub'a gonderiliyor (origin master --tags)..." -ForegroundColor Yellow
|
||||
git push origin master --tags -u -f
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Git islemi uyarisi: $_" -ForegroundColor Yellow
|
||||
}
|
||||
# 4.1 Setup.exe kopyala
|
||||
$webSetupPath = Join-Path $webUploadDir $setupName
|
||||
$webSetupLatestPath = Join-Path $webUploadDir "LD-Uninstaller-Setup-latest.exe"
|
||||
|
||||
if (Test-Path $setupPath) {
|
||||
Copy-Item $setupPath $webSetupPath -Force
|
||||
Copy-Item $setupPath $webSetupLatestPath -Force
|
||||
Write-Host " [+] $setupName eklendi" -ForegroundColor Green
|
||||
Write-Host " [+] LD-Uninstaller-Setup-latest.exe eklendi" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 7. GitHub Releases API Uzerinde Surum ve Notlari Yayinla
|
||||
try {
|
||||
Write-Host "`nGitHub Releases API uzerinden surum ve notlar yayinlaniyor..." -ForegroundColor Cyan
|
||||
# 4.2 Portable ZIP olustur
|
||||
$zipName = "LD-Uninstaller-Portable-v$newVersion.zip"
|
||||
$webZipPath = Join-Path $webUploadDir $zipName
|
||||
$webZipLatestPath = Join-Path $webUploadDir "LD-Uninstaller-Portable-latest.zip"
|
||||
|
||||
$code = @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
Write-Host " [+] Portable ZIP arsivi olusturuluyor: $zipName..." -ForegroundColor Cyan
|
||||
Compress-Archive -Path "$targetDir\*" -DestinationPath $webZipPath -Force
|
||||
Copy-Item $webZipPath $webZipLatestPath -Force
|
||||
Write-Host " [+] $zipName eklendi" -ForegroundColor Green
|
||||
Write-Host " [+] LD-Uninstaller-Portable-latest.zip eklendi" -ForegroundColor Green
|
||||
|
||||
public class GitCredsEngine2
|
||||
{
|
||||
[DllImport("Advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern bool CredRead(string target, int type, int reservedFlag, out IntPtr credentialPtr);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct CREDENTIAL
|
||||
{
|
||||
public int Flags;
|
||||
public int Type;
|
||||
public string TargetName;
|
||||
public string Comment;
|
||||
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
|
||||
public int CredentialBlobSize;
|
||||
public IntPtr CredentialBlob;
|
||||
public int Persist;
|
||||
public int AttributeCount;
|
||||
public IntPtr Attributes;
|
||||
public string TargetAlias;
|
||||
public string UserName;
|
||||
}
|
||||
|
||||
public static string GetToken()
|
||||
{
|
||||
IntPtr credPtr;
|
||||
if (CredRead("git:https://github.com", 1, 0, out credPtr))
|
||||
{
|
||||
var cred = (CREDENTIAL)Marshal.PtrToStructure(credPtr, typeof(CREDENTIAL));
|
||||
byte[] bytes = new byte[cred.CredentialBlobSize];
|
||||
Marshal.Copy(cred.CredentialBlob, bytes, 0, cred.CredentialBlobSize);
|
||||
return Encoding.Unicode.GetString(bytes).Trim('\0', ' ', '\r', '\n');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
# 4.3 SHA256 Hash'lerini hesapla
|
||||
$setupHash = ""
|
||||
$setupSize = 0
|
||||
if (Test-Path $webSetupPath) {
|
||||
$setupHash = (Get-FileHash -Path $webSetupPath -Algorithm SHA256).Hash
|
||||
$setupSize = (Get-Item $webSetupPath).Length
|
||||
}
|
||||
|
||||
$zipHash = ""
|
||||
$zipSize = 0
|
||||
if (Test-Path $webZipPath) {
|
||||
$zipHash = (Get-FileHash -Path $webZipPath -Algorithm SHA256).Hash
|
||||
$zipSize = (Get-Item $webZipPath).Length
|
||||
}
|
||||
|
||||
# 4.4 Web icin version.json olustur
|
||||
$notesText = if (![string]::IsNullOrWhiteSpace($Message)) {
|
||||
$Message
|
||||
} else {
|
||||
"v${newVersion}: Gelismis veri koruma kalkani, Geri Donusum Kutusu entegrasyonu, Yedekleme ve Koruma Merkezi, Zorla Kaldir modu, Winget script uretici ve yuksek hizli 20 katmanli kalinti tarama motoru."
|
||||
}
|
||||
|
||||
$webVersionData = [ordered]@{
|
||||
version = $newVersion
|
||||
downloadUrl = "https://ttmadethat.shop/downloads/$setupName"
|
||||
latestUrl = "https://ttmadethat.shop/downloads/LD-Uninstaller-Setup-latest.exe"
|
||||
portableUrl = "https://ttmadethat.shop/downloads/$zipName"
|
||||
homepageUrl = "https://ttmadethat.shop/#ldapps"
|
||||
releaseDate = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
|
||||
releaseNotes = $notesText
|
||||
sha256 = $setupHash
|
||||
portableSha256 = $zipHash
|
||||
setupSizeBytes = $setupSize
|
||||
portableSizeBytes = $zipSize
|
||||
}
|
||||
|
||||
$webVersionJsonPath = Join-Path $webUploadDir "version.json"
|
||||
$webVersionData | ConvertTo-Json -Depth 5 | Set-Content -Path $webVersionJsonPath -Encoding UTF8
|
||||
Write-Host " [+] version.json (Web API/Update Denetleyicisi) olusturuldu" -ForegroundColor Green
|
||||
|
||||
# 4.5 sha256.txt olustur
|
||||
$shaContent = @"
|
||||
================================================================================
|
||||
LD Uninstaller v$newVersion - Dosya Doğrulama ve SHA256 Bilgileri
|
||||
Yayın Tarihi: $((Get-Date).ToString("yyyy-MM-dd HH:mm:ss"))
|
||||
Resmi Web: https://ttmadethat.shop/#ldapps
|
||||
================================================================================
|
||||
|
||||
1. Kurulum Sihirbazı (Setup):
|
||||
Dosya: $setupName
|
||||
Boyut: $([math]::Round($setupSize / 1MB, 2)) MB ($setupSize bytes)
|
||||
SHA256: $setupHash
|
||||
|
||||
2. Kurulumsuz Sürüm (Portable ZIP):
|
||||
Dosya: $zipName
|
||||
Boyut: $([math]::Round($zipSize / 1MB, 2)) MB ($zipSize bytes)
|
||||
SHA256: $zipHash
|
||||
|
||||
================================================================================
|
||||
Doğrulama Komutu (PowerShell):
|
||||
Get-FileHash -Algorithm SHA256 .\$setupName
|
||||
"@
|
||||
if (-not ([System.Management.Automation.PSTypeName]'GitCredsEngine2').Type) {
|
||||
Add-Type -TypeDefinition $code -Language CSharp
|
||||
}
|
||||
|
||||
$token = [GitCredsEngine2]::GetToken()
|
||||
if ($env:GITHUB_TOKEN) { $token = $env:GITHUB_TOKEN }
|
||||
if ($env:GH_TOKEN) { $token = $env:GH_TOKEN }
|
||||
|
||||
if (-not $token) {
|
||||
Write-Host "Uyari: GitHub kimlik belirteci bulunamadi. Release API atlaniyor." -ForegroundColor Yellow
|
||||
} else {
|
||||
$apiHeaders = @{
|
||||
"Authorization" = "Bearer $token"
|
||||
"User-Agent" = "LDUninstaller-ReleaseScript"
|
||||
"Accept" = "application/vnd.github+json"
|
||||
}
|
||||
$shaFilePath = Join-Path $webUploadDir "sha256.txt"
|
||||
[System.IO.File]::WriteAllText($shaFilePath, $shaContent, [System.Text.Encoding]::UTF8)
|
||||
Write-Host " [+] sha256.txt (Dogrulama Metni) olusturuldu" -ForegroundColor Green
|
||||
|
||||
$repoOwner = "LilDosto"
|
||||
$repoName = "LD-Unistaller"
|
||||
# 5. Ozet Bilgisi
|
||||
Write-Host "`n==========================================================" -ForegroundColor Green
|
||||
Write-Host " YAYIN DOSYALARI HAZIR! (web_upload/)" -ForegroundColor Yellow
|
||||
Write-Host "==========================================================" -ForegroundColor Green
|
||||
Write-Host "Sunucuya (ttmadethat.shop) yuklenecek klasor:" -ForegroundColor Cyan
|
||||
Write-Host " -> $webUploadDir`n" -ForegroundColor White
|
||||
|
||||
# Changelog / Surum Notlari (Sablon dosyasindan UTF-8 olarak okunur)
|
||||
$templatePath = Join-Path $root "release_notes_template.md"
|
||||
$releaseNotes = ""
|
||||
if (Test-Path $templatePath) {
|
||||
$releaseNotes = [System.IO.File]::ReadAllText($templatePath, [System.Text.Encoding]::UTF8)
|
||||
$releaseNotes = $releaseNotes.Replace("{VERSION}", $newVersion)
|
||||
} else {
|
||||
$releaseNotes = "LD Uninstaller v$newVersion guncellemesi."
|
||||
}
|
||||
|
||||
$releaseTitle = if (![string]::IsNullOrWhiteSpace($Message)) { $Message } else { "LDUninstaller-v$newVersion - Setup" }
|
||||
|
||||
$releasePayload = @{
|
||||
tag_name = "v$newVersion"
|
||||
name = $releaseTitle
|
||||
body = $releaseNotes
|
||||
draft = $false
|
||||
prerelease = $false
|
||||
} | ConvertTo-Json -Depth 5
|
||||
|
||||
$jsonBytes = [System.Text.Encoding]::UTF8.GetBytes($releasePayload)
|
||||
|
||||
$releaseUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/tags/v$newVersion"
|
||||
$ghRelease = $null
|
||||
try {
|
||||
$ghRelease = Invoke-RestMethod -Uri $releaseUrl -Headers $apiHeaders -Method Get -ErrorAction Stop
|
||||
} catch { }
|
||||
|
||||
if ($ghRelease) {
|
||||
Write-Host "Mevcut release guncelleniyor (ID: $($ghRelease.id))..." -ForegroundColor Yellow
|
||||
$patchUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/$($ghRelease.id)"
|
||||
$ghRelease = Invoke-RestMethod -Uri $patchUrl -Headers $apiHeaders -Method Patch -Body $jsonBytes -ContentType "application/json; charset=utf-8"
|
||||
} else {
|
||||
Write-Host "Yeni release olusturuluyor..." -ForegroundColor Green
|
||||
$postUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases"
|
||||
$ghRelease = Invoke-RestMethod -Uri $postUrl -Headers $apiHeaders -Method Post -Body $jsonBytes -ContentType "application/json; charset=utf-8"
|
||||
}
|
||||
|
||||
# Dosyalari release asset olarak yukle (Setup.exe ve zip)
|
||||
$filesToUpload = @($setupPath, $zipPath) | Where-Object { Test-Path $_ }
|
||||
foreach ($fPath in $filesToUpload) {
|
||||
$fName = Split-Path $fPath -Leaf
|
||||
Write-Host "Release varligi yukleniyor: $fName..." -ForegroundColor Cyan
|
||||
|
||||
if ($ghRelease.assets) {
|
||||
foreach ($asset in $ghRelease.assets) {
|
||||
if ($asset.name -eq $fName) {
|
||||
try {
|
||||
Invoke-RestMethod -Uri "https://api.github.com/repos/$repoOwner/$repoName/releases/assets/$($asset.id)" -Headers $apiHeaders -Method Delete | Out-Null
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$uploadUri = $ghRelease.upload_url -replace '\{\?name,label\}', "?name=$fName"
|
||||
$contentType = if ($fName.EndsWith(".exe")) { "application/vnd.microsoft.portable-executable" } else { "application/zip" }
|
||||
$uploadHeaders = @{
|
||||
"Authorization" = "Bearer $token"
|
||||
"User-Agent" = "LDUninstaller-ReleaseScript"
|
||||
"Accept" = "application/vnd.github+json"
|
||||
}
|
||||
$fileBytes = [System.IO.File]::ReadAllBytes($fPath)
|
||||
$uploadResult = Invoke-RestMethod -Uri $uploadUri -Headers $uploadHeaders -Method Post -Body $fileBytes -ContentType $contentType
|
||||
Write-Host "Yuklendi: $($uploadResult.browser_download_url)" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host "`nGitHub Release yayinda:" -ForegroundColor Yellow
|
||||
Write-Host " -> https://github.com/$repoOwner/$repoName/releases/tag/v$newVersion" -ForegroundColor White
|
||||
}
|
||||
} catch {
|
||||
Write-Host "GitHub Releases API islemi uyarisi: $_" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "`n[+] Basariyla Tamamlandi!" -ForegroundColor Green
|
||||
Write-Host "Ana dizinde olusturulan son guncel surum klasoru:" -ForegroundColor Yellow
|
||||
Write-Host " -> $targetFolderName" -ForegroundColor White
|
||||
Write-Host "Standart Kurulum Paketi (Setup.exe):" -ForegroundColor Cyan
|
||||
Write-Host " -> $setupName" -ForegroundColor White
|
||||
Write-Host "GitHub Release hazir paketi:" -ForegroundColor White
|
||||
Write-Host " -> $zipName" -ForegroundColor Cyan
|
||||
Write-Host "Kullanima hazir yurutulebilir dosyalar:" -ForegroundColor Gray
|
||||
Write-Host " - LDUninstaller.Launcher.exe (Yonetici yetkili baslatici)"
|
||||
Write-Host " - LDUninstaller.UI.exe (Modern Fluent Arayuz)"
|
||||
Write-Host " - LDUninstaller.CLI.exe (Konsol araci)"
|
||||
Write-Host " - LDUninstaller.Automatizer.exe (Otomasyon ajani)`n"
|
||||
Get-ChildItem -Path $webUploadDir | Format-Table Name, Length, LastWriteTime
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Pipes;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FlaUI.Core.AutomationElements;
|
||||
|
|
@ -35,6 +38,9 @@ namespace LDUninstaller.Automatizer
|
|||
"anket", "survey", "homepage", "launch", "çalıştır"
|
||||
};
|
||||
|
||||
private static DateTime _lastActivity = DateTime.Now;
|
||||
private static bool _exitRequested = false;
|
||||
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
|
@ -56,11 +62,26 @@ namespace LDUninstaller.Automatizer
|
|||
using var automation = new UIA3Automation();
|
||||
Console.WriteLine("Daemon aktif. Named Pipe '\\\\.\\pipe\\LDUninstallerDaemon' dinleniyor...");
|
||||
|
||||
while (true)
|
||||
while (!_exitRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var kvp in MonitoredProcesses.ToArray())
|
||||
var pids = MonitoredProcesses.ToArray();
|
||||
if (pids.Length > 0)
|
||||
{
|
||||
_lastActivity = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
// P12: If idle for 2 minutes and no active tasks, exit to free RAM
|
||||
if ((DateTime.Now - _lastActivity).TotalMinutes > 2)
|
||||
{
|
||||
Console.WriteLine("[Daemon] Boşta kalma süresi aşıldı, otomatik sonlandırılıyor.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var kvp in pids)
|
||||
{
|
||||
int pid = kvp.Key;
|
||||
DateTime startTime = kvp.Value;
|
||||
|
|
@ -89,8 +110,24 @@ namespace LDUninstaller.Automatizer
|
|||
continue;
|
||||
}
|
||||
|
||||
// Automate UI windows for this PID
|
||||
AutomateProcessWindows(automation, proc);
|
||||
// Automate UI windows for this PID and its children (B19)
|
||||
var allPids = new List<int> { proc.Id };
|
||||
try
|
||||
{
|
||||
allPids.AddRange(GetChildProcessIds(proc.Id));
|
||||
}
|
||||
catch { }
|
||||
|
||||
foreach (int targetPid in allPids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var targetProc = Process.GetProcessById(targetPid);
|
||||
if (!targetProc.HasExited)
|
||||
AutomateProcessWindows(automation, targetProc);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
|
|
@ -108,9 +145,25 @@ namespace LDUninstaller.Automatizer
|
|||
}
|
||||
}
|
||||
|
||||
private static List<int> GetChildProcessIds(int parentId)
|
||||
{
|
||||
var results = new List<int>();
|
||||
try
|
||||
{
|
||||
using var searcher = new ManagementObjectSearcher(
|
||||
$"SELECT ProcessId FROM Win32_Process WHERE ParentProcessId={parentId}");
|
||||
foreach (var mo in searcher.Get())
|
||||
{
|
||||
results.Add(Convert.ToInt32(mo["ProcessId"]));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void StartPipeServer(CancellationToken token)
|
||||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
while (!token.IsCancellationRequested && !_exitRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -119,13 +172,22 @@ namespace LDUninstaller.Automatizer
|
|||
using var reader = new StreamReader(server);
|
||||
string? line = reader.ReadLine();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(line) && line.StartsWith("ATTACH:", StringComparison.OrdinalIgnoreCase))
|
||||
if (!string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
string pidStr = line["ATTACH:".Length..].Trim();
|
||||
if (int.TryParse(pidStr, out int pid))
|
||||
if (line.StartsWith("ATTACH:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Console.WriteLine($"[IPC] Takip edilecek PID alındı: {pid}");
|
||||
MonitoredProcesses.TryAdd(pid, DateTime.Now);
|
||||
string pidStr = line["ATTACH:".Length..].Trim();
|
||||
if (int.TryParse(pidStr, out int pid))
|
||||
{
|
||||
Console.WriteLine($"[IPC] Takip edilecek PID alındı: {pid}");
|
||||
MonitoredProcesses.TryAdd(pid, DateTime.Now);
|
||||
_lastActivity = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else if (line.Equals("SHUTDOWN", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_exitRequested = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -202,12 +264,12 @@ namespace LDUninstaller.Automatizer
|
|||
}
|
||||
}
|
||||
|
||||
// Check standard buttons
|
||||
// Check standard buttons (B19: strict word/exact match)
|
||||
var buttons = win.FindAllDescendants(cf => cf.ByControlType(ControlType.Button));
|
||||
foreach (var btn in buttons)
|
||||
{
|
||||
string btnId = btn.AutomationId ?? "";
|
||||
string btnText = btn.Name?.Trim().ToLowerInvariant() ?? "";
|
||||
string btnText = btn.Name?.Trim() ?? "";
|
||||
|
||||
// Prioritize NSIS standard Next button ID 1 or Close/Finish
|
||||
if (btnId == "1" || IsGoodButton(btnText))
|
||||
|
|
@ -229,13 +291,25 @@ namespace LDUninstaller.Automatizer
|
|||
private static bool IsGoodButton(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text)) return false;
|
||||
return GoodButtonTexts.Any(g => text.Equals(g, StringComparison.OrdinalIgnoreCase) || text.Contains(g, StringComparison.OrdinalIgnoreCase));
|
||||
string clean = text.Trim().ToLowerInvariant();
|
||||
|
||||
foreach (var g in GoodButtonTexts)
|
||||
{
|
||||
if (clean.Equals(g, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
|
||||
// Word boundary check for short words to avoid "book", "look", "token", etc.
|
||||
if (Regex.IsMatch(clean, $@"\b{Regex.Escape(g)}\b", RegexOptions.IgnoreCase))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsBadButton(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text)) return false;
|
||||
return BadButtonTexts.Any(b => text.Contains(b, StringComparison.OrdinalIgnoreCase));
|
||||
string clean = text.Trim().ToLowerInvariant();
|
||||
return BadButtonTexts.Any(b => clean.Contains(b, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>LDUninstaller.CLI</RootNamespace>
|
||||
<AssemblyName>LDUninstaller.CLI</AssemblyName>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -248,13 +248,26 @@ Parametreler:
|
|||
|
||||
if (!unattended)
|
||||
{
|
||||
Console.Write("\nDevam etmek istiyor musunuz? [E/H]: ");
|
||||
var key = Console.ReadKey();
|
||||
Console.WriteLine();
|
||||
if (key.Key != ConsoleKey.E && key.Key != ConsoleKey.Y)
|
||||
if (Console.IsInputRedirected)
|
||||
{
|
||||
Console.WriteLine("İşlem iptal edildi.");
|
||||
return 0;
|
||||
Console.Write("\nDevam etmek istiyor musunuz? [E/H]: ");
|
||||
string? line = Console.ReadLine()?.Trim();
|
||||
if (string.IsNullOrEmpty(line) || (!line.StartsWith("e", StringComparison.OrdinalIgnoreCase) && !line.StartsWith("y", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
Console.WriteLine("İşlem iptal edildi.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write("\nDevam etmek istiyor musunuz? [E/H]: ");
|
||||
var key = Console.ReadKey();
|
||||
Console.WriteLine();
|
||||
if (key.Key != ConsoleKey.E && key.Key != ConsoleKey.Y)
|
||||
{
|
||||
Console.WriteLine("İşlem iptal edildi.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,12 +275,17 @@ Parametreler:
|
|||
bulkTask.OnLog += msg => Console.WriteLine($"[Toplu Görev] {msg}");
|
||||
await bulkTask.ExecuteAsync();
|
||||
|
||||
// Automatic Junk Clean
|
||||
if (!string.IsNullOrWhiteSpace(junkLevelStr) && Enum.TryParse<ConfidenceLevel>(junkLevelStr, true, out var minConfidence))
|
||||
var uninstalledApps = bulkTask.Items
|
||||
.Where(i => i.IsEffectivelyUninstalled)
|
||||
.Select(i => i.Entry)
|
||||
.ToList();
|
||||
|
||||
// Automatic Junk Clean (only for effectively uninstalled apps)
|
||||
if (uninstalledApps.Count > 0 && !string.IsNullOrWhiteSpace(junkLevelStr) && Enum.TryParse<ConfidenceLevel>(junkLevelStr, true, out var minConfidence))
|
||||
{
|
||||
Console.WriteLine($"\nArtık temizleme motoru çalıştırılıyor (Asgari Güven: {minConfidence})...");
|
||||
var junkManager = new JunkManager();
|
||||
foreach (var a in appsToUninstall)
|
||||
foreach (var a in uninstalledApps)
|
||||
{
|
||||
var junks = junkManager.ScanJunk(a);
|
||||
var cleanable = junks.Where(j => j.Confidence >= minConfidence).ToList();
|
||||
|
|
|
|||
23
src/LDUninstaller.CLI/app.manifest
Normal file
23
src/LDUninstaller.CLI/app.manifest
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="2.8.0.0" name="LDUninstaller.CLI"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 and Windows 11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
|
|
@ -71,6 +71,17 @@ namespace LDUninstaller.Core.Algorithms
|
|||
string clean1 = NormalizeName(s1);
|
||||
string clean2 = NormalizeName(s2);
|
||||
|
||||
return GetSimilarityNormalized(clean1, clean2, maxOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OPTIMIZATION (P2): Önceden normalize edilmiş metinler için regex çağrılarını atlayan ultra hızlı benzerlik fonksiyonu.
|
||||
/// </summary>
|
||||
public static double GetSimilarityNormalized(string clean1, string clean2, int maxOffset = 5)
|
||||
{
|
||||
if (string.IsNullOrEmpty(clean1) && string.IsNullOrEmpty(clean2)) return 1.0;
|
||||
if (string.IsNullOrEmpty(clean1) || string.IsNullOrEmpty(clean2)) return 0.0;
|
||||
|
||||
if (clean1.Equals(clean2, StringComparison.OrdinalIgnoreCase))
|
||||
return 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Pipes;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -24,19 +26,61 @@ namespace LDUninstaller.Core.Bulk
|
|||
Cancelled
|
||||
}
|
||||
|
||||
public class BulkUninstallEntry
|
||||
public class BulkUninstallEntry : INotifyPropertyChanged
|
||||
{
|
||||
public ApplicationUninstallerEntry Entry { get; }
|
||||
public BulkStatus Status { get; set; } = BulkStatus.Queued;
|
||||
public string StatusMessage { get; set; } = "Kuyrukta";
|
||||
|
||||
private BulkStatus _status = BulkStatus.Queued;
|
||||
public BulkStatus Status
|
||||
{
|
||||
get => _status;
|
||||
set
|
||||
{
|
||||
if (_status != value)
|
||||
{
|
||||
_status = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(StatusBadgeColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _statusMessage = "Kuyrukta";
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
set
|
||||
{
|
||||
if (_statusMessage != value)
|
||||
{
|
||||
_statusMessage = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool PreferQuiet { get; set; } = true;
|
||||
public int ExitCode { get; set; } = -1;
|
||||
public bool IsEffectivelyUninstalled { get; set; }
|
||||
|
||||
public string StatusBadgeColor => Status switch
|
||||
{
|
||||
BulkStatus.Succeeded => "#10B981",
|
||||
BulkStatus.Failed => "#EF4444",
|
||||
BulkStatus.Running => "#3B82F6",
|
||||
BulkStatus.Cancelled => "#F59E0B",
|
||||
_ => "#6B7280"
|
||||
};
|
||||
|
||||
public BulkUninstallEntry(ApplicationUninstallerEntry entry, bool preferQuiet = true)
|
||||
{
|
||||
Entry = entry;
|
||||
PreferQuiet = preferQuiet;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string? name = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
|
||||
public class BulkUninstallTask
|
||||
|
|
@ -63,57 +107,77 @@ namespace LDUninstaller.Core.Bulk
|
|||
|
||||
public async Task ExecuteAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
long restoreSeq = 0;
|
||||
if (CreateRestorePoint)
|
||||
{
|
||||
OnLog?.Invoke("Sistem Geri Yükleme Noktası oluşturuluyor...");
|
||||
await Task.Run(() => Win32.CreateRestorePoint("LD Uninstaller Bulk Pre-Restore Point", out _));
|
||||
await Task.Run(() => Win32.CreateRestorePoint("LD Uninstaller Bulk Pre-Restore Point", out restoreSeq));
|
||||
}
|
||||
|
||||
if (EnableAutomatizer)
|
||||
{
|
||||
EnsureAutomatizerRunning();
|
||||
}
|
||||
|
||||
var throttler = new SemaphoreSlim(MaxConcurrentQuiet, MaxConcurrentQuiet);
|
||||
var runningTasks = new List<Task>();
|
||||
|
||||
foreach (var item in Items)
|
||||
try
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
foreach (var item in Items)
|
||||
{
|
||||
item.Status = BulkStatus.Cancelled;
|
||||
item.StatusMessage = "İptal edildi";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check serialized types
|
||||
bool isSerialized = IsSerializedType(item.Entry.UninstallerKind);
|
||||
|
||||
if (isSerialized)
|
||||
{
|
||||
// Wait for all currently running background tasks to finish
|
||||
await Task.WhenAll(runningTasks);
|
||||
runningTasks.Clear();
|
||||
|
||||
await RunSingleItemAsync(item, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
await throttler.WaitAsync(cancellationToken);
|
||||
|
||||
var t = Task.Run(async () =>
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
await RunSingleItemAsync(item, cancellationToken);
|
||||
}
|
||||
finally
|
||||
{
|
||||
throttler.Release();
|
||||
}
|
||||
}, cancellationToken);
|
||||
item.Status = BulkStatus.Cancelled;
|
||||
item.StatusMessage = "İptal edildi";
|
||||
continue;
|
||||
}
|
||||
|
||||
runningTasks.Add(t);
|
||||
bool isSerialized = IsSerializedType(item.Entry.UninstallerKind);
|
||||
|
||||
if (isSerialized)
|
||||
{
|
||||
await Task.WhenAll(runningTasks);
|
||||
runningTasks.Clear();
|
||||
|
||||
await RunSingleItemAsync(item, cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
await throttler.WaitAsync(cancellationToken);
|
||||
|
||||
var t = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await RunSingleItemAsync(item, cancellationToken);
|
||||
}
|
||||
finally
|
||||
{
|
||||
throttler.Release();
|
||||
}
|
||||
}, cancellationToken);
|
||||
|
||||
runningTasks.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await Task.WhenAll(runningTasks);
|
||||
OnLog?.Invoke("Tüm toplu kaldırma işlemleri tamamlandı.");
|
||||
await Task.WhenAll(runningTasks);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (restoreSeq > 0)
|
||||
{
|
||||
Win32.EndRestorePoint(restoreSeq);
|
||||
}
|
||||
|
||||
if (EnableAutomatizer)
|
||||
{
|
||||
StopAutomatizerDaemon();
|
||||
}
|
||||
|
||||
OnLog?.Invoke("Tüm toplu kaldırma işlemleri tamamlandı.");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RunSingleItemAsync(BulkUninstallEntry item, CancellationToken cancellationToken)
|
||||
|
|
@ -125,12 +189,9 @@ namespace LDUninstaller.Core.Bulk
|
|||
return;
|
||||
}
|
||||
|
||||
// Concurrency Collision Prevention:
|
||||
// 1. Publisher Lock
|
||||
string pub = Sift4.NormalizeName(item.Entry.Publisher);
|
||||
bool pubAcquired = false;
|
||||
|
||||
// 2. Directory Hierarchy Lock
|
||||
string dir = !string.IsNullOrWhiteSpace(item.Entry.InstallLocation)
|
||||
? Path.GetFullPath(item.Entry.InstallLocation).TrimEnd('\\')
|
||||
: string.Empty;
|
||||
|
|
@ -159,7 +220,6 @@ namespace LDUninstaller.Core.Bulk
|
|||
}
|
||||
}
|
||||
|
||||
// 3. MSI Lock
|
||||
bool msiLocked = false;
|
||||
if (item.Entry.UninstallerKind == UninstallerType.Msiexec)
|
||||
{
|
||||
|
|
@ -168,7 +228,6 @@ namespace LDUninstaller.Core.Bulk
|
|||
await WaitForActiveMsiProcesses(cancellationToken);
|
||||
}
|
||||
|
||||
// 4. One Loud Limit (if uninstaller requires GUI)
|
||||
bool isQuiet = item.PreferQuiet && !string.IsNullOrWhiteSpace(item.Entry.QuietUninstallString);
|
||||
bool loudLocked = false;
|
||||
if (!isQuiet)
|
||||
|
|
@ -184,27 +243,42 @@ namespace LDUninstaller.Core.Bulk
|
|||
OnItemStarted?.Invoke(item);
|
||||
OnLog?.Invoke($"Kaldırma başladı: {item.Entry.DisplayName}");
|
||||
|
||||
// Pre-kill locking processes in install folder
|
||||
// Pre-kill locking processes in install folder (B9, P9)
|
||||
PreKillLockingProcesses(item.Entry);
|
||||
|
||||
// Stop services in install folder
|
||||
// Stop services in install folder (B9)
|
||||
PreStopServices(item.Entry);
|
||||
|
||||
// Execute Uninstaller Process
|
||||
int exitCode = await ExecuteUninstallerProcessAsync(item, cancellationToken);
|
||||
item.ExitCode = exitCode;
|
||||
|
||||
if (exitCode == 0 || exitCode == 3010) // 3010 is ERROR_SUCCESS_REBOOT_REQUIRED
|
||||
// B18: Valid exit codes for success: 0, 1605 (already uninstalled), 1641, 3010
|
||||
bool exitCodeSuccess = exitCode == 0 || exitCode == 1605 || exitCode == 1641 || exitCode == 3010;
|
||||
|
||||
// B3: Verify whether it is effectively uninstalled
|
||||
bool isTargetGone = IsTargetEffectivelyRemoved(item.Entry);
|
||||
|
||||
if (exitCodeSuccess || isTargetGone)
|
||||
{
|
||||
item.IsEffectivelyUninstalled = true;
|
||||
item.Status = BulkStatus.Succeeded;
|
||||
item.StatusMessage = exitCode == 3010 ? "Başarılı (Yeniden başlatma gerekli)" : "Başarıyla kaldırıldı";
|
||||
item.StatusMessage = (exitCode == 3010 || exitCode == 1641)
|
||||
? "Başarılı (Yeniden başlatma gerekli)"
|
||||
: "Başarıyla kaldırıldı";
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsEffectivelyUninstalled = false;
|
||||
item.Status = BulkStatus.Failed;
|
||||
item.StatusMessage = $"Hata (Çıkış kodu: {exitCode})";
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
item.Status = BulkStatus.Cancelled;
|
||||
item.StatusMessage = "İptal edildi";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
item.Status = BulkStatus.Failed;
|
||||
|
|
@ -226,6 +300,28 @@ namespace LDUninstaller.Core.Bulk
|
|||
}
|
||||
}
|
||||
|
||||
private static bool IsTargetEffectivelyRemoved(ApplicationUninstallerEntry entry)
|
||||
{
|
||||
// If install directory was populated and is now gone:
|
||||
if (!string.IsNullOrWhiteSpace(entry.InstallLocation) && !Directory.Exists(entry.InstallLocation))
|
||||
return true;
|
||||
|
||||
// If registry key existed and is now gone:
|
||||
if (!string.IsNullOrWhiteSpace(entry.RegistryPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var (hive, subKey, view) = RegistryJunkResult.ParseRegistryPath(entry.RegistryPath);
|
||||
using var baseKey = Microsoft.Win32.RegistryKey.OpenBaseKey(hive, view);
|
||||
using var key = baseKey.OpenSubKey(subKey);
|
||||
if (key == null) return true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task<int> ExecuteUninstallerProcessAsync(BulkUninstallEntry item, CancellationToken token)
|
||||
{
|
||||
string command = item.PreferQuiet && !string.IsNullOrWhiteSpace(item.Entry.QuietUninstallString)
|
||||
|
|
@ -234,15 +330,34 @@ namespace LDUninstaller.Core.Bulk
|
|||
|
||||
if (string.IsNullOrWhiteSpace(command))
|
||||
{
|
||||
// Simple delete fallback for orphaned software
|
||||
if (item.Entry.IsOrphaned && Directory.Exists(item.Entry.InstallLocation))
|
||||
// Simple delete fallback for orphaned software (only if specifically marked orphaned)
|
||||
if (item.Entry.IsOrphaned && Directory.Exists(item.Entry.InstallLocation) && !Junk.SafetyBlacklist.IsDangerousDirectory(item.Entry.InstallLocation))
|
||||
{
|
||||
Directory.Delete(item.Entry.InstallLocation, true);
|
||||
return 0;
|
||||
try
|
||||
{
|
||||
Win32.SendToRecycleBin(item.Entry.InstallLocation);
|
||||
return 0;
|
||||
}
|
||||
catch { return -1; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// B18: Protocol commands like steam://
|
||||
if (command.StartsWith("steam://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(command) { UseShellExecute = true });
|
||||
await Task.Delay(4000, token);
|
||||
return 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var (fileName, args) = SplitCommand(command);
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
|
|
@ -258,16 +373,139 @@ namespace LDUninstaller.Core.Bulk
|
|||
psi.WorkingDirectory = item.Entry.InstallLocation;
|
||||
}
|
||||
|
||||
using var process = Process.Start(psi);
|
||||
if (process == null) return -1;
|
||||
|
||||
if (EnableAutomatizer)
|
||||
Process? process = null;
|
||||
try
|
||||
{
|
||||
NotifyAutomatizerDaemon(process.Id);
|
||||
process = Process.Start(psi);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnLog?.Invoke($"Çalıştırma hatası ({fileName}): {ex.Message}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
await process.WaitForExitAsync(token);
|
||||
return process.ExitCode;
|
||||
if (process == null) return -1;
|
||||
|
||||
using (process)
|
||||
{
|
||||
if (EnableAutomatizer)
|
||||
{
|
||||
NotifyAutomatizerDaemon(process.Id);
|
||||
}
|
||||
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
||||
// Wait for main process
|
||||
try
|
||||
{
|
||||
await process.WaitForExitAsync(token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
try { Win32.GentleKillProcess(process, 1500); } catch { }
|
||||
throw;
|
||||
}
|
||||
|
||||
int exitCode = process.ExitCode;
|
||||
|
||||
// B4: Watch for child / temp uninstaller processes (Inno Setup / NSIS)
|
||||
if (sw.ElapsedMilliseconds < 4000 && (exitCode == 0 || exitCode == 3010))
|
||||
{
|
||||
await WaitForPotentialChildUninstallers(item.Entry, token);
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task WaitForPotentialChildUninstallers(ApplicationUninstallerEntry entry, CancellationToken token)
|
||||
{
|
||||
string tempDir = Path.GetTempPath();
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
if (token.IsCancellationRequested) break;
|
||||
|
||||
bool childActive = false;
|
||||
try
|
||||
{
|
||||
// Inno Setup spawns _iu*.tmp processes
|
||||
// NSIS spawns Au_.exe processes
|
||||
var procs = Process.GetProcesses();
|
||||
foreach (var p in procs)
|
||||
{
|
||||
using (p)
|
||||
{
|
||||
try
|
||||
{
|
||||
string name = p.ProcessName.ToLowerInvariant();
|
||||
if (name.StartsWith("_iu") || name.Equals("au_") || name.Contains("uninstall"))
|
||||
{
|
||||
string? path = Win32.GetProcessPath(p.Id);
|
||||
if (!string.IsNullOrEmpty(path) && path.StartsWith(tempDir, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
childActive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (!childActive)
|
||||
{
|
||||
if (i >= 2) break; // If no child after a couple seconds, assume finished
|
||||
}
|
||||
|
||||
await Task.Delay(1000, token);
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureAutomatizerRunning()
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var existing = Process.GetProcessesByName("LDUninstaller.Automatizer");
|
||||
if (existing.Length > 0)
|
||||
{
|
||||
foreach (var p in existing) p.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
string autoExe = Path.Combine(baseDir, "LDUninstaller.Automatizer.exe");
|
||||
if (File.Exists(autoExe))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(autoExe, "--daemon")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
|
||||
private static void StopAutomatizerDaemon()
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = new NamedPipeClientStream(".", "LDUninstallerDaemon", PipeDirection.Out);
|
||||
client.Connect(500);
|
||||
using var writer = new StreamWriter(client);
|
||||
writer.WriteLine("SHUTDOWN");
|
||||
writer.Flush();
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
|
||||
private static void NotifyAutomatizerDaemon(int pid)
|
||||
|
|
@ -293,9 +531,11 @@ namespace LDUninstaller.Core.Bulk
|
|||
|
||||
try
|
||||
{
|
||||
string norm = Path.GetFullPath(entry.InstallLocation).TrimEnd('\\');
|
||||
// B9: Add trailing directory separator so C:\Foo doesn't kill C:\FooBar
|
||||
string norm = Path.GetFullPath(entry.InstallLocation).TrimEnd('\\') + Path.DirectorySeparatorChar;
|
||||
int currentPid = Process.GetCurrentProcess().Id;
|
||||
var procs = Process.GetProcesses();
|
||||
|
||||
foreach (var p in procs)
|
||||
{
|
||||
using (p)
|
||||
|
|
@ -303,10 +543,12 @@ namespace LDUninstaller.Core.Bulk
|
|||
try
|
||||
{
|
||||
if (p.Id == currentPid) continue;
|
||||
string? mainModule = p.MainModule?.FileName;
|
||||
if (!string.IsNullOrWhiteSpace(mainModule))
|
||||
|
||||
// P9: Use Win32 QueryFullProcessImageName to avoid Access Denied Win32Exceptions
|
||||
string? exePath = Win32.GetProcessPath(p.Id);
|
||||
if (!string.IsNullOrWhiteSpace(exePath))
|
||||
{
|
||||
if (Path.GetFullPath(mainModule).StartsWith(norm, StringComparison.OrdinalIgnoreCase))
|
||||
if (Path.GetFullPath(exePath).StartsWith(norm, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Win32.GentleKillProcess(p, 2000);
|
||||
}
|
||||
|
|
@ -326,8 +568,10 @@ namespace LDUninstaller.Core.Bulk
|
|||
|
||||
try
|
||||
{
|
||||
string norm = Path.GetFullPath(entry.InstallLocation).TrimEnd('\\');
|
||||
// B9: Add trailing separator and parse clean ImagePath
|
||||
string norm = Path.GetFullPath(entry.InstallLocation).TrimEnd('\\') + Path.DirectorySeparatorChar;
|
||||
var services = ServiceController.GetServices();
|
||||
|
||||
foreach (var sc in services)
|
||||
{
|
||||
using (sc)
|
||||
|
|
@ -335,13 +579,22 @@ namespace LDUninstaller.Core.Bulk
|
|||
try
|
||||
{
|
||||
using var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{sc.ServiceName}");
|
||||
string? path = key?.GetValue("ImagePath")?.ToString();
|
||||
if (!string.IsNullOrWhiteSpace(path) && path.StartsWith(norm, StringComparison.OrdinalIgnoreCase))
|
||||
string? rawPath = key?.GetValue("ImagePath")?.ToString();
|
||||
if (!string.IsNullOrWhiteSpace(rawPath))
|
||||
{
|
||||
if (sc.Status == ServiceControllerStatus.Running)
|
||||
string cleanPath = rawPath.Replace("\"", "").Trim();
|
||||
if (cleanPath.StartsWith(@"\??\")) cleanPath = cleanPath.Substring(4);
|
||||
|
||||
int exeIdx = cleanPath.IndexOf(".exe", StringComparison.OrdinalIgnoreCase);
|
||||
if (exeIdx > 0) cleanPath = cleanPath.Substring(0, exeIdx + 4).Trim();
|
||||
|
||||
if (cleanPath.StartsWith(norm, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(3));
|
||||
if (sc.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -354,7 +607,9 @@ namespace LDUninstaller.Core.Bulk
|
|||
|
||||
private static async Task WaitForActiveMsiProcesses(CancellationToken token)
|
||||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
// B15: Timeout after 60 seconds
|
||||
var sw = Stopwatch.StartNew();
|
||||
while (!token.IsCancellationRequested && sw.ElapsedMilliseconds < 60000)
|
||||
{
|
||||
var msiProcs = Process.GetProcessesByName("msiexec");
|
||||
int count = msiProcs.Length;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
"Common Files", "Windows Defender", "Windows Defender Advanced Threat Protection",
|
||||
"Windows Mail", "Windows Media Player", "Windows NT", "Windows Photo Viewer",
|
||||
"Windows Portable Devices", "WindowsPowerShell", "Microsoft", "PackageManagement",
|
||||
"Temp", "Packages", "Microsoft Help"
|
||||
"Temp", "Packages", "Microsoft Help", "WindowsApps"
|
||||
};
|
||||
|
||||
foreach (var root in searchRoots)
|
||||
|
|
@ -90,6 +90,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
{
|
||||
string dirName = Path.GetFileName(dir);
|
||||
if (systemBlacklist.Contains(dirName)) continue;
|
||||
if (Junk.SafetyBlacklist.IsDangerousDirectory(dir)) continue;
|
||||
|
||||
// Check if this path or a subfolder is known
|
||||
if (IsAlreadyRegistered(dir)) continue;
|
||||
|
|
@ -116,6 +117,8 @@ namespace LDUninstaller.Core.Discovery
|
|||
{
|
||||
string subName = Path.GetFileName(sub);
|
||||
if (subBlacklist.Contains(subName)) continue;
|
||||
if (systemBlacklist.Contains(subName)) continue;
|
||||
if (Junk.SafetyBlacklist.IsDangerousDirectory(sub)) continue;
|
||||
if (IsAlreadyRegistered(sub)) continue;
|
||||
|
||||
var subEntry = AnalyzeFolder(sub, $"{dirName} - {subName}");
|
||||
|
|
@ -149,6 +152,10 @@ namespace LDUninstaller.Core.Discovery
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (known.StartsWith(normalized + "\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -162,20 +169,24 @@ namespace LDUninstaller.Core.Discovery
|
|||
var files = Directory.GetFiles(dir, "*.exe", SearchOption.TopDirectoryOnly);
|
||||
if (files.Length == 0) return null;
|
||||
|
||||
// Look for dedicated uninstaller
|
||||
// B7: Look strictly for dedicated uninstallers - NEVER accept setup or install as uninstaller!
|
||||
string? uninstaller = files.FirstOrDefault(f =>
|
||||
{
|
||||
string name = Path.GetFileName(f).ToLowerInvariant();
|
||||
return name.Contains("unins") || name.Contains("uninstall") || name.Contains("setup");
|
||||
return name.StartsWith("unins") || name.StartsWith("uninstall") || name.Equals("uninstaller.exe");
|
||||
});
|
||||
|
||||
string mainExe = uninstaller ?? files[0];
|
||||
var fileInfo = new FileInfo(mainExe);
|
||||
|
||||
var kind = UninstallerType.SimpleDelete;
|
||||
string uninsLower = Path.GetFileName(mainExe).ToLowerInvariant();
|
||||
if (uninsLower.StartsWith("unins000")) kind = UninstallerType.InnoSetup;
|
||||
else if (uninsLower.Equals("uninstall.exe")) kind = UninstallerType.Nsis;
|
||||
if (uninstaller != null)
|
||||
{
|
||||
string uninsLower = Path.GetFileName(uninstaller).ToLowerInvariant();
|
||||
if (uninsLower.StartsWith("unins000")) kind = UninstallerType.InnoSetup;
|
||||
else if (uninsLower.StartsWith("uninstall")) kind = UninstallerType.Nsis;
|
||||
else kind = UninstallerType.Unknown;
|
||||
}
|
||||
|
||||
return new ApplicationUninstallerEntry
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LDUninstaller.Core.Algorithms;
|
||||
using LDUninstaller.Core.InfoAdders;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.Core.Discovery
|
||||
|
|
@ -19,13 +20,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
OnProgress?.Invoke("Kayıt defteri taranıyor...", 10);
|
||||
var regEntries = await Task.Run(() => registryFactory.GetUninstallerEntries().ToList());
|
||||
|
||||
var knownLocations = regEntries
|
||||
.Select(x => x.InstallLocation)
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToList();
|
||||
|
||||
var allEntries = new List<ApplicationUninstallerEntry>(regEntries);
|
||||
|
||||
var tasks = new List<Task<IEnumerable<ApplicationUninstallerEntry>>>();
|
||||
|
||||
if (includeStoreApps)
|
||||
|
|
@ -41,12 +36,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
tasks.Add(Task.Run(() => new ChocolateyFactory().GetUninstallerEntries()));
|
||||
tasks.Add(Task.Run(() => new ScoopFactory().GetUninstallerEntries()));
|
||||
|
||||
if (includeOrphaned)
|
||||
{
|
||||
tasks.Add(Task.Run(() => new DirectoryFactory(knownLocations).GetUninstallerEntries()));
|
||||
}
|
||||
|
||||
OnProgress?.Invoke("Diğer kaynaklar ve paketler taranıyor...", 40);
|
||||
OnProgress?.Invoke("Paket yöneticileri ve platformlar taranıyor...", 30);
|
||||
|
||||
var additionalResults = await Task.WhenAll(tasks);
|
||||
foreach (var set in additionalResults)
|
||||
|
|
@ -54,11 +44,35 @@ namespace LDUninstaller.Core.Discovery
|
|||
allEntries.AddRange(set);
|
||||
}
|
||||
|
||||
OnProgress?.Invoke("Sonuçlar birleştiriliyor ve tekilleştiriliyor...", 80);
|
||||
var merged = await Task.Run(() => MergeResults(allEntries));
|
||||
OnProgress?.Invoke("Kurulum konumları ve kimlikler çözümleniyor...", 50);
|
||||
|
||||
// B7: Fill InstallLocation for registered apps first so DirectoryFactory doesn't falsely flag them as orphans!
|
||||
var locGen = new InstallLocationGenerator();
|
||||
foreach (var entry in allEntries)
|
||||
{
|
||||
locGen.AddInfo(entry);
|
||||
}
|
||||
|
||||
var mergedRegistered = await Task.Run(() => MergeResults(allEntries));
|
||||
|
||||
if (includeOrphaned)
|
||||
{
|
||||
OnProgress?.Invoke("Sürücüler yetim ve sahipsiz klasörler için taranıyor...", 70);
|
||||
|
||||
var knownLocations = mergedRegistered
|
||||
.Select(x => x.InstallLocation)
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToList();
|
||||
|
||||
var orphanEntries = await Task.Run(() => new DirectoryFactory(knownLocations).GetUninstallerEntries().ToList());
|
||||
mergedRegistered.AddRange(orphanEntries);
|
||||
}
|
||||
|
||||
OnProgress?.Invoke("Sonuçlar birleştiriliyor ve tekilleştiriliyor...", 90);
|
||||
var mergedFinal = await Task.Run(() => MergeResults(mergedRegistered));
|
||||
|
||||
OnProgress?.Invoke("Tarama tamamlandı.", 100);
|
||||
return merged;
|
||||
return mergedFinal;
|
||||
}
|
||||
|
||||
public static List<ApplicationUninstallerEntry> MergeResults(IEnumerable<ApplicationUninstallerEntry> entries)
|
||||
|
|
@ -69,7 +83,6 @@ namespace LDUninstaller.Core.Discovery
|
|||
var nameMap = new Dictionary<string, ApplicationUninstallerEntry>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
// OPTIMIZATION: Prefix bucket to replace O(N^2) inner scan with O(1) bucket lookup
|
||||
// Pre-caches CleanName and Publisher to eliminate redundant Regex.Replace / Sift4.NormalizeName calls.
|
||||
var prefixBuckets = new Dictionary<string, List<(ApplicationUninstallerEntry Entry, string CleanName, string Publisher)>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var candidate in entries)
|
||||
|
|
@ -116,7 +129,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
for (int i = 0; i < bucketList.Count; i++)
|
||||
{
|
||||
var target = bucketList[i];
|
||||
double simName = Sift4.GetSimilarity(target.CleanName, cleanName);
|
||||
double simName = Sift4.GetSimilarityNormalized(target.CleanName, cleanName);
|
||||
if (simName > 0.88)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(target.Publisher) || string.IsNullOrWhiteSpace(candidate.Publisher))
|
||||
|
|
@ -124,7 +137,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
existingFuzzy = target.Entry;
|
||||
break;
|
||||
}
|
||||
double simPub = Sift4.GetSimilarity(target.Publisher, candidate.Publisher);
|
||||
double simPub = Sift4.GetSimilarityNormalized(target.Publisher, candidate.Publisher);
|
||||
if (simPub > 0.70)
|
||||
{
|
||||
existingFuzzy = target.Entry;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.Core.Discovery
|
||||
|
|
@ -25,8 +26,15 @@ namespace LDUninstaller.Core.Discovery
|
|||
using var process = Process.Start(psi);
|
||||
if (process == null) return results;
|
||||
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit(3000);
|
||||
var readTask = process.StandardOutput.ReadToEndAsync();
|
||||
if (Task.WhenAny(readTask, Task.Delay(4000)).GetAwaiter().GetResult() != readTask)
|
||||
{
|
||||
try { process.Kill(true); } catch { }
|
||||
return results;
|
||||
}
|
||||
|
||||
string output = readTask.GetAwaiter().GetResult();
|
||||
process.WaitForExit(1000);
|
||||
|
||||
using var reader = new StringReader(output);
|
||||
string? line;
|
||||
|
|
@ -122,8 +130,15 @@ namespace LDUninstaller.Core.Discovery
|
|||
using var process = Process.Start(psi);
|
||||
if (process == null) return results;
|
||||
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
process.WaitForExit(5000);
|
||||
var readTask = process.StandardOutput.ReadToEndAsync();
|
||||
if (Task.WhenAny(readTask, Task.Delay(6000)).GetAwaiter().GetResult() != readTask)
|
||||
{
|
||||
try { process.Kill(true); } catch { }
|
||||
return results;
|
||||
}
|
||||
|
||||
string output = readTask.GetAwaiter().GetResult();
|
||||
process.WaitForExit(1000);
|
||||
|
||||
using var reader = new StringReader(output);
|
||||
string? line;
|
||||
|
|
|
|||
|
|
@ -93,14 +93,31 @@ namespace LDUninstaller.Core.Discovery
|
|||
installDate = dt2;
|
||||
}
|
||||
|
||||
// WindowsInstaller flag / MSI Product code
|
||||
// WindowsInstaller flag / MSI Product code (B13: do NOT assume MSI just because key name is GUID)
|
||||
object? winInstallerVal = sub.GetValue("WindowsInstaller");
|
||||
bool isMsi = winInstallerVal is int wi && wi == 1;
|
||||
bool hasWinInstallerFlag = winInstallerVal is int wi && wi == 1;
|
||||
bool hasMsiUninstallString = (uninstallString != null && uninstallString.Contains("msiexec", StringComparison.OrdinalIgnoreCase)) ||
|
||||
(quietUninstallString != null && quietUninstallString.Contains("msiexec", StringComparison.OrdinalIgnoreCase));
|
||||
bool isMsi = hasWinInstallerFlag || hasMsiUninstallString;
|
||||
|
||||
Guid bundleGuid = Guid.Empty;
|
||||
if (Guid.TryParse(subKeyName, out var guid))
|
||||
{
|
||||
bundleGuid = guid;
|
||||
isMsi = true;
|
||||
}
|
||||
|
||||
// B14: Standardize RegistryPath so 32-bit keys and 64-bit keys have accurate paths
|
||||
string regPath;
|
||||
if (hive == RegistryHive.LocalMachine)
|
||||
{
|
||||
if (view == RegistryView.Registry32)
|
||||
regPath = $@"HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{subKeyName}";
|
||||
else
|
||||
regPath = $@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{subKeyName}";
|
||||
}
|
||||
else
|
||||
{
|
||||
regPath = $@"HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\{subKeyName}";
|
||||
}
|
||||
|
||||
var entry = new ApplicationUninstallerEntry
|
||||
|
|
@ -116,7 +133,7 @@ namespace LDUninstaller.Core.Discovery
|
|||
DisplayIcon = displayIcon.Trim('\"'),
|
||||
AboutUrl = aboutUrl,
|
||||
RegistryKeyName = subKeyName,
|
||||
RegistryPath = $"{hive}\\{subKeyPath}\\{subKeyName}",
|
||||
RegistryPath = regPath,
|
||||
BundleProviderKey = bundleGuid,
|
||||
EstimatedSize = FileSize.FromBytes(estimatedSize),
|
||||
InstallDate = installDate,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.Core.Discovery
|
||||
|
|
@ -16,7 +17,6 @@ namespace LDUninstaller.Core.Discovery
|
|||
|
||||
try
|
||||
{
|
||||
// Run PowerShell to fetch NonDevelopment AppX packages
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "powershell.exe",
|
||||
|
|
@ -29,20 +29,17 @@ namespace LDUninstaller.Core.Discovery
|
|||
using var process = Process.Start(psi);
|
||||
if (process == null) return results;
|
||||
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
|
||||
// FAULT TOLERANCE & PROCESS LIFECYCLE:
|
||||
// Ensure process is never abandoned as a zombie task on timeout.
|
||||
if (!process.WaitForExit(7000))
|
||||
// P5: Non-blocking asynchronous read with strict timeout
|
||||
var readTask = process.StandardOutput.ReadToEndAsync();
|
||||
if (Task.WhenAny(readTask, Task.Delay(8000)).GetAwaiter().GetResult() != readTask)
|
||||
{
|
||||
try
|
||||
{
|
||||
process.Kill(true); // Kill process tree immediately
|
||||
}
|
||||
catch { }
|
||||
try { process.Kill(true); } catch { }
|
||||
return results;
|
||||
}
|
||||
|
||||
string output = readTask.GetAwaiter().GetResult();
|
||||
process.WaitForExit(1000);
|
||||
|
||||
using var reader = new StringReader(output);
|
||||
string? line;
|
||||
bool isHeader = true;
|
||||
|
|
@ -56,7 +53,6 @@ namespace LDUninstaller.Core.Discovery
|
|||
continue;
|
||||
}
|
||||
|
||||
// CSV simple split
|
||||
var parts = SplitCsvLine(line);
|
||||
if (parts.Count < 5) continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using LDUninstaller.Core.Models;
|
||||
using LDUninstaller.Core.Native;
|
||||
|
|
@ -13,6 +16,73 @@ namespace LDUninstaller.Core.InfoAdders
|
|||
void AddInfo(ApplicationUninstallerEntry entry);
|
||||
}
|
||||
|
||||
internal class InfoCacheEntry
|
||||
{
|
||||
public long LastModifiedUtcTicks { get; set; }
|
||||
public long SizeBytes { get; set; }
|
||||
public bool? IsCertValid { get; set; }
|
||||
}
|
||||
|
||||
internal static class InfoCache
|
||||
{
|
||||
private static readonly string CachePath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"LDUninstaller", "cache.json");
|
||||
|
||||
private static readonly ConcurrentDictionary<string, InfoCacheEntry> _cache = new(StringComparer.OrdinalIgnoreCase);
|
||||
private static bool _loaded = false;
|
||||
private static readonly object _saveLock = new();
|
||||
|
||||
public static void EnsureLoaded()
|
||||
{
|
||||
if (_loaded) return;
|
||||
try
|
||||
{
|
||||
if (File.Exists(CachePath))
|
||||
{
|
||||
string json = File.ReadAllText(CachePath);
|
||||
var dict = JsonSerializer.Deserialize<Dictionary<string, InfoCacheEntry>>(json);
|
||||
if (dict != null)
|
||||
{
|
||||
foreach (var kvp in dict)
|
||||
_cache[kvp.Key] = kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
public static bool TryGet(string path, out InfoCacheEntry entry)
|
||||
{
|
||||
EnsureLoaded();
|
||||
return _cache.TryGetValue(path, out entry!);
|
||||
}
|
||||
|
||||
public static void Set(string path, InfoCacheEntry entry)
|
||||
{
|
||||
EnsureLoaded();
|
||||
_cache[path] = entry;
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
lock (_saveLock)
|
||||
{
|
||||
try
|
||||
{
|
||||
string dir = Path.GetDirectoryName(CachePath) ?? "";
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
string json = JsonSerializer.Serialize(_cache, new JsonSerializerOptions { WriteIndented = false });
|
||||
File.WriteAllText(CachePath, json);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InstallLocationGenerator : IMissingInfoAdder
|
||||
{
|
||||
public void AddInfo(ApplicationUninstallerEntry entry)
|
||||
|
|
@ -53,10 +123,11 @@ namespace LDUninstaller.Core.InfoAdders
|
|||
if (entry.UninstallerKind != UninstallerType.Unknown)
|
||||
return;
|
||||
|
||||
string unins = entry.UninstallString;
|
||||
string unins = entry.UninstallString ?? string.Empty;
|
||||
string uninsLower = unins.ToLowerInvariant();
|
||||
|
||||
if (uninsLower.Contains("msiexec.exe") || entry.BundleProviderKey != Guid.Empty)
|
||||
// B13: Require actual msiexec in command or confirmed MSI flag
|
||||
if (uninsLower.Contains("msiexec"))
|
||||
{
|
||||
entry.UninstallerKind = UninstallerType.Msiexec;
|
||||
}
|
||||
|
|
@ -180,14 +251,23 @@ namespace LDUninstaller.Core.InfoAdders
|
|||
|
||||
try
|
||||
{
|
||||
var fi = new FileInfo(targetPath);
|
||||
long ticks = fi.LastWriteTimeUtc.Ticks;
|
||||
|
||||
if (InfoCache.TryGet(targetPath, out var cached) && cached.LastModifiedUtcTicks == ticks && cached.IsCertValid.HasValue)
|
||||
{
|
||||
entry.IsCertificateValid = cached.IsCertValid.Value;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isValid = Win32.VerifyEmbeddedSignature(targetPath);
|
||||
entry.IsCertificateValid = isValid;
|
||||
|
||||
if (isValid)
|
||||
InfoCache.Set(targetPath, new InfoCacheEntry
|
||||
{
|
||||
var cert = X509Certificate.CreateFromSignedFile(targetPath);
|
||||
entry.Certificate = new X509Certificate2(cert);
|
||||
}
|
||||
LastModifiedUtcTicks = ticks,
|
||||
IsCertValid = isValid
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -212,10 +292,24 @@ namespace LDUninstaller.Core.InfoAdders
|
|||
|
||||
try
|
||||
{
|
||||
long totalBytes = CalculateDirSize(new DirectoryInfo(entry.InstallLocation), 0, 3);
|
||||
var di = new DirectoryInfo(entry.InstallLocation);
|
||||
long ticks = di.LastWriteTimeUtc.Ticks;
|
||||
|
||||
if (InfoCache.TryGet(entry.InstallLocation, out var cached) && cached.LastModifiedUtcTicks == ticks && cached.SizeBytes > 0)
|
||||
{
|
||||
entry.EstimatedSize = FileSize.FromBytes(cached.SizeBytes);
|
||||
return;
|
||||
}
|
||||
|
||||
long totalBytes = CalculateDirSize(di, 0, 3);
|
||||
if (totalBytes > 0)
|
||||
{
|
||||
entry.EstimatedSize = FileSize.FromBytes(totalBytes);
|
||||
InfoCache.Set(entry.InstallLocation, new InfoCacheEntry
|
||||
{
|
||||
LastModifiedUtcTicks = ticks,
|
||||
SizeBytes = totalBytes
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
|
@ -308,9 +402,10 @@ namespace LDUninstaller.Core.InfoAdders
|
|||
}
|
||||
}
|
||||
|
||||
public void ProcessAll(System.Collections.Generic.IEnumerable<ApplicationUninstallerEntry> entries)
|
||||
public void ProcessAll(IEnumerable<ApplicationUninstallerEntry> entries)
|
||||
{
|
||||
System.Threading.Tasks.Parallel.ForEach(entries, new System.Threading.Tasks.ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, Process);
|
||||
Parallel.ForEach(entries, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, Process);
|
||||
InfoCache.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
182
src/LDUninstaller.Core/Junk/ExclusionManager.cs
Normal file
182
src/LDUninstaller.Core/Junk/ExclusionManager.cs
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace LDUninstaller.Core.Junk
|
||||
{
|
||||
public class ExclusionItem
|
||||
{
|
||||
public string Path { get; set; } = string.Empty;
|
||||
public bool IsRegex { get; set; }
|
||||
public DateTime AddedAt { get; set; } = DateTime.Now;
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public static class ExclusionManager
|
||||
{
|
||||
private static readonly object _lock = new();
|
||||
private static readonly HashSet<string> _exactExclusions = new(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly List<ExclusionItem> _items = new();
|
||||
private static bool _loaded = false;
|
||||
|
||||
public static string ExclusionFilePath => Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"LDUninstaller", "exclusions.json");
|
||||
|
||||
public static void EnsureLoaded()
|
||||
{
|
||||
if (_loaded) return;
|
||||
lock (_lock)
|
||||
{
|
||||
if (_loaded) return;
|
||||
LoadInternal();
|
||||
_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadInternal()
|
||||
{
|
||||
_exactExclusions.Clear();
|
||||
_items.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
string path = ExclusionFilePath;
|
||||
if (File.Exists(path))
|
||||
{
|
||||
string json = File.ReadAllText(path);
|
||||
var list = JsonSerializer.Deserialize<List<ExclusionItem>>(json);
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(item.Path))
|
||||
{
|
||||
string norm = NormalizePath(item.Path);
|
||||
_exactExclusions.Add(norm);
|
||||
_items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
string dir = Path.GetDirectoryName(ExclusionFilePath) ?? "";
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
string json = JsonSerializer.Serialize(_items, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(ExclusionFilePath, json);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsExcluded(string targetPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(targetPath)) return false;
|
||||
EnsureLoaded();
|
||||
|
||||
string norm = NormalizePath(targetPath);
|
||||
lock (_lock)
|
||||
{
|
||||
if (_exactExclusions.Contains(norm))
|
||||
return true;
|
||||
|
||||
foreach (var item in _items)
|
||||
{
|
||||
if (item.IsRegex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(norm, item.Path, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
else
|
||||
{
|
||||
string itemNorm = NormalizePath(item.Path);
|
||||
if (norm.Equals(itemNorm, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
if (norm.StartsWith(itemNorm + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool AddExclusion(string path, string reason = "Kullanıcı Koruması", bool isRegex = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return false;
|
||||
EnsureLoaded();
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
string norm = NormalizePath(path);
|
||||
if (_exactExclusions.Contains(norm))
|
||||
return false;
|
||||
|
||||
var item = new ExclusionItem
|
||||
{
|
||||
Path = path.Trim(),
|
||||
IsRegex = isRegex,
|
||||
AddedAt = DateTime.Now,
|
||||
Reason = reason
|
||||
};
|
||||
|
||||
_items.Add(item);
|
||||
_exactExclusions.Add(norm);
|
||||
Save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool RemoveExclusion(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return false;
|
||||
EnsureLoaded();
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
string norm = NormalizePath(path);
|
||||
int removed = _items.RemoveAll(x => NormalizePath(x.Path).Equals(norm, StringComparison.OrdinalIgnoreCase));
|
||||
_exactExclusions.Remove(norm);
|
||||
if (removed > 0)
|
||||
{
|
||||
Save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<ExclusionItem> GetAllExclusions()
|
||||
{
|
||||
EnsureLoaded();
|
||||
lock (_lock)
|
||||
{
|
||||
return new List<ExclusionItem>(_items);
|
||||
}
|
||||
}
|
||||
|
||||
private static string NormalizePath(string p)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p)) return string.Empty;
|
||||
return p.Replace('/', '\\').Trim().TrimEnd('\\');
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -7,6 +7,7 @@ namespace LDUninstaller.Core.Junk
|
|||
public static class SafetyBlacklist
|
||||
{
|
||||
private static readonly HashSet<string> BlacklistedDirs = new(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly List<string> ProtectedPrefixes = new();
|
||||
private static readonly HashSet<string> BlacklistedRegPaths = new(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly HashSet<string> ProtectedNames = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
|
|
@ -14,38 +15,108 @@ namespace LDUninstaller.Core.Junk
|
|||
"windows defender", "windows security", "internet explorer", "microsoft.net",
|
||||
"windowspowershell", "dotnet", "common files", "desktop", "downloads",
|
||||
"documents", "pictures", "music", "videos", "appdata", "locallow", "roaming", "local",
|
||||
"temp", "system volume information", "$recycle.bin", "recovery", "boot", "perflogs"
|
||||
"temp", "system volume information", "$recycle.bin", "recovery", "boot", "perflogs",
|
||||
"windowsapps", "package cache", "onedrive"
|
||||
};
|
||||
|
||||
private static readonly string DynamicUsersRoot;
|
||||
private static readonly string UserProfileDir;
|
||||
|
||||
static SafetyBlacklist()
|
||||
{
|
||||
// Windows & System
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.Windows));
|
||||
// Windows & System directories
|
||||
string winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
|
||||
AddDir(winDir);
|
||||
AddPrefix(winDir); // Any file/folder inside C:\Windows must NEVER be treated as junk!
|
||||
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.System));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
|
||||
|
||||
string pf = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
AddDir(pf);
|
||||
if (!string.IsNullOrEmpty(pf))
|
||||
{
|
||||
AddPrefix(Path.Combine(pf, "WindowsApps"));
|
||||
AddDir(Path.Combine(pf, "Common Files"));
|
||||
}
|
||||
|
||||
string pf86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
|
||||
if (!string.IsNullOrEmpty(pf86) && !pf86.Equals(pf, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AddDir(pf86);
|
||||
AddPrefix(Path.Combine(pf86, "WindowsApps"));
|
||||
AddDir(Path.Combine(pf86, "Common Files"));
|
||||
}
|
||||
|
||||
UserProfileDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
AddDir(UserProfileDir);
|
||||
|
||||
// Dynamic Users parent directory (e.g. D:\Users or C:\Users on any non-standard drive)
|
||||
string? usersParent = Path.GetDirectoryName(UserProfileDir);
|
||||
DynamicUsersRoot = !string.IsNullOrWhiteSpace(usersParent) ? usersParent : @"C:\Users";
|
||||
AddDir(DynamicUsersRoot);
|
||||
|
||||
// Core user personal folders
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
|
||||
AddDir(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
|
||||
|
||||
// Drives roots
|
||||
foreach (var drive in DriveInfo.GetDrives())
|
||||
// Package Cache
|
||||
string commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||
if (!string.IsNullOrEmpty(commonAppData))
|
||||
{
|
||||
AddDir(drive.RootDirectory.FullName);
|
||||
AddPrefix(Path.Combine(commonAppData, "Package Cache"));
|
||||
}
|
||||
|
||||
// OneDrive Roots
|
||||
string[] oneDriveVars = { "OneDrive", "OneDriveConsumer", "OneDriveCommercial" };
|
||||
foreach (var v in oneDriveVars)
|
||||
{
|
||||
string? envVal = Environment.GetEnvironmentVariable(v);
|
||||
if (!string.IsNullOrWhiteSpace(envVal) && Directory.Exists(envVal))
|
||||
{
|
||||
AddDir(envVal);
|
||||
AddDir(Path.Combine(envVal, "Documents"));
|
||||
AddDir(Path.Combine(envVal, "Masaüstü"));
|
||||
AddDir(Path.Combine(envVal, "Desktop"));
|
||||
AddDir(Path.Combine(envVal, "Resimler"));
|
||||
AddDir(Path.Combine(envVal, "Pictures"));
|
||||
}
|
||||
}
|
||||
|
||||
// Drives roots
|
||||
try
|
||||
{
|
||||
foreach (var drive in DriveInfo.GetDrives())
|
||||
{
|
||||
AddDir(drive.RootDirectory.FullName);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Registry Core Containers & Blacklists
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows NT");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SYSTEM\CurrentControlSet");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SYSTEM\CurrentControlSet\Services");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SYSTEM");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Classes");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Policies");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Policies\Microsoft");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Policies\Microsoft\Windows");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Policies");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
|
||||
|
|
@ -63,6 +134,9 @@ namespace LDUninstaller.Core.Junk
|
|||
BlacklistedRegPaths.Add(@"HKCR\CLSID");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Classes\CLSID");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Classes\CLSID");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\WOW6432Node\Microsoft");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion");
|
||||
}
|
||||
|
||||
private static void AddDir(string? path)
|
||||
|
|
@ -77,23 +151,53 @@ namespace LDUninstaller.Core.Junk
|
|||
}
|
||||
}
|
||||
|
||||
private static void AddPrefix(string? path)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
string norm = Path.GetFullPath(path).TrimEnd('\\') + Path.DirectorySeparatorChar;
|
||||
if (!ProtectedPrefixes.Contains(norm))
|
||||
ProtectedPrefixes.Add(norm);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsDangerousDirectory(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return true;
|
||||
try
|
||||
{
|
||||
string norm = Path.GetFullPath(path).TrimEnd('\\');
|
||||
|
||||
// 1. Check exact blacklisted system directories
|
||||
if (BlacklistedDirs.Contains(norm))
|
||||
return true;
|
||||
|
||||
// 2. Check protected subfolder prefixes (e.g. C:\Windows\...)
|
||||
string normWithSep = norm + Path.DirectorySeparatorChar;
|
||||
foreach (var pfx in ProtectedPrefixes)
|
||||
{
|
||||
if (normWithSep.StartsWith(pfx, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
|
||||
// 3. User exclusion list
|
||||
if (ExclusionManager.IsExcluded(norm))
|
||||
return true;
|
||||
|
||||
// 4. Protected base folder names
|
||||
string name = Path.GetFileName(norm);
|
||||
if (ProtectedNames.Contains(name))
|
||||
return true;
|
||||
|
||||
// Parent must not be directly root or users root without specific subfolder
|
||||
// 5. Parent checks: cannot delete drive root, user root, or Users parent
|
||||
var di = new DirectoryInfo(norm);
|
||||
if (di.Parent == null) return true; // e.g. C:\
|
||||
if (di.Parent.FullName.Equals(@"C:\Users", StringComparison.OrdinalIgnoreCase)) return true;
|
||||
if (di.Parent == null) return true; // e.g. C:\ or D:\
|
||||
if (di.Parent.FullName.Equals(DynamicUsersRoot, StringComparison.OrdinalIgnoreCase)) return true; // e.g. C:\Users\Username directly
|
||||
if (norm.Equals(UserProfileDir, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -106,14 +210,37 @@ namespace LDUninstaller.Core.Junk
|
|||
public static bool IsDangerousRegistryPath(string regPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(regPath)) return true;
|
||||
|
||||
// Normalize HKLM_32 to standard WOW6432Node representation
|
||||
string norm = regPath.Replace("/", "\\").TrimEnd('\\');
|
||||
if (norm.StartsWith("HKLM_32\\Software", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
norm = "HKLM\\SOFTWARE\\WOW6432Node" + norm.Substring("HKLM_32\\Software".Length);
|
||||
}
|
||||
else if (norm.StartsWith("HKLM_32\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
norm = "HKLM\\" + norm.Substring("HKLM_32\\".Length);
|
||||
}
|
||||
|
||||
// User exclusion check
|
||||
if (ExclusionManager.IsExcluded(norm))
|
||||
return true;
|
||||
|
||||
foreach (var bl in BlacklistedRegPaths)
|
||||
{
|
||||
if (norm.Equals(bl, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
// Root hives
|
||||
if (!norm.Contains('\\')) return true;
|
||||
|
||||
// Root hives or 1-level subkeys under hives (e.g. HKLM\SOFTWARE, HKCU\Software, etc.)
|
||||
int slashCount = 0;
|
||||
for (int i = 0; i < norm.Length; i++)
|
||||
{
|
||||
if (norm[i] == '\\') slashCount++;
|
||||
}
|
||||
|
||||
if (slashCount <= 1) return true; // HKLM, HKLM\SOFTWARE
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,26 @@ namespace LDUninstaller.Core.Models
|
|||
[System.Xml.Serialization.XmlIgnore]
|
||||
public List<IJunkResult> AdditionalJunk { get; } = new();
|
||||
|
||||
public string InstallDateDisplay => InstallDate > DateTime.MinValue.AddYears(1) ? InstallDate.ToString("yyyy-MM-dd") : "—";
|
||||
|
||||
public string UninstallerKindDisplay => UninstallerKind switch
|
||||
{
|
||||
UninstallerType.InnoSetup => "Inno Setup",
|
||||
UninstallerType.Nsis => "NSIS",
|
||||
UninstallerType.Msiexec => "MSI (Windows Installer)",
|
||||
UninstallerType.StoreApp => "Microsoft Store (UWP)",
|
||||
UninstallerType.Steam => "Steam",
|
||||
UninstallerType.InstallShield => "InstallShield",
|
||||
UninstallerType.AdvancedInstaller => "Advanced Installer",
|
||||
UninstallerType.Wise => "Wise",
|
||||
UninstallerType.Squirrel => "Squirrel",
|
||||
UninstallerType.ClickOnce => "ClickOnce",
|
||||
UninstallerType.Chocolatey => "Chocolatey",
|
||||
UninstallerType.Scoop => "Scoop",
|
||||
UninstallerType.SimpleDelete => "Sahipsiz Klasör",
|
||||
_ => UninstallerKind.ToString()
|
||||
};
|
||||
|
||||
public override string ToString() =>
|
||||
$"{DisplayName} ({Publisher}) - {DisplayVersion} [{UninstallerKind}]";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,24 @@ namespace LDUninstaller.Core.Models
|
|||
_ => Type.ToString()
|
||||
};
|
||||
ConfidenceLevel Confidence { get; }
|
||||
string ConfidenceDisplay => Confidence switch
|
||||
{
|
||||
ConfidenceLevel.VeryGood => "Çok Yüksek",
|
||||
ConfidenceLevel.Good => "İyi",
|
||||
_ => "Orta / Düşük"
|
||||
};
|
||||
string ConfidenceBadgeColor => Confidence switch
|
||||
{
|
||||
ConfidenceLevel.VeryGood => "#34D399",
|
||||
ConfidenceLevel.Good => "#FBBF24",
|
||||
_ => "#F87171"
|
||||
};
|
||||
string ConfidenceBadgeBackground => Confidence switch
|
||||
{
|
||||
ConfidenceLevel.VeryGood => "#064E3B",
|
||||
ConfidenceLevel.Good => "#451A03",
|
||||
_ => "#450A0A"
|
||||
};
|
||||
string Reason { get; }
|
||||
bool Selected { get; set; }
|
||||
bool Delete(string backupDir);
|
||||
|
|
@ -44,7 +62,7 @@ namespace LDUninstaller.Core.Models
|
|||
public class RegistryJunkResult : IJunkResult
|
||||
{
|
||||
public string EntryName { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty; // e.g. HKLM\SOFTWARE\Vendor\AppName
|
||||
public string Path { get; set; } = string.Empty; // e.g. HKLM\SOFTWARE\Vendor\AppName or HKLM_32\Software\Vendor\AppName
|
||||
public string? ValueName { get; set; } // if null, entire key is deleted
|
||||
public JunkType Type => ValueName == null ? JunkType.RegistryKey : JunkType.RegistryValue;
|
||||
public ConfidenceLevel Confidence { get; set; } = ConfidenceLevel.Good;
|
||||
|
|
@ -56,16 +74,22 @@ namespace LDUninstaller.Core.Models
|
|||
try
|
||||
{
|
||||
BackupToReg(backupDir);
|
||||
var (hive, subKey) = ParseRegistryPath(Path);
|
||||
using var baseKey = RegistryKey.OpenBaseKey(hive, RegistryView.Default);
|
||||
var (hive, subKey, view) = ParseRegistryPath(Path);
|
||||
using var baseKey = RegistryKey.OpenBaseKey(hive, view);
|
||||
|
||||
if (ValueName == null)
|
||||
{
|
||||
// Check if key exists first
|
||||
using var check = baseKey.OpenSubKey(subKey);
|
||||
if (check == null) return false;
|
||||
|
||||
baseKey.DeleteSubKeyTree(subKey, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
using var opened = baseKey.OpenSubKey(subKey, true);
|
||||
opened?.DeleteValue(ValueName, false);
|
||||
if (opened == null) return false;
|
||||
opened.DeleteValue(ValueName, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -80,9 +104,22 @@ namespace LDUninstaller.Core.Models
|
|||
try
|
||||
{
|
||||
Directory.CreateDirectory(backupDir);
|
||||
string exportPath = Path;
|
||||
string extraArgs = "";
|
||||
|
||||
if (exportPath.StartsWith("HKLM_32\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
exportPath = "HKLM\\" + exportPath.Substring("HKLM_32\\".Length);
|
||||
extraArgs = " /reg:32";
|
||||
}
|
||||
else if (exportPath.Contains("WOW6432Node", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
extraArgs = " /reg:32";
|
||||
}
|
||||
|
||||
string sanitized = System.Text.RegularExpressions.Regex.Replace(Path, @"[\\/:\*\?""<>\|]", "_");
|
||||
string file = System.IO.Path.Combine(backupDir, $"reg_backup_{DateTime.Now:yyyyMMdd_HHmmss}_{sanitized}.reg");
|
||||
var psi = new System.Diagnostics.ProcessStartInfo("reg.exe", $"export \"{Path}\" \"{file}\" /y")
|
||||
var psi = new System.Diagnostics.ProcessStartInfo("reg.exe", $"export \"{exportPath}\" \"{file}\" /y{extraArgs}")
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false
|
||||
|
|
@ -96,11 +133,24 @@ namespace LDUninstaller.Core.Models
|
|||
}
|
||||
}
|
||||
|
||||
private static (RegistryHive hive, string subKey) ParseRegistryPath(string fullPath)
|
||||
public static (RegistryHive hive, string subKey, RegistryView view) ParseRegistryPath(string fullPath)
|
||||
{
|
||||
int firstSlash = fullPath.IndexOf('\\');
|
||||
string hiveStr = firstSlash > 0 ? fullPath[..firstSlash] : fullPath;
|
||||
string sub = firstSlash > 0 ? fullPath[(firstSlash + 1)..] : "";
|
||||
RegistryView view = RegistryView.Default;
|
||||
string working = fullPath;
|
||||
|
||||
if (working.StartsWith("HKLM_32\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
view = RegistryView.Registry32;
|
||||
working = "HKLM\\" + working.Substring("HKLM_32\\".Length);
|
||||
}
|
||||
else if (working.Contains("WOW6432Node", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
view = RegistryView.Registry32;
|
||||
}
|
||||
|
||||
int firstSlash = working.IndexOf('\\');
|
||||
string hiveStr = firstSlash > 0 ? working[..firstSlash] : working;
|
||||
string sub = firstSlash > 0 ? working[(firstSlash + 1)..] : "";
|
||||
|
||||
RegistryHive hive = hiveStr.ToUpperInvariant() switch
|
||||
{
|
||||
|
|
@ -110,7 +160,8 @@ namespace LDUninstaller.Core.Models
|
|||
"HKU" or "HKEY_USERS" => RegistryHive.Users,
|
||||
_ => RegistryHive.LocalMachine
|
||||
};
|
||||
return (hive, sub);
|
||||
|
||||
return (hive, sub, view);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +179,19 @@ namespace LDUninstaller.Core.Models
|
|||
{
|
||||
try
|
||||
{
|
||||
// B32: If target does not exist, return false
|
||||
if (IsDirectory && !Directory.Exists(Path))
|
||||
return false;
|
||||
if (!IsDirectory && !File.Exists(Path))
|
||||
return false;
|
||||
|
||||
// B2: Always use Windows Shell API to send items safely to the Recycle Bin!
|
||||
if (Native.Win32.SendToRecycleBin(Path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback to direct delete if Shell operation was unsupported on volume
|
||||
if (IsDirectory)
|
||||
{
|
||||
if (Directory.Exists(Path))
|
||||
|
|
@ -152,7 +216,7 @@ namespace LDUninstaller.Core.Models
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace LDUninstaller.Core.Native
|
|||
try
|
||||
{
|
||||
using var wtd = new WinTrustFileInfo(filePath);
|
||||
var data = new WinTrustData(wtd.Handle);
|
||||
using var data = new WinTrustData(wtd.Handle);
|
||||
uint result = WinVerifyTrust(new IntPtr(-1), WINTRUST_ACTION_GENERIC_VERIFY_V2, data);
|
||||
return result == 0; // 0 == ERROR_SUCCESS
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ namespace LDUninstaller.Core.Native
|
|||
}
|
||||
}
|
||||
|
||||
// --- System Restore API (srclient.dll) ---
|
||||
// --- System Restore API (srclient.dll) (B11) ---
|
||||
[DllImport("srclient.dll", CharSet = CharSet.Unicode)]
|
||||
public static extern bool SRSetRestorePointW(ref RESTOREPOINTINFO pRestorePointInit, ref STATEMGRSTATUS pSMgrStatus);
|
||||
|
||||
|
|
@ -65,11 +65,102 @@ namespace LDUninstaller.Core.Native
|
|||
}
|
||||
catch
|
||||
{
|
||||
// Fallback / SR disabled on machine
|
||||
// System Restore service disabled or policy prevented
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool EndRestorePoint(long sequenceNumber)
|
||||
{
|
||||
if (sequenceNumber <= 0) return false;
|
||||
try
|
||||
{
|
||||
var info = new RESTOREPOINTINFO
|
||||
{
|
||||
dwEventType = 101, // END_SYSTEM_CHANGE
|
||||
dwRestorePtType = 0,
|
||||
llSequenceNumber = sequenceNumber,
|
||||
szDescription = string.Empty
|
||||
};
|
||||
var status = new STATEMGRSTATUS();
|
||||
return SRSetRestorePointW(ref info, ref status) && status.nStatus == 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Windows Shell File Operations: SendToRecycleBin (B2) ---
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct SHFILEOPSTRUCT
|
||||
{
|
||||
public IntPtr hwnd;
|
||||
public uint wFunc;
|
||||
public string pFrom;
|
||||
public string? pTo;
|
||||
public ushort fFlags;
|
||||
public bool fAnyOperationsAborted;
|
||||
public IntPtr hNameMappings;
|
||||
public string? lpszProgressTitle;
|
||||
}
|
||||
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern int SHFileOperation(ref SHFILEOPSTRUCT lpFileOp);
|
||||
|
||||
public const uint FO_DELETE = 0x0003;
|
||||
public const ushort FOF_SILENT = 0x0004;
|
||||
public const ushort FOF_NOCONFIRMATION = 0x0010;
|
||||
public const ushort FOF_ALLOWUNDO = 0x0040;
|
||||
public const ushort FOF_NOERRORUI = 0x0400;
|
||||
|
||||
public static bool SendToRecycleBin(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) return false;
|
||||
if (!File.Exists(path) && !Directory.Exists(path)) return false;
|
||||
|
||||
// 1. Primary: Microsoft Windows Desktop Shell Recycle Bin (IFileOperation wrapper)
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(
|
||||
path,
|
||||
Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs,
|
||||
Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin);
|
||||
return !Directory.Exists(path);
|
||||
}
|
||||
else if (File.Exists(path))
|
||||
{
|
||||
Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(
|
||||
path,
|
||||
Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs,
|
||||
Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin);
|
||||
return !File.Exists(path);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 2. Secondary: Native SHFileOperation with guaranteed double-null termination
|
||||
try
|
||||
{
|
||||
var shf = new SHFILEOPSTRUCT
|
||||
{
|
||||
hwnd = IntPtr.Zero,
|
||||
wFunc = FO_DELETE,
|
||||
pFrom = path + "\0\0",
|
||||
pTo = null,
|
||||
fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI
|
||||
};
|
||||
int result = SHFileOperation(ref shf);
|
||||
return result == 0 && !shf.fAnyOperationsAborted;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// --- MoveFileEx (Reboot cleanup) ---
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern bool MoveFileEx(string lpExistingFileName, string? lpNewFileName, int dwFlags);
|
||||
|
|
@ -87,7 +178,7 @@ namespace LDUninstaller.Core.Native
|
|||
}
|
||||
}
|
||||
|
||||
// --- Shell Icons ---
|
||||
// --- Shell Icons & Handle Cleanup (P11) ---
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern uint ExtractIconEx(string szFileName, int nIconIndex, IntPtr[]? phiconLarge, IntPtr[]? phiconSmall, uint nIcons);
|
||||
|
||||
|
|
@ -113,6 +204,39 @@ namespace LDUninstaller.Core.Native
|
|||
public const uint SWP_NOSIZE = 0x0001;
|
||||
public const uint SWP_NOZORDER = 0x0004;
|
||||
|
||||
// --- Process Path by Win32 QueryFullProcessImageName (P9) ---
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
public static extern bool QueryFullProcessImageName(IntPtr hProcess, int dwFlags, StringBuilder lpExeName, ref int lpdwSize);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern IntPtr OpenProcess(uint processAccess, bool bInheritHandle, int processId);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern bool CloseHandle(IntPtr hObject);
|
||||
|
||||
public const uint PROCESS_QUERY_LIMITED_INFORMATION = 0x1000;
|
||||
|
||||
public static string? GetProcessPath(int processId)
|
||||
{
|
||||
IntPtr hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, processId);
|
||||
if (hProcess == IntPtr.Zero) return null;
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder(1024);
|
||||
int size = sb.Capacity;
|
||||
if (QueryFullProcessImageName(hProcess, 0, sb, ref size))
|
||||
{
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void GentleKillProcess(Process process, int waitMs = 3000)
|
||||
{
|
||||
try
|
||||
|
|
@ -162,7 +286,7 @@ namespace LDUninstaller.Core.Native
|
|||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
|
||||
public struct RESTOREPOINTINFO
|
||||
{
|
||||
public int dwEventType;
|
||||
|
|
@ -172,7 +296,7 @@ namespace LDUninstaller.Core.Native
|
|||
public string szDescription;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct STATEMGRSTATUS
|
||||
{
|
||||
public int nStatus;
|
||||
|
|
@ -207,28 +331,38 @@ namespace LDUninstaller.Core.Native
|
|||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct WINTRUST_FILE_INFO_NATIVE
|
||||
{
|
||||
public uint cbStruct;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string pcwszFilePath;
|
||||
public IntPtr hFile;
|
||||
public IntPtr pgKnownSubject;
|
||||
}
|
||||
|
||||
public class WinTrustFileInfo : IDisposable
|
||||
{
|
||||
private uint cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustFileInfo));
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
private string pcwszFilePath;
|
||||
private IntPtr hFile = IntPtr.Zero;
|
||||
private IntPtr pgKnownSubject = IntPtr.Zero;
|
||||
private IntPtr _nativeMemory = IntPtr.Zero;
|
||||
|
||||
public IntPtr Handle => _nativeMemory;
|
||||
|
||||
public WinTrustFileInfo(string filePath)
|
||||
{
|
||||
pcwszFilePath = filePath;
|
||||
_nativeMemory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WinTrustFileInfo)));
|
||||
Marshal.StructureToPtr(this, _nativeMemory, false);
|
||||
var native = new WINTRUST_FILE_INFO_NATIVE
|
||||
{
|
||||
cbStruct = (uint)Marshal.SizeOf(typeof(WINTRUST_FILE_INFO_NATIVE)),
|
||||
pcwszFilePath = filePath,
|
||||
hFile = IntPtr.Zero,
|
||||
pgKnownSubject = IntPtr.Zero
|
||||
};
|
||||
_nativeMemory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WINTRUST_FILE_INFO_NATIVE)));
|
||||
Marshal.StructureToPtr(native, _nativeMemory, false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_nativeMemory != IntPtr.Zero)
|
||||
{
|
||||
Marshal.DestroyStructure<WINTRUST_FILE_INFO_NATIVE>(_nativeMemory);
|
||||
Marshal.FreeHGlobal(_nativeMemory);
|
||||
_nativeMemory = IntPtr.Zero;
|
||||
}
|
||||
|
|
|
|||
606
src/LDUninstaller.Core/Services/FileUnlockerService.cs
Normal file
606
src/LDUninstaller.Core/Services/FileUnlockerService.cs
Normal file
|
|
@ -0,0 +1,606 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ServiceProcess;
|
||||
using System.Threading;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Native;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace LDUninstaller.Core.Services
|
||||
{
|
||||
public class ProcessLockInfo
|
||||
{
|
||||
public int ProcessId { get; set; }
|
||||
public string ProcessName { get; set; } = string.Empty;
|
||||
public string ExecutablePath { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public bool IsService { get; set; }
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class UnlockAndDestroyResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string TargetPath { get; set; } = string.Empty;
|
||||
public int KilledProcessesCount { get; set; }
|
||||
public int StoppedServicesCount { get; set; }
|
||||
public int DeletedFilesCount { get; set; }
|
||||
public List<string> ErrorMessages { get; } = new();
|
||||
public bool ScheduledForReboot { get; set; }
|
||||
}
|
||||
|
||||
public static class FileUnlockerService
|
||||
{
|
||||
#region Windows Restart Manager Interop
|
||||
private const int CCH_RM_SESSION_KEY = 32;
|
||||
|
||||
[DllImport("rstrtmgr.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern int RmStartSession(out uint pSessionHandle, int dwSessionFlags, string strSessionKey);
|
||||
|
||||
[DllImport("rstrtmgr.dll", CharSet = CharSet.Unicode)]
|
||||
private static extern int RmRegisterResources(
|
||||
uint pSessionHandle,
|
||||
uint nFiles,
|
||||
string[]? rgsFileNames,
|
||||
uint nApplications,
|
||||
RM_UNIQUE_PROCESS[]? rgApplications,
|
||||
uint nServices,
|
||||
string[]? rgsServiceNames);
|
||||
|
||||
[DllImport("rstrtmgr.dll")]
|
||||
private static extern int RmGetList(
|
||||
uint pSessionHandle,
|
||||
out uint pnProcInfoNeeded,
|
||||
ref uint pnProcInfo,
|
||||
[In, Out] RM_PROCESS_INFO[]? rgAffectedApps,
|
||||
out uint lpdwRebootReasons);
|
||||
|
||||
[DllImport("rstrtmgr.dll")]
|
||||
private static extern int RmEndSession(uint pSessionHandle);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct RM_UNIQUE_PROCESS
|
||||
{
|
||||
public int dwProcessId;
|
||||
public System.Runtime.InteropServices.ComTypes.FILETIME ProcessStartTime;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
private struct RM_PROCESS_INFO
|
||||
{
|
||||
public RM_UNIQUE_PROCESS Process;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string strAppName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
||||
public string strServiceShortName;
|
||||
public int ApplicationType;
|
||||
public uint AppStatus;
|
||||
public uint TSSessionId;
|
||||
[MarshalAs(UnmanagedType.Bool)]
|
||||
public bool bRestartable;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Kısayol (.lnk) veya dosya/klasör yolunu analiz ederek asıl kurulum klasörünü ve hedefi çözümler.
|
||||
/// </summary>
|
||||
public static (string targetFolder, string? primaryFile, string? originalLnk) ResolveTarget(string inputPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(inputPath))
|
||||
return (string.Empty, null, null);
|
||||
|
||||
string norm = Path.GetFullPath(inputPath).TrimEnd('\\');
|
||||
|
||||
// Eğer .lnk kısayolu ise, hedef exe'yi ve onun üst klasörünü çöz
|
||||
if (norm.EndsWith(".lnk", StringComparison.OrdinalIgnoreCase) && File.Exists(norm))
|
||||
{
|
||||
string? resolved = ResolveShortcutTarget(norm);
|
||||
if (!string.IsNullOrWhiteSpace(resolved))
|
||||
{
|
||||
if (Directory.Exists(resolved))
|
||||
{
|
||||
return (resolved, null, norm);
|
||||
}
|
||||
if (File.Exists(resolved))
|
||||
{
|
||||
string? parent = Path.GetDirectoryName(resolved);
|
||||
if (!string.IsNullOrWhiteSpace(parent) && Directory.Exists(parent))
|
||||
{
|
||||
return (parent, resolved, norm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Normal dosya ise üst klasörünü hedef klasör al (ör. C:\Program Files\App\app.exe)
|
||||
if (File.Exists(norm))
|
||||
{
|
||||
string? parent = Path.GetDirectoryName(norm);
|
||||
if (!string.IsNullOrWhiteSpace(parent) && Directory.Exists(parent))
|
||||
{
|
||||
return (parent, norm, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Normal klasör ise doğrudan kendisi
|
||||
return (norm, null, null);
|
||||
}
|
||||
|
||||
public static string? ResolveShortcutTarget(string lnkPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
Type? shellType = Type.GetTypeFromProgID("WScript.Shell");
|
||||
if (shellType != null)
|
||||
{
|
||||
dynamic? shell = Activator.CreateInstance(shellType);
|
||||
if (shell != null)
|
||||
{
|
||||
dynamic? shortcut = shell.CreateShortcut(lnkPath);
|
||||
string? target = shortcut?.TargetPath;
|
||||
if (!string.IsNullOrWhiteSpace(target))
|
||||
return target;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hedef klasör ve içindeki dosyaları o an kilitleyen tüm süreçleri ve servisleri listeler.
|
||||
/// </summary>
|
||||
public static List<ProcessLockInfo> InspectLocks(string targetPath)
|
||||
{
|
||||
var results = new Dictionary<int, ProcessLockInfo>();
|
||||
if (string.IsNullOrWhiteSpace(targetPath) || (!Directory.Exists(targetPath) && !File.Exists(targetPath)))
|
||||
return results.Values.ToList();
|
||||
|
||||
string normDir = Path.GetFullPath(targetPath).TrimEnd('\\');
|
||||
|
||||
// 1. Klasör içi imaj yoluna sahip süreçler
|
||||
try
|
||||
{
|
||||
foreach (var proc in Process.GetProcesses())
|
||||
{
|
||||
try
|
||||
{
|
||||
string? img = Win32.GetProcessPath(proc.Id);
|
||||
if (!string.IsNullOrEmpty(img))
|
||||
{
|
||||
string normImg = img.TrimEnd('\\');
|
||||
if (normImg.StartsWith(normDir + "\\", StringComparison.OrdinalIgnoreCase) ||
|
||||
normImg.Equals(normDir, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!results.ContainsKey(proc.Id))
|
||||
{
|
||||
results[proc.Id] = new ProcessLockInfo
|
||||
{
|
||||
ProcessId = proc.Id,
|
||||
ProcessName = proc.ProcessName,
|
||||
ExecutablePath = img,
|
||||
Description = "Klasör içinde çalışan aktif süreç"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
finally { proc.Dispose(); }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 2. Windows Restart Manager ile kilitli DLL/dosya tutan dış süreçler
|
||||
try
|
||||
{
|
||||
var filesToCheck = new List<string>();
|
||||
if (File.Exists(targetPath))
|
||||
{
|
||||
filesToCheck.Add(targetPath);
|
||||
}
|
||||
else if (Directory.Exists(targetPath))
|
||||
{
|
||||
// En kritik kilit adaylarını topla (exe, dll, sys, log, db)
|
||||
var topFiles = Directory.EnumerateFiles(targetPath, "*.*", SearchOption.AllDirectories)
|
||||
.Where(f =>
|
||||
{
|
||||
string ext = Path.GetExtension(f).ToLowerInvariant();
|
||||
return ext is ".exe" or ".dll" or ".sys" or ".dat" or ".db" or ".log";
|
||||
})
|
||||
.Take(64)
|
||||
.ToList();
|
||||
|
||||
filesToCheck.AddRange(topFiles);
|
||||
}
|
||||
|
||||
if (filesToCheck.Count > 0)
|
||||
{
|
||||
var rmProcs = GetProcessesLockingFilesWithRm(filesToCheck);
|
||||
foreach (var rm in rmProcs)
|
||||
{
|
||||
if (!results.ContainsKey(rm.ProcessId))
|
||||
results[rm.ProcessId] = rm;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 3. Klasör içi dosyaları kullanan Windows Servisleri
|
||||
try
|
||||
{
|
||||
var services = FindServicesInDirectory(normDir);
|
||||
foreach (var s in services)
|
||||
{
|
||||
// Servise ait bir PID varsa listeye ekle veya yeni bilgi oluştur
|
||||
if (s.ProcessId > 0 && results.TryGetValue(s.ProcessId, out var existing))
|
||||
{
|
||||
existing.IsService = true;
|
||||
existing.ServiceName = s.ServiceName;
|
||||
}
|
||||
else
|
||||
{
|
||||
results[s.ProcessId > 0 ? s.ProcessId : -Math.Abs(s.ServiceName.GetHashCode())] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return results.Values.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 4 Aşamalı kilit kırma boru hattını çalıştırır, süreç ve servisleri sonlandırır ve klasörü tamamen siler.
|
||||
/// </summary>
|
||||
public static UnlockAndDestroyResult UnlockAndDestroy(
|
||||
string targetPath,
|
||||
bool sendToRecycleBin = true,
|
||||
Action<string>? onLog = null)
|
||||
{
|
||||
var res = new UnlockAndDestroyResult { TargetPath = targetPath };
|
||||
|
||||
if (string.IsNullOrWhiteSpace(targetPath) || (!Directory.Exists(targetPath) && !File.Exists(targetPath)))
|
||||
{
|
||||
res.Success = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
// GÜVENLİK KALKANI: Kritik sistem veya kullanıcı kök dizini ise asla silme!
|
||||
if (SafetyBlacklist.IsDangerousDirectory(targetPath))
|
||||
{
|
||||
string msg = $"GÜVENLİK ENGELİ: '{targetPath}' kritik bir Windows sistem veya profil kök dizinidir ve silinemez!";
|
||||
onLog?.Invoke(msg);
|
||||
res.ErrorMessages.Add(msg);
|
||||
res.Success = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
string normPath = Path.GetFullPath(targetPath).TrimEnd('\\');
|
||||
onLog?.Invoke($"[1/4] Kilit kırma başlatılıyor: {normPath}");
|
||||
|
||||
// AŞAMA 1 & 2: Süreçleri Sonlandırma (Restart Manager + Process Tree Kill)
|
||||
var locks = InspectLocks(normPath);
|
||||
int currentPid = Process.GetCurrentProcess().Id;
|
||||
|
||||
foreach (var lockInfo in locks)
|
||||
{
|
||||
if (lockInfo.ProcessId <= 4 || lockInfo.ProcessId == currentPid)
|
||||
continue;
|
||||
|
||||
// explorer.exe kontrolü
|
||||
if (lockInfo.ProcessName.Equals("explorer", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
onLog?.Invoke("Dosya Gezgini (explorer.exe) kilit tutuyor; tutamaç serbest bırakılacak.");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var proc = Process.GetProcessById(lockInfo.ProcessId);
|
||||
onLog?.Invoke($"Süreç sonlandırılıyor: {proc.ProcessName} (PID: {proc.Id})");
|
||||
proc.Kill(entireProcessTree: true);
|
||||
proc.WaitForExit(1500);
|
||||
res.KilledProcessesCount++;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// AŞAMA 3: İlgili Windows Servislerini Durdurma ve Kaldırma
|
||||
var services = FindServicesInDirectory(normPath);
|
||||
foreach (var svc in services)
|
||||
{
|
||||
try
|
||||
{
|
||||
onLog?.Invoke($"Servis durduruluyor ve kaldırılıyor: {svc.ServiceName}");
|
||||
using var sc = new ServiceController(svc.ServiceName);
|
||||
if (sc.Status != ServiceControllerStatus.Stopped && sc.Status != ServiceControllerStatus.StopPending)
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(3));
|
||||
}
|
||||
|
||||
// sc delete ile servisi sistemden temizle
|
||||
RunCommandSilent("sc.exe", $"delete \"{svc.ServiceName}\"");
|
||||
res.StoppedServicesCount++;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// AŞAMA 4: İzinleri Sıfırlama ve Agresif Silme Döngüsü
|
||||
onLog?.Invoke("[4/4] Dosya öznitelikleri sıfırlanıyor ve sahiplik alınıyor...");
|
||||
ResetAttributesAndTakeOwnership(normPath);
|
||||
|
||||
// 5 Aşamalı Agresif Silme Döngüsü
|
||||
for (int attempt = 1; attempt <= 5; attempt++)
|
||||
{
|
||||
if (!Directory.Exists(normPath) && !File.Exists(normPath))
|
||||
{
|
||||
res.Success = true;
|
||||
onLog?.Invoke("Hedef başarıyla silindi ve yok edildi!");
|
||||
return res;
|
||||
}
|
||||
|
||||
onLog?.Invoke($"Silme denemesi {attempt}/5...");
|
||||
|
||||
bool deleted = false;
|
||||
if (sendToRecycleBin)
|
||||
{
|
||||
deleted = Win32.SendToRecycleBin(normPath);
|
||||
}
|
||||
|
||||
if (!deleted)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(normPath))
|
||||
{
|
||||
File.Delete(normPath);
|
||||
deleted = !File.Exists(normPath);
|
||||
}
|
||||
else if (Directory.Exists(normPath))
|
||||
{
|
||||
Directory.Delete(normPath, true);
|
||||
deleted = !Directory.Exists(normPath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.ErrorMessages.Add($"Deneme {attempt} hatası: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
if (deleted || (!Directory.Exists(normPath) && !File.Exists(normPath)))
|
||||
{
|
||||
res.Success = true;
|
||||
onLog?.Invoke("Hedef klasör tamamen temizlendi.");
|
||||
return res;
|
||||
}
|
||||
|
||||
// Silinemeyen dosya kaldıysa tekrar Restart Manager ile kilitleyen süreci avla
|
||||
var remainingLocks = InspectLocks(normPath);
|
||||
foreach (var rmProc in remainingLocks)
|
||||
{
|
||||
if (rmProc.ProcessId > 4 && rmProc.ProcessId != currentPid && !rmProc.ProcessName.Equals("explorer", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
try
|
||||
{
|
||||
using var p = Process.GetProcessById(rmProc.ProcessId);
|
||||
p.Kill(entireProcessTree: true);
|
||||
res.KilledProcessesCount++;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
|
||||
// Eğer hala silinemeyen bir kernel driver veya sistem dosyası kaldıysa, yeniden başlatmada silinmeye ayarla
|
||||
if (Directory.Exists(normPath) || File.Exists(normPath))
|
||||
{
|
||||
onLog?.Invoke("Bazı dosyalar çekirdek düzeyinde kilitli; ilk sistem yeniden başlatmasında (MoveFileEx) silinmek üzere zamanlanıyor...");
|
||||
ScheduleAllForRebootDelete(normPath);
|
||||
res.ScheduledForReboot = true;
|
||||
res.Success = true;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private static List<ProcessLockInfo> GetProcessesLockingFilesWithRm(List<string> filePaths)
|
||||
{
|
||||
var list = new List<ProcessLockInfo>();
|
||||
string sessionKey = Guid.NewGuid().ToString();
|
||||
|
||||
int res = RmStartSession(out uint sessionHandle, 0, sessionKey);
|
||||
if (res != 0) return list;
|
||||
|
||||
try
|
||||
{
|
||||
int regRes = RmRegisterResources(sessionHandle, (uint)filePaths.Count, filePaths.ToArray(), 0, null, 0, null);
|
||||
if (regRes != 0) return list;
|
||||
|
||||
uint procInfoNeeded = 0;
|
||||
uint procInfo = 0;
|
||||
RM_PROCESS_INFO[]? processInfo = null;
|
||||
|
||||
res = RmGetList(sessionHandle, out procInfoNeeded, ref procInfo, processInfo, out uint rebootReasons);
|
||||
if (res == 234) // ERROR_MORE_DATA
|
||||
{
|
||||
processInfo = new RM_PROCESS_INFO[procInfoNeeded];
|
||||
procInfo = procInfoNeeded;
|
||||
res = RmGetList(sessionHandle, out procInfoNeeded, ref procInfo, processInfo, out rebootReasons);
|
||||
}
|
||||
|
||||
if (res == 0 && processInfo != null)
|
||||
{
|
||||
foreach (var pi in processInfo)
|
||||
{
|
||||
int pid = pi.Process.dwProcessId;
|
||||
if (pid <= 4) continue;
|
||||
|
||||
string exePath = Win32.GetProcessPath(pid) ?? "";
|
||||
list.Add(new ProcessLockInfo
|
||||
{
|
||||
ProcessId = pid,
|
||||
ProcessName = string.IsNullOrEmpty(pi.strAppName) ? Path.GetFileNameWithoutExtension(exePath) : pi.strAppName,
|
||||
ExecutablePath = exePath,
|
||||
ServiceName = pi.strServiceShortName,
|
||||
IsService = !string.IsNullOrEmpty(pi.strServiceShortName),
|
||||
Description = "Restart Manager tarafından yakalanan kilitli süreç"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
RmEndSession(sessionHandle);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<ProcessLockInfo> FindServicesInDirectory(string dirPath)
|
||||
{
|
||||
var services = new List<ProcessLockInfo>();
|
||||
string normDir = dirPath.TrimEnd('\\');
|
||||
|
||||
try
|
||||
{
|
||||
using var servicesKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services");
|
||||
if (servicesKey == null) return services;
|
||||
|
||||
foreach (var svcName in servicesKey.GetSubKeyNames())
|
||||
{
|
||||
try
|
||||
{
|
||||
using var svcKey = servicesKey.OpenSubKey(svcName);
|
||||
string? imagePath = svcKey?.GetValue("ImagePath")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(imagePath)) continue;
|
||||
|
||||
string clean = imagePath.Replace("\"", "").Trim();
|
||||
if (clean.StartsWith(@"\??\")) clean = clean.Substring(4);
|
||||
|
||||
int exeIdx = clean.IndexOf(".exe", StringComparison.OrdinalIgnoreCase);
|
||||
if (exeIdx > 0) clean = clean.Substring(0, exeIdx + 4).Trim();
|
||||
|
||||
if (clean.StartsWith(normDir + "\\", StringComparison.OrdinalIgnoreCase) ||
|
||||
clean.Equals(normDir, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int pid = GetServicePid(svcName);
|
||||
services.Add(new ProcessLockInfo
|
||||
{
|
||||
ProcessId = pid,
|
||||
ProcessName = svcName,
|
||||
ExecutablePath = clean,
|
||||
ServiceName = svcName,
|
||||
IsService = true,
|
||||
Description = $"Windows Servisi ({svcName})"
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
private static int GetServicePid(string serviceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var sc = new ServiceController(serviceName);
|
||||
// ServiceProcessId is available via reflection or sc queryex
|
||||
string output = RunCommandSilent("sc.exe", $"queryex \"{serviceName}\"");
|
||||
foreach (var line in output.Split('\n'))
|
||||
{
|
||||
if (line.Contains("PID", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int colon = line.IndexOf(':');
|
||||
if (colon > 0 && int.TryParse(line.Substring(colon + 1).Trim(), out int pid))
|
||||
return pid;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void ResetAttributesAndTakeOwnership(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.SetAttributes(path, FileAttributes.Normal);
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
var di = new DirectoryInfo(path) { Attributes = FileAttributes.Normal };
|
||||
foreach (var info in di.GetFileSystemInfos("*", SearchOption.AllDirectories))
|
||||
{
|
||||
try { info.Attributes = FileAttributes.Normal; } catch { }
|
||||
}
|
||||
|
||||
// Sahiplik alma (Take Ownership)
|
||||
RunCommandSilent("takeown.exe", $"/f \"{path}\" /r /d y");
|
||||
RunCommandSilent("icacls.exe", $"\"{path}\" /grant administrators:F /t /c /q");
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void ScheduleAllForRebootDelete(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Win32.MoveFileEx(path, null, Win32.MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
Win32.MoveFileEx(file, null, Win32.MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
}
|
||||
foreach (var dir in Directory.GetDirectories(path, "*", SearchOption.AllDirectories).OrderByDescending(d => d.Length))
|
||||
{
|
||||
Win32.MoveFileEx(dir, null, Win32.MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
}
|
||||
Win32.MoveFileEx(path, null, Win32.MOVEFILE_DELAY_UNTIL_REBOOT);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static string RunCommandSilent(string fileName, string arguments)
|
||||
{
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo(fileName, arguments)
|
||||
{
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
using var proc = Process.Start(psi);
|
||||
if (proc == null) return string.Empty;
|
||||
string output = proc.StandardOutput.ReadToEnd();
|
||||
proc.WaitForExit(3000);
|
||||
return output;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
94
src/LDUninstaller.Core/Services/ReportService.cs
Normal file
94
src/LDUninstaller.Core/Services/ReportService.cs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.Core.Services
|
||||
{
|
||||
public static class ReportService
|
||||
{
|
||||
public static string ReportsDirectory => Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"LDUninstaller",
|
||||
"Reports");
|
||||
|
||||
public static string GenerateHtmlReport(
|
||||
IEnumerable<ApplicationUninstallerEntry> uninstalledApps,
|
||||
IEnumerable<IJunkResult> cleanedJunks,
|
||||
string backupFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(ReportsDirectory))
|
||||
Directory.CreateDirectory(ReportsDirectory);
|
||||
|
||||
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||
string filename = Path.Combine(ReportsDirectory, $"CleanupReport_{timestamp}.html");
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("<!DOCTYPE html>");
|
||||
sb.AppendLine("<html lang=\"tr\">");
|
||||
sb.AppendLine("<head>");
|
||||
sb.AppendLine("<meta charset=\"UTF-8\" />");
|
||||
sb.AppendLine("<title>LD Uninstaller - Kaldırma ve Temizlik Raporu</title>");
|
||||
sb.AppendLine("<style>");
|
||||
sb.AppendLine("body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: #0F172A; color: #E2E8F0; padding: 30px; margin: 0; }");
|
||||
sb.AppendLine(".container { max-width: 900px; margin: 0 auto; background: #1E293B; border-radius: 12px; padding: 25px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }");
|
||||
sb.AppendLine("h1 { color: #38BDF8; margin-top: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }");
|
||||
sb.AppendLine(".meta { color: #94A3B8; font-size: 13px; margin-bottom: 20px; border-bottom: 1px solid #334155; padding-bottom: 12px; }");
|
||||
sb.AppendLine(".badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: bold; background: #064E3B; color: #34D399; }");
|
||||
sb.AppendLine("table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 13px; }");
|
||||
sb.AppendLine("th { background-color: #0F172A; color: #94A3B8; text-align: left; padding: 10px; border-bottom: 2px solid #334155; }");
|
||||
sb.AppendLine("td { padding: 9px 10px; border-bottom: 1px solid #334155; word-break: break-all; }");
|
||||
sb.AppendLine("tr:hover { background-color: #273549; }");
|
||||
sb.AppendLine(".footer { margin-top: 25px; font-size: 12px; color: #64748B; text-align: center; }");
|
||||
sb.AppendLine("</style>");
|
||||
sb.AppendLine("</head>");
|
||||
sb.AppendLine("<body>");
|
||||
sb.AppendLine("<div class=\"container\">");
|
||||
sb.AppendLine("<h1>🛡️ LD Uninstaller - Kaldırma ve Temizlik Raporu</h1>");
|
||||
sb.AppendLine($"<div class=\"meta\">İşlem Tarihi: {DateTime.Now:yyyy-MM-dd HH:mm:ss} | Kayıt Defteri Yedek Dizini: <code>{backupFolder}</code></div>");
|
||||
|
||||
sb.AppendLine("<h3>📦 Kaldırılan Yazılımlar</h3>");
|
||||
sb.AppendLine("<table>");
|
||||
sb.AppendLine("<tr><th>Yazılım Adı</th><th>Yayıncı</th><th>Sürüm</th><th>Kaldırıcı Türü</th></tr>");
|
||||
foreach (var app in uninstalledApps)
|
||||
{
|
||||
sb.AppendLine($"<tr><td><strong>{app.DisplayName}</strong></td><td>{app.Publisher}</td><td>{app.DisplayVersion}</td><td>{app.UninstallerKind}</td></tr>");
|
||||
}
|
||||
sb.AppendLine("</table>");
|
||||
|
||||
var junkList = cleanedJunks.ToList();
|
||||
sb.AppendLine($"<h3 style=\"margin-top: 30px;\">🧹 Temizlenen Kalıntılar ve Artıklar ({junkList.Count} Öğe)</h3>");
|
||||
if (junkList.Count > 0)
|
||||
{
|
||||
sb.AppendLine("<table>");
|
||||
sb.AppendLine("<tr><th>Tür</th><th>Güven</th><th>Açıklama</th><th>Yol</th></tr>");
|
||||
foreach (var junk in junkList)
|
||||
{
|
||||
sb.AppendLine($"<tr><td>{junk.TypeDisplay}</td><td><span class=\"badge\">{junk.ConfidenceDisplay}</span></td><td>{junk.Reason}</td><td><code>{junk.Path}</code></td></tr>");
|
||||
}
|
||||
sb.AppendLine("</table>");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine("<p style=\"color: #10B981;\">Kalıntı veya artık bulunamadı, sistem temiz.</p>");
|
||||
}
|
||||
|
||||
sb.AppendLine("<div class=\"footer\">LD Uninstaller 2.8.0 • Güvenli ve Derinlemesine Sistem Temizliği</div>");
|
||||
sb.AppendLine("</div>");
|
||||
sb.AppendLine("</body>");
|
||||
sb.AppendLine("</html>");
|
||||
|
||||
File.WriteAllText(filename, sb.ToString(), Encoding.UTF8);
|
||||
return filename;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
75
src/LDUninstaller.Core/Services/ShellIntegrationManager.cs
Normal file
75
src/LDUninstaller.Core/Services/ShellIntegrationManager.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace LDUninstaller.Core.Services
|
||||
{
|
||||
public static class ShellIntegrationManager
|
||||
{
|
||||
public const string ContextMenuKey = "LDForceUninstall";
|
||||
public const string MenuText = "💥 LD ile Güçlü Kaldır";
|
||||
|
||||
private static readonly string[] Targets = { "Directory", "exefile", "lnkfile" };
|
||||
|
||||
public static bool IsRegistered()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey($@"Software\Classes\Directory\shell\{ContextMenuKey}");
|
||||
return key != null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Register(string appExePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(appExePath) || !File.Exists(appExePath))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
string subPath = $@"Software\Classes\{target}\shell\{ContextMenuKey}";
|
||||
using var menuKey = Registry.CurrentUser.CreateSubKey(subPath);
|
||||
if (menuKey == null) continue;
|
||||
|
||||
menuKey.SetValue("", MenuText, RegistryValueKind.String);
|
||||
menuKey.SetValue("Icon", $"\"{appExePath}\",0", RegistryValueKind.String);
|
||||
|
||||
using var cmdKey = menuKey.CreateSubKey("command");
|
||||
cmdKey?.SetValue("", $"\"{appExePath}\" --force-path \"%1\"", RegistryValueKind.String);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Unregister()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var target in Targets)
|
||||
{
|
||||
string subPath = $@"Software\Classes\{target}\shell";
|
||||
using var shellKey = Registry.CurrentUser.OpenSubKey(subPath, true);
|
||||
shellKey?.DeleteSubKeyTree(ContextMenuKey, false);
|
||||
|
||||
// Eski menü adı varsa onu da temizle
|
||||
shellKey?.DeleteSubKeyTree("LDUninstaller", false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
94
src/LDUninstaller.Core/Services/UpdateChecker.cs
Normal file
94
src/LDUninstaller.Core/Services/UpdateChecker.cs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LDUninstaller.Core.Services
|
||||
{
|
||||
public class UpdateInfo
|
||||
{
|
||||
public bool HasUpdate { get; set; }
|
||||
public string LatestVersion { get; set; } = string.Empty;
|
||||
public string DownloadUrl { get; set; } = string.Empty;
|
||||
public string HomepageUrl { get; set; } = "https://ttmadethat.shop/#ldapps";
|
||||
public string ReleaseNotes { get; set; } = string.Empty;
|
||||
public string Sha256 { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public static class UpdateChecker
|
||||
{
|
||||
private static readonly HttpClient _httpClient = new()
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(5)
|
||||
};
|
||||
|
||||
private static readonly string[] Endpoints = new[]
|
||||
{
|
||||
"https://ttmadethat.shop/ldapps/version.json",
|
||||
"https://ttmadethat.shop/version.json",
|
||||
"https://ttmadethat.shop/api/ldapps/version"
|
||||
};
|
||||
|
||||
public static async Task<UpdateInfo?> CheckForUpdatesAsync(Version currentVersion, CancellationToken cancellationToken = default)
|
||||
{
|
||||
foreach (var url in Endpoints)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, url);
|
||||
request.Headers.Add("User-Agent", "LDUninstaller-Client");
|
||||
|
||||
using var response = await _httpClient.SendAsync(request, cancellationToken);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
continue;
|
||||
|
||||
string json = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
using var doc = JsonDocument.Parse(json);
|
||||
var root = doc.RootElement;
|
||||
|
||||
string versionStr = GetStringProp(root, "version");
|
||||
string downloadUrl = GetStringProp(root, "downloadUrl");
|
||||
if (string.IsNullOrEmpty(downloadUrl)) downloadUrl = GetStringProp(root, "url");
|
||||
|
||||
string homepageUrl = GetStringProp(root, "homepageUrl");
|
||||
if (string.IsNullOrEmpty(homepageUrl)) homepageUrl = "https://ttmadethat.shop/#ldapps";
|
||||
|
||||
string notes = GetStringProp(root, "releaseNotes");
|
||||
if (string.IsNullOrEmpty(notes)) notes = GetStringProp(root, "notes");
|
||||
|
||||
string sha256 = GetStringProp(root, "sha256");
|
||||
|
||||
if (Version.TryParse(versionStr, out var remoteVer))
|
||||
{
|
||||
bool hasUpdate = remoteVer > currentVersion;
|
||||
return new UpdateInfo
|
||||
{
|
||||
HasUpdate = hasUpdate,
|
||||
LatestVersion = versionStr,
|
||||
DownloadUrl = string.IsNullOrEmpty(downloadUrl) ? homepageUrl : downloadUrl,
|
||||
HomepageUrl = homepageUrl,
|
||||
ReleaseNotes = notes,
|
||||
Sha256 = sha256
|
||||
};
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Try next endpoint or return null if all fail
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string GetStringProp(JsonElement element, string propName)
|
||||
{
|
||||
if (element.TryGetProperty(propName, out var prop))
|
||||
{
|
||||
return prop.GetString() ?? string.Empty;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
129
src/LDUninstaller.Core/Services/WingetService.cs
Normal file
129
src/LDUninstaller.Core/Services/WingetService.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.Core.Services
|
||||
{
|
||||
public class WingetUpgradeItem
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Version { get; set; } = string.Empty;
|
||||
public string AvailableVersion { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public static class WingetService
|
||||
{
|
||||
public static bool IsWingetAvailable()
|
||||
{
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo("winget", "--version")
|
||||
{
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
using var proc = Process.Start(psi);
|
||||
if (proc == null) return false;
|
||||
proc.WaitForExit(3000);
|
||||
return proc.ExitCode == 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<List<WingetUpgradeItem>> GetAvailableUpgradesAsync()
|
||||
{
|
||||
var results = new List<WingetUpgradeItem>();
|
||||
if (!IsWingetAvailable()) return results;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo("winget", "upgrade --include-unknown")
|
||||
{
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
StandardOutputEncoding = System.Text.Encoding.UTF8
|
||||
};
|
||||
|
||||
using var proc = Process.Start(psi);
|
||||
if (proc == null) return;
|
||||
|
||||
string output = proc.StandardOutput.ReadToEnd();
|
||||
proc.WaitForExit(15000);
|
||||
|
||||
// Parse table output: Name | Id | Version | Available | Source
|
||||
using var reader = new StringReader(output);
|
||||
string? line;
|
||||
bool inTable = false;
|
||||
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
if (line.StartsWith("---") || line.Contains("------"))
|
||||
{
|
||||
inTable = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!inTable || string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
// Match columns separated by 2+ spaces
|
||||
var parts = Regex.Split(line.Trim(), @"\s{2,}");
|
||||
if (parts.Length >= 4)
|
||||
{
|
||||
results.Add(new WingetUpgradeItem
|
||||
{
|
||||
Name = parts[0],
|
||||
Id = parts[1],
|
||||
Version = parts[2],
|
||||
AvailableVersion = parts[3]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public static string GenerateWingetExportScript(IEnumerable<ApplicationUninstallerEntry> apps)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
sb.AppendLine("@echo off");
|
||||
sb.AppendLine("chcp 65001 >nul");
|
||||
sb.AppendLine("echo === LD Uninstaller - Toplu Yazilim Kurulum Scripti ===");
|
||||
sb.AppendLine("echo Bu script bilgisayarinizda kayitli yazilimlari Winget ile otomatik kurar.");
|
||||
sb.AppendLine("echo.");
|
||||
|
||||
foreach (var app in apps)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(app.DisplayName) || app.SystemComponent || app.IsOrphaned)
|
||||
continue;
|
||||
|
||||
// Escape quotes
|
||||
string safeName = app.DisplayName.Replace("\"", "").Trim();
|
||||
sb.AppendLine($"echo [{safeName}] kuruluyor...");
|
||||
sb.AppendLine($"winget install --name \"{safeName}\" -e --accept-package-agreements --accept-source-agreements");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendLine("echo Tum kurulum komutlari tamamlandi!");
|
||||
sb.AppendLine("pause");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.ServiceProcess;
|
||||
using System.Xml.Linq;
|
||||
using LDUninstaller.Core.Models;
|
||||
using Microsoft.Win32;
|
||||
|
||||
|
|
@ -10,15 +11,25 @@ namespace LDUninstaller.Core.Startup
|
|||
{
|
||||
public class StartupManager
|
||||
{
|
||||
private static readonly HashSet<string> CriticalSystemServices = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"spooler", "searchindexer", "windefend", "securityhealthservice", "wuauserv",
|
||||
"rpcss", "dcomlaunch", "eventlog", "plugplay", "dhcp", "dnscache", "cryptsvc",
|
||||
"lanmanworkstation", "lanmanserver", "bfe", "mpssvc", "audioendpointbuilder", "audiosrv",
|
||||
"samss", "lsass", "termservice", "w32time", "bits", "vss", "profsvc", "gpsvc"
|
||||
};
|
||||
|
||||
public static List<StartupEntry> GetAllStartupEntries()
|
||||
{
|
||||
var list = new List<StartupEntry>();
|
||||
|
||||
// 1. Registry HKCU Run
|
||||
// 1. Registry HKCU Run & RunOnce (F8)
|
||||
ScanRegistryRun(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list, isHklm: false, isWow64: false);
|
||||
ScanRegistryRun(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\RunOnce", StartupType.RegistryRunOnce, list, isHklm: false, isWow64: false);
|
||||
|
||||
// 2. Registry HKLM Run
|
||||
// 2. Registry HKLM Run & RunOnce (F8)
|
||||
ScanRegistryRun(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", StartupType.RegistryRun, list, isHklm: true, isWow64: false);
|
||||
ScanRegistryRun(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", StartupType.RegistryRunOnce, list, isHklm: true, isWow64: false);
|
||||
|
||||
// 3. Registry HKLM 32-bit (Wow6432Node)
|
||||
if (Environment.Is64BitOperatingSystem)
|
||||
|
|
@ -50,7 +61,10 @@ namespace LDUninstaller.Core.Startup
|
|||
ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Kullanıcı Başlangıç Klasörü", list, isCommon: false);
|
||||
ScanFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup), "Tüm Kullanıcılar Başlangıç Klasörü", list, isCommon: true);
|
||||
|
||||
// 5. Services (3rd party automatic)
|
||||
// 5. Task Scheduler Logon Tasks (F8)
|
||||
ScanLogonScheduledTasks(list);
|
||||
|
||||
// 6. 3rd-Party Services (Automatic/Disabled) (B20: filters critical OS services)
|
||||
ScanServices(list);
|
||||
|
||||
return list;
|
||||
|
|
@ -90,13 +104,17 @@ namespace LDUninstaller.Core.Startup
|
|||
if (ext != ".lnk" && ext != ".url" && ext != ".disabled") continue;
|
||||
|
||||
string fileName = Path.GetFileName(file);
|
||||
string displayName = Path.GetFileNameWithoutExtension(file);
|
||||
string cleanFileName = fileName.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase)
|
||||
? fileName.Substring(0, fileName.Length - ".disabled".Length)
|
||||
: fileName;
|
||||
|
||||
string displayName = Path.GetFileNameWithoutExtension(cleanFileName);
|
||||
bool isEnabled = !ext.Equals(".disabled", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// Check StartupApproved for startup folder
|
||||
// Check StartupApproved using clean original filename (B10)
|
||||
if (isEnabled)
|
||||
{
|
||||
isEnabled = CheckStartupFolderApproved(fileName, isCommon);
|
||||
isEnabled = CheckStartupFolderApproved(cleanFileName, isCommon);
|
||||
}
|
||||
|
||||
list.Add(new StartupEntry
|
||||
|
|
@ -112,6 +130,54 @@ namespace LDUninstaller.Core.Startup
|
|||
catch { }
|
||||
}
|
||||
|
||||
private static void ScanLogonScheduledTasks(List<StartupEntry> list)
|
||||
{
|
||||
try
|
||||
{
|
||||
string tasksDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "Tasks");
|
||||
if (!Directory.Exists(tasksDir)) return;
|
||||
|
||||
foreach (var file in Directory.GetFiles(tasksDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
// Exclude standard Microsoft Windows internal tasks
|
||||
if (file.Contains(@"\Tasks\Microsoft\Windows", StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string xml = File.ReadAllText(file);
|
||||
if (xml.Contains("<LogonTrigger", StringComparison.OrdinalIgnoreCase) || xml.Contains("<BootTrigger", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string rel = file.Substring(tasksDir.Length).TrimStart('\\');
|
||||
string taskName = Path.GetFileName(file);
|
||||
|
||||
// Extract command if possible
|
||||
string execPath = "";
|
||||
var doc = XDocument.Parse(xml);
|
||||
var execNode = doc.Descendants().FirstOrDefault(d => d.Name.LocalName == "Command");
|
||||
if (execNode != null)
|
||||
{
|
||||
execPath = execNode.Value;
|
||||
}
|
||||
|
||||
bool isEnabled = !xml.Contains("<Enabled>false</Enabled>", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
list.Add(new StartupEntry
|
||||
{
|
||||
Name = taskName,
|
||||
Command = !string.IsNullOrEmpty(execPath) ? execPath : rel,
|
||||
Type = StartupType.TaskScheduler,
|
||||
Location = $@"Görev: \{rel}",
|
||||
IsEnabled = isEnabled
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void ScanServices(List<StartupEntry> list)
|
||||
{
|
||||
try
|
||||
|
|
@ -121,6 +187,10 @@ namespace LDUninstaller.Core.Startup
|
|||
{
|
||||
try
|
||||
{
|
||||
// B20: Filter critical system services
|
||||
if (CriticalSystemServices.Contains(sc.ServiceName))
|
||||
continue;
|
||||
|
||||
using var key = Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{sc.ServiceName}");
|
||||
if (key != null)
|
||||
{
|
||||
|
|
@ -128,8 +198,7 @@ namespace LDUninstaller.Core.Startup
|
|||
string imgPath = key.GetValue("ImagePath")?.ToString() ?? "";
|
||||
string imgLower = imgPath.ToLowerInvariant();
|
||||
|
||||
// 2 = Automatic, 3 = Manual, 4 = Disabled
|
||||
// Exclude internal OS services
|
||||
// Exclude internal OS binaries
|
||||
if (!imgLower.Contains(@"\windows\system32\svchost.exe") &&
|
||||
!imgLower.Contains(@"\windows\system32\services.exe") &&
|
||||
!imgLower.Contains(@"\windows\system32\lsass.exe"))
|
||||
|
|
@ -162,7 +231,6 @@ namespace LDUninstaller.Core.Startup
|
|||
string approvedSub = isWow64 ? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32"
|
||||
: @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run";
|
||||
|
||||
// First check HKCU
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(approvedSub))
|
||||
{
|
||||
if (key?.GetValue(entryName) is byte[] data && data.Length > 0)
|
||||
|
|
@ -171,7 +239,6 @@ namespace LDUninstaller.Core.Startup
|
|||
}
|
||||
}
|
||||
|
||||
// If HKLM, also check HKLM StartupApproved
|
||||
if (isHklm)
|
||||
{
|
||||
using var hklmKey = Registry.LocalMachine.OpenSubKey(approvedSub);
|
||||
|
|
@ -220,7 +287,7 @@ namespace LDUninstaller.Core.Startup
|
|||
? new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
: new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
if (entry.Type == StartupType.RegistryRun)
|
||||
if (entry.Type == StartupType.RegistryRun || entry.Type == StartupType.RegistryRunOnce)
|
||||
{
|
||||
bool isWow64 = entry.Location.Contains("Wow6432Node", StringComparison.OrdinalIgnoreCase);
|
||||
bool isHklm = entry.Location.Contains("HKEY_LOCAL_MACHINE", StringComparison.OrdinalIgnoreCase) || entry.Location.Contains("HKLM", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
@ -228,13 +295,11 @@ namespace LDUninstaller.Core.Startup
|
|||
string approvedSub = isWow64 ? @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32"
|
||||
: @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run";
|
||||
|
||||
// Always write to HKCU
|
||||
using (var key = Registry.CurrentUser.CreateSubKey(approvedSub))
|
||||
{
|
||||
key?.SetValue(entry.Name, binaryData, RegistryValueKind.Binary);
|
||||
}
|
||||
|
||||
// If it was in HKLM, also write to HKLM
|
||||
if (isHklm)
|
||||
{
|
||||
try
|
||||
|
|
@ -250,15 +315,18 @@ namespace LDUninstaller.Core.Startup
|
|||
}
|
||||
else if (entry.Type == StartupType.StartupFolder)
|
||||
{
|
||||
// B10: Manage clean filename and preserve StartupApproved registration
|
||||
string fileName = Path.GetFileName(entry.Command);
|
||||
bool isCommon = entry.Location.Contains("Tüm Kullanıcılar", StringComparison.OrdinalIgnoreCase) || entry.Location.Contains("All Users", StringComparison.OrdinalIgnoreCase);
|
||||
string cleanFileName = fileName.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase)
|
||||
? fileName.Substring(0, fileName.Length - ".disabled".Length)
|
||||
: fileName;
|
||||
|
||||
bool isCommon = entry.Location.Contains("Tüm Kullanıcılar", StringComparison.OrdinalIgnoreCase) || entry.Location.Contains("All Users", StringComparison.OrdinalIgnoreCase);
|
||||
const string approvedFolderSub = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder";
|
||||
|
||||
// Write to StartupApproved\StartupFolder in HKCU
|
||||
using (var key = Registry.CurrentUser.CreateSubKey(approvedFolderSub))
|
||||
{
|
||||
key?.SetValue(fileName, binaryData, RegistryValueKind.Binary);
|
||||
key?.SetValue(cleanFileName, binaryData, RegistryValueKind.Binary);
|
||||
}
|
||||
|
||||
if (isCommon)
|
||||
|
|
@ -266,38 +334,57 @@ namespace LDUninstaller.Core.Startup
|
|||
try
|
||||
{
|
||||
using var key = Registry.LocalMachine.CreateSubKey(approvedFolderSub);
|
||||
key?.SetValue(fileName, binaryData, RegistryValueKind.Binary);
|
||||
key?.SetValue(cleanFileName, binaryData, RegistryValueKind.Binary);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
// Fallback rename if StartupApproved is not respected
|
||||
try
|
||||
{
|
||||
if (!enable && File.Exists(entry.Command) && !entry.Command.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string newPath = entry.Command + ".disabled";
|
||||
File.Move(entry.Command, newPath);
|
||||
entry.Command = newPath;
|
||||
}
|
||||
else if (enable && File.Exists(entry.Command) && entry.Command.EndsWith(".disabled", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string newPath = entry.Command.Substring(0, entry.Command.Length - ".disabled".Length);
|
||||
File.Move(entry.Command, newPath);
|
||||
entry.Command = newPath;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
// Physical file rename
|
||||
string dir = Path.GetDirectoryName(entry.Command) ?? "";
|
||||
string normalPath = Path.Combine(dir, cleanFileName);
|
||||
string disabledPath = normalPath + ".disabled";
|
||||
|
||||
if (!enable && File.Exists(normalPath))
|
||||
{
|
||||
File.Move(normalPath, disabledPath, true);
|
||||
entry.Command = disabledPath;
|
||||
}
|
||||
else if (enable && File.Exists(disabledPath))
|
||||
{
|
||||
File.Move(disabledPath, normalPath, true);
|
||||
entry.Command = normalPath;
|
||||
}
|
||||
|
||||
entry.IsEnabled = enable;
|
||||
return true;
|
||||
}
|
||||
else if (entry.Type == StartupType.TaskScheduler)
|
||||
{
|
||||
// Toggle scheduled task via schtasks /change
|
||||
string taskName = entry.Location.Replace("Görev: ", "").Trim();
|
||||
string state = enable ? "/ENABLE" : "/DISABLE";
|
||||
var psi = new ProcessStartInfo("schtasks.exe", $"/Change /TN \"{taskName}\" {state}")
|
||||
{
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false
|
||||
};
|
||||
using var p = Process.Start(psi);
|
||||
p?.WaitForExit(3000);
|
||||
entry.IsEnabled = enable;
|
||||
return true;
|
||||
}
|
||||
else if (entry.Type == StartupType.Service)
|
||||
{
|
||||
string svcName = !string.IsNullOrEmpty(entry.ServiceName) ? entry.ServiceName : entry.Name;
|
||||
|
||||
// B20: Never allow stopping critical Windows services
|
||||
if (CriticalSystemServices.Contains(svcName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int targetStartType = enable ? 2 : 4; // 2 = Auto, 4 = Disabled
|
||||
|
||||
// 1. Update Registry Start type directly
|
||||
try
|
||||
{
|
||||
using var key = Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{svcName}", true);
|
||||
|
|
@ -308,7 +395,6 @@ namespace LDUninstaller.Core.Startup
|
|||
}
|
||||
catch { }
|
||||
|
||||
// 2. Run sc.exe config start= auto / disabled
|
||||
try
|
||||
{
|
||||
string mode = enable ? "auto" : "disabled";
|
||||
|
|
@ -322,7 +408,6 @@ namespace LDUninstaller.Core.Startup
|
|||
}
|
||||
catch { }
|
||||
|
||||
// 3. Stop or Start the service
|
||||
try
|
||||
{
|
||||
using var sc = new ServiceController(svcName);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,22 @@ namespace LDUninstaller.Core.Tweaks
|
|||
},
|
||||
RevertAction = () =>
|
||||
{
|
||||
using var key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\DataCollection");
|
||||
key?.SetValue("AllowTelemetry", 1, RegistryValueKind.DWord);
|
||||
EnableAndStartService("DiagTrack", 2);
|
||||
EnableAndStartService("dmwappushservice", 3);
|
||||
|
||||
try
|
||||
{
|
||||
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\Windows\DataCollection", true);
|
||||
key?.DeleteValue("AllowTelemetry", false);
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
using var userKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack", true);
|
||||
userKey?.DeleteValue("ShowedToastAtLevel", false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
},
|
||||
new DebloatTweak
|
||||
|
|
@ -57,10 +71,23 @@ namespace LDUninstaller.Core.Tweaks
|
|||
},
|
||||
RevertAction = () =>
|
||||
{
|
||||
using var searchKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Search");
|
||||
searchKey?.SetValue("DisableWebSearch", 0, RegistryValueKind.DWord);
|
||||
searchKey?.SetValue("ConnectedSearchUseWeb", 1, RegistryValueKind.DWord);
|
||||
searchKey?.SetValue("BingSearchEnabled", 1, RegistryValueKind.DWord);
|
||||
try
|
||||
{
|
||||
using var searchKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Search");
|
||||
searchKey?.SetValue("DisableWebSearch", 0, RegistryValueKind.DWord);
|
||||
searchKey?.SetValue("ConnectedSearchUseWeb", 1, RegistryValueKind.DWord);
|
||||
searchKey?.SetValue("BingSearchEnabled", 1, RegistryValueKind.DWord);
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
using var policyKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\Windows\Windows Search", true);
|
||||
policyKey?.DeleteValue("AllowCortana", false);
|
||||
policyKey?.DeleteValue("DisableWebSearch", false);
|
||||
policyKey?.DeleteValue("ConnectedSearchUseWeb", false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
},
|
||||
new DebloatTweak
|
||||
|
|
@ -165,5 +192,24 @@ namespace LDUninstaller.Core.Tweaks
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void EnableAndStartService(string serviceName, int startMode = 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var key = Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{serviceName}", true))
|
||||
{
|
||||
key?.SetValue("Start", startMode, RegistryValueKind.DWord); // 2 = Auto, 3 = Demand
|
||||
}
|
||||
|
||||
using var sc = new ServiceController(serviceName);
|
||||
if (sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending)
|
||||
{
|
||||
sc.Start();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace LDUninstaller.Launcher
|
|||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = exePath,
|
||||
Arguments = string.Join(" ", args),
|
||||
Arguments = BuildArgumentString(args),
|
||||
UseShellExecute = true,
|
||||
Verb = "runas"
|
||||
};
|
||||
|
|
@ -68,7 +68,7 @@ namespace LDUninstaller.Launcher
|
|||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = uiPath,
|
||||
Arguments = string.Join(" ", args),
|
||||
Arguments = BuildArgumentString(args),
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = Path.GetDirectoryName(uiPath)
|
||||
};
|
||||
|
|
@ -90,5 +90,16 @@ namespace LDUninstaller.Launcher
|
|||
var principal = new WindowsPrincipal(identity);
|
||||
return principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
private static string BuildArgumentString(string[] args)
|
||||
{
|
||||
if (args == null || args.Length == 0) return string.Empty;
|
||||
return string.Join(" ", args.Select(a =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(a)) return "\"\"";
|
||||
if (a.Contains(" ") && !a.StartsWith("\"")) return $"\"{a}\"";
|
||||
return a;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,22 +4,40 @@
|
|||
StartupUri="MainWindow.xaml"
|
||||
ShutdownMode="OnMainWindowClose">
|
||||
<Application.Resources>
|
||||
<!-- Colors -->
|
||||
<Color x:Key="BgDark">#0B0F19</Color>
|
||||
<Color x:Key="BgSidebar">#111827</Color>
|
||||
<Color x:Key="BgCard">#1F2937</Color>
|
||||
<Color x:Key="BgCardHover">#283548</Color>
|
||||
<Color x:Key="BorderColor">#374151</Color>
|
||||
<Color x:Key="BorderLight">#4B5563</Color>
|
||||
<Color x:Key="TextPrimary">#F9FAFB</Color>
|
||||
<Color x:Key="TextSecondary">#9CA3AF</Color>
|
||||
<Color x:Key="TextMuted">#6B7280</Color>
|
||||
|
||||
<Color x:Key="AccentBlue">#3B82F6</Color>
|
||||
<Color x:Key="AccentBlueHover">#2563EB</Color>
|
||||
<!-- ================= LOGO-INSPIRED TITANIUM & SAPPHIRE PALETTE ================= -->
|
||||
<!-- Deep Titanium & Slate Backgrounds -->
|
||||
<Color x:Key="BgDark">#0F1115</Color>
|
||||
<Color x:Key="BgSidebar">#15181E</Color>
|
||||
<Color x:Key="BgCard">#1A1E26</Color>
|
||||
<Color x:Key="BgCardHover">#232833</Color>
|
||||
<Color x:Key="BgCardActive">#2A303D</Color>
|
||||
<Color x:Key="BorderColor">#2A303D</Color>
|
||||
<Color x:Key="BorderLight">#3D4658</Color>
|
||||
<Color x:Key="BorderGlow">#4F6386</Color>
|
||||
|
||||
<!-- Platinum, Silver & Titanium Typography -->
|
||||
<Color x:Key="TextPrimary">#F8FAFC</Color>
|
||||
<Color x:Key="TextSecondary">#CBD5E1</Color>
|
||||
<Color x:Key="TextMuted">#7E8B9F</Color>
|
||||
<Color x:Key="TextDim">#525D6F</Color>
|
||||
|
||||
<!-- Translucent Sapphire Glass Accents (from Logo Middle Layer) -->
|
||||
<Color x:Key="AccentBlue">#2563EB</Color>
|
||||
<Color x:Key="AccentBlueHover">#3B82F6</Color>
|
||||
<Color x:Key="AccentBlueDeep">#1D4ED8</Color>
|
||||
<Color x:Key="AccentBlueLight">#60A5FA</Color>
|
||||
<Color x:Key="AccentBlueGlow">#93C5FD</Color>
|
||||
<Color x:Key="AccentGlassTint">#14233C</Color>
|
||||
<Color x:Key="AccentGlassBorder">#3B82F6</Color>
|
||||
|
||||
<!-- Precision & Status Accents -->
|
||||
<Color x:Key="AccentGreen">#10B981</Color>
|
||||
<Color x:Key="AccentRed">#EF4444</Color>
|
||||
<Color x:Key="AccentGreenHover">#059669</Color>
|
||||
<Color x:Key="AccentGreenGlass">#064E3B</Color>
|
||||
<Color x:Key="AccentRed">#F43F5E</Color>
|
||||
<Color x:Key="AccentRedHover">#E11D48</Color>
|
||||
<Color x:Key="AccentPurple">#8B5CF6</Color>
|
||||
<Color x:Key="AccentCyan">#0EA5E9</Color>
|
||||
<Color x:Key="AccentAmber">#F59E0B</Color>
|
||||
|
||||
<!-- SolidColorBrushes -->
|
||||
|
|
@ -32,35 +50,64 @@
|
|||
<SolidColorBrush x:Key="BrushTextPrimary" Color="{StaticResource TextPrimary}" />
|
||||
<SolidColorBrush x:Key="BrushTextSecondary" Color="{StaticResource TextSecondary}" />
|
||||
<SolidColorBrush x:Key="BrushTextMuted" Color="{StaticResource TextMuted}" />
|
||||
|
||||
<SolidColorBrush x:Key="BrushTextDim" Color="{StaticResource TextDim}" />
|
||||
|
||||
<SolidColorBrush x:Key="BrushAccentBlue" Color="{StaticResource AccentBlue}" />
|
||||
<SolidColorBrush x:Key="BrushAccentBlueHover" Color="{StaticResource AccentBlueHover}" />
|
||||
<SolidColorBrush x:Key="BrushAccentBlueLight" Color="{StaticResource AccentBlueLight}" />
|
||||
<SolidColorBrush x:Key="BrushAccentGreen" Color="{StaticResource AccentGreen}" />
|
||||
<SolidColorBrush x:Key="BrushAccentRed" Color="{StaticResource AccentRed}" />
|
||||
<SolidColorBrush x:Key="BrushAccentPurple" Color="{StaticResource AccentPurple}" />
|
||||
<SolidColorBrush x:Key="BrushAccentCyan" Color="{StaticResource AccentCyan}" />
|
||||
<SolidColorBrush x:Key="BrushAccentAmber" Color="{StaticResource AccentAmber}" />
|
||||
|
||||
<!-- Modern Button Style -->
|
||||
<!-- LinearGradients (Sapphire Glass & Titanium Metal) -->
|
||||
<LinearGradientBrush x:Key="BrushGlassSapphire" StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#3B82F6" Offset="0.0" />
|
||||
<GradientStop Color="#2563EB" Offset="0.4" />
|
||||
<GradientStop Color="#1D4ED8" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="BrushGlassSapphireHover" StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Color="#60A5FA" Offset="0.0" />
|
||||
<GradientStop Color="#3B82F6" Offset="0.4" />
|
||||
<GradientStop Color="#2563EB" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="BrushMetallicSurface" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#242934" Offset="0.0" />
|
||||
<GradientStop Color="#1A1E26" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="BrushMetallicHover" StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#2E3442" Offset="0.0" />
|
||||
<GradientStop Color="#222731" Offset="1.0" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- ================= MODERN BUTTON STYLES ================= -->
|
||||
<!-- Sapphire Glass Primary Button -->
|
||||
<Style x:Key="ModernBtnPrimary" TargetType="Button">
|
||||
<Setter Property="Background" Value="{StaticResource BrushAccentBlue}" />
|
||||
<Setter Property="Background" Value="{StaticResource BrushGlassSapphire}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Padding" Value="14,8" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="16,8" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="#4B6EAF" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="7" Padding="{TemplateBinding Padding}">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="{StaticResource BrushAccentBlueHover}" />
|
||||
<Setter TargetName="border" Property="Background" Value="{StaticResource BrushGlassSapphireHover}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="#60A5FA" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Opacity" Value="0.85" />
|
||||
<Setter TargetName="border" Property="Opacity" Value="0.88" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="border" Property="Opacity" Value="0.4" />
|
||||
|
|
@ -71,24 +118,26 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Titanium Metal Secondary Button -->
|
||||
<Style x:Key="ModernBtnSecondary" TargetType="Button">
|
||||
<Setter Property="Background" Value="#2A3446" />
|
||||
<Setter Property="Background" Value="{StaticResource BrushMetallicSurface}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextPrimary}" />
|
||||
<Setter Property="FontWeight" Value="Medium" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Padding" Value="12,7" />
|
||||
<Setter Property="Padding" Value="14,7" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="7" Padding="{TemplateBinding Padding}">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="#374151" />
|
||||
<Setter TargetName="border" Property="Background" Value="{StaticResource BrushMetallicHover}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource BrushBorderLight}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="Opacity" Value="0.8" />
|
||||
|
|
@ -99,7 +148,7 @@
|
|||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Sidebar Nav Button Style -->
|
||||
<!-- Sidebar Navigation Button Style (Sapphire Glass Indicator) -->
|
||||
<Style x:Key="SidebarNavBtn" TargetType="RadioButton">
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontSize" Value="13.5" />
|
||||
|
|
@ -110,16 +159,18 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Border x:Name="navBorder" Background="Transparent" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
||||
<Border x:Name="navBorder" Background="Transparent" BorderThickness="1" BorderBrush="Transparent" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="navBorder" Property="Background" Value="#1E293B" />
|
||||
<Setter TargetName="navBorder" Property="Background" Value="#1C212B" />
|
||||
<Setter TargetName="navBorder" Property="BorderBrush" Value="#29303D" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextPrimary}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="navBorder" Property="Background" Value="#2563EB" />
|
||||
<Setter TargetName="navBorder" Property="Background" Value="{StaticResource BrushGlassSapphire}" />
|
||||
<Setter TargetName="navBorder" Property="BorderBrush" Value="#4B6EAF" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
</Trigger>
|
||||
|
|
@ -131,9 +182,9 @@
|
|||
|
||||
<!-- Modern TextBox Style -->
|
||||
<Style x:Key="ModernTextBox" TargetType="TextBox">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#171A21" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextPrimary}" />
|
||||
<Setter Property="CaretBrush" Value="{StaticResource BrushAccentBlue}" />
|
||||
<Setter Property="CaretBrush" Value="{StaticResource BrushAccentBlueLight}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="10,7" />
|
||||
|
|
@ -141,12 +192,13 @@
|
|||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="7">
|
||||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource BrushAccentBlue}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource BrushAccentBlueHover}" />
|
||||
<Setter TargetName="border" Property="Background" Value="#1C2028" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
|
@ -156,7 +208,7 @@
|
|||
|
||||
<!-- Modern ComboBox Style -->
|
||||
<Style x:Key="ModernComboBox" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#171A21" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextPrimary}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace LDUninstaller.UI
|
||||
|
|
@ -10,8 +12,68 @@ namespace LDUninstaller.UI
|
|||
[DllImport("shell32.dll", SetLastError = true)]
|
||||
private static extern int SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
private const int SW_RESTORE = 9;
|
||||
private static Mutex? _instanceMutex;
|
||||
private static readonly object _logLock = new();
|
||||
|
||||
public static string LogFilePath { get; } = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"LDUninstaller",
|
||||
"logs",
|
||||
"trace.log");
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
// Shell Context Menu: Direct Force Shredder & Unlocker Mode
|
||||
string? forcePath = GetForcePathParam(e.Args);
|
||||
if (!string.IsNullOrEmpty(forcePath))
|
||||
{
|
||||
InitLogging();
|
||||
Log($"Direct force-path invoked: {forcePath}");
|
||||
var forceWin = new Dialogs.ForceDeleteWindow(forcePath);
|
||||
forceWin.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
// B24: Global single-instance Mutex (Main Application)
|
||||
bool isFirstInstance;
|
||||
try
|
||||
{
|
||||
_instanceMutex = new Mutex(true, @"Global\LDUninstaller_SingleInstance_Mutex", out isFirstInstance);
|
||||
}
|
||||
catch
|
||||
{
|
||||
isFirstInstance = true;
|
||||
}
|
||||
|
||||
if (!isFirstInstance)
|
||||
{
|
||||
// Activate running instance
|
||||
try
|
||||
{
|
||||
var current = Process.GetCurrentProcess();
|
||||
foreach (var proc in Process.GetProcessesByName(current.ProcessName))
|
||||
{
|
||||
if (proc.Id != current.Id && proc.MainWindowHandle != IntPtr.Zero)
|
||||
{
|
||||
ShowWindow(proc.MainWindowHandle, SW_RESTORE);
|
||||
SetForegroundWindow(proc.MainWindowHandle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Unify taskbar grouping with shortcuts and ensure correct icon binding
|
||||
|
|
@ -21,27 +83,111 @@ namespace LDUninstaller.UI
|
|||
|
||||
base.OnStartup(e);
|
||||
|
||||
string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "trace.log");
|
||||
// B30: %LocalAppData%\LDUninstaller\logs\trace.log with rolling size limit
|
||||
InitLogging();
|
||||
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, args) =>
|
||||
{
|
||||
try { File.AppendAllText(logPath, $"PROCESS EXIT TRIGGERED! Environment.StackTrace:\n{Environment.StackTrace}\n"); } catch { }
|
||||
Log("Process exit triggered.");
|
||||
};
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (s, args) =>
|
||||
{
|
||||
try { File.AppendAllText(logPath, $"UNHANDLED: {args.ExceptionObject}\n"); } catch { }
|
||||
Log($"UNHANDLED: {args.ExceptionObject}");
|
||||
};
|
||||
|
||||
DispatcherUnhandledException += (s, args) =>
|
||||
{
|
||||
try { File.WriteAllText(logPath, args.Exception.ToString()); } catch { }
|
||||
Log($"DISPATCHER UNHANDLED: {args.Exception}");
|
||||
MessageBox.Show(
|
||||
$"Arayüz Hatası:\n{args.Exception.Message}\n\n{args.Exception}",
|
||||
$"Arayüz Hatası:\n{args.Exception.Message}\n\nDetaylar log dosyasına kaydedildi:\n{LogFilePath}",
|
||||
"Hata - LD Uninstaller",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
args.Handled = true;
|
||||
};
|
||||
}
|
||||
|
||||
private static void InitLogging()
|
||||
{
|
||||
try
|
||||
{
|
||||
string? dir = Path.GetDirectoryName(LogFilePath);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
// Roll if > 5 MB
|
||||
if (File.Exists(LogFilePath))
|
||||
{
|
||||
var fi = new FileInfo(LogFilePath);
|
||||
if (fi.Length > 5 * 1024 * 1024)
|
||||
{
|
||||
string oldLog = Path.Combine(dir!, "trace.old.log");
|
||||
if (File.Exists(oldLog)) File.Delete(oldLog);
|
||||
File.Move(LogFilePath, oldLog);
|
||||
}
|
||||
}
|
||||
|
||||
Log($"=== LD Uninstaller Başlatıldı - {DateTime.Now:yyyy-MM-dd HH:mm:ss} ===");
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void Log(string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (_logLock)
|
||||
{
|
||||
string? dir = Path.GetDirectoryName(LogFilePath);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
string line = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] {message}{Environment.NewLine}";
|
||||
File.AppendAllText(LogFilePath, line);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static string? GetForcePathParam(string[] args)
|
||||
{
|
||||
if (args == null || args.Length == 0) return null;
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
string arg = args[i];
|
||||
if (arg.Equals("--force-path", StringComparison.OrdinalIgnoreCase) ||
|
||||
arg.Equals("/force-path", StringComparison.OrdinalIgnoreCase) ||
|
||||
arg.Equals("-force-path", StringComparison.OrdinalIgnoreCase) ||
|
||||
arg.Equals("/target", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (i + 1 < args.Length)
|
||||
return args[i + 1].Trim('\"');
|
||||
}
|
||||
else if (arg.StartsWith("--force-path=", StringComparison.OrdinalIgnoreCase) ||
|
||||
arg.StartsWith("/force-path=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int eq = arg.IndexOf('=');
|
||||
return arg[(eq + 1)..].Trim('\"');
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_instanceMutex?.ReleaseMutex();
|
||||
_instanceMutex?.Dispose();
|
||||
}
|
||||
catch { }
|
||||
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,31 +42,31 @@ namespace LDUninstaller.UI.Controls
|
|||
{
|
||||
Palette = new Brush[]
|
||||
{
|
||||
new SolidColorBrush(Color.FromRgb(37, 99, 235)), // Modern Blue
|
||||
new SolidColorBrush(Color.FromRgb(16, 185, 129)), // Emerald
|
||||
new SolidColorBrush(Color.FromRgb(139, 92, 246)), // Violet
|
||||
new SolidColorBrush(Color.FromRgb(245, 158, 11)), // Amber
|
||||
new SolidColorBrush(Color.FromRgb(14, 165, 233)), // Sky
|
||||
new SolidColorBrush(Color.FromRgb(239, 68, 68)), // Rose
|
||||
new SolidColorBrush(Color.FromRgb(99, 102, 241)), // Indigo
|
||||
new SolidColorBrush(Color.FromRgb(20, 184, 166)) // Teal
|
||||
new SolidColorBrush(Color.FromRgb(37, 99, 235)), // Sapphire Glass Blue
|
||||
new SolidColorBrush(Color.FromRgb(71, 85, 105)), // Titanium Steel
|
||||
new SolidColorBrush(Color.FromRgb(14, 165, 233)), // Cyan Ice Grid
|
||||
new SolidColorBrush(Color.FromRgb(16, 185, 129)), // Emerald Mint
|
||||
new SolidColorBrush(Color.FromRgb(29, 78, 216)), // Deep Sapphire Glass
|
||||
new SolidColorBrush(Color.FromRgb(124, 58, 237)), // Violet Amethyst
|
||||
new SolidColorBrush(Color.FromRgb(79, 70, 229)), // Luminous Indigo
|
||||
new SolidColorBrush(Color.FromRgb(217, 119, 6)) // Warm Topaz
|
||||
};
|
||||
|
||||
foreach (var b in Palette) b.Freeze();
|
||||
|
||||
BorderPen = new Pen(new SolidColorBrush(Color.FromArgb(120, 15, 23, 42)), 1.5);
|
||||
BorderPen = new Pen(new SolidColorBrush(Color.FromArgb(180, 15, 17, 21)), 1.5);
|
||||
BorderPen.Freeze();
|
||||
|
||||
HoverPen = new Pen(Brushes.White, 2.0);
|
||||
HoverPen = new Pen(new SolidColorBrush(Color.FromRgb(147, 197, 253)), 2.0); // Sapphire glow border
|
||||
HoverPen.Freeze();
|
||||
|
||||
BackdropBrush = new SolidColorBrush(Color.FromRgb(15, 23, 42));
|
||||
BackdropBrush = new SolidColorBrush(Color.FromRgb(15, 17, 21));
|
||||
BackdropBrush.Freeze();
|
||||
|
||||
EmptyTextBrush = new SolidColorBrush(Color.FromRgb(148, 163, 184));
|
||||
EmptyTextBrush = new SolidColorBrush(Color.FromRgb(126, 139, 159));
|
||||
EmptyTextBrush.Freeze();
|
||||
|
||||
SubTextBrush = new SolidColorBrush(Color.FromArgb(200, 240, 240, 240));
|
||||
SubTextBrush = new SolidColorBrush(Color.FromArgb(220, 241, 245, 249));
|
||||
SubTextBrush.Freeze();
|
||||
|
||||
TitleTypeface = new Typeface(new FontFamily("Segoe UI"), FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal);
|
||||
|
|
|
|||
149
src/LDUninstaller.UI/Dialogs/BackupRestoreWindow.xaml
Normal file
149
src/LDUninstaller.UI/Dialogs/BackupRestoreWindow.xaml
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<Window x:Class="LDUninstaller.UI.Dialogs.BackupRestoreWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Yedekleme ve Koruma Merkezi - LD Uninstaller"
|
||||
Height="560" Width="850"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ShowInTaskbar="False"
|
||||
Background="{StaticResource BrushBgDark}"
|
||||
Foreground="{StaticResource BrushTextPrimary}"
|
||||
FontFamily="Segoe UI"
|
||||
Icon="pack://application:,,,/LDUninstaller.UI;component/Resources/app.ico"
|
||||
BorderBrush="{StaticResource BrushBorder}"
|
||||
BorderThickness="1">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="50" ResizeBorderThickness="6" CornerRadius="8" GlassFrameThickness="0" UseAeroCaptionButtons="False" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Custom Title Bar -->
|
||||
<Border Grid.Row="0" Background="{StaticResource BrushBgSidebar}" MouseDown="TitleBar_MouseDown" Padding="20,0">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Background="{StaticResource BrushGlassSapphire}" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<TextBlock Text="🛡️" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<TextBlock Text="Yedekleme, Geri Yükleme ve Koruma Merkezi" FontSize="14.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Tab Control -->
|
||||
<TabControl Grid.Row="1" Background="Transparent" BorderThickness="0" Margin="20,10,20,10">
|
||||
<TabControl.Resources>
|
||||
<Style TargetType="TabItem">
|
||||
<Setter Property="Background" Value="#171A22" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="16,8" />
|
||||
<Setter Property="Margin" Value="0,0,4,0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<Border x:Name="bd" Background="{TemplateBinding Background}" CornerRadius="6,6,0,0" Padding="{TemplateBinding Padding}" Margin="{TemplateBinding Margin}">
|
||||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="bd" Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextPrimary}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</TabControl.Resources>
|
||||
|
||||
<!-- TAB 1: BACKUPS -->
|
||||
<TabItem Header="💾 Kayıt Defteri Yedekleri (.reg)">
|
||||
<Grid Margin="0,15,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DataGrid x:Name="dgBackups" Grid.Row="0" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12.5"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Padding" Value="10,8" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Yedek Dosyası" Binding="{Binding Name}" Width="320" />
|
||||
<DataGridTextColumn Header="Oluşturulma Tarihi" Binding="{Binding LastWriteTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" Width="160" />
|
||||
<DataGridTextColumn Header="Boyut" Binding="{Binding SizeDisplay}" Width="110" />
|
||||
<DataGridTextColumn Header="Tam Yol" Binding="{Binding FullPath}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,12,0,0">
|
||||
<Button x:Name="btnRestore" Content="🔄 Seçili Yedeği Geri Yükle" Style="{StaticResource ModernBtnPrimary}" Margin="0,0,10,0" Click="BtnRestore_Click" />
|
||||
<Button x:Name="btnOpenFolder" Content="📂 Yedek Klasörünü Aç" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnOpenFolder_Click" />
|
||||
<Button x:Name="btnDeleteBackup" Content="🗑️ Yedeği Sil" Style="{StaticResource ModernBtnSecondary}" Click="BtnDeleteBackup_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- TAB 2: EXCLUSION LIST -->
|
||||
<TabItem Header="⛔ Koruma Listesi (Exclusions)">
|
||||
<Grid Margin="0,15,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DataGrid x:Name="dgExclusions" Grid.Row="0" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12.5"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Padding" Value="10,8" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Korunan Yol veya Desen" Binding="{Binding Path}" Width="350" />
|
||||
<DataGridTextColumn Header="Açıklama" Binding="{Binding Reason}" Width="250" />
|
||||
<DataGridTextColumn Header="Eklenme Tarihi" Binding="{Binding AddedAt, StringFormat='yyyy-MM-dd HH:mm'}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,12,0,0">
|
||||
<Button x:Name="btnRemoveExclusion" Content="❌ Korumayı Kaldır" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnRemoveExclusion_Click" />
|
||||
<Button x:Name="btnAddExclusion" Content="➕ Manuel Koruma Kuralı Ekle" Style="{StaticResource ModernBtnPrimary}" Click="BtnAddExclusion_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<!-- Footer -->
|
||||
<Border Grid.Row="2" Background="{StaticResource BrushBgSidebar}" Padding="20,12" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Button Content="Kapat" Style="{StaticResource ModernBtnSecondary}" HorizontalAlignment="Right" Click="BtnClose_Click" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
185
src/LDUninstaller.UI/Dialogs/BackupRestoreWindow.xaml.cs
Normal file
185
src/LDUninstaller.UI/Dialogs/BackupRestoreWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.UI.Dialogs
|
||||
{
|
||||
public class BackupFileItem
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string FullPath { get; set; } = string.Empty;
|
||||
public DateTime LastWriteTime { get; set; }
|
||||
public long Size { get; set; }
|
||||
public string SizeDisplay => FileSize.FromBytes(Size).ToString();
|
||||
}
|
||||
|
||||
public partial class BackupRestoreWindow : Window
|
||||
{
|
||||
public BackupRestoreWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += BackupRestoreWindow_Loaded;
|
||||
}
|
||||
|
||||
private void BackupRestoreWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadBackups();
|
||||
LoadExclusions();
|
||||
}
|
||||
|
||||
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void LoadBackups()
|
||||
{
|
||||
string backupDir = JunkManager.BackupDirectory;
|
||||
if (!Directory.Exists(backupDir))
|
||||
{
|
||||
dgBackups.ItemsSource = new List<BackupFileItem>();
|
||||
return;
|
||||
}
|
||||
|
||||
var di = new DirectoryInfo(backupDir);
|
||||
var items = di.GetFiles("*.reg")
|
||||
.Concat(di.GetFiles("*.txt"))
|
||||
.OrderByDescending(f => f.LastWriteTime)
|
||||
.Select(f => new BackupFileItem
|
||||
{
|
||||
Name = f.Name,
|
||||
FullPath = f.FullName,
|
||||
LastWriteTime = f.LastWriteTime,
|
||||
Size = f.Length
|
||||
})
|
||||
.ToList();
|
||||
|
||||
dgBackups.ItemsSource = items;
|
||||
}
|
||||
|
||||
private void LoadExclusions()
|
||||
{
|
||||
var items = ExclusionManager.GetAllExclusions();
|
||||
dgExclusions.ItemsSource = items;
|
||||
}
|
||||
|
||||
private void BtnRestore_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgBackups.SelectedItem is not BackupFileItem item)
|
||||
{
|
||||
MessageBox.Show("Lütfen geri yüklemek istediğiniz bir .reg yedek dosyası seçin.", "Yedek Seçilmedi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.Name.EndsWith(".reg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
MessageBox.Show("Yalnızca .reg biçimindeki kayıt defteri yedekleri doğrudan geri yüklenebilir.", "Uyarı", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var confirm = MessageBox.Show(
|
||||
$"'{item.Name}' yedeğini Windows Kayıt Defteri'ne geri aktarmak istiyor musunuz?\n\nDosya: {item.FullPath}",
|
||||
"Geri Yükleme Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (confirm != MessageBoxResult.Yes) return;
|
||||
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo("reg.exe", $"import \"{item.FullPath}\"")
|
||||
{
|
||||
UseShellExecute = true,
|
||||
Verb = "runas"
|
||||
};
|
||||
|
||||
using var proc = Process.Start(psi);
|
||||
proc?.WaitForExit(5000);
|
||||
|
||||
if (proc != null && proc.ExitCode == 0)
|
||||
{
|
||||
MessageBox.Show("Kayıt defteri yedeği başarıyla geri yüklendi!", "Başarılı", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"Geri yükleme işlemi tamamlanamadı (Çıkış kodu: {proc?.ExitCode}).", "Hata", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Geri yükleme sırasında hata oluştu: {ex.Message}", "Hata", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnOpenFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string backupDir = JunkManager.BackupDirectory;
|
||||
if (!Directory.Exists(backupDir))
|
||||
Directory.CreateDirectory(backupDir);
|
||||
|
||||
Process.Start("explorer.exe", backupDir);
|
||||
}
|
||||
|
||||
private void BtnDeleteBackup_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgBackups.SelectedItem is not BackupFileItem item)
|
||||
{
|
||||
MessageBox.Show("Lütfen silmek istediğiniz bir yedek dosyası seçin.", "Yedek Seçilmedi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var confirm = MessageBox.Show($"'{item.Name}' dosyasını silmek istediğinize emin misiniz?", "Yedek Silme Onayı", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
if (confirm != MessageBoxResult.Yes) return;
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(item.FullPath))
|
||||
File.Delete(item.FullPath);
|
||||
|
||||
LoadBackups();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Dosya silinemedi: {ex.Message}", "Hata", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnRemoveExclusion_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgExclusions.SelectedItem is not ExclusionItem item)
|
||||
{
|
||||
MessageBox.Show("Lütfen koruma listesinden kaldırmak istediğiniz bir kural seçin.", "Kural Seçilmedi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
ExclusionManager.RemoveExclusion(item.Path);
|
||||
LoadExclusions();
|
||||
}
|
||||
|
||||
private void BtnAddExclusion_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFolderDialog
|
||||
{
|
||||
Title = "Korumaya almak istediğiniz klasörü seçin:"
|
||||
};
|
||||
|
||||
if (dialog.ShowDialog() == true && !string.IsNullOrWhiteSpace(dialog.FolderName))
|
||||
{
|
||||
ExclusionManager.AddExclusion(dialog.FolderName, "Kullanıcı Manuel Koruması");
|
||||
LoadExclusions();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,29 +29,29 @@
|
|||
<Border Grid.Row="0" Background="{StaticResource BrushBgSidebar}" MouseDown="TitleBar_MouseDown" Padding="20,0">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Background="#2563EB" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<Border Background="{StaticResource BrushGlassSapphire}" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<TextBlock Text="🗑️" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<TextBlock x:Name="txtTitle" Text="Kaldırma ve Kalıntı Temizleme Motoru" FontSize="14.5" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtTitle" Text="Kaldırma ve Kalıntı Temizleme Motoru" FontSize="14.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="#9CA3AF" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Subheader info banner -->
|
||||
<Border Grid.Row="1" Background="#1E293B" Padding="20,12" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Border Grid.Row="1" Background="#14171E" Padding="20,12" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<TextBlock x:Name="txtSubHeader" TextWrapping="Wrap" Foreground="{StaticResource BrushTextSecondary}" FontSize="12.5" LineHeight="18"
|
||||
Text="Kaldırma işlemi sırasında MSI kilitleri ve süreç çakışmaları otomatik yönetilir. Kaldırma bittiğinde sistem kalıntıları otomatik olarak taranıp ekrana getirilecektir." />
|
||||
</Border>
|
||||
|
||||
<!-- Queue Item List -->
|
||||
<DataGrid x:Name="dgQueue" Grid.Row="2" Background="Transparent" RowBackground="#161E2E" AlternatingRowBackground="#1A2333"
|
||||
<DataGrid x:Name="dgQueue" Grid.Row="2" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="0" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="White" FontSize="13"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="13"
|
||||
SelectionMode="Single" Margin="20,15">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
|
|
@ -72,8 +72,8 @@
|
|||
<DataGridTemplateColumn Header="Durum" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="#1E293B" CornerRadius="5" Padding="8,4" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{Binding StatusMessage}" FontWeight="Medium" FontSize="12" Foreground="#60A5FA" />
|
||||
<Border Background="#131B2B" BorderBrush="{Binding StatusBadgeColor}" BorderThickness="1" CornerRadius="5" Padding="8,4" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{Binding StatusMessage}" FontWeight="Medium" FontSize="12" Foreground="{Binding StatusBadgeColor}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
</DataGrid>
|
||||
|
||||
<!-- Options Panel -->
|
||||
<Border Grid.Row="3" Background="#161E2E" Padding="20,14" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Border Grid.Row="3" Background="#13161C" Padding="20,14" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
|
|
|
|||
|
|
@ -15,12 +15,37 @@ namespace LDUninstaller.UI.Dialogs
|
|||
private readonly List<ApplicationUninstallerEntry> _targetApps;
|
||||
private BulkUninstallTask? _bulkTask;
|
||||
private CancellationTokenSource? _cts;
|
||||
private bool _isRunning;
|
||||
|
||||
public List<ApplicationUninstallerEntry> UninstalledApps { get; private set; } = new();
|
||||
|
||||
public BulkWizardWindow(List<ApplicationUninstallerEntry> apps)
|
||||
{
|
||||
InitializeComponent();
|
||||
_targetApps = apps;
|
||||
Loaded += BulkWizardWindow_Loaded;
|
||||
Closing += BulkWizardWindow_Closing;
|
||||
}
|
||||
|
||||
private void BulkWizardWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (_isRunning)
|
||||
{
|
||||
var res = MessageBox.Show(
|
||||
"Kaldırma işlemleri arka planda devam ediyor. İptal edip çıkmak istediğinize emin misiniz?",
|
||||
"İptal Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (res == MessageBoxResult.Yes)
|
||||
{
|
||||
_cts?.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BulkWizardWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
|
|
@ -62,12 +87,22 @@ namespace LDUninstaller.UI.Dialogs
|
|||
|
||||
private void CancelOrClose()
|
||||
{
|
||||
if (_cts != null && !_cts.IsCancellationRequested)
|
||||
if (_isRunning)
|
||||
{
|
||||
_cts.Cancel();
|
||||
var res = MessageBox.Show(
|
||||
"Kaldırma işlemleri halen devam ediyor. İptal etmek istediğinize emin misiniz?",
|
||||
"İşlemi İptal Et",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (res == MessageBoxResult.Yes)
|
||||
{
|
||||
_cts?.Cancel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try { DialogResult = false; } catch { }
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +114,7 @@ namespace LDUninstaller.UI.Dialogs
|
|||
chkRestorePoint.IsEnabled = false;
|
||||
chkPreferQuiet.IsEnabled = false;
|
||||
cmbConcurrent.IsEnabled = false;
|
||||
_isRunning = true;
|
||||
|
||||
_cts = new CancellationTokenSource();
|
||||
int concurrent = cmbConcurrent.SelectedIndex + 1;
|
||||
|
|
@ -116,10 +152,15 @@ namespace LDUninstaller.UI.Dialogs
|
|||
try
|
||||
{
|
||||
await _bulkTask.ExecuteAsync(_cts.Token);
|
||||
txtStatus.Text = "Kaldırma tamamlandı!";
|
||||
UninstalledApps = _bulkTask.Items
|
||||
.Where(i => i.IsEffectivelyUninstalled)
|
||||
.Select(i => i.Entry)
|
||||
.ToList();
|
||||
|
||||
txtStatus.Text = $"Kaldırma tamamlandı! ({UninstalledApps.Count}/{_targetApps.Count} başarılı)";
|
||||
await Task.Delay(400);
|
||||
|
||||
DialogResult = true;
|
||||
try { DialogResult = true; } catch { }
|
||||
Close();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
@ -132,7 +173,9 @@ namespace LDUninstaller.UI.Dialogs
|
|||
}
|
||||
finally
|
||||
{
|
||||
_isRunning = false;
|
||||
btnCancel.Content = "Kapat";
|
||||
btnStart.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
115
src/LDUninstaller.UI/Dialogs/ForceDeleteWindow.xaml
Normal file
115
src/LDUninstaller.UI/Dialogs/ForceDeleteWindow.xaml
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<Window x:Class="LDUninstaller.UI.Dialogs.ForceDeleteWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="LD Güçlü Kaldır ve Kilit Kırıcı"
|
||||
Height="540" Width="720"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Topmost="True"
|
||||
Background="{StaticResource BrushBgDark}"
|
||||
Foreground="{StaticResource BrushTextPrimary}"
|
||||
FontFamily="Segoe UI"
|
||||
Icon="pack://application:,,,/LDUninstaller.UI;component/Resources/app.ico"
|
||||
BorderBrush="#EF4444"
|
||||
BorderThickness="1">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="50" ResizeBorderThickness="6" CornerRadius="8" GlassFrameThickness="0" UseAeroCaptionButtons="False" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="65" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Custom Title Bar -->
|
||||
<Border Grid.Row="0" Background="{StaticResource BrushBgSidebar}" MouseDown="TitleBar_MouseDown" Padding="20,0" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Background="#450A0A" BorderBrush="#EF4444" BorderThickness="1" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<TextBlock Text="💥" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<TextBlock Text="LD Güçlü Kaldır ve Kilit Kırıcı (Force Shredder)" FontSize="14.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Target Info Banner -->
|
||||
<Border Grid.Row="1" Background="#161921" Margin="20,15,20,10" Padding="16,12" CornerRadius="8" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock x:Name="txtTargetTitle" Text="Hedef Dizin / Dosya" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource BrushTextMuted}" />
|
||||
<TextBlock x:Name="txtTargetPath" Text="C:\..." FontSize="13" FontWeight="Bold" Foreground="{StaticResource BrushAccentRed}" TextWrapping="Wrap" Margin="0,4,0,2" />
|
||||
<TextBlock x:Name="txtLnkNote" Text="" FontSize="11" Foreground="{StaticResource BrushAccentBlueLight}" Visibility="Collapsed" />
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="bdLockStatus" Grid.Column="1" VerticalAlignment="Center" CornerRadius="6" Padding="8,4" Background="#1F2937">
|
||||
<TextBlock x:Name="txtLockStatus" Text="Kilitler Taranıyor..." FontSize="11.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextSecondary}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Locks List or Ready State -->
|
||||
<Grid Grid.Row="2" Margin="20,0,20,10">
|
||||
<DataGrid x:Name="dgLocks" Background="#11141A" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="11.5" />
|
||||
<Setter Property="Padding" Value="8,6" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="PID" Binding="{Binding ProcessId}" Width="60" />
|
||||
<DataGridTextColumn Header="Süreç / Servis Adı" Binding="{Binding ProcessName}" Width="160" />
|
||||
<DataGridTextColumn Header="Açıklama / Durum" Binding="{Binding Description}" Width="200" />
|
||||
<DataGridTextColumn Header="Yürütülebilir Dosya Yolu" Binding="{Binding ExecutablePath}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<!-- When no locks found -->
|
||||
<Border x:Name="pnlNoLocks" Background="#11141A" BorderBrush="{StaticResource BrushBorder}" BorderThickness="1" CornerRadius="6" Visibility="Collapsed">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="🔓" FontSize="32" HorizontalAlignment="Center" Margin="0,0,0,6" />
|
||||
<TextBlock Text="Klasörü kilitleyen aktif süreç veya servis tespit edilmedi." FontSize="13" FontWeight="SemiBold" Foreground="#34D399" HorizontalAlignment="Center" />
|
||||
<TextBlock Text="Klasör ve kalıntıları doğrudan yok edilmeye hazır." FontSize="11.5" Foreground="{StaticResource BrushTextMuted}" HorizontalAlignment="Center" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Options & Status Panel -->
|
||||
<Border Grid.Row="3" Background="#13161C" Margin="20,0,20,10" Padding="14,10" CornerRadius="6" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<StackPanel>
|
||||
<CheckBox x:Name="chkRecycle" Content="Geri Dönüşüm Kutusu'na Gönder (Kalıcı veri kaybını önler)" IsChecked="True" Style="{StaticResource ModernCheckBox}" Margin="0,0,0,6" />
|
||||
<CheckBox x:Name="chkCleanJunk" Content="Kayıt Defteri ve AppData / ProgramData kalıntılarını da otomatik temizle" IsChecked="True" Style="{StaticResource ModernCheckBox}" />
|
||||
<ProgressBar x:Name="pbProgress" Height="4" Margin="0,8,0,0" Background="#1E293B" Foreground="#EF4444" BorderThickness="0" Visibility="Collapsed" IsIndeterminate="True" />
|
||||
<TextBlock x:Name="txtLog" Text="" FontSize="11.5" Foreground="{StaticResource BrushTextMuted}" Margin="0,6,0,0" TextWrapping="Wrap" Visibility="Collapsed" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Footer Buttons -->
|
||||
<Border Grid.Row="4" Background="{StaticResource BrushBgSidebar}" Padding="20,12" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button x:Name="btnDestroy" Content="💥 Kilitleri Kır, Yok Et ve Kalıntıları Temizle" Style="{StaticResource ModernBtnPrimary}" Background="#DC2626" BorderBrush="#EF4444" Margin="0,0,10,0" Click="BtnDestroy_Click" />
|
||||
<Button x:Name="btnCancel" Content="İptal" Style="{StaticResource ModernBtnSecondary}" Click="BtnClose_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
179
src/LDUninstaller.UI/Dialogs/ForceDeleteWindow.xaml.cs
Normal file
179
src/LDUninstaller.UI/Dialogs/ForceDeleteWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Models;
|
||||
using LDUninstaller.Core.Native;
|
||||
using LDUninstaller.Core.Services;
|
||||
|
||||
namespace LDUninstaller.UI.Dialogs
|
||||
{
|
||||
public partial class ForceDeleteWindow : Window
|
||||
{
|
||||
private readonly string _rawInputPath;
|
||||
private string _targetFolder = string.Empty;
|
||||
private string? _primaryFile;
|
||||
private string? _originalLnk;
|
||||
private bool _isDangerous;
|
||||
|
||||
public ForceDeleteWindow(string rawPath)
|
||||
{
|
||||
InitializeComponent();
|
||||
_rawInputPath = rawPath ?? string.Empty;
|
||||
Loaded += ForceDeleteWindow_Loaded;
|
||||
}
|
||||
|
||||
private async void ForceDeleteWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var (folder, file, lnk) = FileUnlockerService.ResolveTarget(_rawInputPath);
|
||||
_targetFolder = folder;
|
||||
_primaryFile = file;
|
||||
_originalLnk = lnk;
|
||||
|
||||
txtTargetPath.Text = _targetFolder;
|
||||
|
||||
if (!string.IsNullOrEmpty(_originalLnk))
|
||||
{
|
||||
txtLnkNote.Text = $"🔗 Masaüstü/Başlat kısayolu çözümlendi: '{Path.GetFileName(_originalLnk)}' ve ana kurulum klasörü birlikte yok edilecek.";
|
||||
txtLnkNote.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
// Güvenlik Kara Liste Kontrolü
|
||||
if (SafetyBlacklist.IsDangerousDirectory(_targetFolder))
|
||||
{
|
||||
_isDangerous = true;
|
||||
btnDestroy.IsEnabled = false;
|
||||
txtLockStatus.Text = "⛔ Kritik Sistem Klasörü";
|
||||
txtLockStatus.Foreground = new SolidColorBrush(Color.FromRgb(248, 113, 113));
|
||||
bdLockStatus.Background = new SolidColorBrush(Color.FromRgb(69, 10, 10));
|
||||
|
||||
MessageBox.Show(
|
||||
$"GÜVENLİK ENGELİ:\n\n'{_targetFolder}'\n\nBu klasör Windows sistem dosyalarını, kullanıcı profil kökünü veya kritik bir sürücü kökünü içerdiğinden LD Uninstaller tarafından SİLİNEMEZ!",
|
||||
"Kritik Sistem Koruması Devrede",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Hand);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await RefreshLocksAsync();
|
||||
}
|
||||
|
||||
private async Task RefreshLocksAsync()
|
||||
{
|
||||
txtLockStatus.Text = "Kilitler taranıyor...";
|
||||
|
||||
var locks = await Task.Run(() => FileUnlockerService.InspectLocks(_targetFolder));
|
||||
|
||||
if (locks.Count > 0)
|
||||
{
|
||||
dgLocks.ItemsSource = locks;
|
||||
dgLocks.Visibility = Visibility.Visible;
|
||||
pnlNoLocks.Visibility = Visibility.Collapsed;
|
||||
|
||||
txtLockStatus.Text = $"⚠️ {locks.Count} Kilitli Süreç / Servis";
|
||||
txtLockStatus.Foreground = new SolidColorBrush(Color.FromRgb(248, 113, 113));
|
||||
bdLockStatus.Background = new SolidColorBrush(Color.FromRgb(69, 10, 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
dgLocks.Visibility = Visibility.Collapsed;
|
||||
pnlNoLocks.Visibility = Visibility.Visible;
|
||||
|
||||
txtLockStatus.Text = "✓ Aktif Kilit Yok";
|
||||
txtLockStatus.Foreground = new SolidColorBrush(Color.FromRgb(52, 211, 153));
|
||||
bdLockStatus.Background = new SolidColorBrush(Color.FromRgb(6, 78, 59));
|
||||
}
|
||||
}
|
||||
|
||||
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private async void BtnDestroy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isDangerous) return;
|
||||
|
||||
var res = MessageBox.Show(
|
||||
$"Hedef:\n{_targetFolder}\n\nBu klasörle ilişkili tüm çalışan süreçler ve servisler anında sonlandırılacak, klasör ve kalıntıları tamamen yok edilecektir.\n\nİşlemi onaylıyor musunuz?",
|
||||
"💥 Güçlü Kaldırma Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (res != MessageBoxResult.Yes) return;
|
||||
|
||||
btnDestroy.IsEnabled = false;
|
||||
btnCancel.IsEnabled = false;
|
||||
chkRecycle.IsEnabled = false;
|
||||
chkCleanJunk.IsEnabled = false;
|
||||
pbProgress.Visibility = Visibility.Visible;
|
||||
txtLog.Visibility = Visibility.Visible;
|
||||
|
||||
bool sendToRecycle = chkRecycle.IsChecked == true;
|
||||
bool cleanJunk = chkCleanJunk.IsChecked == true;
|
||||
|
||||
var destroyResult = await Task.Run(() =>
|
||||
{
|
||||
return FileUnlockerService.UnlockAndDestroy(
|
||||
_targetFolder,
|
||||
sendToRecycle,
|
||||
msg => Dispatcher.Invoke(() => txtLog.Text = msg));
|
||||
});
|
||||
|
||||
// Kısayol dosyasını da temizle
|
||||
if (!string.IsNullOrEmpty(_originalLnk) && File.Exists(_originalLnk))
|
||||
{
|
||||
try { Win32.SendToRecycleBin(_originalLnk); } catch { }
|
||||
}
|
||||
|
||||
// Kalıntı temizleme (Junk Scan & Clean)
|
||||
int leftoverCount = 0;
|
||||
if (cleanJunk)
|
||||
{
|
||||
Dispatcher.Invoke(() => txtLog.Text = "Kayıt Defteri ve sistem kalıntıları temizleniyor...");
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
string appName = Path.GetFileName(_targetFolder);
|
||||
var entry = new ApplicationUninstallerEntry
|
||||
{
|
||||
DisplayName = appName,
|
||||
InstallLocation = _targetFolder
|
||||
};
|
||||
|
||||
var jm = new JunkManager();
|
||||
var junks = jm.ScanJunk(entry);
|
||||
var cleanable = junks.Where(j => j.Confidence >= ConfidenceLevel.Good).ToList();
|
||||
leftoverCount = JunkManager.CleanJunk(cleanable, JunkManager.BackupDirectory);
|
||||
});
|
||||
}
|
||||
|
||||
pbProgress.Visibility = Visibility.Collapsed;
|
||||
|
||||
string summaryMsg = $"İşlem Başarıyla Tamamlandı!\n\n" +
|
||||
$"• Sonlandırılan Süreç: {destroyResult.KilledProcessesCount}\n" +
|
||||
$"• Durdurulan/Silinen Servis: {destroyResult.StoppedServicesCount}\n" +
|
||||
$"• Temizlenen Kalıntı Kayıt/Dosya: {leftoverCount}\n";
|
||||
|
||||
if (destroyResult.ScheduledForReboot)
|
||||
{
|
||||
summaryMsg += "\nNOT: Bazı kilitli çekirdek dosyalar ilk sistem yeniden başlatmasında (MoveFileEx) silinmek üzere zamanlandı.";
|
||||
}
|
||||
|
||||
MessageBox.Show(summaryMsg, "💥 Güçlü Kaldırma Tamamlandı", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,32 +28,39 @@
|
|||
<Border Grid.Row="0" Background="{StaticResource BrushBgSidebar}" MouseDown="TitleBar_MouseDown" Padding="20,0">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Background="#10B981" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<Border Background="{StaticResource BrushAccentGreen}" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<TextBlock Text="🧹" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<TextBlock x:Name="txtTitle" Text="Kalıntı ve Artık Temizleme Motoru" FontSize="14.5" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtTitle" Text="Kalıntı ve Artık Temizleme Motoru" FontSize="14.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="#9CA3AF" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Backup Alert Banner -->
|
||||
<Border Grid.Row="1" Background="#1E293B" Padding="20,12" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Border Grid.Row="1" Background="#14171E" Padding="20,12" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="🛡️ " FontSize="14" VerticalAlignment="Center" />
|
||||
<TextBlock Text="Kayıt defterinden silinecek tüm anahtarlar silinmeden önce otomatik olarak AppData\Local\LDUninstaller\Backups klasörüne .reg yedeği olarak aktarılır."
|
||||
Foreground="#94A3B8" FontSize="12.5" VerticalAlignment="Center" TextWrapping="Wrap" />
|
||||
Foreground="{StaticResource BrushTextSecondary}" FontSize="12.5" VerticalAlignment="Center" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Junk Item Grid -->
|
||||
<DataGrid x:Name="dgJunk" Grid.Row="2" Background="Transparent" RowBackground="#161E2E" AlternatingRowBackground="#1A2333"
|
||||
BorderThickness="0" AutoGenerateColumns="False" CanUserAddRows="False"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="White" FontSize="12.5"
|
||||
<DataGrid x:Name="dgJunk" Grid.Row="2" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="0" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="False"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12.5"
|
||||
Margin="20,15">
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Background="#1A202C" Foreground="#E2E8F0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<MenuItem Header="🛡️ Korumaya Al (Bir daha kalıntı olarak arama)" Click="MenuExclude_Click" />
|
||||
<Separator Background="#2D3748" />
|
||||
<MenuItem Header="📋 Yolu Kopyala" Click="MenuCopyPath_Click" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
|
|
@ -78,8 +85,8 @@
|
|||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="5" Padding="7,3" HorizontalAlignment="Left"
|
||||
Background="#1E293B">
|
||||
<TextBlock Text="{Binding Confidence}" FontWeight="SemiBold" FontSize="11.5" Foreground="#34D399" />
|
||||
Background="{Binding ConfidenceBadgeBackground}">
|
||||
<TextBlock Text="{Binding ConfidenceDisplay}" FontWeight="SemiBold" FontSize="11.5" Foreground="{Binding ConfidenceBadgeColor}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
|
|
@ -102,14 +109,23 @@
|
|||
<!-- Footer -->
|
||||
<Border Grid.Row="3" Background="{StaticResource BrushBgSidebar}" Padding="20,12" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<CheckBox x:Name="chkSelectAll" Content="Tümünü Seç / Seçimi Kaldır" Style="{StaticResource ModernCheckBox}" Checked="ChkSelectAll_Changed" Unchecked="ChkSelectAll_Changed" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtCount" Text="0 öğe seçildi" Margin="25,0,0,0" Foreground="{StaticResource BrushTextSecondary}" VerticalAlignment="Center" FontSize="12.5" />
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox x:Name="chkSelectAll" Content="Tümünü Seç / Seçimi Kaldır" Style="{StaticResource ModernCheckBox}" Checked="ChkSelectAll_Changed" Unchecked="ChkSelectAll_Changed" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtCount" Text="0 öğe seçildi" Margin="25,0,0,0" Foreground="{StaticResource BrushTextSecondary}" VerticalAlignment="Center" FontSize="12.5" />
|
||||
</StackPanel>
|
||||
<ProgressBar x:Name="pbCleanProgress" Height="4" Margin="0,8,20,0" Background="#1E293B" Foreground="#10B981" BorderThickness="0" Visibility="Collapsed" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Button x:Name="btnExclude" Content="🛡️ Korumaya Al" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnExclude_Click" ToolTip="Seçili öğeyi kalıcı olarak koruma listesine ekler" />
|
||||
<Button x:Name="btnClean" Content="Seçilen Kalıntıları Temizle" Style="{StaticResource ModernBtnPrimary}" Margin="0,0,10,0" Click="BtnClean_Click" />
|
||||
<Button Content="Kapat" Style="{StaticResource ModernBtnSecondary}" Click="BtnClose_Click" />
|
||||
<Button x:Name="btnClose" Content="Kapat" Style="{StaticResource ModernBtnSecondary}" Click="BtnClose_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using LDUninstaller.Core.Junk;
|
||||
|
|
@ -26,14 +27,14 @@ namespace LDUninstaller.UI.Dialogs
|
|||
btnClean.Visibility = Visibility.Visible;
|
||||
chkSelectAll.Visibility = Visibility.Visible;
|
||||
|
||||
// U2: Yalnızca Çok Yüksek (VeryGood) güven seviyesine sahip olanlar varsayılan olarak seçili gelir
|
||||
foreach (var j in _junkItems)
|
||||
{
|
||||
if (j.Confidence > ConfidenceLevel.Bad)
|
||||
j.Selected = true;
|
||||
j.Selected = (j.Confidence == ConfidenceLevel.VeryGood);
|
||||
}
|
||||
|
||||
dgJunk.ItemsSource = _junkItems;
|
||||
chkSelectAll.IsChecked = true;
|
||||
chkSelectAll.IsChecked = _junkItems.All(x => x.Selected);
|
||||
UpdateCount();
|
||||
}
|
||||
else
|
||||
|
|
@ -42,6 +43,7 @@ namespace LDUninstaller.UI.Dialogs
|
|||
pnlNoJunk.Visibility = Visibility.Visible;
|
||||
btnClean.Visibility = Visibility.Collapsed;
|
||||
chkSelectAll.Visibility = Visibility.Collapsed;
|
||||
btnExclude.Visibility = Visibility.Collapsed;
|
||||
txtCount.Text = "0 kalıntı bulundu (Sistem tertemiz)";
|
||||
}
|
||||
}
|
||||
|
|
@ -85,25 +87,120 @@ namespace LDUninstaller.UI.Dialogs
|
|||
btnClean.IsEnabled = count > 0;
|
||||
}
|
||||
|
||||
private void BtnClean_Click(object sender, RoutedEventArgs e)
|
||||
private void MenuCopyPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgJunk.SelectedItem is IJunkResult item && !string.IsNullOrWhiteSpace(item.Path))
|
||||
{
|
||||
Clipboard.SetText(item.Path);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuExclude_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgJunk.SelectedItem is IJunkResult item)
|
||||
{
|
||||
ExcludeItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnExclude_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dgJunk.SelectedItem is IJunkResult item)
|
||||
{
|
||||
ExcludeItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Lütfen korumaya almak istediğiniz bir kalıntı öğesini seçin.", "Öğe Seçilmedi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExcludeItem(IJunkResult item)
|
||||
{
|
||||
ExclusionManager.AddExclusion(item.Path, $"Kullanıcı Koruması: {item.EntryName}");
|
||||
_junkItems.Remove(item);
|
||||
dgJunk.ItemsSource = null;
|
||||
dgJunk.ItemsSource = _junkItems;
|
||||
UpdateCount();
|
||||
|
||||
MessageBox.Show(
|
||||
$"Hedef koruma listesine (Exclusion List) eklendi:\n{item.Path}\n\nBu yol sonraki tüm taramalarda otomatik olarak korunacaktır.",
|
||||
"Korumaya Alındı",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
private async void BtnClean_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var toDelete = _junkItems.Where(x => x.Selected && x.Confidence > ConfidenceLevel.Bad).ToList();
|
||||
if (toDelete.Count == 0) return;
|
||||
|
||||
var res = MessageBox.Show(
|
||||
$"{toDelete.Count} adet kalıntı öğe güvenle silinecek. Silme öncesinde .reg yedeği alınacaktır.\nDevam edilsin mi?",
|
||||
$"{toDelete.Count} adet kalıntı öğe Geri Dönüşüm Kutusu'na gönderilecek ve kayıt defteri anahtarları silinmeden önce .reg dosyası olarak yedeklenecektir.\n\nDevam edilsin mi?",
|
||||
"Kalıntı Temizleme Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (res != MessageBoxResult.Yes) return;
|
||||
|
||||
int cleaned = JunkManager.CleanJunk(toDelete, JunkManager.BackupDirectory);
|
||||
MessageBox.Show(
|
||||
$"{cleaned} adet kalıntı dosya ve kayıt defteri anahtarı başarıyla temizlendi!\nKayıt defteri yedekleri:\n{JunkManager.BackupDirectory}",
|
||||
"Temizlik Tamamlandı",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
btnClean.IsEnabled = false;
|
||||
btnClose.IsEnabled = false;
|
||||
btnExclude.IsEnabled = false;
|
||||
pbCleanProgress.Visibility = Visibility.Visible;
|
||||
pbCleanProgress.Maximum = toDelete.Count;
|
||||
pbCleanProgress.Value = 0;
|
||||
|
||||
string backupDir = JunkManager.BackupDirectory;
|
||||
int successCount = 0;
|
||||
var failedItems = new List<string>();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
foreach (var item in toDelete)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool ok = item.Delete(backupDir);
|
||||
if (ok)
|
||||
successCount++;
|
||||
else
|
||||
failedItems.Add(item.Path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
failedItems.Add($"{item.Path} ({ex.Message})");
|
||||
}
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
pbCleanProgress.Value++;
|
||||
txtCount.Text = $"{pbCleanProgress.Value} / {toDelete.Count} temizleniyor...";
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
pbCleanProgress.Visibility = Visibility.Collapsed;
|
||||
btnClose.IsEnabled = true;
|
||||
|
||||
if (failedItems.Count == 0)
|
||||
{
|
||||
MessageBox.Show(
|
||||
$"{successCount} adet kalıntı dosya ve kayıt defteri anahtarı başarıyla temizlendi!\nKayıt defteri yedekleri:\n{backupDir}",
|
||||
"Temizlik Tamamlandı",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
string failedSummary = string.Join("\n", failedItems.Take(5));
|
||||
if (failedItems.Count > 5) failedSummary += $"\n... ve {failedItems.Count - 5} diğer öğe";
|
||||
|
||||
MessageBox.Show(
|
||||
$"{successCount} adet öğe başarıyla temizlendi.\n{failedItems.Count} öğe silinemedi (dosya kilitli veya erişim engellendi):\n\n{failedSummary}\n\nKayıt defteri yedekleri:\n{backupDir}",
|
||||
"Kalıntı Temizleme Raporu",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Warning);
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
|
|
|
|||
59
src/LDUninstaller.UI/Dialogs/LogViewerWindow.xaml
Normal file
59
src/LDUninstaller.UI/Dialogs/LogViewerWindow.xaml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<Window x:Class="LDUninstaller.UI.Dialogs.LogViewerWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Sistem ve İşlem Günlüğü - LD Uninstaller"
|
||||
Height="550" Width="820"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ShowInTaskbar="False"
|
||||
Background="{StaticResource BrushBgDark}"
|
||||
Foreground="{StaticResource BrushTextPrimary}"
|
||||
FontFamily="Segoe UI"
|
||||
Icon="pack://application:,,,/LDUninstaller.UI;component/Resources/app.ico"
|
||||
BorderBrush="{StaticResource BrushBorder}"
|
||||
BorderThickness="1">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="50" ResizeBorderThickness="6" CornerRadius="8" GlassFrameThickness="0" UseAeroCaptionButtons="False" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Custom Title Bar -->
|
||||
<Border Grid.Row="0" Background="{StaticResource BrushBgSidebar}" MouseDown="TitleBar_MouseDown" Padding="20,0">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Background="{StaticResource BrushGlassSapphire}" CornerRadius="6" Width="28" Height="28" Margin="0,0,12,0">
|
||||
<TextBlock Text="📜" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<TextBlock Text="Sistem ve İşlem Günlüğü (trace.log)" FontSize="14.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Button Content="✕" Width="30" Height="30" HorizontalAlignment="Right" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Log Content Box -->
|
||||
<Border Grid.Row="1" Margin="20,15,20,10" Background="#11141A" BorderBrush="{StaticResource BrushBorder}" BorderThickness="1" CornerRadius="6">
|
||||
<TextBox x:Name="txtLog" Background="Transparent" Foreground="#E2E8F0" FontFamily="Consolas, Cascadia Code, Courier New" FontSize="12"
|
||||
IsReadOnly="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
|
||||
BorderThickness="0" Padding="12" />
|
||||
</Border>
|
||||
|
||||
<!-- Footer -->
|
||||
<Border Grid.Row="2" Background="{StaticResource BrushBgSidebar}" Padding="20,12" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Button Content="🔄 Yenile" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnRefresh_Click" />
|
||||
<Button Content="📋 Kopyala" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnCopy_Click" />
|
||||
<Button Content="📂 Not Defterinde Aç" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,10,0" Click="BtnOpenExternal_Click" />
|
||||
<Button Content="🗑️ Temizle" Style="{StaticResource ModernBtnSecondary}" Click="BtnClear_Click" />
|
||||
</StackPanel>
|
||||
<Button Content="Kapat" Style="{StaticResource ModernBtnPrimary}" HorizontalAlignment="Right" VerticalAlignment="Center" Click="BtnClose_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
82
src/LDUninstaller.UI/Dialogs/LogViewerWindow.xaml.cs
Normal file
82
src/LDUninstaller.UI/Dialogs/LogViewerWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace LDUninstaller.UI.Dialogs
|
||||
{
|
||||
public partial class LogViewerWindow : Window
|
||||
{
|
||||
public LogViewerWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += (s, e) => LoadLog();
|
||||
}
|
||||
|
||||
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void LoadLog()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(App.LogFilePath))
|
||||
{
|
||||
using var fs = new FileStream(App.LogFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
using var reader = new StreamReader(fs);
|
||||
txtLog.Text = reader.ReadToEnd();
|
||||
txtLog.ScrollToEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
txtLog.Text = "Henüz bir log kaydı oluşturulmadı.";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
txtLog.Text = $"Log dosyası okunamadı: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnRefresh_Click(object sender, RoutedEventArgs e) => LoadLog();
|
||||
|
||||
private void BtnCopy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(txtLog.Text))
|
||||
{
|
||||
Clipboard.SetText(txtLog.Text);
|
||||
MessageBox.Show("Log metni panoya kopyalandı.", "Kopyalandı", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnOpenExternal_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(App.LogFilePath))
|
||||
Process.Start(new ProcessStartInfo("notepad.exe", App.LogFilePath) { UseShellExecute = true });
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void BtnClear_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(App.LogFilePath))
|
||||
File.WriteAllText(App.LogFilePath, string.Empty);
|
||||
LoadLog();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
<RootNamespace>LDUninstaller.UI</RootNamespace>
|
||||
<AssemblyName>LDUninstaller.UI</AssemblyName>
|
||||
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:LDUninstaller.UI.Controls"
|
||||
Title="LD Uninstaller - Gelişmiş Sistem ve Toplu Yazılım Kaldırıcı"
|
||||
Height="800" Width="1280"
|
||||
MinHeight="650" MinWidth="1000"
|
||||
Height="820" Width="1300"
|
||||
MinHeight="650" MinWidth="1050"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="{StaticResource BrushBgDark}"
|
||||
Foreground="{StaticResource BrushTextPrimary}"
|
||||
FontFamily="Segoe UI"
|
||||
Icon="pack://application:,,,/LDUninstaller.UI;component/Resources/app.ico"
|
||||
BorderBrush="{StaticResource BrushBorder}"
|
||||
BorderThickness="1">
|
||||
BorderThickness="1"
|
||||
KeyDown="Window_KeyDown">
|
||||
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="50" ResizeBorderThickness="6" CornerRadius="8" GlassFrameThickness="0" UseAeroCaptionButtons="False" />
|
||||
|
|
@ -33,13 +34,13 @@
|
|||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- App Brand / Logo -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="20,0">
|
||||
<Border CornerRadius="8" Width="36" Height="36" Margin="0,0,12,0" ClipToBounds="True">
|
||||
<Image Source="pack://application:,,,/Resources/logo.png" Width="36" Height="36" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="18,0">
|
||||
<Border CornerRadius="9" Width="38" Height="38" Margin="0,0,12,0" Background="#1A202C" BorderBrush="#364560" BorderThickness="1" ClipToBounds="True">
|
||||
<Image Source="pack://application:,,,/Resources/logo.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
</Border>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="LD Uninstaller" FontSize="15" FontWeight="Bold" Foreground="White" />
|
||||
<TextBlock x:Name="txtAppVersion" Text="v2.4.0" FontSize="11" Foreground="#60A5FA" />
|
||||
<TextBlock Text="LD Uninstaller" FontSize="15" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock x:Name="txtAppVersion" Text="v2.8.0" FontSize="11" Foreground="{StaticResource BrushAccentBlueLight}" FontWeight="SemiBold" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
|
@ -49,16 +50,18 @@
|
|||
<RadioButton x:Name="navTreemap" Content="🗺️ Disk Haritası" Style="{StaticResource SidebarNavBtn}" Checked="Nav_Checked" />
|
||||
<RadioButton x:Name="navStartup" Content="⚡ Başlangıç Yöneticisi" Style="{StaticResource SidebarNavBtn}" Checked="Nav_Checked" />
|
||||
<RadioButton x:Name="navDebloat" Content="🛡️ Windows Debloat" Style="{StaticResource SidebarNavBtn}" Checked="Nav_Checked" />
|
||||
<RadioButton x:Name="navBackups" Content="💾 Yedek & Koruma" Style="{StaticResource SidebarNavBtn}" Checked="Nav_Checked" />
|
||||
<RadioButton x:Name="navTools" Content="🔧 Sistem Araçları" Style="{StaticResource SidebarNavBtn}" Checked="Nav_Checked" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Sidebar Footer Status -->
|
||||
<Border Grid.Row="2" Background="#161E2E" Padding="16,14" Margin="12" CornerRadius="8" BorderThickness="1" BorderBrush="#253045">
|
||||
<Border Grid.Row="2" Background="#11141A" Padding="14,12" Margin="12" CornerRadius="8" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
||||
<Ellipse Width="7" Height="7" Fill="#10B981" Margin="0,0,7,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="Sistem Koruması Aktif" FontSize="11.5" FontWeight="SemiBold" Foreground="#34D399" />
|
||||
<Ellipse Width="7" Height="7" Fill="{StaticResource BrushAccentGreen}" Margin="0,0,7,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="Sistem Koruması Aktif" FontSize="11.5" FontWeight="SemiBold" Foreground="{StaticResource BrushAccentGreen}" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="Otomatik .REG yedekleme ve çakışma önleyici açık." FontSize="10.5" Foreground="{StaticResource BrushTextMuted}" TextWrapping="Wrap" />
|
||||
<TextBlock Text="Otomatik .REG yedeği ve süreç koruyucu devrede." FontSize="10.5" Foreground="{StaticResource BrushTextMuted}" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
@ -78,11 +81,11 @@
|
|||
<Grid>
|
||||
<!-- Search Bar in Header -->
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Border Background="#1F2937" CornerRadius="7" Width="320" Height="32" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Border Background="#171A21" CornerRadius="8" Width="330" Height="32" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<TextBlock Text="🔍" FontSize="11" Foreground="#6B7280" Margin="10,0,0,0" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="txtSearch" Background="Transparent" Foreground="White" BorderThickness="0" Margin="28,2,10,0" VerticalAlignment="Center" FontSize="12.5" TextChanged="TxtSearch_TextChanged" />
|
||||
<TextBlock Text="Uygulama veya yayıncı ara..." Foreground="#6B7280" Margin="30,0,0,0" VerticalAlignment="Center" FontSize="12" IsHitTestVisible="False">
|
||||
<TextBlock Text="🔍" FontSize="11" Foreground="{StaticResource BrushTextDim}" Margin="10,0,0,0" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="txtSearch" Background="Transparent" Foreground="{StaticResource BrushTextPrimary}" CaretBrush="{StaticResource BrushAccentBlueLight}" BorderThickness="0" Margin="28,2,10,0" VerticalAlignment="Center" FontSize="12.5" TextChanged="TxtSearch_TextChanged" />
|
||||
<TextBlock Text="Uygulama veya yayıncı ara... (Ctrl+F)" Foreground="{StaticResource BrushTextMuted}" Margin="30,0,0,0" VerticalAlignment="Center" FontSize="12" IsHitTestVisible="False">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
|
|
@ -100,15 +103,15 @@
|
|||
|
||||
<!-- Window Control Buttons (Minimize, Maximize, Close) -->
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button Content="—" Width="32" Height="32" Background="Transparent" Foreground="#9CA3AF" BorderThickness="0" FontSize="12" Cursor="Hand" Click="BtnMinimize_Click" />
|
||||
<Button Content="▢" Width="32" Height="32" Background="Transparent" Foreground="#9CA3AF" BorderThickness="0" FontSize="12" Cursor="Hand" Click="BtnMaximize_Click" />
|
||||
<Button Content="✕" Width="32" Height="32" Background="Transparent" Foreground="#EF4444" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" />
|
||||
<Button Content="—" Width="32" Height="32" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="12" Cursor="Hand" Click="BtnMinimize_Click" />
|
||||
<Button Content="▢" Width="32" Height="32" Background="Transparent" Foreground="{StaticResource BrushTextMuted}" BorderThickness="0" FontSize="12" Cursor="Hand" Click="BtnMaximize_Click" />
|
||||
<Button Content="✕" Width="32" Height="32" Background="Transparent" Foreground="{StaticResource BrushAccentRed}" BorderThickness="0" FontSize="14" Cursor="Hand" Click="BtnClose_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- ================= CONNECTED DRIVES TABS ================= -->
|
||||
<Border x:Name="pnlDriveTabs" Grid.Row="1" Background="#131B2A" Padding="20,8" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}" Visibility="Collapsed">
|
||||
<Border x:Name="pnlDriveTabs" Grid.Row="1" Background="#111419" Padding="20,8" BorderThickness="0,0,0,1" BorderBrush="{StaticResource BrushBorder}" Visibility="Collapsed">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
|
@ -117,15 +120,15 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,14,0">
|
||||
<TextBlock Text="💾 Diskler:" FontSize="12" FontWeight="Bold" Foreground="#94A3B8" VerticalAlignment="Center" />
|
||||
<TextBlock Text="💾 Diskler:" FontSize="12" FontWeight="Bold" Foreground="{StaticResource BrushTextSecondary}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Drive Tabs Container -->
|
||||
<WrapPanel x:Name="wpDriveTabs" Grid.Column="1" VerticalAlignment="Center" Orientation="Horizontal" />
|
||||
|
||||
<!-- Selected Drive Badge -->
|
||||
<Border x:Name="bdDriveSelectedInfo" Grid.Column="2" Background="#1E293B" CornerRadius="6" Padding="10,4" VerticalAlignment="Center">
|
||||
<TextBlock x:Name="txtDriveSelectedInfo" Text="Tüm Diskler" FontSize="11.5" Foreground="#60A5FA" FontWeight="SemiBold" />
|
||||
<Border x:Name="bdDriveSelectedInfo" Grid.Column="2" Background="#14233C" BorderBrush="#2D4675" BorderThickness="1" CornerRadius="6" Padding="10,4" VerticalAlignment="Center">
|
||||
<TextBlock x:Name="txtDriveSelectedInfo" Text="Tüm Diskler" FontSize="11.5" Foreground="{StaticResource BrushAccentBlueLight}" FontWeight="SemiBold" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
@ -151,16 +154,21 @@
|
|||
<RadioButton x:Name="chipAll" Content="Tümü" IsChecked="True" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipDesktop" Content="Masaüstü" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipStore" Content="Windows Store" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipSteam" Content="Steam Oyunları" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipSteam" Content="Steam" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipOrphan" Content="Yetim / Sahipsiz" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipSystem" Content="Sistem Bileşenleri" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipOld" Content="🕒 90+ Gün Kullanılmayanlar" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
<RadioButton x:Name="chipBroken" Content="⚠️ Bozuk Girdiler" Checked="FilterChip_Checked" Style="{StaticResource SidebarNavBtn}" Padding="10,5" Margin="0,0,6,0" FontSize="12" />
|
||||
</WrapPanel>
|
||||
|
||||
<!-- Top Action Buttons -->
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Button x:Name="btnUninstall" Content="🗑️ Kaldır" Style="{StaticResource ModernBtnPrimary}" Margin="0,0,10,0" Click="BtnUninstall_Click" />
|
||||
<Button x:Name="btnUninstall" Content="🗑️ Kaldır" Style="{StaticResource ModernBtnPrimary}" Margin="0,0,8,0" Click="BtnUninstall_Click" />
|
||||
<Button x:Name="btnForceUninstall" Content="💥 Zorla Kaldır" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,8,0" Click="BtnForceUninstall_Click" ToolTip="Kaldırıcıyı çalıştırmadan doğrudan kalıntıları arar ve siler" />
|
||||
<Button x:Name="btnWinget" Content="⚡ Winget" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,8,0" Click="BtnWinget_Click" ToolTip="Winget güncelleme ve kurulum scripti üret" />
|
||||
<Button Content="📤 Dışa Aktar" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,8,0" Click="BtnExport_Click" />
|
||||
<Button Content="🔄 Yenile" Style="{StaticResource ModernBtnSecondary}" Click="BtnRefresh_Click" />
|
||||
<Button Content="🔄 Yenile (F5)" Style="{StaticResource ModernBtnSecondary}" Margin="0,0,8,0" Click="BtnRefresh_Click" />
|
||||
<Button x:Name="btnToggleMiniTreemap" Content="🗺️ Harita" Style="{StaticResource ModernBtnSecondary}" Click="BtnToggleMiniTreemap_Click" ToolTip="Alt disk haritasını göster/gizle" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
|
@ -189,15 +197,16 @@
|
|||
</StackPanel>
|
||||
|
||||
<!-- DataGrid Virtual List -->
|
||||
<DataGrid x:Name="dgApps" Grid.Row="2" Background="Transparent" RowBackground="#131B2A" AlternatingRowBackground="#172236"
|
||||
<DataGrid x:Name="dgApps" Grid.Row="2" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" AutoGenerateColumns="False" CanUserAddRows="False"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="White" FontSize="12.5"
|
||||
IsReadOnly="True" HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12.5"
|
||||
SelectionMode="Extended" EnableRowVirtualization="True" EnableColumnVirtualization="True"
|
||||
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
VirtualizingPanel.ScrollUnit="Pixel" ScrollViewer.CanContentScroll="True">
|
||||
VirtualizingPanel.ScrollUnit="Pixel" ScrollViewer.CanContentScroll="True"
|
||||
MouseDoubleClick="DgApps_MouseDoubleClick">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
|
|
@ -207,8 +216,9 @@
|
|||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Background="#1E293B" Foreground="White">
|
||||
<ContextMenu Background="#181B22" Foreground="{StaticResource BrushTextPrimary}" BorderBrush="{StaticResource BrushBorder}">
|
||||
<MenuItem Header="🗑️ Kaldır" Click="BtnUninstall_Click" />
|
||||
<MenuItem Header="💥 Zorla Kaldır (Kalıntıları Temizle)" Click="BtnForceUninstall_Click" />
|
||||
<Separator Background="{StaticResource BrushBorder}" />
|
||||
<MenuItem Header="📁 Kurulum Klasörünü Aç" Click="MenuOpenFolder_Click" />
|
||||
<MenuItem Header="🔑 Kayıt Defterinde Aç" Click="MenuOpenReg_Click" />
|
||||
|
|
@ -224,7 +234,7 @@
|
|||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Uygulama Adı" Width="300">
|
||||
<DataGridTemplateColumn Header="Uygulama Adı" Width="280">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
|
|
@ -254,30 +264,31 @@
|
|||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Yayıncı" Binding="{Binding Publisher}" Width="180" />
|
||||
<DataGridTextColumn Header="Sürüm" Binding="{Binding DisplayVersion}" Width="100" />
|
||||
<DataGridTemplateColumn Header="Boyut" Width="105">
|
||||
<DataGridTextColumn Header="Yayıncı" Binding="{Binding Publisher}" Width="160" />
|
||||
<DataGridTextColumn Header="Sürüm" Binding="{Binding DisplayVersion}" Width="90" />
|
||||
<DataGridTemplateColumn Header="Boyut" SortMemberPath="EstimatedSize.Bytes" Width="100">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="#1E293B" CornerRadius="4" Padding="6,2" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{Binding EstimatedSize}" FontWeight="SemiBold" FontSize="11.5" Foreground="#60A5FA" />
|
||||
<Border Background="#14233C" BorderBrush="#263A5E" BorderThickness="1" CornerRadius="4" Padding="6,2" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{Binding EstimatedSize}" FontWeight="SemiBold" FontSize="11.5" Foreground="{StaticResource BrushAccentBlueLight}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Kaldırıcı Türü" Binding="{Binding UninstallerKind}" Width="120" />
|
||||
<DataGridTemplateColumn Header="Sertifika" Width="110">
|
||||
<DataGridTextColumn Header="Kurulum Tarihi" Binding="{Binding InstallDateDisplay}" SortMemberPath="InstallDate" Width="105" />
|
||||
<DataGridTextColumn Header="Kaldırıcı Türü" Binding="{Binding UninstallerKindDisplay}" Width="130" />
|
||||
<DataGridTemplateColumn Header="Sertifika" Width="100">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock VerticalAlignment="Center" FontSize="11.5">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="—" />
|
||||
<Setter Property="Foreground" Value="#6B7280" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextDim}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsCertificateValid}" Value="True">
|
||||
<Setter Property="Text" Value="✓ Doğrulandı" />
|
||||
<Setter Property="Foreground" Value="#34D399" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushAccentGreen}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
|
|
@ -291,10 +302,10 @@
|
|||
</DataGrid>
|
||||
|
||||
<!-- Collapsible Bottom Treemap Preview -->
|
||||
<Border x:Name="pnlMiniTreemap" Grid.Row="3" Height="140" Margin="0,10,0,0" CornerRadius="8" Background="#161E2E" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" ClipToBounds="True">
|
||||
<Border x:Name="pnlMiniTreemap" Grid.Row="3" Height="140" Margin="0,10,0,0" CornerRadius="8" Background="#14171E" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" ClipToBounds="True">
|
||||
<Grid>
|
||||
<controls:WpfSquarifiedTreeMap x:Name="miniTreeMap" />
|
||||
<Button Content="✕" Width="24" Height="24" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="6" Background="#263449" Foreground="White" BorderThickness="0" Cursor="Hand" Click="BtnHideMiniTreemap_Click" />
|
||||
<Button Content="✕" Width="24" Height="24" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="6" Background="#242B38" Foreground="White" BorderThickness="0" Cursor="Hand" Click="BtnHideMiniTreemap_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
@ -306,8 +317,8 @@
|
|||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="Disk Kullanımı Squarified Ağaç Haritası (Boyuta Göre Görsel Dağılım)" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,12" />
|
||||
<Border Grid.Row="1" CornerRadius="10" Background="#161E2E" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" ClipToBounds="True">
|
||||
<TextBlock Text="Disk Kullanımı Squarified Ağaç Haritası (Boyuta Göre Görsel Dağılım)" FontSize="15" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" Margin="0,0,0,12" />
|
||||
<Border Grid.Row="1" CornerRadius="10" Background="#14171E" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" ClipToBounds="True">
|
||||
<controls:WpfSquarifiedTreeMap x:Name="fullTreeMap" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
@ -320,19 +331,32 @@
|
|||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="0,0,0,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Windows Başlangıç Uygulamaları ve Servisleri" FontSize="15" FontWeight="SemiBold" />
|
||||
<TextBlock Text="Windows 10/11 StartupApproved standardı ile programlar silinmeden güvenle kapatılabilir." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
<TextBlock Text="Windows Başlangıç Uygulamaları ve Servisleri" FontSize="15" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Windows StartupApproved ve Görev Zamanlayıcı kayıtları güvenle açılıp kapatılabilir." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button Content="Durumu Değiştir (Aç/Kapat)" Style="{StaticResource ModernBtnPrimary}" HorizontalAlignment="Right" Click="BtnToggleStartup_Click" />
|
||||
|
||||
<Border Grid.Column="1" Background="#171A21" CornerRadius="6" Width="220" Height="30" Margin="0,0,12,0" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<TextBlock Text="🔍" FontSize="11" Foreground="{StaticResource BrushTextDim}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
<TextBox x:Name="txtStartupSearch" Background="Transparent" Foreground="{StaticResource BrushTextPrimary}" BorderThickness="0" Margin="26,2,6,0" VerticalAlignment="Center" FontSize="12" TextChanged="TxtStartupSearch_TextChanged" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Button Grid.Column="2" Content="Durumu Değiştir (Aç/Kapat)" Style="{StaticResource ModernBtnPrimary}" VerticalAlignment="Center" Click="BtnToggleStartup_Click" />
|
||||
</Grid>
|
||||
|
||||
<DataGrid x:Name="dgStartup" Grid.Row="1" Background="Transparent" RowBackground="#131B2A" AlternatingRowBackground="#172236"
|
||||
<DataGrid x:Name="dgStartup" Grid.Row="1" Background="Transparent" RowBackground="#13161D" AlternatingRowBackground="#171A22"
|
||||
BorderThickness="1" BorderBrush="{StaticResource BrushBorder}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True"
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="White" FontSize="12.5">
|
||||
HeadersVisibility="Column" GridLinesVisibility="None" Foreground="{StaticResource BrushTextPrimary}" FontSize="12.5">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#1B1F28" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextSecondary}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
|
|
@ -347,13 +371,15 @@
|
|||
<DataGridTemplateColumn Header="Durum" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="5" Padding="8,3" HorizontalAlignment="Left">
|
||||
<Border CornerRadius="5" Padding="8,3" HorizontalAlignment="Left" BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="#1E293B" />
|
||||
<Setter Property="Background" Value="#171A21" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsEnabled}" Value="True">
|
||||
<Setter Property="Background" Value="#064E3B" />
|
||||
<Setter Property="Background" Value="#0D2E26" />
|
||||
<Setter Property="BorderBrush" Value="#10B981" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
|
@ -362,11 +388,11 @@
|
|||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="Devre Dışı" />
|
||||
<Setter Property="Foreground" Value="#9CA3AF" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextMuted}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsEnabled}" Value="True">
|
||||
<Setter Property="Text" Value="Etkin" />
|
||||
<Setter Property="Foreground" Value="#34D399" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushAccentGreen}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
|
@ -390,43 +416,158 @@
|
|||
|
||||
<Grid Grid.Row="0" Margin="0,0,0,15">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Windows Telemetri ve Performans İnce Ayarları" FontSize="15" FontWeight="SemiBold" />
|
||||
<TextBlock Text="Windows Telemetri ve Performans İnce Ayarları" FontSize="15" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Gereksiz arka plan telemetri servislerini, Cortana aramalarını ve otomatik sponsorlu yazılımları kapatın." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button Content="Tüm Önerilenleri Uygula" Style="{StaticResource ModernBtnPrimary}" HorizontalAlignment="Right" Click="BtnApplyAllDebloat_Click" />
|
||||
</Grid>
|
||||
|
||||
<ItemsControl x:Name="icDebloat" Grid.Row="1">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="#161E2E" CornerRadius="8" Padding="18,14" Margin="0,0,0,10" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
||||
<TextBlock Text="{Binding Title}" FontSize="13.5" FontWeight="Bold" Foreground="White" />
|
||||
<Border Background="#1E293B" CornerRadius="4" Padding="6,2" Margin="10,0,0,0">
|
||||
<TextBlock Text="{Binding Category}" FontSize="10.5" Foreground="#60A5FA" />
|
||||
</Border>
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl x:Name="icDebloat">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,10" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,4">
|
||||
<TextBlock Text="{Binding Title}" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<Border Background="#14233C" BorderBrush="#263A5E" BorderThickness="1" CornerRadius="4" Padding="6,2" Margin="10,0,0,0">
|
||||
<TextBlock Text="{Binding Category}" FontSize="10.5" Foreground="{StaticResource BrushAccentBlueLight}" />
|
||||
</Border>
|
||||
<Border CornerRadius="4" Padding="6,2" Margin="8,0,0,0" BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="#171A21" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrushBorder}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsApplied}" Value="True">
|
||||
<Setter Property="Background" Value="#0D2E26" />
|
||||
<Setter Property="BorderBrush" Value="#10B981" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock FontSize="10.5" FontWeight="SemiBold">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="Devre Dışı" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushTextMuted}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsApplied}" Value="True">
|
||||
<Setter Property="Text" Value="✓ Uygulandı" />
|
||||
<Setter Property="Foreground" Value="{StaticResource BrushAccentGreen}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding Description}" FontSize="12" Foreground="{StaticResource BrushTextSecondary}" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding Description}" FontSize="12" Foreground="{StaticResource BrushTextSecondary}" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="1" Content="Uygula / Değiştir" Style="{StaticResource ModernBtnSecondary}" VerticalAlignment="Center" Tag="{Binding}" Click="BtnToggleDebloatItem_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Button Grid.Column="1" Content="Uygula / Değiştir" Style="{StaticResource ModernBtnSecondary}" VerticalAlignment="Center" Tag="{Binding}" Click="BtnToggleDebloatItem_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<!-- ================= VIEW 5: TOOLS & DIAGNOSTICS ================= -->
|
||||
<Grid x:Name="viewTools" Grid.Row="2" Margin="20,16,20,10" Visibility="Collapsed">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="0,0,10,0">
|
||||
<TextBlock Text="LD Uninstaller Sistem Araçları ve Yardımcılar" FontSize="16" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" Margin="0,0,0,4" />
|
||||
<TextBlock Text="Sistem temizliğini kolaylaştıran gelişmiş modüller, yedekleme merkezi ve tanı araçları." FontSize="12.5" Foreground="{StaticResource BrushTextSecondary}" Margin="0,0,0,18" />
|
||||
|
||||
<!-- Tool 1: Shell Integration -->
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,12" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Gezgin (Explorer) Sağ Tık Menüsü Entegrasyonu" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Masaüstü ve klasörlerdeki .exe ve kısayol (.lnk) dosyalarına sağ tıklandığında 'LD Uninstaller ile Kaldır' seçeneğini gösterir." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button x:Name="btnToggleShell" Grid.Column="1" Content="Aktif Et" Style="{StaticResource ModernBtnSecondary}" VerticalAlignment="Center" Click="BtnToggleShell_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Tool 2: Backup & Exclusion Center -->
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,12" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Yedekleme ve Koruma (Exclusion) Merkezi" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Kayıt defterinden silinen tüm .reg yedeklerini yönetin, tek tıkla geri yükleyin veya silinmesini istemediğiniz klasörleri korumaya alın." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button Content="Yedekleri Yönet" Style="{StaticResource ModernBtnPrimary}" Grid.Column="1" VerticalAlignment="Center" Click="BtnOpenBackups_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Tool 3: Clean Broken Entries -->
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,12" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Bozuk ve Eksik Kayıt Defteri Girdilerini Temizle" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Kaldırıcısı veya hedef klasörü diskte artık var olmayan hayalet (ghost) kayıt defteri girdilerini tespit eder ve temizler." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button Content="Bozuk Girdileri Bul" Style="{StaticResource ModernBtnSecondary}" Grid.Column="1" VerticalAlignment="Center" Click="BtnCleanBrokenEntries_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Tool 4: Log Viewer -->
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,12" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Sistem ve İşlem Günlüğü (Log Görüntüleyici)" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock Text="Arka planda gerçekleşen tarama, kaldırma, kilit çözme ve hata adımlarını gerçek zamanlı inceleyin." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button Content="Logları Göster" Style="{StaticResource ModernBtnSecondary}" Grid.Column="1" VerticalAlignment="Center" Click="BtnOpenLogs_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Tool 5: Update Checker -->
|
||||
<Border Background="#161921" CornerRadius="8" Padding="18,14" Margin="0,0,0,12" BorderThickness="1" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Sürüm ve Güncelleme Denetimi" FontSize="13.5" FontWeight="Bold" Foreground="{StaticResource BrushTextPrimary}" />
|
||||
<TextBlock x:Name="txtUpdateStatus" Text="Sunucudan en son sürüm bilgisini sorgulayın." FontSize="12" Foreground="{StaticResource BrushTextSecondary}" Margin="0,3,0,0" />
|
||||
</StackPanel>
|
||||
<Button x:Name="btnCheckUpdate" Content="Güncellemeleri Denetle" Style="{StaticResource ModernBtnSecondary}" Grid.Column="1" VerticalAlignment="Center" Click="BtnCheckUpdate_Click" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<!-- ================= BOTTOM STATUS BAR ================= -->
|
||||
<Border Grid.Row="3" Background="{StaticResource BrushBgSidebar}" Padding="20,0" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BrushBorder}">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<TextBlock x:Name="txtFooterStatus" Text="Hazır." FontSize="11.5" Foreground="{StaticResource BrushTextMuted}" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtFooterStats" Text="231 Uygulama | 184.2 GB Toplam Boyut" FontSize="11.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextSecondary}" HorizontalAlignment="Right" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="txtFooterStats" Text="" FontSize="11.5" FontWeight="SemiBold" Foreground="{StaticResource BrushTextSecondary}" HorizontalAlignment="Right" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ using LDUninstaller.Core.Discovery;
|
|||
using LDUninstaller.Core.InfoAdders;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Models;
|
||||
using LDUninstaller.Core.Services;
|
||||
using LDUninstaller.Core.Startup;
|
||||
using LDUninstaller.Core.Tweaks;
|
||||
using LDUninstaller.UI.Dialogs;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace LDUninstaller.UI
|
||||
{
|
||||
|
|
@ -25,9 +27,10 @@ namespace LDUninstaller.UI
|
|||
{
|
||||
private List<ApplicationUninstallerEntry> _allEntries = new();
|
||||
private List<ApplicationUninstallerEntry> _filteredEntries = new();
|
||||
private readonly HashSet<ApplicationUninstallerEntry> _selectedApps = new();
|
||||
private List<StartupEntry> _allStartupEntries = new();
|
||||
private List<DrivePartitionInfo> _allDrives = new();
|
||||
private string? _selectedDriveFilter = null;
|
||||
|
||||
private readonly System.Windows.Threading.DispatcherTimer _searchDebounceTimer = new()
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(160)
|
||||
|
|
@ -35,15 +38,13 @@ namespace LDUninstaller.UI
|
|||
|
||||
public MainWindow()
|
||||
{
|
||||
TraceLog("1. MainWindow ctor");
|
||||
App.Log("MainWindow ctor initialized.");
|
||||
InitializeComponent();
|
||||
|
||||
var ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
var ver = typeof(MainWindow).Assembly.GetName().Version;
|
||||
if (ver != null && txtAppVersion != null)
|
||||
txtAppVersion.Text = $"v{ver.Major}.{ver.Minor}.{ver.Build}";
|
||||
|
||||
Closing += (s, e) => TraceLog($"WINDOW CLOSING! Reason: {e.Cancel}");
|
||||
Closed += (s, e) => TraceLog("WINDOW CLOSED!");
|
||||
Loaded += MainWindow_Loaded;
|
||||
|
||||
_searchDebounceTimer.Tick += (s, e) =>
|
||||
|
|
@ -54,7 +55,8 @@ namespace LDUninstaller.UI
|
|||
|
||||
miniTreeMap.OnItemSelected += SelectAppFromTreemap;
|
||||
fullTreeMap.OnItemSelected += SelectAppFromTreemap;
|
||||
TraceLog($"2. MainWindow ctor finished, Icon={this.Icon}");
|
||||
|
||||
UpdateShellButtonText();
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
|
|
@ -114,37 +116,42 @@ namespace LDUninstaller.UI
|
|||
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern int ExtractIconEx(string lpszFile, int nIconIndex, out IntPtr phiconLarge, out IntPtr phiconSmall, int nIcons);
|
||||
|
||||
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Log("MainWindow_Loaded started.");
|
||||
try
|
||||
{
|
||||
await RefreshDataAsync();
|
||||
_ = LoadStartupEntriesAsync();
|
||||
_ = LoadDebloatTweaksAsync();
|
||||
_ = SilentUpdateCheckAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.Log($"LOADED EXCEPTION: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void TraceLog(string msg)
|
||||
private async Task SilentUpdateCheckAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "trace.log");
|
||||
File.AppendAllText(path, $"[{DateTime.Now:HH:mm:ss.fff}] {msg}\n");
|
||||
var currentVer = typeof(MainWindow).Assembly.GetName().Version ?? new Version(2, 8, 0);
|
||||
var update = await UpdateChecker.CheckForUpdatesAsync(currentVer);
|
||||
if (update != null && update.HasUpdate)
|
||||
{
|
||||
txtUpdateStatus.Text = $"Yeni LD Uninstaller sürümü mevcut: v{update.LatestVersion}";
|
||||
btnCheckUpdate.Content = "🔥 Şimdi İndir";
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TraceLog("3. MainWindow_Loaded start");
|
||||
try
|
||||
{
|
||||
await RefreshDataAsync();
|
||||
TraceLog("4. RefreshDataAsync finished");
|
||||
_ = LoadStartupEntriesAsync();
|
||||
_ = LoadDebloatTweaksAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLog($"LOADED EXCEPTION: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RefreshDataAsync()
|
||||
{
|
||||
TraceLog("RefreshDataAsync: DiscoverAllAsync starting");
|
||||
App.Log("RefreshDataAsync starting.");
|
||||
txtFooterStatus.Text = "Sistemdeki tüm yazılımlar taranıyor...";
|
||||
txtFooterStats.Text = "Yükleniyor...";
|
||||
|
||||
var pipeline = new DiscoveryPipeline();
|
||||
pipeline.OnProgress += (msg, pct) =>
|
||||
|
|
@ -153,7 +160,7 @@ namespace LDUninstaller.UI
|
|||
};
|
||||
|
||||
var list = await pipeline.DiscoverAllAsync();
|
||||
TraceLog($"RefreshDataAsync: DiscoverAllAsync returned {list.Count} items");
|
||||
App.Log($"DiscoverAllAsync found {list.Count} items.");
|
||||
|
||||
txtFooterStatus.Text = "Eksik bilgiler, boyutlar ve sertifikalar tamamlanıyor...";
|
||||
await Task.Run(() =>
|
||||
|
|
@ -161,23 +168,20 @@ namespace LDUninstaller.UI
|
|||
var adder = new InfoAdderManager();
|
||||
adder.ProcessAll(list);
|
||||
});
|
||||
TraceLog("RefreshDataAsync: ProcessAll finished");
|
||||
|
||||
_allEntries = list;
|
||||
_selectedApps.Clear();
|
||||
_allDrives = DriveAnalyzer.AnalyzeDrives(_allEntries);
|
||||
UpdateDriveTabs();
|
||||
ApplyFilter();
|
||||
TraceLog("RefreshDataAsync: ApplyFilter finished");
|
||||
|
||||
txtFooterStatus.Text = "Tarama tamamlandı. Sistem hazır.";
|
||||
App.Log("RefreshDataAsync completed.");
|
||||
}
|
||||
|
||||
private void UpdateDriveTabs()
|
||||
{
|
||||
if (wpDriveTabs == null || pnlDriveTabs == null) return;
|
||||
|
||||
// Only show drive tabs if there is more than 1 drive
|
||||
if (_allDrives.Count <= 1)
|
||||
{
|
||||
pnlDriveTabs.Visibility = Visibility.Collapsed;
|
||||
|
|
@ -188,10 +192,6 @@ namespace LDUninstaller.UI
|
|||
pnlDriveTabs.Visibility = Visibility.Visible;
|
||||
wpDriveTabs.Children.Clear();
|
||||
|
||||
// 1. "Tüm Diskler" Tab
|
||||
long totalUsed = _allDrives.Sum(d => d.UsedBytes);
|
||||
long totalCap = _allDrives.Sum(d => d.TotalBytes);
|
||||
|
||||
var rbAll = new RadioButton
|
||||
{
|
||||
Content = $"🌐 Tüm Diskler ({_allDrives.Count} Sürücü)",
|
||||
|
|
@ -208,7 +208,6 @@ namespace LDUninstaller.UI
|
|||
};
|
||||
wpDriveTabs.Children.Add(rbAll);
|
||||
|
||||
// 2. Each Connected Drive Tab
|
||||
foreach (var drive in _allDrives)
|
||||
{
|
||||
var rb = new RadioButton
|
||||
|
|
@ -242,10 +241,13 @@ namespace LDUninstaller.UI
|
|||
bool onlySteam = chipSteam?.IsChecked == true;
|
||||
bool onlyOrphan = chipOrphan?.IsChecked == true;
|
||||
bool onlySystem = chipSystem?.IsChecked == true;
|
||||
bool onlyOld = chipOld?.IsChecked == true;
|
||||
bool onlyBroken = chipBroken?.IsChecked == true;
|
||||
|
||||
var ninetyDaysAgo = DateTime.Now.AddDays(-90);
|
||||
|
||||
_filteredEntries = _allEntries.Where(app =>
|
||||
{
|
||||
// Drive filter (C:, D:, etc.)
|
||||
if (!string.IsNullOrEmpty(_selectedDriveFilter))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(app.InstallLocation)) return false;
|
||||
|
|
@ -271,6 +273,24 @@ namespace LDUninstaller.UI
|
|||
if (onlyOrphan && !app.IsOrphaned) return false;
|
||||
if (onlySystem && !app.SystemComponent && !app.IsUpdate) return false;
|
||||
|
||||
// F9: 90+ gün kullanılmayanlar
|
||||
if (onlyOld)
|
||||
{
|
||||
bool isOldDate = app.InstallDate > DateTime.MinValue.AddYears(1) && app.InstallDate < ninetyDaysAgo;
|
||||
bool isOldDir = false;
|
||||
if (!string.IsNullOrEmpty(app.InstallLocation) && Directory.Exists(app.InstallLocation))
|
||||
{
|
||||
try { isOldDir = Directory.GetLastWriteTime(app.InstallLocation) < ninetyDaysAgo; } catch { }
|
||||
}
|
||||
if (!isOldDate && !isOldDir) return false;
|
||||
}
|
||||
|
||||
// F11: Bozuk girdiler
|
||||
if (onlyBroken)
|
||||
{
|
||||
if (!IsBrokenEntry(app)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}).ToList();
|
||||
|
||||
|
|
@ -279,36 +299,57 @@ namespace LDUninstaller.UI
|
|||
fullTreeMap.SetData(_filteredEntries);
|
||||
|
||||
long totalBytes = _filteredEntries.Sum(x => x.EstimatedSize.Bytes);
|
||||
int selectedCount = _filteredEntries.Count(x => x.IsSelected);
|
||||
long selectedBytes = _filteredEntries.Where(x => x.IsSelected).Sum(x => x.EstimatedSize.Bytes);
|
||||
|
||||
string statsPrefix = selectedCount > 0
|
||||
? $"{selectedCount} Seçildi ({FileSize.FromBytes(selectedBytes)}) | "
|
||||
: "";
|
||||
|
||||
if (!string.IsNullOrEmpty(_selectedDriveFilter))
|
||||
{
|
||||
var drive = _allDrives.FirstOrDefault(d => string.Equals(d.DriveLetter, _selectedDriveFilter, StringComparison.OrdinalIgnoreCase));
|
||||
if (drive != null)
|
||||
{
|
||||
txtFooterStats.Text = $"{drive.DisplayTitle} | {_filteredEntries.Count} Uygulama ({FileSize.FromBytes(totalBytes)}) | {FileSize.FromBytes(drive.FreeBytes)} Boş Alan";
|
||||
txtFooterStats.Text = $"{statsPrefix}{drive.DisplayTitle} | {_filteredEntries.Count} Uygulama ({FileSize.FromBytes(totalBytes)}) | {FileSize.FromBytes(drive.FreeBytes)} Boş Alan";
|
||||
if (txtDriveSelectedInfo != null)
|
||||
txtDriveSelectedInfo.Text = $"{drive.DisplayTitle}: {drive.DisplayStats}";
|
||||
}
|
||||
else
|
||||
{
|
||||
txtFooterStats.Text = $"{_filteredEntries.Count} Uygulama | {FileSize.FromBytes(totalBytes)} Toplam Boyut";
|
||||
txtFooterStats.Text = $"{statsPrefix}{_filteredEntries.Count} Uygulama | {FileSize.FromBytes(totalBytes)} Toplam Boyut";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_allDrives.Count > 1)
|
||||
txtFooterStats.Text = $"{statsPrefix}{_filteredEntries.Count} Uygulama | {FileSize.FromBytes(totalBytes)} Toplam Boyut";
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsBrokenEntry(ApplicationUninstallerEntry app)
|
||||
{
|
||||
if (app.UninstallerKind == UninstallerType.StoreApp) return false;
|
||||
|
||||
bool uninstallStringMissing = string.IsNullOrWhiteSpace(app.UninstallString);
|
||||
bool exeMissing = false;
|
||||
|
||||
if (!uninstallStringMissing)
|
||||
{
|
||||
string cmd = app.UninstallString.Trim();
|
||||
if (cmd.StartsWith("\""))
|
||||
{
|
||||
long totalUsedAll = _allDrives.Sum(d => d.UsedBytes);
|
||||
long totalCapAll = _allDrives.Sum(d => d.TotalBytes);
|
||||
txtFooterStats.Text = $"{_filteredEntries.Count} Uygulama | {FileSize.FromBytes(totalBytes)} Toplam Boyut | {_allDrives.Count} Sürücü";
|
||||
if (txtDriveSelectedInfo != null)
|
||||
txtDriveSelectedInfo.Text = $"Tüm Sürücüler ({FileSize.FromBytes(totalUsedAll)} / {FileSize.FromBytes(totalCapAll)})";
|
||||
}
|
||||
else
|
||||
{
|
||||
txtFooterStats.Text = $"{_filteredEntries.Count} Uygulama | {FileSize.FromBytes(totalBytes)} Toplam Boyut";
|
||||
int endQuote = cmd.IndexOf('\"', 1);
|
||||
if (endQuote > 0)
|
||||
{
|
||||
string exe = cmd.Substring(1, endQuote - 1);
|
||||
if (!File.Exists(exe) && !exe.Contains("msiexec", StringComparison.OrdinalIgnoreCase))
|
||||
exeMissing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool folderMissing = string.IsNullOrWhiteSpace(app.InstallLocation) || !Directory.Exists(app.InstallLocation);
|
||||
return (uninstallStringMissing || exeMissing) && folderMissing && !string.IsNullOrWhiteSpace(app.RegistryPath);
|
||||
}
|
||||
|
||||
private void SelectAppFromTreemap(ApplicationUninstallerEntry app)
|
||||
|
|
@ -323,16 +364,25 @@ namespace LDUninstaller.UI
|
|||
_searchDebounceTimer.Stop();
|
||||
_searchDebounceTimer.Start();
|
||||
}
|
||||
|
||||
private void FilterChip_Checked(object sender, RoutedEventArgs e) => ApplyFilter();
|
||||
|
||||
private void Nav_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (viewApps == null) return;
|
||||
|
||||
if (navBackups?.IsChecked == true)
|
||||
{
|
||||
navApps.IsChecked = true;
|
||||
BtnOpenBackups_Click(sender, e);
|
||||
return;
|
||||
}
|
||||
|
||||
viewApps.Visibility = navApps.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
|
||||
viewTreemap.Visibility = navTreemap.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
|
||||
viewStartup.Visibility = navStartup.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
|
||||
viewDebloat.Visibility = navDebloat.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
|
||||
viewTools.Visibility = navTools?.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private List<ApplicationUninstallerEntry> GetSelectedOrCurrentApps()
|
||||
|
|
@ -361,16 +411,16 @@ namespace LDUninstaller.UI
|
|||
var dlg = new BulkWizardWindow(targets) { Owner = this };
|
||||
bool? result = dlg.ShowDialog();
|
||||
|
||||
if (result == true)
|
||||
if (result == true && dlg.UninstalledApps.Count > 0)
|
||||
{
|
||||
txtFooterStatus.Text = "Kaldırma tamamlandı. Kalıntılar taranıyor...";
|
||||
|
||||
var jm = new JunkManager();
|
||||
var junks = await Task.Run(() => jm.ScanMultiple(targets));
|
||||
var junks = await Task.Run(() => jm.ScanMultiple(dlg.UninstalledApps));
|
||||
|
||||
var titleEntry = targets.Count == 1
|
||||
? targets[0]
|
||||
: new ApplicationUninstallerEntry { DisplayName = $"{targets.Count} Kaldırılan Yazılım" };
|
||||
var titleEntry = dlg.UninstalledApps.Count == 1
|
||||
? dlg.UninstalledApps[0]
|
||||
: new ApplicationUninstallerEntry { DisplayName = $"{dlg.UninstalledApps.Count} Kaldırılan Yazılım" };
|
||||
|
||||
var cleanWin = new LeftoverCleanWindow(titleEntry, junks)
|
||||
{
|
||||
|
|
@ -379,15 +429,103 @@ namespace LDUninstaller.UI
|
|||
};
|
||||
|
||||
cleanWin.ShowDialog();
|
||||
await RefreshDataAsync();
|
||||
|
||||
// F12: Rapor oluştur
|
||||
ReportService.GenerateHtmlReport(dlg.UninstalledApps, junks, JunkManager.BackupDirectory);
|
||||
|
||||
// P6: Hızlı bellek içi güncelleme
|
||||
foreach (var uninstalled in dlg.UninstalledApps)
|
||||
{
|
||||
_allEntries.Remove(uninstalled);
|
||||
}
|
||||
|
||||
ApplyFilter();
|
||||
txtFooterStatus.Text = $"{dlg.UninstalledApps.Count} yazılım başarıyla kaldırıldı ve kalıntılar temizlendi.";
|
||||
}
|
||||
}
|
||||
|
||||
// F3: Zorla Kaldır (Force Uninstall)
|
||||
private async void BtnForceUninstall_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var targets = GetSelectedOrCurrentApps();
|
||||
if (targets.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Lütfen zorla kaldırmak istediğiniz yazılımı seçin.", "Yazılım Seçilmedi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var confirm = MessageBox.Show(
|
||||
$"Seçilen {targets.Count} uygulama için orijinal kaldırıcı çalıştırılmayacak;\ndoğrudan tüm disk ve kayıt defteri kalıntıları taranıp temizlenecektir.\n\nDevam edilsin mi?",
|
||||
"Zorla Kaldırma Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
if (confirm != MessageBoxResult.Yes) return;
|
||||
|
||||
txtFooterStatus.Text = "Kalıntılar taranıyor...";
|
||||
var jm = new JunkManager();
|
||||
var junks = await Task.Run(() => jm.ScanMultiple(targets));
|
||||
|
||||
var titleEntry = targets.Count == 1 ? targets[0] : new ApplicationUninstallerEntry { DisplayName = $"{targets.Count} Uygulama" };
|
||||
var cleanWin = new LeftoverCleanWindow(titleEntry, junks) { Owner = this };
|
||||
cleanWin.ShowDialog();
|
||||
|
||||
// Kayıt defteri anahtarını temizle
|
||||
foreach (var app in targets)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(app.RegistryPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
var (hive, subKey, view) = RegistryJunkResult.ParseRegistryPath(app.RegistryPath);
|
||||
using var baseKey = RegistryKey.OpenBaseKey(hive, view);
|
||||
baseKey.DeleteSubKeyTree(subKey, false);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
_allEntries.Remove(app);
|
||||
}
|
||||
|
||||
ReportService.GenerateHtmlReport(targets, junks, JunkManager.BackupDirectory);
|
||||
ApplyFilter();
|
||||
txtFooterStatus.Text = $"{targets.Count} uygulama zorla temizlendi.";
|
||||
}
|
||||
|
||||
// F5: Winget Entegrasyonu
|
||||
private void BtnWinget_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "Batch Dosyası (*.bat)|*.bat|JSON Paketi (*.json)|*.json",
|
||||
FileName = $"winget_install_bundle_{DateTime.Now:yyyyMMdd}"
|
||||
};
|
||||
|
||||
if (sfd.ShowDialog() == true)
|
||||
{
|
||||
try
|
||||
{
|
||||
string content = WingetService.GenerateWingetExportScript(_allEntries);
|
||||
File.WriteAllText(sfd.FileName, content);
|
||||
MessageBox.Show(
|
||||
$"Winget toplu kurulum scripti oluşturuldu:\n{sfd.FileName}\n\nYeni bir bilgisayarda bu scripti çalıştırarak yüklü yazılımlarınızı otomatik kurabilirsiniz.",
|
||||
"Winget Scripti Hazır",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Script oluşturulamadı: {ex.Message}", "Hata", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// B28: Escaped RFC 4180 CSV export
|
||||
private void BtnExport_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var sfd = new Microsoft.Win32.SaveFileDialog
|
||||
var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "JSON Dosyası (*.json)|*.json|CSV Dosyası (*.csv)|*.csv|BCU Listesi (*.bcul)|*.bcul",
|
||||
Filter = "CSV Dosyası (*.csv)|*.csv|JSON Dosyası (*.json)|*.json",
|
||||
FileName = $"installed_apps_{DateTime.Now:yyyyMMdd}"
|
||||
};
|
||||
|
||||
|
|
@ -400,16 +538,18 @@ namespace LDUninstaller.UI
|
|||
{
|
||||
File.WriteAllText(sfd.FileName, JsonSerializer.Serialize(_allEntries, new JsonSerializerOptions { WriteIndented = true }));
|
||||
}
|
||||
else if (ext == ".csv")
|
||||
{
|
||||
using var sw = new StreamWriter(sfd.FileName);
|
||||
sw.WriteLine("DisplayName,Publisher,DisplayVersion,EstimatedSize,UninstallerKind");
|
||||
foreach (var a in _allEntries)
|
||||
sw.WriteLine($"\"{a.DisplayName}\",\"{a.Publisher}\",\"{a.DisplayVersion}\",\"{a.EstimatedSize}\",\"{a.UninstallerKind}\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllLines(sfd.FileName, _allEntries.Select(a => a.DisplayName));
|
||||
using var sw = new StreamWriter(sfd.FileName, false, System.Text.Encoding.UTF8);
|
||||
sw.WriteLine("DisplayName,Publisher,DisplayVersion,EstimatedSizeBytes,InstallDate,UninstallerKind");
|
||||
foreach (var a in _allEntries)
|
||||
{
|
||||
string name = EscapeCsv(a.DisplayName);
|
||||
string pub = EscapeCsv(a.Publisher);
|
||||
string ver = EscapeCsv(a.DisplayVersion);
|
||||
string kind = EscapeCsv(a.UninstallerKind.ToString());
|
||||
sw.WriteLine($"\"{name}\",\"{pub}\",\"{ver}\",{a.EstimatedSize.Bytes},\"{a.InstallDateDisplay}\",\"{kind}\"");
|
||||
}
|
||||
}
|
||||
MessageBox.Show("Yazılım listesi başarıyla kaydedildi.", "Dışa Aktarma Başarılı", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
|
@ -420,8 +560,18 @@ namespace LDUninstaller.UI
|
|||
}
|
||||
}
|
||||
|
||||
private static string EscapeCsv(string? val) =>
|
||||
(val ?? "").Replace("\"", "\"\"");
|
||||
|
||||
private async void BtnRefresh_Click(object sender, RoutedEventArgs e) => await RefreshDataAsync();
|
||||
|
||||
private void BtnToggleMiniTreemap_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
pnlMiniTreemap.Visibility = pnlMiniTreemap.Visibility == Visibility.Visible
|
||||
? Visibility.Collapsed
|
||||
: Visibility.Visible;
|
||||
}
|
||||
|
||||
private void BtnHideMiniTreemap_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
pnlMiniTreemap.Visibility = Visibility.Collapsed;
|
||||
|
|
@ -436,8 +586,20 @@ namespace LDUninstaller.UI
|
|||
}
|
||||
}
|
||||
|
||||
// U11: Kayıt defterinde tam anahtarı aç
|
||||
private void MenuOpenReg_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var targets = GetSelectedOrCurrentApps();
|
||||
if (targets.Count > 0 && !string.IsNullOrWhiteSpace(targets[0].RegistryPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
string targetKey = targets[0].RegistryPath.Replace("HKLM_32", "HKEY_LOCAL_MACHINE").Replace("HKLM", "HKEY_LOCAL_MACHINE").Replace("HKCU", "HKEY_CURRENT_USER");
|
||||
using var regKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit");
|
||||
regKey?.SetValue("LastKey", $"Computer\\{targetKey}");
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
Process.Start("regedit.exe");
|
||||
}
|
||||
|
||||
|
|
@ -451,11 +613,63 @@ namespace LDUninstaller.UI
|
|||
}
|
||||
}
|
||||
|
||||
// U14: Klavye kısayolları ve çift tıklama
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Delete && viewApps.Visibility == Visibility.Visible)
|
||||
{
|
||||
BtnUninstall_Click(sender, e);
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.Key == Key.F5)
|
||||
{
|
||||
_ = RefreshDataAsync();
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.Key == Key.F && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
|
||||
{
|
||||
txtSearch?.Focus();
|
||||
txtSearch?.SelectAll();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DgApps_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (dgApps.SelectedItem is ApplicationUninstallerEntry)
|
||||
{
|
||||
BtnUninstall_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Startup Tab Handlers
|
||||
private async Task LoadStartupEntriesAsync()
|
||||
{
|
||||
var entries = await Task.Run(() => StartupManager.GetAllStartupEntries());
|
||||
dgStartup.ItemsSource = entries;
|
||||
_allStartupEntries = await Task.Run(() => StartupManager.GetAllStartupEntries());
|
||||
FilterStartupEntries();
|
||||
}
|
||||
|
||||
private void TxtStartupSearch_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
FilterStartupEntries();
|
||||
}
|
||||
|
||||
private void FilterStartupEntries()
|
||||
{
|
||||
if (dgStartup == null) return;
|
||||
string q = txtStartupSearch?.Text?.Trim().ToLowerInvariant() ?? "";
|
||||
|
||||
if (string.IsNullOrEmpty(q))
|
||||
{
|
||||
dgStartup.ItemsSource = _allStartupEntries;
|
||||
}
|
||||
else
|
||||
{
|
||||
dgStartup.ItemsSource = _allStartupEntries.Where(x =>
|
||||
(x.Name != null && x.Name.Contains(q, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(x.Command != null && x.Command.Contains(q, StringComparison.OrdinalIgnoreCase))
|
||||
).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private async void BtnToggleStartup_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -486,6 +700,15 @@ namespace LDUninstaller.UI
|
|||
{
|
||||
if (sender is Button btn && btn.Tag is DebloatTweak tweak)
|
||||
{
|
||||
string action = tweak.IsApplied ? "varsayılana geri döndürülecek" : "uygulanacak";
|
||||
var res = MessageBox.Show(
|
||||
$"'{tweak.Title}' ayarı {action}.\n\nDevam edilsin mi?",
|
||||
"İnce Ayar Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (res != MessageBoxResult.Yes) return;
|
||||
|
||||
bool apply = !tweak.IsApplied;
|
||||
bool ok = await Task.Run(() => apply ? tweak.Apply() : tweak.Revert());
|
||||
if (ok)
|
||||
|
|
@ -497,17 +720,110 @@ namespace LDUninstaller.UI
|
|||
|
||||
private async void BtnApplyAllDebloat_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var tweaks = await Task.Run(() =>
|
||||
var res = MessageBox.Show(
|
||||
"Tüm telemetri, Cortana ve sponsorlu arka plan uygulama engellemeleri uygulanacaktır.\n\nDevam edilsin mi?",
|
||||
"Toplu Ayar Onayı",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
|
||||
if (res != MessageBoxResult.Yes) return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var list = WindowsTweaks.GetDefaultTweaks();
|
||||
foreach (var t in list) t.Apply();
|
||||
return list;
|
||||
});
|
||||
|
||||
await LoadDebloatTweaksAsync();
|
||||
MessageBox.Show("Tüm önerilen Windows ince ayarları ve telemetri kapatmaları uygulandı!", "Başarılı", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
// Tools View Handlers
|
||||
private void UpdateShellButtonText()
|
||||
{
|
||||
if (btnToggleShell != null)
|
||||
btnToggleShell.Content = ShellIntegrationManager.IsRegistered() ? "Devre Dışı Bırak" : "Aktif Et";
|
||||
}
|
||||
|
||||
private void BtnToggleShell_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ShellIntegrationManager.IsRegistered())
|
||||
{
|
||||
ShellIntegrationManager.Unregister();
|
||||
MessageBox.Show("Explorer sağ tık '💥 LD ile Güçlü Kaldır' menüsü kaldırıldı.", "Bilgi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
string launcherExe = Path.Combine(baseDir, "LDUninstaller.Launcher.exe");
|
||||
string targetExe = File.Exists(launcherExe) ? launcherExe : (Process.GetCurrentProcess().MainModule?.FileName ?? "");
|
||||
|
||||
if (ShellIntegrationManager.Register(targetExe))
|
||||
{
|
||||
MessageBox.Show(
|
||||
"Explorer sağ tık menüsü başarıyla eklendi!\n\nArtık masaüstünde veya Gezgin'de herhangi bir klasöre, uygulamaya (.exe) veya kısayola (.lnk) sağ tıklayarak '💥 LD ile Güçlü Kaldır' seçeneğini kullanabilirsiniz.",
|
||||
"Başarılı",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Sağ tık menüsü kaydedilemedi. Yönetici yetkisi gerekebilir.", "Hata", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
}
|
||||
UpdateShellButtonText();
|
||||
}
|
||||
|
||||
private void BtnOpenBackups_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var win = new BackupRestoreWindow { Owner = this };
|
||||
win.ShowDialog();
|
||||
}
|
||||
|
||||
private void BtnCleanBrokenEntries_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
navApps.IsChecked = true;
|
||||
chipBroken.IsChecked = true;
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void BtnOpenLogs_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var win = new LogViewerWindow { Owner = this };
|
||||
win.ShowDialog();
|
||||
}
|
||||
|
||||
private async void BtnCheckUpdate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
btnCheckUpdate.IsEnabled = false;
|
||||
txtUpdateStatus.Text = "Sunucu sorgulanıyor...";
|
||||
|
||||
var currentVer = typeof(MainWindow).Assembly.GetName().Version ?? new Version(2, 8, 0);
|
||||
var update = await UpdateChecker.CheckForUpdatesAsync(currentVer);
|
||||
|
||||
btnCheckUpdate.IsEnabled = true;
|
||||
|
||||
if (update != null && update.HasUpdate)
|
||||
{
|
||||
txtUpdateStatus.Text = $"Yeni sürüm mevcut: v{update.LatestVersion}";
|
||||
var res = MessageBox.Show(
|
||||
$"Yeni bir LD Uninstaller sürümü yayında!\n\nMevcut: v{currentVer}\nYeni: v{update.LatestVersion}\n\nİndirme sayfasına gitmek istiyor musunuz?",
|
||||
"Güncelleme Mevcut",
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Information);
|
||||
|
||||
if (res == MessageBoxResult.Yes)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(update.DownloadUrl) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtUpdateStatus.Text = $"En güncel sürümü kullanıyorsunuz (v{currentVer}).";
|
||||
MessageBox.Show($"LD Uninstaller güncel! (v{currentVer})", "Güncel", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
// Window TitleBar Chrome Handlers
|
||||
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
|
|
|||
29
src/LDUninstaller.UI/app.manifest
Normal file
29
src/LDUninstaller.UI/app.manifest
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="2.8.0.0" name="LDUninstaller.UI"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 and Windows 11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
BIN
test_bmp.ico
BIN
test_bmp.ico
Binary file not shown.
|
Before Width: | Height: | Size: 353 KiB |
68
tests/LDUninstaller.Tests/FileUnlockerServiceTests.cs
Normal file
68
tests/LDUninstaller.Tests/FileUnlockerServiceTests.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using LDUninstaller.Core.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace LDUninstaller.Tests
|
||||
{
|
||||
public class FileUnlockerServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void ResolveTarget_StandardDirectory_ReturnsDirectly()
|
||||
{
|
||||
string testDir = Path.GetTempPath().TrimEnd('\\');
|
||||
var (folder, file, lnk) = FileUnlockerService.ResolveTarget(testDir);
|
||||
|
||||
Assert.Equal(testDir, folder, ignoreCase: true);
|
||||
Assert.Null(file);
|
||||
Assert.Null(lnk);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnlockAndDestroy_DangerousWindowsDirectory_BlockedBySafetyGuard()
|
||||
{
|
||||
string winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
|
||||
var result = FileUnlockerService.UnlockAndDestroy(winDir);
|
||||
|
||||
Assert.False(result.Success);
|
||||
Assert.NotEmpty(result.ErrorMessages);
|
||||
Assert.Contains("GÜVENLİK ENGELİ", result.ErrorMessages[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InspectLocks_NonExistentPath_ReturnsEmptyWithoutThrowing()
|
||||
{
|
||||
string fakePath = Path.Combine(Path.GetTempPath(), "NonExistentDir_" + Guid.NewGuid());
|
||||
var locks = FileUnlockerService.InspectLocks(fakePath);
|
||||
|
||||
Assert.NotNull(locks);
|
||||
Assert.Empty(locks);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnlockAndDestroy_SafeTempDirectory_SuccessfullyDestroys()
|
||||
{
|
||||
string tempFolder = Path.Combine(Path.GetTempPath(), "LDUnlockerTest_" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(tempFolder);
|
||||
string testFile = Path.Combine(tempFolder, "locked_mock.txt");
|
||||
File.WriteAllText(testFile, "test data for unlocker");
|
||||
|
||||
try
|
||||
{
|
||||
Assert.True(Directory.Exists(tempFolder));
|
||||
|
||||
var result = FileUnlockerService.UnlockAndDestroy(tempFolder, sendToRecycleBin: false);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(Directory.Exists(tempFolder));
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(tempFolder))
|
||||
{
|
||||
try { Directory.Delete(tempFolder, true); } catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
tests/LDUninstaller.Tests/JunkManagerTests.cs
Normal file
63
tests/LDUninstaller.Tests/JunkManagerTests.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System.Collections.Generic;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace LDUninstaller.Tests
|
||||
{
|
||||
public class JunkManagerTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("github", "git", false)]
|
||||
[InlineData("github desktop", "git", false)]
|
||||
[InlineData("git", "git", true)]
|
||||
[InlineData("git-scm", "git", true)]
|
||||
[InlineData("git_tools", "git", true)]
|
||||
[InlineData("git.exe", "git", true)]
|
||||
[InlineData("photostudio", "studio", false)]
|
||||
[InlineData("visual studio code", "studio", true)]
|
||||
[InlineData("sublime_text", "sublime", true)]
|
||||
public void IsWordOrExactMatch_BoundaryEnforcement(string target, string token, bool expected)
|
||||
{
|
||||
bool actual = JunkManager.IsWordOrExactMatch(target, token);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetMatchTokens_StopWords_ExcludesGenericWords()
|
||||
{
|
||||
var entry = new ApplicationUninstallerEntry
|
||||
{
|
||||
DisplayName = "VLC media player",
|
||||
Publisher = "VideoLAN"
|
||||
};
|
||||
|
||||
var (cleanName, cleanPub, tokens) = JunkManager.GetMatchTokens(entry);
|
||||
|
||||
Assert.Equal("vlc media player", cleanName);
|
||||
Assert.Equal("videolan", cleanPub);
|
||||
Assert.Contains("vlc", tokens);
|
||||
Assert.DoesNotContain("media", tokens);
|
||||
Assert.DoesNotContain("player", tokens);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetMatchTokens_AppWithStopWords_FiltersProperly()
|
||||
{
|
||||
var entry = new ApplicationUninstallerEntry
|
||||
{
|
||||
DisplayName = "Windows App SDK Desktop Runtime",
|
||||
Publisher = "Microsoft Corporation"
|
||||
};
|
||||
|
||||
var (_, _, tokens) = JunkManager.GetMatchTokens(entry);
|
||||
|
||||
// "app", "sdk", "desktop", "runtime", "windows" are stop-words and should be filtered from lone tokens
|
||||
Assert.DoesNotContain("app", tokens);
|
||||
Assert.DoesNotContain("sdk", tokens);
|
||||
Assert.DoesNotContain("desktop", tokens);
|
||||
Assert.DoesNotContain("runtime", tokens);
|
||||
Assert.DoesNotContain("windows", tokens);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
tests/LDUninstaller.Tests/LDUninstaller.Tests.csproj
Normal file
27
tests/LDUninstaller.Tests/LDUninstaller.Tests.csproj
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\LDUninstaller.Core\LDUninstaller.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
90
tests/LDUninstaller.Tests/SafetyBlacklistTests.cs
Normal file
90
tests/LDUninstaller.Tests/SafetyBlacklistTests.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using Xunit;
|
||||
|
||||
namespace LDUninstaller.Tests
|
||||
{
|
||||
public class SafetyBlacklistTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(@"C:\Windows")]
|
||||
[InlineData(@"C:\Windows\System32")]
|
||||
[InlineData(@"C:\Windows\System32\drivers\etc")]
|
||||
[InlineData(@"C:\Program Files\WindowsApps")]
|
||||
[InlineData(@"C:\ProgramData\Package Cache")]
|
||||
[InlineData(@"")]
|
||||
[InlineData(@" ")]
|
||||
[InlineData(null)]
|
||||
public void IsDangerousDirectory_CriticalPaths_ReturnsTrue(string? path)
|
||||
{
|
||||
bool isDangerous = SafetyBlacklist.IsDangerousDirectory(path!);
|
||||
Assert.True(isDangerous);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsDangerousDirectory_UserRootAndDocuments_Protected()
|
||||
{
|
||||
string userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
|
||||
Assert.True(SafetyBlacklist.IsDangerousDirectory(userProfile));
|
||||
Assert.True(SafetyBlacklist.IsDangerousDirectory(myDocuments));
|
||||
Assert.True(SafetyBlacklist.IsDangerousDirectory(desktop));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsDangerousDirectory_SafeAppFolder_ReturnsFalse()
|
||||
{
|
||||
string safeAppPath = @"C:\Program Files\VendorXYZ\App123";
|
||||
Assert.False(SafetyBlacklist.IsDangerousDirectory(safeAppPath));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"HKLM\SYSTEM")]
|
||||
[InlineData(@"HKLM\SYSTEM\CurrentControlSet\Services")]
|
||||
[InlineData(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion")]
|
||||
[InlineData(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")]
|
||||
[InlineData(@"HKLM_32\SOFTWARE\Microsoft\Windows\CurrentVersion")]
|
||||
[InlineData(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer")]
|
||||
public void IsDangerousRegistryKey_CriticalKeys_ReturnsTrue(string regKey)
|
||||
{
|
||||
bool isDangerous = SafetyBlacklist.IsDangerousRegistryPath(regKey);
|
||||
Assert.True(isDangerous);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"HKLM\SOFTWARE\RandomVendor\CleanableApp")]
|
||||
[InlineData(@"HKLM_32\SOFTWARE\RandomVendor\CleanableApp")]
|
||||
[InlineData(@"HKCU\SOFTWARE\RandomVendor\CleanableApp")]
|
||||
public void IsDangerousRegistryKey_SafeKeys_ReturnsFalse(string regKey)
|
||||
{
|
||||
bool isDangerous = SafetyBlacklist.IsDangerousRegistryPath(regKey);
|
||||
Assert.False(isDangerous);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExclusionManager_Integration_ProtectsCustomPaths()
|
||||
{
|
||||
string testCustomPath = @"D:\MyImportantProjects\CustomWork";
|
||||
string testChildPath = @"D:\MyImportantProjects\CustomWork\nested\document.docx";
|
||||
|
||||
try
|
||||
{
|
||||
Assert.False(SafetyBlacklist.IsDangerousDirectory(testChildPath));
|
||||
|
||||
// Add to exclusion
|
||||
ExclusionManager.AddExclusion(testCustomPath, "Birim Testi Koruması");
|
||||
|
||||
Assert.True(ExclusionManager.IsExcluded(testCustomPath));
|
||||
Assert.True(ExclusionManager.IsExcluded(testChildPath));
|
||||
Assert.True(SafetyBlacklist.IsDangerousDirectory(testChildPath));
|
||||
}
|
||||
finally
|
||||
{
|
||||
ExclusionManager.RemoveExclusion(testCustomPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
tests/LDUninstaller.Tests/Sift4Tests.cs
Normal file
58
tests/LDUninstaller.Tests/Sift4Tests.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using LDUninstaller.Core.Algorithms;
|
||||
using Xunit;
|
||||
|
||||
namespace LDUninstaller.Tests
|
||||
{
|
||||
public class Sift4Tests
|
||||
{
|
||||
[Fact]
|
||||
public void SimplestDistance_IdenticalStrings_ReturnsZero()
|
||||
{
|
||||
int dist = Sift4.SimplestDistance("antigravity", "antigravity");
|
||||
Assert.Equal(0, dist);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSimilarity_ExactMatch_ReturnsOne()
|
||||
{
|
||||
double sim = Sift4.GetSimilarity("Visual Studio Code", "Visual Studio Code");
|
||||
Assert.Equal(1.0, sim);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSimilarity_CompanySuffixVariations_HighSimilarity()
|
||||
{
|
||||
// Suffixes like "Corporation" or "Inc." should be handled
|
||||
double sim = Sift4.GetSimilarity("Microsoft", "Microsoft Corporation");
|
||||
Assert.True(sim >= 0.80, $"Expected >= 0.80 but was {sim}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSimilarity_CompletelyDifferentStrings_LowSimilarity()
|
||||
{
|
||||
double sim = Sift4.GetSimilarity("Photoshop", "Notepad");
|
||||
Assert.True(sim < 0.40, $"Expected < 0.40 but was {sim}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetSimilarityNormalized_DirectInputs_MatchesFastExecution()
|
||||
{
|
||||
string s1 = "google chrome";
|
||||
string s2 = "google chrom";
|
||||
|
||||
double sim = Sift4.GetSimilarityNormalized(s1, s2);
|
||||
Assert.True(sim > 0.90, $"Expected > 0.90 but was {sim}");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null, 1.0)]
|
||||
[InlineData("", "", 1.0)]
|
||||
[InlineData("test", "", 0.0)]
|
||||
[InlineData("", "test", 0.0)]
|
||||
public void GetSimilarityNormalized_EdgeCases(string? a, string? b, double expected)
|
||||
{
|
||||
double sim = Sift4.GetSimilarityNormalized(a!, b!);
|
||||
Assert.Equal(expected, sim);
|
||||
}
|
||||
}
|
||||
}
|
||||
90
user_prompt_full.txt
Normal file
90
user_prompt_full.txt
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<USER_REQUEST>
|
||||
# ROL VE AMAÇ: OTONOM TAURI v2 & RUST MİMARI (SONSUZ İTERASYON MODU)
|
||||
|
||||
Sen dünya standartlarında bir Sistem Mimarı, Kıdemli Rust Mühendisi ve Baş UI/UX Tasarımcısısın. Görevin, aşağıda detaylarını vereceğim mevcut projeyi sıfırdan, **Tauri v2 (Rust Backend + React/TypeScript/TailwindCSS Frontend)** kullanarak en yüksek endüstri standartlarında, son kullanıcı için kusursuz, ultra performanslı ve görsel olarak büyüleyici bir masaüstü uygulaması olarak baştan yazmaktır.
|
||||
|
||||
Bu görevde **TAM OTONOM** çalışacaksın. Uygulama sıfır hata ile derlenene, tüm testlerden geçene ve son kullanıcı deneyimi (UX) açısından kusursuz olana kadar **DURMAYACAKSIN**.
|
||||
|
||||
---
|
||||
|
||||
## PROJE BAĞLAMI VE MEVCUT DURUM
|
||||
- **Projenin Amacı / Ne Yaptığı:** [PROJENİN NE İŞE YARADIĞINI BURAYA YAZ]
|
||||
- **Mevcut Kod Tabanı / Kaynaklar:** [EĞER MEVCUT KOD KLASÖRDEYSE YOLUNU BELİRT VEYA ÖZELLİKLERİ LİSTELE]
|
||||
- **Hedef İşletim Sistemi:** Windows 11 (Birincil) / Cross-platform uyumlu.
|
||||
- **Özel İstekler / Kütüphaneler:** [VARSA ÖZEL İSTEKLERİNİ EKLE]
|
||||
|
||||
---
|
||||
|
||||
## KESİN VE İHLAL EDİLEMEZ KURALLAR (ZERO-TOLERANCE POLICY)
|
||||
|
||||
1. **ASLA YER TUTUCU (PLACEHOLDER) KULLANMA:** Kod yazarken KESİNLİKLE `// TODO`, `// ... geri kalan kod`, `// implementasyonu buraya ekle` gibi ifadeler kullanma. Her dosyanın her satırını eksiksiz, tam ve çalışır şekilde yaz.
|
||||
2. **ASLA `unwrap()` VEYA `expect()` KULLANMA:** Rust tarafında panik (crash) oluşturacak hiçbir kısayol kullanma. `thiserror` veya `anyhow` ile özel hata tipleri (`AppError`) oluştur ve tüm Tauri komutlarından `Result<T, AppError>` (Serde ile serialize edilebilir) döndür.
|
||||
3. **ONAY BEKLEME, AKSİYON AL:** "Şimdi şu dosyayı oluşturayım mı?" diye sorma. Dosyayı oluştur, kodu yaz, terminali çalıştır, hatayı gör ve düzelt.
|
||||
4. **KENDİ KENDİNİ ONARMA DÖNGÜSÜ (SELF-HEALING LOOP):** Her modülü yazdıktan sonra `cargo check`, `cargo test` ve frontend için `npm run build` / `tsc --noEmit` çalıştır. Tek bir uyarı (warning) veya hata (error) bile varsa, bir sonraki adıma geçmeden önce onu kökünden çöz.
|
||||
|
||||
---
|
||||
|
||||
## TEKNİK MİMARİ VE YIĞIN (TECH STACK) STANDARTLARI
|
||||
|
||||
### 1. Rust Backend (`src-tauri`)
|
||||
- **Mimari:** Temiz, modüler yapı (`commands/`, `models/`, `services/`, `state/`, `error.rs`, `utils/`). `main.rs` ve `lib.rs` dosyalarını şişirme; sadece başlatma ve kayıt işlemleri olsun.
|
||||
- **Asenkron & Performans:** Ağır G/Ç (I/O), ağ veya işlemci yoğunluklu görevlerde UI thread'ini ASLA bloklama. `tokio::spawn`, `tokio::sync::Mutex` veya `RwLock` kullanarak thread-safe state yönetimi (`tauri::State`) kur.
|
||||
- **IPC & Güvenlik:** Tüm komutlar tip güvenli olmalı. İlerleme durumu gerektiren işlemlerde Tauri v2 `Channel` API'sini veya `AppHandle::emit` event sistemini kullanarak arayüze gerçek zamanlı (real-time) telemetri/ilerleme akışı sağla.
|
||||
- **Tauri v2 Yetenekleri (Capabilities):** `src-tauri/capabilities/` altındaki izinleri en az ayrıcalık (least privilege) prensibine göre eksiksiz yapılandır.
|
||||
|
||||
### 2. Frontend & UI/UX (`src/`)
|
||||
- **Yığın:** React 18+, TypeScript (Strict Mode), TailwindCSS, Lucide Icons, Framer Motion (akıcı mikro animasyonlar için), Zustand (State yönetimi için).
|
||||
- **Görsel Kalite (Aesthetic Excellence):**
|
||||
- Amatör bir web sitesi gibi değil, **native, modern ve rafine bir masaüstü uygulaması** (Linear, Raycast veya Discord kalitesinde) gibi görünmeli ve hissettirmeli.
|
||||
- Özel (frameless/custom) pencere başlık çubuğu (Window Titlebar - küçültme, büyütme, kapatma butonları tam çalışır şekilde) tasarla.
|
||||
- Derinlik hissi veren koyu tema (Dark Mode varsayılan, zarif renk paleti, `backdrop-blur`, ince kenarlıklar `border-white/10`).
|
||||
- Sağ tık menüsünü (context menu) ve gereksiz metin seçimlerini (`select-none`) devre dışı bırakarak native hissi koru.
|
||||
- **Son Kullanıcı Deneyimi (Zero-Friction UX):**
|
||||
- **Sıfır Donma:** Her buton tıklamasında anında görsel geri bildirim (loading spinner, optimist UI güncellemesi, skeleton loader) olmalı.
|
||||
- **Zengin Bildirimler:** İşlem başarılarını ve hataları kullanıcı dostu Toast bildirimleriyle göster. Ham Rust hata mesajlarını değil, anlaşılır açıklamaları ve çözüm önerilerini sun.
|
||||
- **Boş Durumlar (Empty States) & Klavye Kısayolları:** Veri yokken şık illüstrasyon/ikonlu yönlendirmeler koy. Temel işlemler için klavye kısayolları (`Ctrl+...`, `Esc`) ekle.
|
||||
|
||||
---
|
||||
|
||||
## OTONOM ÇALIŞMA VE İTERASYON FAZLARI
|
||||
|
||||
Görevini aşağıdaki 6 fazı sırasıyla ve eksiksiz tamamlayarak yürüteceksin. Bir faz %100 bitmeden diğerine geçme:
|
||||
|
||||
### FAZ 1: Derin Analiz ve Mimari Planlama
|
||||
- Mevcut projeyi/gereksinimleri en ince detayına kadar analiz et.
|
||||
- Tüm özellikleri, uç durumları (edge-cases), veri yapılarını ve IPC kontratlarını (Rust struct <-> TypeScript interface eşleşmelerini) çıkar.
|
||||
- Klasör ağacını oluştur ve gerekli bağımlılıkları (`Cargo.toml` ve `package.json`) en güncel ve uyumlu sürümleriyle kur.
|
||||
|
||||
### FAZ 2: Çekirdek Rust Backend İnşası
|
||||
- Önce `error.rs` ve `state.rs` yapılarını kur.
|
||||
- Tüm iş mantığını (business logic) `services/` altında saf Rust modülleri olarak yaz.
|
||||
- Tauri komutlarını (`#[tauri::command]`) `commands/` altında tanımla ve `lib.rs` içinde `generate_handler!` makrosuna kaydet.
|
||||
- Terminalde `cargo check` ve `cargo clippy` çalıştır. **Sıfır hata ve sıfır uyarı** alana kadar kodu iyileştir.
|
||||
|
||||
### FAZ 3: Kusursuz Frontend ve IPC Entegrasyonu
|
||||
- Rust komutlarını çağıran tip güvenli bir `src/lib/tauri.ts` (API katmanı) yaz.
|
||||
- Tasarım sistemini, özel pencere çubuğunu, navigasyonu ve ana ekranları oluştur.
|
||||
- Tüm Rust fonksiyonlarını arayüze bağla. Gerçek zamanlı event dinleyicilerini (`listen`) kur ve memory leak olmaması için `useEffect` cleanup fonksiyonlarını eksiksiz yaz.
|
||||
- `npm run build` çalıştırarak TypeScript ve bundle hatalarını kontrol et, varsa düzelt.
|
||||
|
||||
### FAZ 4: Otomatik Testler ve Stres Testi
|
||||
- Rust tarafında kritik servisler ve veri dönüşümleri için `#[cfg(test)]` birim testlerini (unit tests) yaz.
|
||||
- Bozuk girdi, eksik dosya, ağ kopması, yetki hatası gibi tüm uç senaryoları (edge-cases) simüle et.
|
||||
- `cargo test` komutunu çalıştır. Tüm testler yeşil (PASS) olana kadar kod üzerinde iterasyon yap.
|
||||
|
||||
### FAZ 5: Son Kullanıcı Cilası (UI/UX Polishing) & Performans Denetimi
|
||||
- Uygulamayı bir son kullanıcı gözüyle baştan sona denetle:
|
||||
- Pencere yeniden boyutlandırıldığında (responsive) bozulan bir yer var mı?
|
||||
- Uzun süren işlemlerde iptal etme (cancellation) veya ilerleme çubuğu (progress bar) var mı?
|
||||
- Ayarlar/durumlar uygulama kapatılıp açıldığında kalıcı olarak (local config / store) korunuyor mu?
|
||||
- Eksik gördüğün her detayı kendin tespit et ve koda ekle.
|
||||
|
||||
### FAZ 6: Final Doğrulama
|
||||
- Hem `cargo test`, hem `cargo clippy`, hem de `npm run build` komutlarını son kez çalıştır.
|
||||
- Her şeyin %100 kusursuz, eksiksiz ve çalışır olduğundan emin olduğunda yaptığın mimariyi, eklediğin UX iyileştirmelerini ve test sonuçlarını özetleyen bir rapor sun.
|
||||
|
||||
**ŞİMDİ FAZ 1 İLE BAŞLA VE UYGULAMA KUSURSUZ OLANA KADAR DURMA.**
|
||||
</USER_REQUEST>
|
||||
<ADDITIONAL_METADATA>
|
||||
The current local time is: 2026-11-11T23:11:41+03:00.
|
||||
</ADDITIONAL_METADATA>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"major": 2,
|
||||
"minor": 7,
|
||||
"patch": 1,
|
||||
"version": "2.7.1"
|
||||
"minor": 8,
|
||||
"version": "2.8.0",
|
||||
"patch": 0,
|
||||
"major": 2
|
||||
}
|
||||
|
|
|
|||
BIN
web_upload/LD-Uninstaller-Setup-latest.exe
Normal file
BIN
web_upload/LD-Uninstaller-Setup-latest.exe
Normal file
Binary file not shown.
BIN
web_upload/LD-Uninstaller-Setup-v2.8.0.exe
Normal file
BIN
web_upload/LD-Uninstaller-Setup-v2.8.0.exe
Normal file
Binary file not shown.
19
web_upload/sha256.txt
Normal file
19
web_upload/sha256.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
================================================================================
|
||||
LD Uninstaller v2.8.0 - Dosya Doğrulama ve SHA256 Bilgileri
|
||||
Yayın Tarihi: 2026-11-08 22:04:10
|
||||
Resmi Web: https://ttmadethat.shop/#ldapps
|
||||
================================================================================
|
||||
|
||||
1. Kurulum Sihirbazı (Setup):
|
||||
Dosya: LD-Uninstaller-Setup-v2.8.0.exe
|
||||
Boyut: 4.16 MB (4359712 bytes)
|
||||
SHA256: 1236D2701F315AFFDE2050A81EC2C59B703C9C937C68E466F23F1B2CDE84C3DE
|
||||
|
||||
2. Kurulumsuz Sürüm (Portable ZIP):
|
||||
Dosya: LD-Uninstaller-Portable-v2.8.0.zip
|
||||
Boyut: 3.03 MB (3179364 bytes)
|
||||
SHA256: 238538A19C244877ED6CFFA41CDF729618E6549ACC9F86AEF6D171B8ACFB4ADE
|
||||
|
||||
================================================================================
|
||||
Doğrulama Komutu (PowerShell):
|
||||
Get-FileHash -Algorithm SHA256 .\LD-Uninstaller-Setup-v2.8.0.exe
|
||||
13
web_upload/version.json
Normal file
13
web_upload/version.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"version": "2.8.0",
|
||||
"downloadUrl": "https://ttmadethat.shop/downloads/LD-Uninstaller-Setup-v2.8.0.exe",
|
||||
"latestUrl": "https://ttmadethat.shop/downloads/LD-Uninstaller-Setup-latest.exe",
|
||||
"portableUrl": "https://ttmadethat.shop/downloads/LD-Uninstaller-Portable-v2.8.0.zip",
|
||||
"homepageUrl": "https://ttmadethat.shop/#ldapps",
|
||||
"releaseDate": "2026-11-08 22:04:10",
|
||||
"releaseNotes": "v2.8.0: Gelismis veri koruma kalkani, Geri Donusum Kutusu entegrasyonu, Yedekleme ve Koruma Merkezi, Zorla Kaldir modu, Winget script uretici ve yuksek hizli 20 katmanli kalinti tarama motoru.",
|
||||
"sha256": "1236D2701F315AFFDE2050A81EC2C59B703C9C937C68E466F23F1B2CDE84C3DE",
|
||||
"portableSha256": "238538A19C244877ED6CFFA41CDF729618E6549ACC9F86AEF6D171B8ACFB4ADE",
|
||||
"setupSizeBytes": 4359712,
|
||||
"portableSizeBytes": 3179364
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue