Compare commits
10 commits
45bcba6aee
...
884b33c833
| Author | SHA1 | Date | |
|---|---|---|---|
| 884b33c833 | |||
|
|
7bf17d9f43 | ||
|
|
8393b59988 | ||
|
|
55e0ec099f | ||
|
|
f7371eac3f | ||
|
|
05618bc2f7 | ||
|
|
1f0c0eff67 | ||
|
|
4ef32db388 | ||
|
|
6f262a3f91 | ||
|
|
38f5355f87 |
69
.gitignore
vendored
|
|
@ -1,24 +1,55 @@
|
|||
## Visual Studio / .NET
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
# Dependencies
|
||||
node_modules
|
||||
target/
|
||||
dist
|
||||
dist-ssr
|
||||
dist_server/
|
||||
web_upload/
|
||||
*.local
|
||||
|
||||
# Secrets, Signing Keys & Local Server Scripts (NEVER commit)
|
||||
bağlan.bat
|
||||
*baglan*.bat
|
||||
ba*lan.bat
|
||||
publish.ps1
|
||||
publish.bat
|
||||
release.ps1
|
||||
user_prompt_full.txt
|
||||
.keys/
|
||||
*.key
|
||||
*.pub
|
||||
*.pem
|
||||
*.pfx
|
||||
*.p12
|
||||
*.sig
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
secrets.*
|
||||
config.local.*
|
||||
|
||||
# Release binaries & legacy packaged builds
|
||||
LD-Uninstaller-Setup-*.exe
|
||||
LD Uninstaller v*/
|
||||
|
||||
# .NET artifacts
|
||||
bin/
|
||||
obj/
|
||||
*.user
|
||||
*.suo
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
.vs/
|
||||
.idea/
|
||||
|
||||
## User local scripts
|
||||
*.bat
|
||||
bağlan.bat
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
trace.log
|
||||
crash_*.log
|
||||
test_*.json
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
## Release packages & archives
|
||||
*.zip
|
||||
LD Uninstaller v*/
|
||||
dist/
|
||||
publish/
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.sw?
|
||||
|
|
|
|||
3
.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
145
README.md
|
|
@ -1,95 +1,88 @@
|
|||
<div align="center">
|
||||
|
||||
<img src="logo.png" width="96" alt="LD Uninstaller Logo" />
|
||||
|
||||
# LD Uninstaller
|
||||
|
||||
**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.
|
||||
**Windows için 20 katmanlı kalıntı temizleyici, dosya kilit açıcı ve disk kullanım haritası • Windows uninstaller, 20-layer leftover cleaner, file unlocker, and disk treemap analyzer**
|
||||
|
||||
[](./LICENSE)
|
||||
[](https://git.ttmadethat.shop/LilDosto/LD-Uninstaller/releases/latest)
|
||||
[](https://v2.tauri.app)
|
||||
[](https://git.ttmadethat.shop/LilDosto/LD-Uninstaller/releases/latest)
|
||||
|
||||
[🇹🇷 Türkçe](#-türkçe) • [🇬🇧 English](#-english) • [📦 Releases](https://git.ttmadethat.shop/LilDosto/LD-Uninstaller/releases/latest)
|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## ✨ Öne Çıkan Özellikler
|
||||
## 🇹🇷 Türkçe
|
||||
|
||||
### 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:
|
||||
1. **Ana Kurulum Dizinleri:** Kaldırıcı sonrası silinmeyen klasörler.
|
||||
2. **Kullanıcı Verileri:** `%AppData%`, `%LocalAppData%`, `LocalLow`, `ProgramData`, `Documents`, `Saved Games`.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
15. **Windows Güvenlik Duvarı:** `FirewallRules` altındaki ölü kurallar.
|
||||
16. **Windows Prefetch:** `C:\Windows\Prefetch` yürütme önbellek dosyaları.
|
||||
17. **Hata Dökümleri:** `CrashDumps` ve WER arşiv raporları.
|
||||
18. **UserAssist:** ROT13 ile şifrelenen çalıştırma geçmişi.
|
||||
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.
|
||||
**LD Uninstaller**, Windows için Tauri v2, Rust ve React 18 ile geliştirilmiş; yüklü yazılımları tam olarak kaldıran, 20 katmanlı artık taraması yapan, kilitli dosya/klasörleri çözen ve disk kullanımını görselleştiren performanslı bir sistem temizleme aracıdır.
|
||||
|
||||
### 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.
|
||||
### Özellikler
|
||||
|
||||
### 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.
|
||||
- **Uygulama Keşfi & Kaldırma:** Kayıt defteri ve kurulum yollarından yüklü yazılımları listeleme, standart/sessiz kaldırma yürütme ve uygulama listesini CSV olarak dışa aktarma.
|
||||
- **20 Katmanlı Derin Kalıntı Temizliği (`junk_cleaner` & `sift4`):** Kurulum dizinleri, `%AppData%`/`%LocalAppData%`/`ProgramData`, nokta klasörler, Common Files, `%TEMP%`, `HKLM`/`HKCU`/`WOW6432Node` kayıt defteri anahtarları, servisler, zamanlanmış görevler, App Paths, Run/RunOnce, kabuk uzantıları, MuiCache, Prefetch, AppCompatFlags, güvenlik duvarı kuralları, CrashDumps/WER, UserAssist, ölü kısayollar, yetim MSI kayıtları; ayrıca hariç tutma beyaz listesi (`exclusions`).
|
||||
- **Otomatik Kayıt Defteri Yedekleme (`backup_service`):** Silinen kayıt defteri anahtarlarını geri yüklenebilir UTF-8 `.reg` yedekleri olarak saklama ve yedek yöneticisinden tek tıkla geri alma.
|
||||
- **Dosya / Klasör Kilit Açıcı & Shredder (`file_unlocker`):** Windows Restart Manager (`rstrtmgr.dll`) ile kilitleyen süreçleri tespit etme, sonlandırma veya bir sonraki yeniden başlatmada silme (`MoveFileEx`).
|
||||
- **Disk Treemap, Başlangıç & İnce Ayarlar:** Bölüm bazlı görsel disk kullanım haritası (`treemap_service`), Windows başlangıç öğeleri yönetimi (`startup_service`) ve sistem ince ayarları (`tweaks_service`).
|
||||
- **Güvenlik Kalkanı & OTA:** Kanonik yol doğrulaması / kritik sistem dizini koruması (`safety`), döngüsel günlükleme, yönetici yetki denetimi, tekil örnek koruması ve Minisign imzalı OTA güncelleme.
|
||||
|
||||
### 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.
|
||||
### Teknoloji Yığını
|
||||
|
||||
### 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.
|
||||
- **Masaüstü & Çekirdek:** Tauri v2, Rust (`windows` crate Restart Manager/Shell/FileSystem, `winreg`, `sysinfo`, `walkdir`, `trash`, `csv`, `sha2`, `tokio`)
|
||||
- **Arayüz:** React 18, TypeScript, Tailwind CSS, Zustand, Lucide Icons, Vite
|
||||
|
||||
---
|
||||
### Kurulum ve Kullanım
|
||||
|
||||
## 📦 Dağıtım ve Yayınlama (Release Management)
|
||||
|
||||
Projeyi derlemek ve belirlenen kurallara göre tek klasörde paketlemek için PowerShell otomasyonu:
|
||||
**Son Kullanıcı:**
|
||||
1. [Releases](https://git.ttmadethat.shop/LilDosto/LD-Uninstaller/releases/latest) sayfasından kurulum paketi `LD-Uninstaller_3.0.2_x64-setup.exe` veya taşınabilir sürüm `LD-Uninstaller-v3.0.2-portable.zip` dosyasını indirin.
|
||||
2. Kaldırmak istediğiniz uygulamayı seçip kalıntı taramasını çalıştırın ve temizlemeden önce yedeklemeleri kontrol edin.
|
||||
|
||||
**Geliştirici (Kaynaktan Derleme):**
|
||||
```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
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
# veya doğrudan arayüz:
|
||||
.\LD Uninstaller v2.5.0\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
|
||||
npm install
|
||||
npm run tauri dev # Geliştirme modunda çalıştır
|
||||
npm run tauri build # Kurulum paketi üret
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📄 Lisans
|
||||
## 🇬🇧 English
|
||||
|
||||
Bu proje [MIT Lisansı](LICENSE) kapsamında lisanslanmıştır. Detaylar için [`LICENSE`](LICENSE) dosyasına göz atabilirsiniz.
|
||||
**LD Uninstaller** is a high-performance Windows uninstaller and system maintenance utility built with Tauri v2, Rust, and React 18, featuring a 20-layer leftover scanner, Windows Restart Manager file unlocker, registry backups, and disk treemap visualization.
|
||||
|
||||
### Features
|
||||
|
||||
- **Application Discovery & Uninstallation:** Enumerates installed software, triggers native uninstallers, and exports the application inventory to CSV.
|
||||
- **20-Layer Deep Leftover Cleaner (`junk_cleaner` & `sift4`):** Scans leftover install folders, `%AppData%`/`%LocalAppData%`/`ProgramData`, dot-folders, Common Files, `%TEMP%`, `HKLM`/`HKCU`/`WOW6432Node` registry keys, services, scheduled tasks, App Paths, Run/RunOnce entries, shell extensions, MuiCache, Prefetch, AppCompatFlags, firewall rules, CrashDumps/WER, UserAssist, broken shortcuts, and orphan MSI entries, with customizable exclusion rules.
|
||||
- **Automatic Registry Backups (`backup_service`):** Exports removed registry entries to UTF-8 `.reg` backups with one-click restore and backup management.
|
||||
- **File / Folder Unlocker & Shredder (`file_unlocker`):** Detects locking processes via Windows Restart Manager (`rstrtmgr.dll`), safely terminates locks, or schedules deletion on reboot.
|
||||
- **Disk Treemap, Startup & Tweaks:** Visualizes disk space usage per partition (`treemap_service`), toggles Windows startup items (`startup_service`), and manages system tweaks (`tweaks_service`).
|
||||
- **Safety Guardrails & OTA:** Path traversal / system directory protection (`safety`), rotating log files, elevation detection, single-instance guard, and Minisign-verified OTA updates.
|
||||
|
||||
### Tech Stack
|
||||
|
||||
- **Desktop & Backend:** Tauri v2, Rust (`windows` crate Restart Manager/Shell/FileSystem, `winreg`, `sysinfo`, `walkdir`, `trash`, `csv`, `sha2`, `tokio`)
|
||||
- **Frontend:** React 18, TypeScript, Tailwind CSS, Zustand, Lucide Icons, Vite
|
||||
|
||||
### Installation & Usage
|
||||
|
||||
**End Users:**
|
||||
1. Download `LD-Uninstaller_3.0.2_x64-setup.exe` (installer) or `LD-Uninstaller-v3.0.2-portable.zip` (portable) from the [Releases](https://git.ttmadethat.shop/LilDosto/LD-Uninstaller/releases/latest) page.
|
||||
2. Select any installed program to uninstall and scan/clean leftovers with automatic `.reg` backup safety.
|
||||
|
||||
**Developers (Build from Source):**
|
||||
```powershell
|
||||
npm install
|
||||
npm run tauri dev # Run in development mode
|
||||
npm run tauri build # Build Windows installer
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📄 Lisans / License
|
||||
|
||||
Bu proje [MIT Lisansı](./LICENSE) altında lisanslanmıştır. • Licensed under the [MIT License](./LICENSE).
|
||||
|
|
|
|||
3
bağlan.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
ssh -i "%USERPROFILE%\.ssh\id_ed25519" root@116.202.14.171
|
||||
pause
|
||||
14
index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>LD Uninstaller</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
3160
package-lock.json
generated
Normal file
36
package.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "ld-uninstaller",
|
||||
"private": true,
|
||||
"version": "3.0.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.2.0",
|
||||
"@tauri-apps/plugin-opener": "^2.2.5",
|
||||
"@tauri-apps/plugin-process": "^2.4.0",
|
||||
"@tauri-apps/plugin-updater": "^2.14.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.468.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"tailwind-merge": "^2.5.5",
|
||||
"zustand": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.2.0",
|
||||
"@types/node": "^22.10.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.49",
|
||||
"tailwindcss": "^3.4.16",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.3"
|
||||
}
|
||||
}
|
||||
6
postcss.config.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
BIN
public/logo.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
6
public/tauri.svg
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
||||
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
1
public/vite.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
312
release.ps1
|
|
@ -1,312 +0,0 @@
|
|||
param(
|
||||
[ValidateSet("major", "minor", "patch", "current")]
|
||||
[string]$Type = "current",
|
||||
[string]$Message = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = $PSScriptRoot
|
||||
if (-not $root) { $root = (Get-Location).Path }
|
||||
|
||||
$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
|
||||
}
|
||||
|
||||
$vData = Get-Content $versionFile -Raw | ConvertFrom-Json
|
||||
$major = [int]$vData.major
|
||||
$minor = [int]$vData.minor
|
||||
$patch = [int]$vData.patch
|
||||
|
||||
switch ($Type.ToLowerInvariant()) {
|
||||
"major" {
|
||||
$major += 1
|
||||
$minor = 0
|
||||
$patch = 0
|
||||
}
|
||||
"minor" {
|
||||
$minor += 1
|
||||
$patch = 0
|
||||
}
|
||||
"patch" {
|
||||
$patch += 1
|
||||
}
|
||||
"current" {
|
||||
# Keep existing version
|
||||
}
|
||||
}
|
||||
|
||||
$newVersion = "$major.$minor.$patch"
|
||||
$vData.major = $major
|
||||
$vData.minor = $minor
|
||||
$vData.patch = $patch
|
||||
$vData.version = $newVersion
|
||||
|
||||
$vData | ConvertTo-Json | Set-Content $versionFile -Encoding UTF8
|
||||
|
||||
# Update Directory.Build.props
|
||||
$propsContent = @"
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>$newVersion</Version>
|
||||
<AssemblyVersion>$newVersion.0</AssemblyVersion>
|
||||
<FileVersion>$newVersion.0</FileVersion>
|
||||
<Product>LD Uninstaller</Product>
|
||||
<Company>LD Software</Company>
|
||||
<Authors>LD Software</Authors>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
"@
|
||||
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
|
||||
|
||||
# 1. Ana klasorde eski surumleri 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
|
||||
try {
|
||||
Remove-Item -Path $old.FullName -Recurse -Force -ErrorAction SilentlyContinue
|
||||
} 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
|
||||
|
||||
$targetFolderName = "LD Uninstaller v$newVersion"
|
||||
$targetDir = Join-Path $root $targetFolderName
|
||||
|
||||
Write-Host "Yeni surum klasoru olusturuluyor: $targetFolderName..." -ForegroundColor Green
|
||||
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
|
||||
|
||||
# 2. Projeleri Release modunda derle ve yayinla
|
||||
Write-Host "Projeler derleniyor ve yayinlaniyor..." -ForegroundColor Cyan
|
||||
|
||||
$projects = @(
|
||||
"src/LDUninstaller.UI/LDUninstaller.UI.csproj",
|
||||
"src/LDUninstaller.CLI/LDUninstaller.CLI.csproj",
|
||||
"src/LDUninstaller.Automatizer/LDUninstaller.Automatizer.csproj",
|
||||
"src/LDUninstaller.Launcher/LDUninstaller.Launcher.csproj"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# 3. Gereksiz pdb ve log 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
|
||||
$isccCandidates = @(
|
||||
"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 }
|
||||
}
|
||||
|
||||
$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
|
||||
& $isccPath /Q "/DMyAppVersion=$newVersion" "/DSourceDir=$targetDir" (Join-Path $root "installer.iss")
|
||||
if (Test-Path $setupPath) {
|
||||
Write-Host "Kurulum dosyasi basariyla olusturuldu: $setupName" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
}
|
||||
}
|
||||
|
||||
# 7. GitHub Releases API Uzerinde Surum ve Notlari Yayinla
|
||||
try {
|
||||
Write-Host "`nGitHub Releases API uzerinden surum ve notlar yayinlaniyor..." -ForegroundColor Cyan
|
||||
|
||||
$code = @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
"@
|
||||
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"
|
||||
}
|
||||
|
||||
$repoOwner = "LilDosto"
|
||||
$repoName = "LD-Unistaller"
|
||||
|
||||
# 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"
|
||||
|
|
@ -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-csharp/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;
|
||||
|
||||
656
src-csharp/LDUninstaller.Core/Bulk/BulkUninstallTask.cs
Normal file
|
|
@ -0,0 +1,656 @@
|
|||
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;
|
||||
using LDUninstaller.Core.Algorithms;
|
||||
using LDUninstaller.Core.Models;
|
||||
using LDUninstaller.Core.Native;
|
||||
|
||||
namespace LDUninstaller.Core.Bulk
|
||||
{
|
||||
public enum BulkStatus
|
||||
{
|
||||
Queued,
|
||||
Running,
|
||||
Succeeded,
|
||||
Failed,
|
||||
Skipped,
|
||||
Cancelled
|
||||
}
|
||||
|
||||
public class BulkUninstallEntry : INotifyPropertyChanged
|
||||
{
|
||||
public ApplicationUninstallerEntry Entry { get; }
|
||||
|
||||
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
|
||||
{
|
||||
public List<BulkUninstallEntry> Items { get; }
|
||||
public int MaxConcurrentQuiet { get; set; } = 2;
|
||||
public bool CreateRestorePoint { get; set; } = true;
|
||||
public bool EnableAutomatizer { get; set; } = true;
|
||||
|
||||
public event Action<BulkUninstallEntry>? OnItemStarted;
|
||||
public event Action<BulkUninstallEntry>? OnItemCompleted;
|
||||
public event Action<string>? OnLog;
|
||||
|
||||
private readonly SemaphoreSlim _msiLock = new(1, 1);
|
||||
private readonly SemaphoreSlim _loudLimitLock = new(1, 1);
|
||||
private readonly object _stateLock = new();
|
||||
private readonly HashSet<string> _activePublishers = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly HashSet<string> _activeDirectories = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public BulkUninstallTask(IEnumerable<ApplicationUninstallerEntry> entries, bool preferQuiet = true)
|
||||
{
|
||||
Items = entries.Select(e => new BulkUninstallEntry(e, preferQuiet)).ToList();
|
||||
}
|
||||
|
||||
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 restoreSeq));
|
||||
}
|
||||
|
||||
if (EnableAutomatizer)
|
||||
{
|
||||
EnsureAutomatizerRunning();
|
||||
}
|
||||
|
||||
var throttler = new SemaphoreSlim(MaxConcurrentQuiet, MaxConcurrentQuiet);
|
||||
var runningTasks = new List<Task>();
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
item.Status = BulkStatus.Cancelled;
|
||||
item.StatusMessage = "İptal edildi";
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
item.Status = BulkStatus.Cancelled;
|
||||
item.StatusMessage = "İptal edildi";
|
||||
return;
|
||||
}
|
||||
|
||||
string pub = Sift4.NormalizeName(item.Entry.Publisher);
|
||||
bool pubAcquired = false;
|
||||
|
||||
string dir = !string.IsNullOrWhiteSpace(item.Entry.InstallLocation)
|
||||
? Path.GetFullPath(item.Entry.InstallLocation).TrimEnd('\\')
|
||||
: string.Empty;
|
||||
|
||||
while (!pubAcquired && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
lock (_stateLock)
|
||||
{
|
||||
bool pubConflict = !string.IsNullOrWhiteSpace(pub) && _activePublishers.Contains(pub);
|
||||
bool dirConflict = !string.IsNullOrWhiteSpace(dir) && _activeDirectories.Any(d =>
|
||||
d.Equals(dir, StringComparison.OrdinalIgnoreCase) ||
|
||||
dir.StartsWith(d + "\\", StringComparison.OrdinalIgnoreCase) ||
|
||||
d.StartsWith(dir + "\\", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!pubConflict && !dirConflict)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(pub)) _activePublishers.Add(pub);
|
||||
if (!string.IsNullOrWhiteSpace(dir)) _activeDirectories.Add(dir);
|
||||
pubAcquired = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pubAcquired)
|
||||
{
|
||||
await Task.Delay(500, cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
bool msiLocked = false;
|
||||
if (item.Entry.UninstallerKind == UninstallerType.Msiexec)
|
||||
{
|
||||
await _msiLock.WaitAsync(cancellationToken);
|
||||
msiLocked = true;
|
||||
await WaitForActiveMsiProcesses(cancellationToken);
|
||||
}
|
||||
|
||||
bool isQuiet = item.PreferQuiet && !string.IsNullOrWhiteSpace(item.Entry.QuietUninstallString);
|
||||
bool loudLocked = false;
|
||||
if (!isQuiet)
|
||||
{
|
||||
await _loudLimitLock.WaitAsync(cancellationToken);
|
||||
loudLocked = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
item.Status = BulkStatus.Running;
|
||||
item.StatusMessage = "Çalıştırılıyor...";
|
||||
OnItemStarted?.Invoke(item);
|
||||
OnLog?.Invoke($"Kaldırma başladı: {item.Entry.DisplayName}");
|
||||
|
||||
// Pre-kill locking processes in install folder (B9, P9)
|
||||
PreKillLockingProcesses(item.Entry);
|
||||
|
||||
// Stop services in install folder (B9)
|
||||
PreStopServices(item.Entry);
|
||||
|
||||
// Execute Uninstaller Process
|
||||
int exitCode = await ExecuteUninstallerProcessAsync(item, cancellationToken);
|
||||
item.ExitCode = exitCode;
|
||||
|
||||
// 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 || 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;
|
||||
item.StatusMessage = $"Hata: {ex.Message}";
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (_stateLock)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(pub)) _activePublishers.Remove(pub);
|
||||
if (!string.IsNullOrWhiteSpace(dir)) _activeDirectories.Remove(dir);
|
||||
}
|
||||
|
||||
if (msiLocked) _msiLock.Release();
|
||||
if (loudLocked) _loudLimitLock.Release();
|
||||
|
||||
OnItemCompleted?.Invoke(item);
|
||||
OnLog?.Invoke($"Tamamlandı [{item.Status}]: {item.Entry.DisplayName}");
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
? item.Entry.QuietUninstallString
|
||||
: item.Entry.UninstallString;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command))
|
||||
{
|
||||
// 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))
|
||||
{
|
||||
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
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = args,
|
||||
UseShellExecute = true,
|
||||
CreateNoWindow = item.PreferQuiet
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(item.Entry.InstallLocation) && Directory.Exists(item.Entry.InstallLocation))
|
||||
{
|
||||
psi.WorkingDirectory = item.Entry.InstallLocation;
|
||||
}
|
||||
|
||||
Process? process = null;
|
||||
try
|
||||
{
|
||||
process = Process.Start(psi);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnLog?.Invoke($"Çalıştırma hatası ({fileName}): {ex.Message}");
|
||||
return -1;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = new NamedPipeClientStream(".", "LDUninstallerDaemon", PipeDirection.Out);
|
||||
client.Connect(1000);
|
||||
using var writer = new StreamWriter(client);
|
||||
writer.WriteLine($"ATTACH:{pid}");
|
||||
writer.Flush();
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
|
||||
private static void PreKillLockingProcesses(ApplicationUninstallerEntry entry)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entry.InstallLocation) || !Directory.Exists(entry.InstallLocation))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (p.Id == currentPid) continue;
|
||||
|
||||
// P9: Use Win32 QueryFullProcessImageName to avoid Access Denied Win32Exceptions
|
||||
string? exePath = Win32.GetProcessPath(p.Id);
|
||||
if (!string.IsNullOrWhiteSpace(exePath))
|
||||
{
|
||||
if (Path.GetFullPath(exePath).StartsWith(norm, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Win32.GentleKillProcess(p, 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void PreStopServices(ApplicationUninstallerEntry entry)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entry.InstallLocation) || !Directory.Exists(entry.InstallLocation))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{sc.ServiceName}");
|
||||
string? rawPath = key?.GetValue("ImagePath")?.ToString();
|
||||
if (!string.IsNullOrWhiteSpace(rawPath))
|
||||
{
|
||||
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))
|
||||
{
|
||||
if (sc.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
sc.Stop();
|
||||
sc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static async Task WaitForActiveMsiProcesses(CancellationToken token)
|
||||
{
|
||||
// B15: Timeout after 60 seconds
|
||||
var sw = Stopwatch.StartNew();
|
||||
while (!token.IsCancellationRequested && sw.ElapsedMilliseconds < 60000)
|
||||
{
|
||||
var msiProcs = Process.GetProcessesByName("msiexec");
|
||||
int count = msiProcs.Length;
|
||||
foreach (var p in msiProcs) p.Dispose();
|
||||
|
||||
if (count <= 1)
|
||||
break;
|
||||
await Task.Delay(1000, token);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSerializedType(UninstallerType type)
|
||||
{
|
||||
return type is UninstallerType.WindowsFeature
|
||||
or UninstallerType.WindowsUpdate
|
||||
or UninstallerType.InstallShield
|
||||
or UninstallerType.SdbInst
|
||||
or UninstallerType.PowerShell;
|
||||
}
|
||||
|
||||
private static (string fileName, string arguments) SplitCommand(string command)
|
||||
{
|
||||
string trimmed = command.Trim();
|
||||
if (trimmed.StartsWith("\""))
|
||||
{
|
||||
int endQuote = trimmed.IndexOf('\"', 1);
|
||||
if (endQuote > 0)
|
||||
{
|
||||
string file = trimmed.Substring(1, endQuote - 1);
|
||||
string args = endQuote + 1 < trimmed.Length ? trimmed[(endQuote + 1)..].Trim() : "";
|
||||
return (file, args);
|
||||
}
|
||||
}
|
||||
|
||||
int space = trimmed.IndexOf(' ');
|
||||
if (space > 0)
|
||||
{
|
||||
return (trimmed[..space], trimmed[(space + 1)..].Trim());
|
||||
}
|
||||
|
||||
return (trimmed, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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-csharp/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('\\');
|
||||
}
|
||||
}
|
||||
}
|
||||
247
src-csharp/LDUninstaller.Core/Junk/SafetyBlacklist.cs
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
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)
|
||||
{
|
||||
"windows", "system32", "syswow64", "winsxs", "microsoft", "windows nt",
|
||||
"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",
|
||||
"windowsapps", "package cache", "onedrive"
|
||||
};
|
||||
|
||||
private static readonly string DynamicUsersRoot;
|
||||
private static readonly string UserProfileDir;
|
||||
|
||||
static SafetyBlacklist()
|
||||
{
|
||||
// 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));
|
||||
|
||||
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));
|
||||
|
||||
// Package Cache
|
||||
string commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||
if (!string.IsNullOrEmpty(commonAppData))
|
||||
{
|
||||
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");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved");
|
||||
BlacklistedRegPaths.Add(@"HKLM\SOFTWARE\RegisteredApplications");
|
||||
BlacklistedRegPaths.Add(@"HKCU\SOFTWARE\RegisteredApplications");
|
||||
BlacklistedRegPaths.Add(@"HKCR\*\shellex\ContextMenuHandlers");
|
||||
BlacklistedRegPaths.Add(@"HKCR\Directory\shellex\ContextMenuHandlers");
|
||||
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)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
BlacklistedDirs.Add(Path.GetFullPath(path).TrimEnd('\\'));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
// 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:\ 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;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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 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-csharp/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-csharp/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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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-csharp/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-csharp/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;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 353 KiB |
|
|
@ -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" />
|
||||
193
src-csharp/LDUninstaller.UI/App.xaml.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace LDUninstaller.UI
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
[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
|
||||
SetCurrentProcessExplicitAppUserModelID("LDSoftware.LDUninstaller");
|
||||
}
|
||||
catch { }
|
||||
|
||||
base.OnStartup(e);
|
||||
|
||||
// B30: %LocalAppData%\LDUninstaller\logs\trace.log with rolling size limit
|
||||
InitLogging();
|
||||
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, args) =>
|
||||
{
|
||||
Log("Process exit triggered.");
|
||||
};
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (s, args) =>
|
||||
{
|
||||
Log($"UNHANDLED: {args.ExceptionObject}");
|
||||
};
|
||||
|
||||
DispatcherUnhandledException += (s, args) =>
|
||||
{
|
||||
Log($"DISPATCHER UNHANDLED: {args.Exception}");
|
||||
MessageBox.Show(
|
||||
$"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-csharp/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-csharp/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-csharp/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-csharp/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>
|
||||
208
src-csharp/LDUninstaller.UI/Dialogs/LeftoverCleanWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using LDUninstaller.Core.Junk;
|
||||
using LDUninstaller.Core.Models;
|
||||
|
||||
namespace LDUninstaller.UI.Dialogs
|
||||
{
|
||||
public partial class LeftoverCleanWindow : Window
|
||||
{
|
||||
private readonly List<IJunkResult> _junkItems;
|
||||
|
||||
public LeftoverCleanWindow(ApplicationUninstallerEntry app, List<IJunkResult> junkItems)
|
||||
{
|
||||
_junkItems = junkItems ?? new List<IJunkResult>();
|
||||
InitializeComponent();
|
||||
|
||||
txtTitle.Text = $"'{app.DisplayName}' Artık ve Kalıntı Dosyaları";
|
||||
|
||||
if (_junkItems.Count > 0)
|
||||
{
|
||||
dgJunk.Visibility = Visibility.Visible;
|
||||
pnlNoJunk.Visibility = Visibility.Collapsed;
|
||||
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)
|
||||
{
|
||||
j.Selected = (j.Confidence == ConfidenceLevel.VeryGood);
|
||||
}
|
||||
|
||||
dgJunk.ItemsSource = _junkItems;
|
||||
chkSelectAll.IsChecked = _junkItems.All(x => x.Selected);
|
||||
UpdateCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
dgJunk.Visibility = Visibility.Collapsed;
|
||||
pnlNoJunk.Visibility = Visibility.Visible;
|
||||
btnClean.Visibility = Visibility.Collapsed;
|
||||
chkSelectAll.Visibility = Visibility.Collapsed;
|
||||
btnExclude.Visibility = Visibility.Collapsed;
|
||||
txtCount.Text = "0 kalıntı bulundu (Sistem tertemiz)";
|
||||
}
|
||||
}
|
||||
|
||||
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 ChkSelectAll_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_junkItems == null || dgJunk == null || txtCount == null) return;
|
||||
|
||||
bool sel = chkSelectAll?.IsChecked == true;
|
||||
foreach (var j in _junkItems)
|
||||
{
|
||||
if (j.Confidence > ConfidenceLevel.Bad)
|
||||
j.Selected = sel;
|
||||
}
|
||||
dgJunk.Items.Refresh();
|
||||
UpdateCount();
|
||||
}
|
||||
|
||||
private void JunkItemCheckBox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateCount();
|
||||
}
|
||||
|
||||
private void UpdateCount()
|
||||
{
|
||||
if (_junkItems == null || txtCount == null || btnClean == null) return;
|
||||
|
||||
int count = _junkItems.Count(x => x.Selected);
|
||||
txtCount.Text = $"{count} / {_junkItems.Count} öğe seçildi";
|
||||
btnClean.IsEnabled = count > 0;
|
||||
}
|
||||
|
||||
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 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;
|
||||
|
||||
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-csharp/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-csharp/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)
|
||||
{
|
||||
|
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 353 KiB |
|
Before Width: | Height: | Size: 945 KiB After Width: | Height: | Size: 945 KiB |
29
src-csharp/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>
|
||||
2
src-tauri/.cargo/config.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
target-dir = "C:/Users/lildosto/ld_target"
|
||||
7
src-tauri/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Generated by Tauri
|
||||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
||||
6064
src-tauri/Cargo.lock
generated
Normal file
51
src-tauri/Cargo.toml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
[package]
|
||||
name = "ld_uninstaller"
|
||||
version = "3.0.2"
|
||||
description = "LD Uninstaller - Modern High Performance Windows Uninstaller & System Cleaner"
|
||||
authors = ["LD Team"]
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "ld_uninstaller_lib"
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
tauri-plugin-process = "2"
|
||||
tauri-plugin-single-instance = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
thiserror = "2"
|
||||
winreg = "0.52"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
trash = "5.2"
|
||||
sysinfo = "0.32"
|
||||
walkdir = "2.5"
|
||||
regex = "1.11"
|
||||
reqwest = { version = "0.12", features = ["json"] }
|
||||
sha2 = "0.10"
|
||||
hex = "0.4"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
csv = "1.3"
|
||||
windows = { version = "0.58", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_Security",
|
||||
"Win32_UI_Shell",
|
||||
"Win32_UI_WindowsAndMessaging",
|
||||
"Win32_System_RestartManager",
|
||||
"Win32_System_Threading",
|
||||
"Win32_System_Diagnostics_ToolHelp",
|
||||
"Win32_Storage_FileSystem"
|
||||
] }
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = 3
|
||||
panic = "abort"
|
||||
strip = true
|
||||
3
src-tauri/build.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
23
src-tauri/capabilities/default.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-destroy",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-is-maximized",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-show",
|
||||
"core:window:allow-set-focus",
|
||||
"core:window:allow-unminimize",
|
||||
"opener:default",
|
||||
"updater:default",
|
||||
"process:default"
|
||||
]
|
||||
}
|
||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src-tauri/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
85
src-tauri/src/commands/app_commands.rs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
use crate::error::{AppError, AppResult};
|
||||
use crate::models::ApplicationEntry;
|
||||
use crate::services::{DiscoveryService, UninstallerService};
|
||||
use crate::state::AppState;
|
||||
use std::path::PathBuf;
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_installed_apps(state: State<'_, AppState>) -> AppResult<Vec<ApplicationEntry>> {
|
||||
let apps = tokio::task::spawn_blocking(DiscoveryService::scan_all_applications)
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(format!("Tarama görevi yürütülemedi: {}", e)))??;
|
||||
|
||||
let mut cache = state.cached_apps.write().await;
|
||||
*cache = apps.clone();
|
||||
Ok(apps)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn uninstall_application(
|
||||
app_id: String,
|
||||
quiet: bool,
|
||||
state: State<'_, AppState>,
|
||||
) -> AppResult<bool> {
|
||||
// 1. Kilit kapsamını (lock scope) anında sınırla: uygulamayı kopyala ve kilidi hemen bırak
|
||||
let app_to_uninstall = {
|
||||
let cache = state.cached_apps.read().await;
|
||||
cache
|
||||
.iter()
|
||||
.find(|a| a.id == app_id)
|
||||
.cloned()
|
||||
.ok_or_else(|| AppError::NotFound(format!("Uygulama bulunamadı (ID: {})", app_id)))?
|
||||
};
|
||||
|
||||
// 2. Senkron süreç bekleme döngüsünü spawn_blocking ile Tokio thread pool'dan ayır (Deadlock önlendi)
|
||||
tokio::task::spawn_blocking(move || {
|
||||
UninstallerService::uninstall(&app_to_uninstall, quiet)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(format!("Kaldırma süreci yürütülemedi: {}", e)))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn export_apps_csv(file_path: String, state: State<'_, AppState>) -> AppResult<String> {
|
||||
let apps = {
|
||||
let cache = state.cached_apps.read().await;
|
||||
cache.clone()
|
||||
};
|
||||
|
||||
let target_path = if file_path.trim().is_empty() || file_path.contains("Default\\Desktop") {
|
||||
if let Ok(user_profile) = std::env::var("USERPROFILE") {
|
||||
PathBuf::from(user_profile).join("Desktop").join("LD_Uninstaller_Apps.csv")
|
||||
} else {
|
||||
PathBuf::from("LD_Uninstaller_Apps.csv")
|
||||
}
|
||||
} else {
|
||||
PathBuf::from(file_path)
|
||||
};
|
||||
|
||||
let target_path_str = target_path.to_string_lossy().to_string();
|
||||
|
||||
tokio::task::spawn_blocking(move || -> AppResult<String> {
|
||||
let mut wtr = csv::Writer::from_path(&target_path)
|
||||
.map_err(|e| AppError::Io(std::io::Error::other(e)))?;
|
||||
|
||||
wtr.write_record(["Ad", "Sürüm", "Yayımcı", "Yükleme Konumu", "Boyut (KB)", "Kaldırma Komutu"])
|
||||
.map_err(|e| AppError::Io(std::io::Error::other(e)))?;
|
||||
|
||||
for app in &apps {
|
||||
wtr.write_record([
|
||||
&app.display_name,
|
||||
&app.display_version,
|
||||
&app.publisher,
|
||||
&app.install_location,
|
||||
&app.estimated_size_kb.to_string(),
|
||||
&app.uninstall_string,
|
||||
]).map_err(|e| AppError::Io(std::io::Error::other(e)))?;
|
||||
}
|
||||
|
||||
wtr.flush().map_err(|e| AppError::Io(std::io::Error::other(e)))?;
|
||||
Ok(target_path_str)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(format!("Dışa aktarma yürütülemedi: {}", e)))?
|
||||
}
|
||||
60
src-tauri/src/commands/junk_commands.rs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
use crate::error::{AppError, AppResult};
|
||||
use crate::models::{CleanReport, JunkItem, JunkScanResult};
|
||||
use crate::services::JunkCleanerService;
|
||||
use crate::state::AppState;
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn scan_app_leftovers(
|
||||
app_name: String,
|
||||
publisher: String,
|
||||
install_location: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> AppResult<JunkScanResult> {
|
||||
let exclusions = match state.exclusions.read() {
|
||||
Ok(guard) => guard.clone(),
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
JunkCleanerService::scan_leftovers(&app_name, &publisher, &install_location, &exclusions)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(format!("Kalıntı tarama işi yürütülemedi: {}", e)))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn clean_leftovers(
|
||||
items: Vec<JunkItem>,
|
||||
use_recycle_bin: bool,
|
||||
state: State<'_, AppState>,
|
||||
) -> AppResult<CleanReport> {
|
||||
let backup_dir = state.config_dir.join("Backups");
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
JunkCleanerService::clean_selected_items(&items, use_recycle_bin, &backup_dir)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(format!("Kalıntı temizleme işi yürütülemedi: {}", e)))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_exclusions(state: State<'_, AppState>) -> AppResult<Vec<String>> {
|
||||
let list = match state.exclusions.read() {
|
||||
Ok(guard) => guard.clone(),
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn add_exclusion(path_or_key: String, state: State<'_, AppState>) -> AppResult<bool> {
|
||||
state.add_exclusion(path_or_key)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn remove_exclusion(path_or_key: String, state: State<'_, AppState>) -> AppResult<bool> {
|
||||
state.remove_exclusion(&path_or_key)?;
|
||||
Ok(true)
|
||||
}
|
||||
11
src-tauri/src/commands/mod.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
pub mod app_commands;
|
||||
pub mod junk_commands;
|
||||
pub mod system_commands;
|
||||
pub mod unlocker_commands;
|
||||
pub mod update_commands;
|
||||
|
||||
pub use app_commands::*;
|
||||
pub use junk_commands::*;
|
||||
pub use system_commands::*;
|
||||
pub use unlocker_commands::*;
|
||||
pub use update_commands::*;
|
||||
141
src-tauri/src/commands/system_commands.rs
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
use crate::error::{AppError, AppResult};
|
||||
use crate::models::{BackupEntry, DrivePartition, StartupItem, SystemDiagnostics, SystemTweak, TreemapItem};
|
||||
use crate::services::{safety::SafetyBlacklist, BackupService, StartupService, TreemapService, TweaksService};
|
||||
use crate::state::AppState;
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_startup_items() -> AppResult<Vec<StartupItem>> {
|
||||
tokio::task::spawn_blocking(StartupService::get_startup_items)
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn toggle_startup_item(id: String, enable: bool) -> AppResult<bool> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
StartupService::toggle_startup_item(&id, enable)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_tweaks() -> AppResult<Vec<SystemTweak>> {
|
||||
tokio::task::spawn_blocking(TweaksService::get_available_tweaks)
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn toggle_tweak(id: String, enable: bool) -> AppResult<bool> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
TweaksService::apply_tweak(&id, enable)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_disk_partitions() -> AppResult<Vec<DrivePartition>> {
|
||||
tokio::task::spawn_blocking(TreemapService::get_disk_partitions)
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_treemap_data(state: State<'_, AppState>) -> AppResult<Vec<TreemapItem>> {
|
||||
let cache = state.cached_apps.read().await;
|
||||
TreemapService::generate_apps_treemap(&cache)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_backups(state: State<'_, AppState>) -> AppResult<Vec<BackupEntry>> {
|
||||
let config_dir = state.config_dir.clone();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let dummy_state = AppState {
|
||||
exclusions: std::sync::RwLock::new(Vec::new()),
|
||||
cached_apps: tokio::sync::RwLock::new(Vec::new()),
|
||||
config_dir,
|
||||
};
|
||||
BackupService::list_backups(&dummy_state)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn restore_backup(file_path: String) -> AppResult<bool> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
BackupService::restore_backup(&file_path)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_backup(file_path: String) -> AppResult<bool> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
BackupService::delete_backup(&file_path)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn is_admin_elevated() -> bool {
|
||||
SafetyBlacklist::is_elevated()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn relaunch_as_admin() -> AppResult<bool> {
|
||||
SafetyBlacklist::relaunch_as_admin()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn open_logs_folder(state: State<'_, AppState>) -> AppResult<bool> {
|
||||
let logs_dir = state.config_dir.join("Logs");
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let _ = std::process::Command::new("explorer")
|
||||
.arg(logs_dir)
|
||||
.spawn();
|
||||
Ok(true)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_system_diagnostics(state: State<'_, AppState>) -> AppResult<SystemDiagnostics> {
|
||||
let is_elevated = SafetyBlacklist::is_elevated();
|
||||
let config_dir = state.config_dir.to_string_lossy().to_string();
|
||||
|
||||
let log_file = state.config_dir.join("Logs").join("app.log");
|
||||
let log_file_size_kb = if let Ok(meta) = std::fs::metadata(log_file) {
|
||||
meta.len() / 1024
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
let cached_apps_count = {
|
||||
let cache = state.cached_apps.read().await;
|
||||
cache.len()
|
||||
};
|
||||
|
||||
let total_exclusions_count = match state.exclusions.read() {
|
||||
Ok(guard) => guard.len(),
|
||||
Err(_) => 0,
|
||||
};
|
||||
|
||||
let os_version = std::env::var("OS")
|
||||
.unwrap_or_else(|_| "Windows 11 / 10".to_string());
|
||||
|
||||
Ok(SystemDiagnostics {
|
||||
is_elevated,
|
||||
os_version,
|
||||
config_dir,
|
||||
log_file_size_kb,
|
||||
cached_apps_count,
|
||||
total_exclusions_count,
|
||||
})
|
||||
}
|
||||
40
src-tauri/src/commands/unlocker_commands.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use crate::error::AppResult;
|
||||
use crate::services::FileUnlockerService;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn force_unlock_and_shred(path: String) -> AppResult<bool> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
FileUnlockerService::force_unlock_and_delete(&path)
|
||||
}).await.map_err(|e| crate::error::AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_locking_processes(path: String) -> AppResult<Vec<u32>> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
FileUnlockerService::terminate_locking_processes(&path)
|
||||
}).await.map_err(|e| crate::error::AppError::Execution(e.to_string()))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn browse_target_path(folder_only: bool) -> AppResult<Option<String>> {
|
||||
use std::os::windows::process::CommandExt;
|
||||
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let script = if folder_only {
|
||||
"[System.Reflection.Assembly]::LoadWithPartialName('System.windows.forms') | Out-Null; $f = New-Object System.Windows.Forms.FolderBrowserDialog; $f.Description = 'Silmek veya kilidini açmak istediğiniz klasörü seçin'; if ($f.ShowDialog() -eq 'OK') { $f.SelectedPath }"
|
||||
} else {
|
||||
"[System.Reflection.Assembly]::LoadWithPartialName('System.windows.forms') | Out-Null; $f = New-Object System.Windows.Forms.OpenFileDialog; $f.Title = 'Silmek veya kilidini açmak istediğiniz dosyayı seçin'; if ($f.ShowDialog() -eq 'OK') { $f.FileName }"
|
||||
};
|
||||
let output = std::process::Command::new("powershell")
|
||||
.args(["-NoProfile", "-Command", script])
|
||||
.creation_flags(CREATE_NO_WINDOW)
|
||||
.output()?;
|
||||
let res = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
if res.is_empty() {
|
||||
Ok(None)
|
||||
} else {
|
||||
Ok(Some(res))
|
||||
}
|
||||
}).await.map_err(|e| crate::error::AppError::Execution(e.to_string()))?
|
||||
}
|
||||