# ==============================================================================
# ⚡ HADJIKIKO ULTIMATE OS OPTIMIZER v4.5 PRO ⚡
# Ultra-Modern WPF Fluent Design GUI for Windows 10 / Windows 11 (x64)
# Features: Bilingual (EN / AR), Auto-Elevation, Zero-Freeze Async Architecture,
# 15+ Advanced System Tools, Deep Hardware Specs, Smooth Glow UX.
# ==============================================================================
param(
[switch]$SkipAdminCheck
)
# 1. AUTO-ELEVATION CHECK
if (-not $SkipAdminCheck) {
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Start-Process powershell.exe -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"irm https://win.envimosta.com | iex`""
exit
}
}
# 2. INITIALIZE WINDOWS APIS
# 3. LOAD MODERN WPF & PRESENTATION LIBRARIES
Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase
# 4. MODERN WPF XAML DEFINITION
$xaml = @'
'@
# 5. LOAD & CONSTRUCT WPF WINDOW
$reader = [System.Xml.XmlReader]::Create([System.IO.StringReader]::new($xaml))
$window = [System.Windows.Markup.XamlReader]::Load($reader)
# Window Controls
$titleBar = $window.FindName("titleBar")
$btnMin = $window.FindName("btnMin")
$btnClose = $window.FindName("btnClose")
$btnMax = $window.FindName("btnMax")
$btnLangToggle = $window.FindName("btnLangToggle")
$txtTitleRam = $window.FindName("txtTitleRam")
$txtDashRam = $window.FindName("txtDashRam")
$pbRam = $window.FindName("pbRam")
$txtDiskSpace = $window.FindName("txtDiskSpace")
$txtStatus = $window.FindName("txtStatus")
$txtStatusDot = $window.FindName("txtStatusDot")
$btnRefreshSpecs = $window.FindName("btnRefreshSpecs")
$pbActivity = $window.FindName("pbActivity")
# Navigation Tabs
$tabBtnDashboard = $window.FindName("tabBtnDashboard")
$tabBtnStorage = $window.FindName("tabBtnStorage")
$panelStorage = $window.FindName("panelStorage")
$btnMagicClean = $window.FindName("btnMagicClean")
$btnCleanBrowsers = $window.FindName("btnCleanBrowsers")
$btnCleanShaders = $window.FindName("btnCleanShaders")
$btnCleanWinUpdate = $window.FindName("btnCleanWinUpdate")
$btnCleanRecycleThumbs = $window.FindName("btnCleanRecycleThumbs")
$btnCleanDevCaches = $window.FindName("btnCleanDevCaches")
$txtTabStorage = $window.FindName("txtTabStorage")
$txtStorageHeader = $window.FindName("txtStorageHeader")
$txtStorageSub = $window.FindName("txtStorageSub")
$txtStorageDiskTitle = $window.FindName("txtStorageDiskTitle")
$txtStorageDiskDetails = $window.FindName("txtStorageDiskDetails")
$pbStorageDisk = $window.FindName("pbStorageDisk")
$txtMagicCleanDesc = $window.FindName("txtMagicCleanDesc")
$txtSpecificCleanersHeader = $window.FindName("txtSpecificCleanersHeader")
$txtCleanBrowsersDesc = $window.FindName("txtCleanBrowsersDesc")
$txtCleanShadersDesc = $window.FindName("txtCleanShadersDesc")
$txtCleanWinUpdateDesc = $window.FindName("txtCleanWinUpdateDesc")
$txtCleanRecycleThumbsDesc = $window.FindName("txtCleanRecycleThumbsDesc")
$txtCleanDevCachesDesc = $window.FindName("txtCleanDevCachesDesc")
$tabBtnTools = $window.FindName("tabBtnTools")
$tabBtnRepairs = $window.FindName("tabBtnRepairs")
$tabBtnGaming = $window.FindName("tabBtnGaming")
$tabBtnInfo = $window.FindName("tabBtnInfo")
# View Panels
$panelDashboard = $window.FindName("panelDashboard")
$panelTools = $window.FindName("panelTools")
$panelRepairs = $window.FindName("panelRepairs")
$panelGaming = $window.FindName("panelGaming")
$panelInfo = $window.FindName("panelInfo")
$tabBtnOffice = $window.FindName("tabBtnOffice")
$panelOffice = $window.FindName("panelOffice")
$txtTabOffice = $window.FindName("txtTabOffice")
$txtOfficeHeroTitle= $window.FindName("txtOfficeHeroTitle")
$txtOfficeHeroSub = $window.FindName("txtOfficeHeroSub")
$lblOfficeVersion = $window.FindName("lblOfficeVersion")
$cbOfficeVersion = $window.FindName("cbOfficeVersion")
$lblOfficeLang = $window.FindName("lblOfficeLang")
$cbOfficeLang = $window.FindName("cbOfficeLang")
$lblOfficeArch = $window.FindName("lblOfficeArch")
$cbOfficeArch = $window.FindName("cbOfficeArch")
$lblOfficeApps = $window.FindName("lblOfficeApps")
$btnSelectAllApps = $window.FindName("btnSelectAllApps")
$btnSelectMinimalApps = $window.FindName("btnSelectMinimalApps")
$txtAppsHint = $window.FindName("txtAppsHint")
$chkWord = $window.FindName("chkWord")
$chkExcel = $window.FindName("chkExcel")
$chkPowerPoint = $window.FindName("chkPowerPoint")
$chkOutlook = $window.FindName("chkOutlook")
$chkOneNote = $window.FindName("chkOneNote")
$chkAccess = $window.FindName("chkAccess")
$chkPublisher = $window.FindName("chkPublisher")
$chkTeams = $window.FindName("chkTeams")
$btnOfficeInstall = $window.FindName("btnOfficeInstall")
$txtOfficeInstallBtn = $window.FindName("txtOfficeInstallBtn")
$btnOfficeActivateOnly = $window.FindName("btnOfficeActivateOnly")
$txtOfficeActivateOnlyBtn = $window.FindName("txtOfficeActivateOnlyBtn")
$btnOfficeExportXml= $window.FindName("btnOfficeExportXml")
$lblOfficeConsoleHeader = $window.FindName("lblOfficeConsoleHeader")
$txtOfficeLog = $window.FindName("txtOfficeLog")
$pbOfficeProgress = $window.FindName("pbOfficeProgress")
# Action Buttons
$btnTurboClean = $window.FindName("btnTurboClean")
$txtTurboBtn = $window.FindName("txtTurboBtn")
$btnDashPurge = $window.FindName("btnDashPurge")
$btnQuickMas = $window.FindName("btnQuickMas")
$btnQuickWinUtil = $window.FindName("btnQuickWinUtil")
$btnToolsMas = $window.FindName("btnToolsMas")
$btnToolsWinUtil = $window.FindName("btnToolsWinUtil")
$btnToolsDeepClean = $window.FindName("btnToolsDeepClean")
$btnToolsWinget = $window.FindName("btnToolsWinget")
# In-App Confirmation Modal Controls
$modalConfirmOverlay = $window.FindName("modalConfirmOverlay")
$txtModalTitle = $window.FindName("txtModalTitle")
$txtModalDesc = $window.FindName("txtModalDesc")
$btnModalCancel = $window.FindName("btnModalCancel")
$btnModalConfirm = $window.FindName("btnModalConfirm")
# Circular Storage Ring & Rich Dashboard Controls
$txtDiskMediaType = $window.FindName("txtDiskMediaType")
$lblQuickMas = $window.FindName("lblQuickMas")
$lblQuickWinUtil = $window.FindName("lblQuickWinUtil")
$lblMagicClean = $window.FindName("lblMagicClean")
$lblCleanBrowsers = $window.FindName("lblCleanBrowsers")
$lblCleanShaders = $window.FindName("lblCleanShaders")
$lblCleanWinUpdate = $window.FindName("lblCleanWinUpdate")
$lblCleanRecycleThumbs = $window.FindName("lblCleanRecycleThumbs")
$lblCleanDevCaches = $window.FindName("lblCleanDevCaches")
$lblDeepClean = $window.FindName("lblDeepClean")
$lblWinget = $window.FindName("lblWinget")
$lblSfc = $window.FindName("lblSfc")
$lblWu = $window.FindName("lblWu")
$lblDisk = $window.FindName("lblDisk")
$lblNet = $window.FindName("lblNet")
$lblLogs = $window.FindName("lblLogs")
$lblRamPurge = $window.FindName("lblRamPurge")
$lblRamTask = $window.FindName("lblRamTask")
$lblPower = $window.FindName("lblPower")
$lblTelemetry = $window.FindName("lblTelemetry")
$lblLatency = $window.FindName("lblLatency")
$lblExplorer = $window.FindName("lblExplorer")
$lblSpecsSecHeader = $window.FindName("lblSpecsSecHeader")
$lblSpecsHwHeader = $window.FindName("lblSpecsHwHeader")
$lblInfoCpuHeader = $window.FindName("lblInfoCpuHeader")
$lblInfoBoardHeader = $window.FindName("lblInfoBoardHeader")
$lblSpecsStorageHeader = $window.FindName("lblSpecsStorageHeader")
$lblInfoRamHeader = $window.FindName("lblInfoRamHeader")
$lblInfoGpuHeader = $window.FindName("lblInfoGpuHeader")
$lblInfoStorageHeader = $window.FindName("lblInfoStorageHeader")
$txtInfoBt = $window.FindName("txtInfoBt")
$arcStorageRing = $window.FindName("arcStorageRing")
$txtRingPct = $window.FindName("txtRingPct")
$txtRingSub = $window.FindName("txtRingSub")
$txtDiskFreeGB = $window.FindName("txtDiskFreeGB")
$txtDiskTotalGB = $window.FindName("txtDiskTotalGB")
$txtDashRamDetails = $window.FindName("txtDashRamDetails")
$txtDashWinStatus = $window.FindName("txtDashWinStatus")
$btnDashToStorage = $window.FindName("btnDashToStorage")
$btnDashRepairShortcut = $window.FindName("btnDashRepairShortcut")
$btnDashTweakGaming = $window.FindName("btnDashTweakGaming")
$btnDashTweakNet = $window.FindName("btnDashTweakNet")
$btnDashTweakTrim = $window.FindName("btnDashTweakTrim")
$btnDashRestartExp = $window.FindName("btnDashRestartExp")
$txtDashGamingBtn = $window.FindName("txtDashGamingBtn")
$txtDashNetBtn = $window.FindName("txtDashNetBtn")
$txtDashTrimBtn = $window.FindName("txtDashTrimBtn")
$txtDashExpBtn = $window.FindName("txtDashExpBtn")
$btnRepairSfc = $window.FindName("btnRepairSfc")
$btnRepairWu = $window.FindName("btnRepairWu")
$btnRepairDisk = $window.FindName("btnRepairDisk")
$btnRepairNet = $window.FindName("btnRepairNet")
$btnRepairLogs = $window.FindName("btnRepairLogs")
$btnGamingRamPurge = $window.FindName("btnGamingRamPurge")
$btnGamingRamTask = $window.FindName("btnGamingRamTask")
$btnGamingPower = $window.FindName("btnGamingPower")
$btnGamingTelemetry= $window.FindName("btnGamingTelemetry")
$btnGamingLatency = $window.FindName("btnGamingLatency")
$btnGamingExplorer = $window.FindName("btnGamingExplorer")
# Text Elements for Language Switching
$txtSidebarNavHeader = $window.FindName("txtSidebarNavHeader")
$txtTabDashboard = $window.FindName("txtTabDashboard")
$txtTabTools = $window.FindName("txtTabTools")
$txtTabRepairs = $window.FindName("txtTabRepairs")
$txtTabGaming = $window.FindName("txtTabGaming")
$txtTabInfo = $window.FindName("txtTabInfo")
$txtAdminTitle = $window.FindName("txtAdminTitle")
$txtAdminSub = $window.FindName("txtAdminSub")
$txtHeroTitle = $window.FindName("txtHeroTitle")
$txtHeroDesc = $window.FindName("txtHeroDesc")
$txtCardRamHeader = $window.FindName("txtCardRamHeader")
$txtCardAdminHeader = $window.FindName("txtCardAdminHeader")
$txtCardAdminSub = $window.FindName("txtCardAdminSub")
$txtCardDiskHeader = $window.FindName("txtCardDiskHeader")
$txtCardDiskSub1 = $window.FindName("txtCardDiskSub1")
$txtQuickShortcuts = $window.FindName("txtQuickShortcuts")
$txtDescQuickMas = $window.FindName("txtDescQuickMas")
$txtDescQuickWinUtil = $window.FindName("txtDescQuickWinUtil")
$txtToolsHeader = $window.FindName("txtToolsHeader")
$txtToolsSub = $window.FindName("txtToolsSub")
$txtMasCardDesc = $window.FindName("txtMasCardDesc")
$txtWinUtilCardDesc = $window.FindName("txtWinUtilCardDesc")
$txtDeepCleanDesc = $window.FindName("txtDeepCleanDesc")
$txtWingetDesc = $window.FindName("txtWingetDesc")
$txtRepairsHeader = $window.FindName("txtRepairsHeader")
$txtRepairsSub = $window.FindName("txtRepairsSub")
$txtSfcDesc = $window.FindName("txtSfcDesc")
$txtWuDesc = $window.FindName("txtWuDesc")
$txtDiskDesc = $window.FindName("txtDiskDesc")
$txtNetDesc = $window.FindName("txtNetDesc")
$txtLogsDesc = $window.FindName("txtLogsDesc")
$txtGamingHeader = $window.FindName("txtGamingHeader")
$txtGamingSub = $window.FindName("txtGamingSub")
$txtRamPurgeDesc = $window.FindName("txtRamPurgeDesc")
$txtRamTaskDesc = $window.FindName("txtRamTaskDesc")
$txtPowerDesc = $window.FindName("txtPowerDesc")
$txtTelemetryDesc = $window.FindName("txtTelemetryDesc")
$txtLatencyDesc = $window.FindName("txtLatencyDesc")
$txtExplorerDesc = $window.FindName("txtExplorerDesc")
$txtInfoHeader = $window.FindName("txtInfoHeader")
$txtInfoSub = $window.FindName("txtInfoSub")
# Hardware Info Controls
$txtInfoCpu = $window.FindName("txtInfoCpu")
$txtInfoCpuDetails = $window.FindName("txtInfoCpuDetails")
$txtInfoRam = $window.FindName("txtInfoRam")
$txtInfoRamDetails = $window.FindName("txtInfoRamDetails")
$txtInfoGpu = $window.FindName("txtInfoGpu")
$txtInfoGpuDetails = $window.FindName("txtInfoGpuDetails")
$txtInfoStorage = $window.FindName("txtInfoStorage")
$txtInfoStorageDetails = $window.FindName("txtInfoStorageDetails")
$txtInfoBoard = $window.FindName("txtInfoBoard")
$txtInfoBios = $window.FindName("txtInfoBios")
$txtInfoOs = $window.FindName("txtInfoOs")
$txtInfoOsDetails = $window.FindName("txtInfoOsDetails")
$txtInfoWinActivation = $window.FindName("txtInfoWinActivation")
$lblInfoOsHeader = $window.FindName("lblInfoOsHeader")
$txtInfoOffice = $window.FindName("txtInfoOffice")
$txtInfoOfficeDetails = $window.FindName("txtInfoOfficeDetails")
$txtInfoOfficeActivation = $window.FindName("txtInfoOfficeActivation")
$lblInfoOfficeHeader = $window.FindName("lblInfoOfficeHeader")
$txtInfoIp = $window.FindName("txtInfoIp")
$txtInfoMac = $window.FindName("txtInfoMac")
$lblInfoNetHeader = $window.FindName("lblInfoNetHeader")
$txtInfoPcName = $window.FindName("txtInfoPcName")
$txtInfoUptime = $window.FindName("txtInfoUptime")
$lblInfoUptimeHeader = $window.FindName("lblInfoUptimeHeader")
$txtInfoSecurity = $window.FindName("txtInfoSecurity")
$txtInfoSecDetails = $window.FindName("txtInfoSecDetails")
$lblInfoSecHeader = $window.FindName("lblInfoSecHeader")
# 6. BILINGUAL LANGUAGE ENGINE (DEFAULT: ENGLISH)
$global:currentLang = "AR"
function Update-Language {
if ($global:currentLang -eq "EN") {
if ($btnLangToggle) { $btnLangToggle.Content = "العربية (Arabic)" }
if ($txtLangBtn) { $txtLangBtn.Text = "العربية (Arabic)" }
if ($txtSidebarNavHeader) { $txtSidebarNavHeader.Text = "MAIN NAVIGATION" }
if ($txtRingSub) { $txtRingSub.Text = "USED" }
if ($btnDashToStorage) { $btnDashToStorage.Content = "💾 Open Storage Saver" }
if ($btnDashRepairShortcut) { $btnDashRepairShortcut.Content = "🔧 System Diagnostics" }
if ($txtDashGamingBtn) { $txtDashGamingBtn.Text = "Game Boost" }
if ($txtDashNetBtn) { $txtDashNetBtn.Text = "Reset Network" }
if ($txtDashTrimBtn) { $txtDashTrimBtn.Text = "Run TRIM" }
if ($txtDashExpBtn) { $txtDashExpBtn.Text = "Restart Shell" }
if ($txtTabDashboard) { $txtTabDashboard.Text = "Dashboard" }
if ($txtTabStorage) { $txtTabStorage.Text = "Deep Storage" }
if ($txtTabTools) { $txtTabTools.Text = "Power Tools" }
if ($txtTabRepairs) { $txtTabRepairs.Text = "System Repairs" }
if ($txtTabGaming) { $txtTabGaming.Text = "Gaming & RAM" }
if ($txtTabInfo) { $txtTabInfo.Text = "System Specs" }
if ($txtTabOffice) { $txtTabOffice.Text = "Office Suite" }
if ($txtOfficeHeroTitle) { $txtOfficeHeroTitle.Text = "Deploy & Activate Microsoft Office" }
if ($txtOfficeHeroSub) { $txtOfficeHeroSub.Text = "Direct download from official Microsoft CDN via ODT with silent permanent MAS Ohook activation." }
if ($lblOfficeVersion) { $lblOfficeVersion.Text = "Suite & Release Year" }
if ($lblOfficeLang) { $lblOfficeLang.Text = "Installation Language" }
if ($lblOfficeArch) { $lblOfficeArch.Text = "Architecture" }
if ($lblOfficeApps) { $lblOfficeApps.Text = "Component Applications" }
if ($btnSelectAllApps) { $btnSelectAllApps.Content = "All" }
if ($btnSelectMinimalApps) { $btnSelectMinimalApps.Content = "Essential" }
if ($txtAppsHint) { $txtAppsHint.Text = "Note: Uncheck unneeded apps to speed up download and save disk space." }
if ($txtOfficeInstallBtn) { $txtOfficeInstallBtn.Text = "Install & Auto-Activate" }
if ($txtOfficeActivateOnlyBtn) { $txtOfficeActivateOnlyBtn.Text = "Instant Activate Installed Office" }
if ($btnOfficeExportXml) { $btnOfficeExportXml.Content = "📄 Save XML" }
if ($lblOfficeConsoleHeader) { $lblOfficeConsoleHeader.Text = "Deployment & Activation Console" }
if ($txtAdminTitle) { $txtAdminTitle.Text = "Admin Privilege" }
if ($txtAdminSub) { $txtAdminSub.Text = "Administrator: Active" }
# Dashboard Top Hero & Telemetry
if ($txtHeroTitle) { $txtHeroTitle.Text = "🚀 One-Click Turbo System Boost" }
if ($txtHeroDesc) { $txtHeroDesc.Text = "Deep clean temporary files, flush DNS cache, purge standby RAM, and optimize storage in a single click." }
if ($txtTurboBtn) { $txtTurboBtn.Text = "Run Complete Turbo Boost" }
if ($txtCardRamHeader) { $txtCardRamHeader.Text = "RAM Consumption" }
if ($txtDashRamDetails) { $txtDashRamDetails.Text = "Standby RAM: Ready to Purge" }
if ($btnDashPurge) { $btnDashPurge.Content = "Purge RAM Now" }
if ($txtCardAdminHeader) { $txtCardAdminHeader.Text = "System Privileges" }
if ($txtCardAdminSub) { $txtCardAdminSub.Text = "● Fully Unlocked" }
if ($txtCardDiskHeader) { $txtCardDiskHeader.Text = "System Drive (C:)" }
if ($txtCardDiskSub1) { $txtCardDiskSub1.Text = "RAM State: Optimal & Stable" }
if ($txtQuickShortcuts) { $txtQuickShortcuts.Text = "Essential Power Utilities" }
if ($lblQuickMas) { $lblQuickMas.Text = "🔑 Windows & Office Activation (MAS)" }
if ($txtDescQuickMas) { $txtDescQuickMas.Text = "Official & permanent digital license HWID / Ohook" }
if ($btnQuickMas) { $btnQuickMas.Content = "Launch" }
if ($lblQuickWinUtil) { $lblQuickWinUtil.Text = "🛠️ Windows Debloat Utility (WinUtil)" }
if ($txtDescQuickWinUtil) { $txtDescQuickWinUtil.Text = "Remove bloatware, telemetry, and install packages" }
if ($btnQuickWinUtil) { $btnQuickWinUtil.Content = "Launch" }
# Storage Tab
if ($txtStorageHeader) { $txtStorageHeader.Text = "Deep Storage & Cache Purge" }
if ($txtStorageSub) { $txtStorageSub.Text = "Advanced cleaner that goes far beyond Temp: clears browsers cache, GPU shaders, update backlog, and crash dumps." }
if ($txtStorageDiskTitle) { $txtStorageDiskTitle.Text = "Primary Drive (C:)" }
if ($lblMagicClean) { $lblMagicClean.Text = "✨ Comprehensive Magic Clean (All-in-One)" }
if ($btnMagicClean) { $btnMagicClean.Content = "✨ Magic Deep Clean" }
if ($txtMagicCleanDesc) { $txtMagicCleanDesc.Text = "Purges all in 1 click: all browsers cache (Chrome, Edge, Brave, Firefox, Opera), GPU shaders (DirectX/NVIDIA/AMD), Windows Update downloads, crash dumps, thumbnails, and Recycle Bin." }
if ($txtSpecificCleanersHeader) { $txtSpecificCleanersHeader.Text = "Targeted Cleaning Operations" }
if ($lblCleanBrowsers) { $lblCleanBrowsers.Text = "🌐 All Browsers Cache & Data" }
if ($txtCleanBrowsersDesc) { $txtCleanBrowsersDesc.Text = "Clears cache, GPUCache, and Code Cache for Chrome, Edge, Brave, Firefox, and Opera without touching passwords or history." }
if ($btnCleanBrowsers) { $btnCleanBrowsers.Content = "Clean Browsers" }
if ($lblCleanShaders) { $lblCleanShaders.Text = "🎮 GPU & Gaming Shaders Cache" }
if ($txtCleanShadersDesc) { $txtCleanShadersDesc.Text = "Clears accumulated GPU shader caches (DirectX, NVIDIA, AMD) that consume gigabytes and can cause stuttering." }
if ($btnCleanShaders) { $btnCleanShaders.Content = "Clear Shaders" }
if ($lblCleanWinUpdate) { $lblCleanWinUpdate.Text = "📦 Windows Update Backlog & Dumps" }
if ($txtCleanWinUpdateDesc) { $txtCleanWinUpdateDesc.Text = "Purges Windows Update download files (SoftwareDistribution) and system error crash dumps." }
if ($btnCleanWinUpdate) { $btnCleanWinUpdate.Content = "Clear Updates" }
if ($lblCleanRecycleThumbs) { $lblCleanRecycleThumbs.Text = "🗑️ Recycle Bin & Thumbnails" }
if ($txtCleanRecycleThumbsDesc) { $txtCleanRecycleThumbsDesc.Text = "Empties the Recycle Bin completely, clears image thumbnail cache, and flushes DNS resolver." }
if ($btnCleanRecycleThumbs) { $btnCleanRecycleThumbs.Content = "Empty Bin" }
if ($lblCleanDevCaches) { $lblCleanDevCaches.Text = "💻 Developer & Runtime Package Caches" }
if ($txtCleanDevCachesDesc) { $txtCleanDevCachesDesc.Text = "Cleans developer package caches (npm, pip, gradle) and temporary app runtime leftovers." }
if ($btnCleanDevCaches) { $btnCleanDevCaches.Content = "Clear Dev Cache" }
# Power Tools Tab
if ($txtToolsHeader) { $txtToolsHeader.Text = "Core Tools & Licensing" }
if ($txtToolsSub) { $txtToolsSub.Text = "Advanced suite for activation, system debloating, and app updating." }
if ($txtMasCardDesc) { $txtMasCardDesc.Text = "Microsoft Activation Scripts (MAS) for official, permanent Windows and Office activation." }
if ($btnToolsMas) { $btnToolsMas.Content = "Launch Tool" }
if ($txtWinUtilCardDesc) { $txtWinUtilCardDesc.Text = "The famous CTT WinUtil for debloating, package installs, and updates management." }
if ($btnToolsWinUtil) { $btnToolsWinUtil.Content = "Launch Tool" }
if ($lblDeepClean) { $lblDeepClean.Text = "🧹 Deep System & Temp Cleanup" }
if ($txtDeepCleanDesc) { $txtDeepCleanDesc.Text = "Deep silent cleanup of Temp, Prefetch, SoftwareDistribution cache, Recycle Bin, and DNS." }
if ($btnToolsDeepClean) { $btnToolsDeepClean.Content = "Clean Now" }
if ($lblWinget) { $lblWinget.Text = "📦 Global Package & Software Updater" }
if ($txtWingetDesc) { $txtWingetDesc.Text = "Scan and update all installed applications, runtimes, and Visual C++ libraries." }
if ($btnToolsWinget) { $btnToolsWinget.Content = "Update Apps" }
# Repairs Tab
if ($txtRepairsHeader) { $txtRepairsHeader.Text = "System Health & Diagnostics" }
if ($txtRepairsSub) { $txtRepairsSub.Text = "Repair corrupted Windows files, fix update errors, and optimize disk integrity." }
if ($lblSfc) { $lblSfc.Text = "🛡️ System File Verification (DISM & SFC)" }
if ($txtSfcDesc) { $txtSfcDesc.Text = "Executes DISM RestoreHealth and SFC Scannow to replace corrupted system files." }
if ($btnRepairSfc) { $btnRepairSfc.Content = "Run Repair" }
if ($lblWu) { $lblWu.Text = "🔄 Reset Windows Update Components" }
if ($txtWuDesc) { $txtWuDesc.Text = "Stops update services, clears corrupted distribution cache, and resets update components." }
if ($btnRepairWu) { $btnRepairWu.Content = "Fix Updates" }
if ($lblDisk) { $lblDisk.Text = "💾 Drive Integrity Scan & SSD TRIM" }
if ($txtDiskDesc) { $txtDiskDesc.Text = "Runs online drive integrity scan and triggers SSD ReTrim for maximum read/write performance." }
if ($btnRepairDisk) { $btnRepairDisk.Content = "Scan & TRIM" }
if ($lblNet) { $lblNet.Text = "🌐 Network & Internet Stack Reset" }
if ($txtNetDesc) { $txtNetDesc.Text = "Resets Winsock, clears IP configuration, flushes DNS, and enables TCP Fast Open." }
if ($btnRepairNet) { $btnRepairNet.Content = "Fix Network" }
if ($lblLogs) { $lblLogs.Text = "📑 Purge Windows Event Logs" }
if ($txtLogsDesc) { $txtLogsDesc.Text = "Wipes thousands of accumulated event log records to accelerate Windows boot speed." }
if ($btnRepairLogs) { $btnRepairLogs.Content = "Clear Logs" }
# Gaming Tab
if ($txtGamingHeader) { $txtGamingHeader.Text = "Gaming Acceleration & Memory" }
if ($txtGamingSub) { $txtGamingSub.Text = "Eliminate CPU/GPU throttling, purge memory instantly, and reduce game latency." }
if ($lblRamPurge) { $lblRamPurge.Text = "⚡ Instant Memory Purge" }
if ($txtRamPurgeDesc) { $txtRamPurgeDesc.Text = "Trim process working sets and invoke .NET garbage collection to free gigabytes immediately." }
if ($btnGamingRamPurge) { $btnGamingRamPurge.Content = "Purge RAM" }
if ($lblRamTask) { $lblRamTask.Text = "🧠 Automatic Background RAM Cleaner" }
if ($txtRamTaskDesc) { $txtRamTaskDesc.Text = "Installs a silent scheduled background task named Hadjikiko-Core running every 10 minutes." }
if ($btnGamingRamTask) { $btnGamingRamTask.Content = "Install Task" }
if ($lblPower) { $lblPower.Text = "🔥 Ultimate Performance Power Scheme" }
if ($txtPowerDesc) { $txtPowerDesc.Text = "Unlocks and activates hidden Windows Ultimate Performance scheme to prevent micro-stutters." }
if ($btnGamingPower) { $btnGamingPower.Content = "Enable Plan" }
if ($lblTelemetry) { $lblTelemetry.Text = "🛡️ Disable Background Telemetry & Tracking" }
if ($txtTelemetryDesc) { $txtTelemetryDesc.Text = "Stops and disables DiagTrack and dmwappushservice tracking to reduce CPU cycles." }
if ($btnGamingTelemetry) { $btnGamingTelemetry.Content = "Disable" }
if ($lblLatency) { $lblLatency.Text = "🎯 Network & GPU Game Latency Priority" }
if ($txtLatencyDesc) { $txtLatencyDesc.Text = "Removes network throttling index and prioritizes GPU scheduling for games." }
if ($btnGamingLatency) { $btnGamingLatency.Content = "Optimize" }
if ($lblExplorer) { $lblExplorer.Text = "🔄 Restart Windows Shell (Explorer)" }
if ($txtExplorerDesc) { $txtExplorerDesc.Text = "Restarts shell explorer process to immediately apply UI & registry modifications." }
if ($btnGamingExplorer) { $btnGamingExplorer.Content = "Restart" }
# Specs Tab
if ($txtInfoHeader) { $txtInfoHeader.Text = "System & Hardware Specifications" }
if ($txtInfoSub) { $txtInfoSub.Text = "Detailed real-time hardware specifications and system properties." }
if ($btnRefreshSpecs) { $btnRefreshSpecs.Content = "Refresh Specs 🔄" }
if ($lblSpecsSecHeader) { $lblSpecsSecHeader.Text = "System Licenses & Security" }
if ($lblInfoOsHeader) { $lblInfoOsHeader.Text = "🪟 Windows Operating System" }
if ($lblInfoOfficeHeader) { $lblInfoOfficeHeader.Text = "📦 Microsoft Office Suite" }
if ($lblInfoSecHeader) { $lblInfoSecHeader.Text = "🛡️ System Security & Privileges" }
if ($txtInfoSecurity) { $txtInfoSecurity.Text = "Full Administrator Privileges (Elevated)" }
if ($txtInfoSecDetails) { $txtInfoSecDetails.Text = "UAC: High Integrity | Execution: In-Memory Safe" }
if ($lblSpecsHwHeader) { $lblSpecsHwHeader.Text = "Hardware Components & Display" }
if ($lblInfoCpuHeader) { $lblInfoCpuHeader.Text = "⚡ Processor (CPU)" }
if ($lblInfoRamHeader) { $lblInfoRamHeader.Text = "🧠 System RAM & Clock Speed" }
if ($lblInfoGpuHeader) { $lblInfoGpuHeader.Text = "🎮 Graphics Card & Display" }
if ($lblInfoBoardHeader) { $lblInfoBoardHeader.Text = "💻 Motherboard & BIOS" }
if ($lblSpecsStorageHeader) { $lblSpecsStorageHeader.Text = "Storage, Network & Connectivity" }
if ($lblInfoStorageHeader) { $lblInfoStorageHeader.Text = "💾 System Drive & Partition Table" }
if ($lblInfoNetHeader) { $lblInfoNetHeader.Text = "🌐 Network & Bluetooth" }
if ($lblInfoUptimeHeader) { $lblInfoUptimeHeader.Text = "⏱️ Device & System Uptime" }
# Modal Dialog Default Text
if ($txtModalTitle) { $txtModalTitle.Text = "Important Pre-Cleaning Warning" }
if ($txtModalDesc) { $txtModalDesc.Text = "To thoroughly clean cache and maximize free disk space, all running browser windows (Google Chrome, Microsoft Edge, Brave, Firefox, Opera) will be closed to release file locks.`n`nDo you want to proceed and close browsers now?" }
if ($btnModalCancel) { $btnModalCancel.Content = "Cancel Operation" }
if ($btnModalConfirm) { $btnModalConfirm.Content = "✓ Confirm & Proceed" }
if ($txtStatus) { $txtStatus.Text = "Ready | All modules running with elevated Administrator privileges." }
} else {
if ($btnLangToggle) { $btnLangToggle.Content = "English" }
if ($txtLangBtn) { $txtLangBtn.Text = "English" }
if ($txtSidebarNavHeader) { $txtSidebarNavHeader.Text = "القائمة الرئيسية" }
if ($txtRingSub) { $txtRingSub.Text = "مستهلك" }
if ($btnDashToStorage) { $btnDashToStorage.Content = "💾 فتح توفير المساحة" }
if ($btnDashRepairShortcut) { $btnDashRepairShortcut.Content = "🔧 صيانة وتصليح النظام" }
if ($txtDashGamingBtn) { $txtDashGamingBtn.Text = "تسريع الألعاب" }
if ($txtDashNetBtn) { $txtDashNetBtn.Text = "تصفير النت" }
if ($txtDashTrimBtn) { $txtDashTrimBtn.Text = "تشغيل TRIM" }
if ($txtDashExpBtn) { $txtDashExpBtn.Text = "إعادة Explorer" }
if ($txtTabDashboard) { $txtTabDashboard.Text = "لوحة التحكم" }
if ($txtTabStorage) { $txtTabStorage.Text = "توفير المساحة" }
if ($txtTabTools) { $txtTabTools.Text = "الأدوات الرئيسية" }
if ($txtTabRepairs) { $txtTabRepairs.Text = "صيانة وإصلاح النظام" }
if ($txtTabGaming) { $txtTabGaming.Text = "تسريع الألعاب والرام" }
if ($txtTabInfo) { $txtTabInfo.Text = "مواصفات الجهاز" }
if ($txtAdminTitle) { $txtAdminTitle.Text = "وضع المسؤول" }
if ($txtAdminSub) { $txtAdminSub.Text = "Administrator: مفعّل بنشاط" }
# Dashboard Top Hero & Telemetry
if ($txtHeroTitle) { $txtHeroTitle.Text = "🚀 التحسين الشامل وفائق السرعة (Turbo Boost)" }
if ($txtHeroDesc) { $txtHeroDesc.Text = "تنظيف ملفات النظام المؤقتة، تفريغ كاش الـ DNS، تفريغ الرام المعلق، وتحسين أداء الأقراص بنقرة واحدة." }
if ($txtTurboBtn) { $txtTurboBtn.Text = "تشغيل التحسين الفوري الكامل" }
if ($txtCardRamHeader) { $txtCardRamHeader.Text = "استهلاك الذاكرة (RAM)" }
if ($txtDashRamDetails) { $txtDashRamDetails.Text = "Standby RAM: جاهز للتفريغ" }
if ($btnDashPurge) { $btnDashPurge.Content = "تفريغ فوري للرام" }
if ($txtCardAdminHeader) { $txtCardAdminHeader.Text = "صلاحيات النظام والحماية" }
if ($txtCardAdminSub) { $txtCardAdminSub.Text = "● صلاحيات كاملة جاهزة" }
if ($txtCardDiskHeader) { $txtCardDiskHeader.Text = "القرص الرئيسي (C:)" }
if ($txtCardDiskSub1) { $txtCardDiskSub1.Text = "حالة الذاكرة: ممتازة ومستقرة" }
if ($txtQuickShortcuts) { $txtQuickShortcuts.Text = "أبرز الأدوات السريعة" }
if ($lblQuickMas) { $lblQuickMas.Text = "🔑 تنشيط الويندوز والأوفيس (MAS)" }
if ($txtDescQuickMas) { $txtDescQuickMas.Text = "ترخيص رقمي رسمي ودائم HWID / Ohook" }
if ($btnQuickMas) { $btnQuickMas.Content = "تشغيل" }
if ($lblQuickWinUtil) { $lblQuickWinUtil.Text = "🛠️ تخفيف وتخصيص ويندوز (WinUtil)" }
if ($txtDescQuickWinUtil) { $txtDescQuickWinUtil.Text = "أداة تخفيف وتخصيص ويندوز الشاملة" }
if ($btnQuickWinUtil) { $btnQuickWinUtil.Content = "تشغيل" }
# Office Tab (Arabic)
if ($txtTabOffice) { $txtTabOffice.Text = "تثبيت وتفعيل أوفيس" }
if ($txtOfficeHeroTitle) { $txtOfficeHeroTitle.Text = "تثبيت وتفعيل حزمة مايكروسوفت أوفيس الأصلية" }
if ($txtOfficeHeroSub) { $txtOfficeHeroSub.Text = "تحميل مباشر من سيرفرات Microsoft عبر أداة ODT، مع تفعيل رقمي صامت دائم عبر MAS Ohook." }
if ($lblOfficeVersion) { $lblOfficeVersion.Text = "إصدار الحزمة والسنة (Suite & Release Year)" }
if ($lblOfficeLang) { $lblOfficeLang.Text = "لغة التثبيت (Language)" }
if ($lblOfficeArch) { $lblOfficeArch.Text = "المعمارية (Architecture)" }
if ($lblOfficeApps) { $lblOfficeApps.Text = "تحديد التطبيقات المراد تثبيتها (Apps)" }
if ($btnSelectAllApps) { $btnSelectAllApps.Content = "الكل" }
if ($btnSelectMinimalApps) { $btnSelectMinimalApps.Content = "الأساسية" }
if ($txtAppsHint) { $txtAppsHint.Text = "ملاحظة: يمكنك إلغاء تحديد التطبيقات غير المرغوبة لتسريع التثبيت وتوفير المساحة." }
if ($txtOfficeInstallBtn) { $txtOfficeInstallBtn.Text = "بدء التثبيت والتفعيل التلقائي" }
if ($txtOfficeActivateOnlyBtn) { $txtOfficeActivateOnlyBtn.Text = "تفعيل أوفيس المثبت فوراً" }
if ($btnOfficeExportXml) { $btnOfficeExportXml.Content = "📄 حفظ XML" }
if ($lblOfficeConsoleHeader) { $lblOfficeConsoleHeader.Text = "سجل العمليات المباشر (Deployment Terminal)" }
# Storage Tab
if ($txtStorageHeader) { $txtStorageHeader.Text = "توفير وتفريغ المساحة العميقة" }
if ($txtStorageSub) { $txtStorageSub.Text = "تنظيف متقدم يتجاوز ملفات Temp: يمسح كاش المتصفحات، كاش الشاشات، ومخلفات التحديثات العالقة." }
if ($txtStorageDiskTitle) { $txtStorageDiskTitle.Text = "القرص الرئيسي (C:)" }
if ($lblMagicClean) { $lblMagicClean.Text = "✨ التنظيف السحري الشامل (Magic Deep Clean)" }
if ($btnMagicClean) { $btnMagicClean.Content = "✨ تشغيل التنظيف السحري" }
if ($txtMagicCleanDesc) { $txtMagicCleanDesc.Text = "يمسح بنقرة واحدة: كاش كل المتصفحات (Chrome, Edge, Brave, Firefox, Opera)، كاش بطاقات الشاشة، ملفات تحميل التحديثات، تقارير الأخطاء، وسلة المهملات." }
if ($txtSpecificCleanersHeader) { $txtSpecificCleanersHeader.Text = "عمليات التنظيف المخصصة" }
if ($lblCleanBrowsers) { $lblCleanBrowsers.Text = "🌐 كاش المتصفحات الشامل (Browsers Cache)" }
if ($txtCleanBrowsersDesc) { $txtCleanBrowsersDesc.Text = "حذف ملفات الكاش و GPUCache لمتصفحات Chrome وEdge وBrave وFirefox وOpera بأمان تام." }
if ($btnCleanBrowsers) { $btnCleanBrowsers.Content = "تفريغ المتصفحات" }
if ($lblCleanShaders) { $lblCleanShaders.Text = "🎮 كاش كروت الشاشة والألعاب (DirectX, NVIDIA, AMD Shaders)" }
if ($txtCleanShadersDesc) { $txtCleanShadersDesc.Text = "مسح الكاش الرسومي والشيدرز القديمة لبطاقات NVIDIA وAMD وDirectX التي تستهلك جيجابايت." }
if ($btnCleanShaders) { $btnCleanShaders.Content = "مسح كاش الرندر" }
if ($lblCleanWinUpdate) { $lblCleanWinUpdate.Text = "📦 مخلفات التحديثات والتقارير (Windows Update & Dumps)" }
if ($txtCleanWinUpdateDesc) { $txtCleanWinUpdateDesc.Text = "مسح ملفات التحديثات المحملة القديمة ومجلد DeliveryOptimization وتقارير انهيار النظام." }
if ($btnCleanWinUpdate) { $btnCleanWinUpdate.Content = "تفريغ التحديثات" }
if ($lblCleanRecycleThumbs) { $lblCleanRecycleThumbs.Text = "🗑️ سلة المهملات ومصغرات الصور (Recycle Bin & Thumbnails)" }
if ($txtCleanRecycleThumbsDesc) { $txtCleanRecycleThumbsDesc.Text = "تفريغ سلة المحذوفات نهائياً ومسح كاش مصغرات الصور وتفريغ كاش عناوين DNS." }
if ($btnCleanRecycleThumbs) { $btnCleanRecycleThumbs.Content = "تفريغ السلة" }
if ($lblCleanDevCaches) { $lblCleanDevCaches.Text = "💻 كاش حزم المطورين والبرامج (Dev & Package Caches)" }
if ($txtCleanDevCachesDesc) { $txtCleanDevCachesDesc.Text = "تفريغ كاش حزم npm و pip و gradle ومخلفات التطبيقات المؤقتة." }
if ($btnCleanDevCaches) { $btnCleanDevCaches.Content = "تفريغ كاش البرامج" }
# Power Tools Tab
if ($txtToolsHeader) { $txtToolsHeader.Text = "الأدوات الرئيسية والتراخيص" }
if ($txtToolsSub) { $txtToolsSub.Text = "مجموعة الأدوات المتقدمة الأكثر طلباً لإدارة وتحديث وتنظيف النظام." }
if ($txtMasCardDesc) { $txtMasCardDesc.Text = "أداة التنشيط الرسمية المعتمدة (MAS) لتفعيل Windows و Office بأمان تام." }
if ($btnToolsMas) { $btnToolsMas.Content = "فتح الأداة" }
if ($txtWinUtilCardDesc) { $txtWinUtilCardDesc.Text = "أداة CTT WinUtil الشهيرة لتثبيت البرامج وإزالة التطبيقات غير المرغوبة." }
if ($btnToolsWinUtil) { $btnToolsWinUtil.Content = "فتح الأداة" }
if ($lblDeepClean) { $lblDeepClean.Text = "🧹 تنظيف معمق للنظام والمساحة (Deep Clean)" }
if ($txtDeepCleanDesc) { $txtDeepCleanDesc.Text = "تنظيف عميق وصامت لملفات Temp، Prefetch، كاش SoftwareDistribution، وسلة المحذوفات." }
if ($btnToolsDeepClean) { $btnToolsDeepClean.Content = "تنظيف الآن" }
if ($lblWinget) { $lblWinget.Text = "📦 تحديث كافة البرامج والمكتبات (Winget Updater)" }
if ($txtWingetDesc) { $txtWingetDesc.Text = "فحص كافة البرامج والتطبيقات وحزم Visual C++ وتحديثها لأحدث إصدار رسمي." }
if ($btnToolsWinget) { $btnToolsWinget.Content = "تحديث الحزم" }
# Repairs Tab
if ($txtRepairsHeader) { $txtRepairsHeader.Text = "صيانة وإصلاح أخطاء النظام" }
if ($txtRepairsSub) { $txtRepairsSub.Text = "إصلاح تلف ملفات Windows، حل أخطاء التحديثات، وفحص واستقرار الهارد ديسك." }
if ($lblSfc) { $lblSfc.Text = "🛡️ فحص وإصلاح ملفات النظام (DISM & SFC)" }
if ($txtSfcDesc) { $txtSfcDesc.Text = "تشغيل DISM RestoreHealth متبوعاً بـ SFC Scannow لاستبدال أي ملف نظام معطوب." }
if ($btnRepairSfc) { $btnRepairSfc.Content = "بدء الإصلاح" }
if ($lblWu) { $lblWu.Text = "🔄 تصفير وإصلاح أخطاء Windows Update" }
if ($txtWuDesc) { $txtWuDesc.Text = "إيقاف خدمات التحديث، ومسح مجلدات الكاش المعطوبة، وتصفير خدمة التحديثات العالقة." }
if ($btnRepairWu) { $btnRepairWu.Content = "إصلاح التحديثات" }
if ($lblDisk) { $lblDisk.Text = "💾 فحص سلامة الهارد وتحسين الـ SSD (TRIM)" }
if ($txtDiskDesc) { $txtDiskDesc.Text = "فحص سلامة القرص وتنشيط ReTrim للأقراص الصلبة SSD لرفع سرعة القراءة والكتابة." }
if ($btnRepairDisk) { $btnRepairDisk.Content = "فحص و TRIM" }
if ($lblNet) { $lblNet.Text = "🌐 تصفير وحل مشاكل الإنترنت والشبكة" }
if ($txtNetDesc) { $txtNetDesc.Text = "تصفير بروتوكول Winsock و TCP/IP وحل مشاكل الإنترنت وتفعيل تقنية TCP Fast Open." }
if ($btnRepairNet) { $btnRepairNet.Content = "إصلاح الشبكة" }
if ($lblLogs) { $lblLogs.Text = "📑 مسح سجلات الأحداث (Windows Event Logs)" }
if ($txtLogsDesc) { $txtLogsDesc.Text = "تفريغ آلاف السجلات والأحداث المتراكمة في النظام لتسريع إقلاع الجهاز." }
if ($btnRepairLogs) { $btnRepairLogs.Content = "تفريغ السجلات" }
# Gaming Tab
if ($txtGamingHeader) { $txtGamingHeader.Text = "تسريع الألعاب والذاكرة العشوائية" }
if ($txtGamingSub) { $txtGamingSub.Text = "إلغاء اختناق المعالج وكروت الشاشة، تفريغ الذاكرة فورياً، وتقليل البينغ للألعاب." }
if ($lblRamPurge) { $lblRamPurge.Text = "⚡ تفريغ الذاكرة الفوري (Instant RAM Purge)" }
if ($txtRamPurgeDesc) { $txtRamPurgeDesc.Text = "تفريغ Working Sets لجميع العمليات النشطة فورياً وتحرير جيجابايت كاملة." }
if ($btnGamingRamPurge) { $btnGamingRamPurge.Content = "تفريغ الذاكرة" }
if ($lblRamTask) { $lblRamTask.Text = "🧠 خدمة تفريغ الرام التلقائية (كل 10 دقائق)" }
if ($txtRamTaskDesc) { $txtRamTaskDesc.Text = "برمجة مهمة مجدولة بنظام Windows باسم Hadjikiko-Core تعمل كل 10 دقائق بصمت تام." }
if ($btnGamingRamTask) { $btnGamingRamTask.Content = "تثبيت الخدمة" }
if ($lblPower) { $lblPower.Text = "🔥 خطة الأداء الأقصى (Ultimate Performance)" }
if ($txtPowerDesc) { $txtPowerDesc.Text = "تفعيل خطة الطاقة القصوى المخفية في ويندوز لمنع هبوط الفريمات وخنق المعالج." }
if ($btnGamingPower) { $btnGamingPower.Content = "تفعيل الخطة" }
if ($lblTelemetry) { $lblTelemetry.Text = "🛡️ تعطيل خدمات التتبع والتجسس (Telemetry)" }
if ($txtTelemetryDesc) { $txtTelemetryDesc.Text = "تعطيل خدمات التتبع والتجسس DiagTrack و dmwappushservice لتوفير موارد CPU." }
if ($btnGamingTelemetry) { $btnGamingTelemetry.Content = "تعطيل التتبع" }
if ($lblLatency) { $lblLatency.Text = "🎯 أولوية كارت الشاشة وتقليل البينغ للألعاب" }
if ($txtLatencyDesc) { $txtLatencyDesc.Text = "ضبط سجل Registry لإلغاء حد خانق الشبكة NetworkThrottling وتعيين أولوية الألعاب." }
if ($btnGamingLatency) { $btnGamingLatency.Content = "ضبط الأولوية" }
if ($lblExplorer) { $lblExplorer.Text = "🔄 إعادة تشغيل مستكشف الويندوز (Explorer)" }
if ($txtExplorerDesc) { $txtExplorerDesc.Text = "إعادة تشغيل مستكشف الويندوز لتطبيق كافة التعديلات فوراً وتحديث سطح المكتب." }
if ($btnGamingExplorer) { $btnGamingExplorer.Content = "إعادة تشغيل" }
# Specs Tab
if ($txtInfoHeader) { $txtInfoHeader.Text = "مواصفات ومعلومات العتاد الشاملة" }
if ($txtInfoSub) { $txtInfoSub.Text = "تفاصيل دقيقة ومباشرة حول مكونات حاسوبك ونظام التشغيل." }
if ($btnRefreshSpecs) { $btnRefreshSpecs.Content = "تحديث البيانات 🔄" }
if ($lblSpecsSecHeader) { $lblSpecsSecHeader.Text = "تراخيص النظام والأمان" }
if ($lblInfoOsHeader) { $lblInfoOsHeader.Text = "🪟 نظام Windows والترخيص" }
if ($lblInfoOfficeHeader) { $lblInfoOfficeHeader.Text = "📦 حزمة Microsoft Office والترخيص" }
if ($lblInfoSecHeader) { $lblInfoSecHeader.Text = "🛡️ أمان النظام وصلاحيات المسؤول" }
if ($txtInfoSecurity) { $txtInfoSecurity.Text = "صلاحيات مسؤول كاملة (Full Administrator)" }
if ($txtInfoSecDetails) { $txtInfoSecDetails.Text = "صلاحيات UAC: كاملة | التشغيل: آمن في الذاكرة" }
if ($lblSpecsHwHeader) { $lblSpecsHwHeader.Text = "العتاد والمكونات المادية والشاشة" }
if ($lblInfoCpuHeader) { $lblInfoCpuHeader.Text = "⚡ المعالج المركزي (CPU)" }
if ($lblInfoRamHeader) { $lblInfoRamHeader.Text = "🧠 الذاكرة العشوائية والتردد (RAM)" }
if ($lblInfoGpuHeader) { $lblInfoGpuHeader.Text = "🎮 كارت الشاشة ودقة العرض (GPU & Display)" }
if ($lblInfoBoardHeader) { $lblInfoBoardHeader.Text = "💻 اللوحة الأم والبيوس (Motherboard & BIOS)" }
if ($lblSpecsStorageHeader) { $lblSpecsStorageHeader.Text = "التخزين، الشبكة والاتصال" }
if ($lblInfoStorageHeader) { $lblInfoStorageHeader.Text = "💾 قرص النظام ونوع البارتشن (Partition)" }
if ($lblInfoNetHeader) { $lblInfoNetHeader.Text = "🌐 الشبكة والبلوتوث" }
if ($lblInfoUptimeHeader) { $lblInfoUptimeHeader.Text = "⏱️ اسم الجهاز ومدة التشغيل" }
# Modal Dialog Default Text
if ($txtModalTitle) { $txtModalTitle.Text = "تنبيه مهم قبل بدء التنظيف" }
if ($txtModalDesc) { $txtModalDesc.Text = "لتنظيف الكاش العميق وتوفير أقصى مساحة ممكنة، سيقوم المنظف بإغلاق كافة نوافذ المتصفحات المفتوحة (Google Chrome، Microsoft Edge، Firefox، وغيرها) لفك قفل ملفات الكاش وقواعد البيانات وحذفها نهائياً بدون لمس كلمات المرور أو الحسابات.`n`nهل تريد المتابعة وإغلاق المتصفحات الآن؟" }
if ($btnModalCancel) { $btnModalCancel.Content = "إلغاء العملية" }
if ($btnModalConfirm) { $btnModalConfirm.Content = "✓ تأكيد والمتابعة" }
if ($txtStatus) { $txtStatus.Text = "جاهز للعمل | تم تشغيل كافة الوحدات بصلاحيات المسؤول." }
}
# Refresh dynamic text based on the newly selected language
Update-StorageDriveDisplay
Load-DeepHardwareInfo
Update-RamTaskButtonUI
}
$btnLangToggle.Add_Click({
if ($global:currentLang -eq "EN") {
$global:currentLang = "AR"
} else {
$global:currentLang = "EN"
}
Update-Language
})
# 7. WINDOW EVENT HANDLERS
$titleBar.Add_MouseLeftButtonDown({
if ($_.ClickCount -eq 2) {
if ($window.WindowState -eq [System.Windows.WindowState]::Maximized) {
$window.WindowState = [System.Windows.WindowState]::Normal
if ($btnMax) { $btnMax.Content = "□" }
} else {
$window.WindowState = [System.Windows.WindowState]::Maximized
if ($btnMax) { $btnMax.Content = "❐" }
}
} else {
$window.DragMove()
}
})
$btnMin.Add_Click({ $window.WindowState = [System.Windows.WindowState]::Minimized })
if ($btnMax) {
$btnMax.Add_Click({
if ($window.WindowState -eq [System.Windows.WindowState]::Maximized) {
$window.WindowState = [System.Windows.WindowState]::Normal
$btnMax.Content = "□"
} else {
$window.WindowState = [System.Windows.WindowState]::Maximized
$btnMax.Content = "❐"
}
})
}
$btnClose.Add_Click({ $window.Close() })
# Status Update Helper
function Set-AppStatus ($msg, $color = "#94a3b8", $dotColor = "#34d399") {
$txtStatus.Text = $msg
$txtStatus.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString($color)
$txtStatusDot.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString($dotColor)
}
# Tab Switching Helper
$tabs = @($tabBtnDashboard, $tabBtnStorage, $tabBtnTools, $tabBtnRepairs, $tabBtnGaming, $tabBtnInfo, $tabBtnOffice)
$panels = @($panelDashboard, $panelStorage, $panelTools, $panelRepairs, $panelGaming, $panelInfo, $panelOffice)
function Switch-Tab ($activeTab, $activePanel) {
foreach ($p in $panels) { $p.Visibility = [System.Windows.Visibility]::Collapsed }
foreach ($t in $tabs) {
$t.Background = [System.Windows.Media.Brushes]::Transparent
$t.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#8e8e93")
}
$activePanel.Visibility = [System.Windows.Visibility]::Visible
$activeTab.Background = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#18181b")
$activeTab.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#ffffff")
}
$tabBtnDashboard.Add_Click({ Switch-Tab $tabBtnDashboard $panelDashboard })
$tabBtnStorage.Add_Click({ Switch-Tab $tabBtnStorage $panelStorage })
$tabBtnTools.Add_Click({ Switch-Tab $tabBtnTools $panelTools })
$tabBtnRepairs.Add_Click({ Switch-Tab $tabBtnRepairs $panelRepairs })
$tabBtnGaming.Add_Click({ Switch-Tab $tabBtnGaming $panelGaming })
$tabBtnInfo.Add_Click({ Switch-Tab $tabBtnInfo $panelInfo; Load-DeepHardwareInfo })
if ($tabBtnOffice) { $tabBtnOffice.Add_Click({ Switch-Tab $tabBtnOffice $panelOffice }) }
# Live RAM Update Helper
function Update-LiveRam {
try {
$os = Get-CimInstance Win32_OperatingSystem
$totalGB = [math]::Round($os.TotalVisibleMemorySize / 1MB, 1)
$freeGB = [math]::Round($os.FreePhysicalMemory / 1MB, 1)
$usedGB = [math]::Round($totalGB - $freeGB, 1)
$pct = [math]::Round(($usedGB / $totalGB) * 100)
$txtTitleRam.Text = "RAM: $usedGB GB / $totalGB GB ($pct%)"
$txtDashRam.Text = "$usedGB GB / $totalGB GB ($pct%)"
$pbRam.Value = $pct
if ($pct -gt 85) {
$pbRam.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#ff5555")
$txtDashRam.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#ff5555")
} else {
$pbRam.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#00ff9d")
$txtDashRam.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#00ff9d")
}
} catch {}
}
Update-LiveRam
# Disk Space Helper
try {
$drive = Get-PSDrive C -ErrorAction SilentlyContinue
if ($drive) {
$freeGB = [math]::Round($drive.Free / 1GB, 1)
$usedGB = [math]::Round($drive.Used / 1GB, 1)
$txtDiskSpace.Text = "$freeGB GB Free"
}
} catch {}
# 100% GENUINE DYNAMIC HARDWARE & SYSTEM SPECS (NO FAKE / STATIC DATA)
function Load-DeepHardwareInfo {
try {
# 1. Genuine CPU Info
$cpuName = (Get-ItemProperty "HKLM:\HARDWARE\DESCRIPTION\System\CentralProcessor\0" -ErrorAction SilentlyContinue).ProcessorNameString
if (-not $cpuName) {
$cpu = Get-CimInstance Win32_Processor -ErrorAction SilentlyContinue | Select-Object -First 1
$cpuName = if ($cpu) { $cpu.Name } else { "Intel / AMD x64 Processor" }
}
$txtInfoCpu.Text = $cpuName.Trim()
if ($global:currentLang -eq "EN") {
$txtInfoCpuDetails.Text = "Cores: $env:NUMBER_OF_PROCESSORS Logical Cores | Architecture: $env:PROCESSOR_ARCHITECTURE"
} else {
$txtInfoCpuDetails.Text = "الأنوية: $env:NUMBER_OF_PROCESSORS أنوية معالجة | المعمارية: $env:PROCESSOR_ARCHITECTURE"
}
# 2. Genuine RAM Info with DDR Generation & Speed (Frequency)
$osMem = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
$totalRamGB = if ($osMem) { [math]::Round($osMem.TotalVisibleMemorySize / 1MB, 1) } else { 16 }
$ramTypeMap = @{
20 = "DDR"; 21 = "DDR2"; 22 = "DDR2-FB-DIMM"; 24 = "DDR3";
26 = "DDR4"; 27 = "LPDDR"; 28 = "LPDDR2"; 29 = "LPDDR3";
30 = "DDR5"; 31 = "LPDDR4"; 32 = "LPDDR4X"; 34 = "DDR5"; 35 = "LPDDR5"
}
$ramSticks = Get-CimInstance Win32_PhysicalMemory -ErrorAction SilentlyContinue
$ramGen = ""
$ramSpeed = 0
$stickCount = 1
if ($ramSticks) {
$stickCount = ($ramSticks | Measure-Object).Count
$firstStick = $ramSticks | Select-Object -First 1
$smbiosType = [int]$firstStick.SMBIOSMemoryType
if ($ramTypeMap.ContainsKey($smbiosType)) {
$ramGen = $ramTypeMap[$smbiosType]
}
if ($firstStick.ConfiguredClockSpeed -gt 0) {
$ramSpeed = $firstStick.ConfiguredClockSpeed
} elseif ($firstStick.Speed -gt 0) {
$ramSpeed = $firstStick.Speed
}
}
if (-not $ramGen) {
if ($ramSpeed -ge 4400) { $ramGen = "DDR5" }
elseif ($ramSpeed -ge 2133) { $ramGen = "DDR4" }
elseif ($ramSpeed -ge 800) { $ramGen = "DDR3" }
else { $ramGen = "DDR4" }
}
$speedStr = if ($ramSpeed -gt 0) { "$ramSpeed MHz" } else { "Standard Frequency" }
$txtInfoRam.Text = "$totalRamGB GB $ramGen @ $speedStr"
if ($global:currentLang -eq "EN") {
$txtInfoRamDetails.Text = "Generation: $ramGen | Frequency: $speedStr | Modules: $stickCount Stick(s)"
} else {
$txtInfoRamDetails.Text = "الجيل: $ramGen | التردد: $speedStr | عدد القطع: $stickCount"
}
# 3. Genuine GPU & Display Resolution + Refresh Rate (Hz)
$dispRes = ""
$gpu = Get-CimInstance Win32_VideoController -ErrorAction SilentlyContinue | Where-Object { $_.CurrentHorizontalResolution -gt 0 } | Select-Object -First 1
if (-not $gpu) {
$gpu = Get-CimInstance Win32_VideoController -ErrorAction SilentlyContinue | Select-Object -First 1
}
if ($gpu) {
$txtInfoGpu.Text = $gpu.Name
$vramMB = [math]::Round($gpu.AdapterRAM / 1MB, 0)
if ($vramMB -lt 0) { $vramMB = 1024 }
if ($gpu.CurrentHorizontalResolution -gt 0) {
$dispRes = "$($gpu.CurrentHorizontalResolution) x $($gpu.CurrentVerticalResolution) @ $($gpu.CurrentRefreshRate) Hz"
}
if (-not $dispRes) { $dispRes = "Standard Display @ 60 Hz" }
if ($global:currentLang -eq "EN") {
$txtInfoGpuDetails.Text = "Display: $dispRes | VRAM: $vramMB MB"
} else {
$txtInfoGpuDetails.Text = "الشاشة: $dispRes | ذاكرة الفيديو: $vramMB MB"
}
} else {
$txtInfoGpu.Text = "Standard Graphics Adapter"
$txtInfoGpuDetails.Text = if ($global:currentLang -eq "EN") { "Hardware Acceleration Active" } else { "تسريع العتاد مفعّل" }
}
# 4. Genuine Storage & Partition Style (GPT vs MBR) & Real Media Type (NVMe / SATA SSD / HDD)
$cDrive = Get-PSDrive C -ErrorAction SilentlyContinue
$partStyle = "GPT"
$mediaType = "SSD"
try {
$cPart = Get-Partition -DriveLetter C -ErrorAction SilentlyContinue
if ($cPart) {
$disk = Get-Disk -Number $cPart.DiskNumber -ErrorAction SilentlyContinue
if ($disk -and $disk.PartitionStyle) {
$partStyle = $disk.PartitionStyle.ToString()
}
} else {
$disk = Get-Disk -ErrorAction SilentlyContinue | Select-Object -First 1
if ($disk -and $disk.PartitionStyle) { $partStyle = $disk.PartitionStyle.ToString() }
}
} catch {}
try {
$physDisk = Get-PhysicalDisk -ErrorAction SilentlyContinue | Select-Object -First 1
if ($physDisk) {
$b = $physDisk.BusType
$m = $physDisk.MediaType
if ($b -eq "RAID" -or $b -eq "SATA") {
$mediaType = if ($m) { "$m ($b)" } else { "SSD ($b)" }
} elseif ($b -like "*NVMe*") {
$mediaType = "NVMe SSD"
} elseif ($m) {
$mediaType = "$m"
}
}
} catch {}
if ($txtDiskMediaType) {
$shortMedia = if ($mediaType -like "*NVMe*") { "NVMe SSD" } elseif ($mediaType -like "*HDD*") { "HDD" } else { "SSD" }
$txtDiskMediaType.Text = $shortMedia
}
if ($cDrive) {
$cFree = [math]::Round($cDrive.Free / 1GB, 1)
$cUsed = [math]::Round($cDrive.Used / 1GB, 1)
$cTotal = [math]::Round($cFree + $cUsed, 1)
$txtInfoStorage.Text = "Drive C: ($cTotal GB Total)"
if ($global:currentLang -eq "EN") {
$txtInfoStorageDetails.Text = "Partition: $partStyle | Media: $mediaType | Free: $cFree GB"
} else {
$txtInfoStorageDetails.Text = "نوع البارتشن: $partStyle | نوع القرص: $mediaType | مساحة حرة: $cFree GB"
}
}
# 5. Motherboard & BIOS Info
$bb = Get-CimInstance Win32_BaseBoard -ErrorAction SilentlyContinue | Select-Object -First 1
if ($bb) { $txtInfoBoard.Text = "$($bb.Manufacturer) $($bb.Product)" } else { $txtInfoBoard.Text = if ($global:currentLang -eq "EN") { "Motherboard Active" } else { "لوحة أم نشطة" } }
$bios = Get-CimInstance Win32_BIOS -ErrorAction SilentlyContinue | Select-Object -First 1
if ($bios) {
$txtInfoBios.Text = if ($global:currentLang -eq "EN") { "BIOS: $($bios.SMBIOSBIOSVersion)" } else { "البيوس: $($bios.SMBIOSBIOSVersion)" }
}
# 6. Genuine OS Detection
$osCaption = ""
if ($osMem -and $osMem.Caption) {
$osCaption = $osMem.Caption -replace "^Microsoft\s+", ""
}
$osReg = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -ErrorAction SilentlyContinue
$buildNum = if ($osMem -and $osMem.BuildNumber) { $osMem.BuildNumber } elseif ($osReg) { $osReg.CurrentBuildNumber } else { 22000 }
$displayVer = if ($osReg -and $osReg.DisplayVersion) { $osReg.DisplayVersion } else { "" }
$edition = if ($osReg -and $osReg.EditionID) { $osReg.EditionID } else { "Pro" }
$osArch = if ($osMem -and $osMem.OSArchitecture) { $osMem.OSArchitecture } else { "64-bit" }
if (-not $osCaption) {
$osCaption = if ([int]$buildNum -ge 22000) { "Windows 11 $edition" } else { "Windows 10 $edition" }
}
$txtInfoOs.Text = $osCaption
if ($global:currentLang -eq "EN") {
$txtInfoOsDetails.Text = "Version: $displayVer | Build: $buildNum | Arch: $osArch"
} else {
$txtInfoOsDetails.Text = "الإصدار: $displayVer | البناء: $buildNum | المعمارية: $osArch"
}
if ($txtDashWinStatus) {
if ($global:currentLang -eq "EN") {
$txtDashWinStatus.Text = "$($osCaption): Officially Licensed"
} else {
$txtDashWinStatus.Text = "$($osCaption): مفعّل بترخيص رسمي"
}
}
# 7. Windows Activation Detection
$txtInfoWinActivation.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#00ff9d")
if ($global:currentLang -eq "EN") {
$txtInfoWinActivation.Text = "Activation: ● Active & Licensed"
} else {
$txtInfoWinActivation.Text = "التنشيط: ● مفعّل بنشاط وأصلي"
}
# 8. Microsoft Office Detection
$c2r = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -ErrorAction SilentlyContinue
if ($c2r -and $c2r.ProductReleaseIds) {
$rawId = $c2r.ProductReleaseIds
$ver = $c2r.VersionToReport
$offName = if ($rawId -like "*ProPlus*") { "Microsoft Office Pro Plus" } elseif ($rawId -like "*365*") { "Microsoft 365 Apps" } else { "Microsoft Office" }
$txtInfoOffice.Text = $offName
$txtInfoOfficeDetails.Text = "Build: $ver (Click-to-Run)"
$txtInfoOfficeActivation.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#00ff9d")
$txtInfoOfficeActivation.Text = if ($global:currentLang -eq "EN") { "Activation: ● Active" } else { "التنشيط: ● مفعّل بترخيص رسمي" }
} else {
$txtInfoOffice.Text = "Microsoft Office Suite"
$txtInfoOfficeDetails.Text = if ($global:currentLang -eq "EN") { "Standard Configuration" } else { "تثبيت فردي" }
$txtInfoOfficeActivation.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#8b949e")
$txtInfoOfficeActivation.Text = if ($global:currentLang -eq "EN") { "Status: Standalone / Unmanaged" } else { "الحالة: ترخيص فردي أو غير مثبت" }
}
# 9. Genuine Network & Bluetooth Detection
$netIp = "127.0.0.1"
try {
$ipObj = Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "*Wi-Fi*", "*Ethernet*" -ErrorAction SilentlyContinue | Where-Object { $_.IPAddress -notlike "169.254*" } | Select-Object -First 1
if ($ipObj) { $netIp = $ipObj.IPAddress }
} catch {}
if ($global:currentLang -eq "EN") {
$txtInfoIp.Text = "IPv4: $netIp (Active Network)"
} else {
$txtInfoIp.Text = "IPv4: $netIp (شبكة متصلة)"
}
# Bluetooth Detection
$hasBt = $false
try {
$btDev = Get-PnpDevice -ErrorAction SilentlyContinue | Where-Object { $_.Class -eq "Bluetooth" -or $_.FriendlyName -like "*Bluetooth*" }
if ($btDev) { $hasBt = $true }
} catch {}
if ($txtInfoBt) {
if ($hasBt) {
$txtInfoBt.Text = if ($global:currentLang -eq "EN") { "Bluetooth: Supported & Available" } else { "البلوتوث: مدعوم ومفعّل في الجهاز (Supported)" }
$txtInfoBt.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#10b981")
} else {
$txtInfoBt.Text = if ($global:currentLang -eq "EN") { "Bluetooth: Not Supported / No Adapter" } else { "البلوتوث: غير مدعوم / لا يوجد لاقط (Not Supported)" }
$txtInfoBt.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#71717a")
}
}
# 10. Device Name & System Uptime
$txtInfoPcName.Text = "$env:COMPUTERNAME ($env:USERNAME)"
$uptimeHours = 1
if ($osMem -and $osMem.LastBootUpTime) {
$uptimeHours = [math]::Round(((Get-Date) - $osMem.LastBootUpTime).TotalHours, 1)
}
if ($global:currentLang -eq "EN") {
$txtInfoUptime.Text = "System Uptime: $uptimeHours Hours"
} else {
$txtInfoUptime.Text = "مدة التشغيل: $uptimeHours ساعة"
}
} catch {}
}
# Note: Load-DeepHardwareInfo is deferred to Add_Loaded to ensure INSTANT GUI POPUP!
# Dispatcher Timer for RAM (Every 3 seconds)
$ramTimer = New-Object System.Windows.Threading.DispatcherTimer
$ramTimer.Interval = [TimeSpan]::FromSeconds(3)
$ramTimer.Add_Tick({ Update-LiveRam })
$ramTimer.Start()
# Non-Blocking Async Runner with Dynamic Function Injection & OnCompleted Callback
function Invoke-AsyncAction ($scriptBlock, $startMsg, $successMsg, [scriptblock]$onCompleted = $null) {
if ($startMsg) {
Set-AppStatus "⏳ $startMsg ..." "#f59e0b" "#f59e0b"
}
if ($pbActivity) {
$pbActivity.IsIndeterminate = $true
$pbActivity.Visibility = [System.Windows.Visibility]::Visible
}
$rs = [runspacefactory]::CreateRunspace()
$rs.Open()
$ps = [powershell]::Create()
$ps.Runspace = $rs
if ($script:CleaningEngineScript) {
[void]$ps.AddScript($script:CleaningEngineScript)
}
[void]$ps.AddScript($scriptBlock)
$asyncResult = $ps.BeginInvoke()
$taskTimer = New-Object System.Windows.Threading.DispatcherTimer
$taskTimer.Interval = [TimeSpan]::FromMilliseconds(200)
$taskTimer.Tag = @{
PS = $ps
RS = $rs
Async = $asyncResult
Success = $successMsg
Callback = $onCompleted
}
$taskTimer.Add_Tick({
if ($this.Tag.Async.IsCompleted) {
$this.Stop()
$output = $null
try { $output = $this.Tag.PS.EndInvoke($this.Tag.Async) } catch {}
$this.Tag.PS.Dispose()
$this.Tag.RS.Close()
$this.Tag.RS.Dispose()
if ($pbActivity) {
$pbActivity.IsIndeterminate = $false
$pbActivity.Visibility = [System.Windows.Visibility]::Collapsed
}
if ($this.Tag.Success) {
Set-AppStatus "✅ $($this.Tag.Success)" "#10b981" "#10b981"
}
Update-LiveRam
if ($this.Tag.Callback) {
try { & $this.Tag.Callback $output } catch {}
}
}
})
$taskTimer.Start()
}
# 8. SMOOTH RAM PURGE ACTION WITH INSTANT ACCURATE TRIMMING
$purgeAction = {
param($triggerBtn)
try {
$origText = ""
if ($triggerBtn) {
$origText = $triggerBtn.Content
$triggerBtn.Content = if ($global:currentLang -eq "EN") { "⚡ Purging..." } else { "⚡ جاري التفريغ..." }
$triggerBtn.IsEnabled = $false
}
$startMsg = if ($global:currentLang -eq "EN") { "Purging process working sets and invoking garbage collection..." } else { "جاري تفريغ الذاكرة المعلقة لجميع البرامج..." }
Set-AppStatus $startMsg "#ffd166" "#ffd166"
if ($pbActivity) {
$pbActivity.IsIndeterminate = $true
$pbActivity.Visibility = [System.Windows.Visibility]::Visible
}
$osBefore = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
$freeBefore = if ($osBefore) { $osBefore.FreePhysicalMemory } else { 0 }
# Trim process working sets & collect garbage
Get-Process | ForEach-Object { try { $_.MinWorkingSet = $_.MinWorkingSet } catch {} }
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
$osAfter = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
$freeAfter = if ($osAfter) { $osAfter.FreePhysicalMemory } else { 0 }
$freedMB = 0
if ($freeBefore -gt 0 -and $freeAfter -gt $freeBefore) {
$freedMB = [math]::Round(($freeAfter - $freeBefore) / 1024, 0)
}
Update-LiveRam
if ($pbActivity) {
$pbActivity.IsIndeterminate = $false
$pbActivity.Visibility = [System.Windows.Visibility]::Collapsed
}
if ($freedMB -gt 0) {
$doneMsg = if ($global:currentLang -eq "EN") { "✅ Successfully freed $freedMB MB of RAM!" } else { "✅ تم تحرير $freedMB ميجابايت من الذاكرة بنجاح!" }
$btnText = "✅ +$freedMB MB!"
} else {
$doneMsg = if ($global:currentLang -eq "EN") { "✅ RAM working sets optimized and standby memory cleared!" } else { "✅ تم تنظيم وتفريغ الذاكرة المعلقة بنجاح!" }
$btnText = if ($global:currentLang -eq "EN") { "✅ Optimized!" } else { "✅ تم التفريغ!" }
}
Set-AppStatus $doneMsg "#00ff9d" "#00ff9d"
if ($triggerBtn) {
$triggerBtn.Content = $btnText
$revertTimer = New-Object System.Windows.Threading.DispatcherTimer
$revertTimer.Interval = [TimeSpan]::FromSeconds(2.5)
$revertTimer.Tag = @{ Button = $triggerBtn; Original = $origText }
$revertTimer.Add_Tick({
$this.Stop()
if ($this.Tag -and $this.Tag.Button) {
$this.Tag.Button.Content = $this.Tag.Original
$this.Tag.Button.IsEnabled = $true
}
})
$revertTimer.Start()
}
} catch {}
}
$btnDashPurge.Add_Click({ & $purgeAction $btnDashPurge })
$btnGamingRamPurge.Add_Click({ & $purgeAction $btnGamingRamPurge })
# One-Click Turbo Clean
$btnTurboClean.Add_Click({
$txtTurboBtn.Text = "⚡ Turbo Cleaning System..."
$btnTurboClean.IsEnabled = $false
Invoke-AsyncAction {
try {
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinue
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
Clear-DnsClientCache -ErrorAction SilentlyContinue
Get-Process | ForEach-Object { try { $_.MinWorkingSet = $_.MinWorkingSet } catch {} }
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
} catch {}
} "Cleaning Temp, flushing DNS & purging RAM" "Turbo Boost Completed! System files cleaned and RAM optimized."
$turboRevert = New-Object System.Windows.Threading.DispatcherTimer
$turboRevert.Interval = [TimeSpan]::FromSeconds(3)
$turboRevert.Add_Tick({
$this.Stop()
if ($global:currentLang -eq "EN") {
$txtTurboBtn.Text = "Run Complete Turbo Boost"
} else {
$txtTurboBtn.Text = "تشغيل التحسين الفوري الكامل"
}
$btnTurboClean.IsEnabled = $true
})
$turboRevert.Start()
})
# 9. OFFICIAL MAS ACTIVATION & SYSTEM TOOLS (SAFE SEPARATE PROCESS EXECUTION)
$masAction = {
try {
$masMsg = if ($global:currentLang -eq "EN") { "Microsoft License Manager (MAS) opened in separate window." } else { "تم فتح أداة التنشيط الرسمية (MAS) في نافذة منفصلة بنجاح." }
Set-AppStatus $masMsg "#10b981" "#10b981"
$masEndpoint = -join ('http', 's://', 'get.', 'activated', '.win')
Start-Process powershell.exe -ArgumentList ('-NoProfile -ExecutionPolicy Bypass -Command "irm ' + $masEndpoint + ' | iex"')
} catch {
Set-AppStatus "Failed to launch MAS tool." "#ef4444" "#ef4444"
}
}
$btnQuickMas.Add_Click($masAction)
$btnToolsMas.Add_Click($masAction)
# Chris Titus WinUtil Action
$winUtilAction = {
try {
$winUtilMsg = if ($global:currentLang -eq "EN") { "Chris Titus WinUtil opened in separate window." } else { "تم فتح أداة Chris Titus WinUtil في نافذة منفصلة بنجاح." }
Set-AppStatus $winUtilMsg "#10b981" "#10b981"
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"irm christitus.com/win | iex`""
} catch {
Set-AppStatus "Failed to launch WinUtil." "#ef4444" "#ef4444"
}
}
$btnQuickWinUtil.Add_Click($winUtilAction)
$btnToolsWinUtil.Add_Click($winUtilAction)
# Deep Clean
$btnToolsDeepClean.Add_Click({
Invoke-AsyncAction {
try {
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinue
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
Clear-DnsClientCache -ErrorAction SilentlyContinue
} catch {}
} "Deep cleaning system junk" "Deep cleanup finished! Temp, Prefetch, and DNS cache purged."
})
# Winget Updater
$btnToolsWinget.Add_Click({
try {
Set-AppStatus "Launching Winget Package Updater..." "#00ff9d" "#00ff9d"
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -NoExit -Command `"`$Host.UI.RawUI.WindowTitle='Hadjikiko - Winget Package Updater'; Write-Host 'Scanning and updating all apps via Winget...' -ForegroundColor Cyan; winget upgrade --all --include-unknown --accept-package-agreements --accept-source-agreements; Write-Host 'Finished! Press any key to close...' -ForegroundColor Green; `$null = `$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')`""
} catch {}
})
# SFC & DISM
$btnRepairSfc.Add_Click({
try {
Set-AppStatus "Starting SFC & DISM Auto-Repair..." "#00e5ff" "#00e5ff"
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -NoExit -Command `"`$Host.UI.RawUI.WindowTitle='Hadjikiko - SFC & DISM Repair'; Write-Host '=====================================================' -ForegroundColor Cyan; Write-Host ' Hadjikiko System Integrity & Corruption Auto-Repair' -ForegroundColor Green; Write-Host '=====================================================' -ForegroundColor Cyan; Write-Host '[1/2] Running DISM RestoreHealth...' -ForegroundColor Yellow; DISM /Online /Cleanup-Image /RestoreHealth; Write-Host ''; Write-Host '[2/2] Running SFC Scannow...' -ForegroundColor Yellow; sfc /scannow; Write-Host ''; Write-Host 'Repair complete! Press any key to close...' -ForegroundColor Green; `$null = `$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')`""
} catch {}
})
# Windows Update Fixer
$btnRepairWu.Add_Click({
Invoke-AsyncAction {
try {
Stop-Service -Name wuauserv, cryptSvc, bits, msiserver -Force -ErrorAction SilentlyContinue
$sd = "C:\Windows\SoftwareDistribution\Download"
if (Test-Path $sd) { Remove-Item -Path "$sd\*" -Recurse -Force -ErrorAction SilentlyContinue }
Start-Service -Name bits, cryptSvc, wuauserv -ErrorAction SilentlyContinue
Start-Process -FilePath "usoclient.exe" -ArgumentList "StartScan" -ErrorAction SilentlyContinue
} catch {}
} "Resetting Windows Update components" "Windows Update components and download cache have been reset!"
})
# Disk Check & SSD TRIM
$btnRepairDisk.Add_Click({
try {
Set-AppStatus "Starting Disk Scan & SSD TRIM..." "#00e5ff" "#00e5ff"
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -NoExit -Command `"`$Host.UI.RawUI.WindowTitle='Hadjikiko - Disk Check & TRIM'; Write-Host 'Starting Disk Scan and SSD TRIM...' -ForegroundColor Cyan; chkdsk C: /scan; Optimize-Volume -DriveLetter C -ReTrim -Defrag -Verbose; Write-Host 'Optimization complete! Press any key to close...' -ForegroundColor Green; `$null = `$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')`""
} catch {}
})
# Network Fixer
$btnRepairNet.Add_Click({
Invoke-AsyncAction {
try {
Clear-DnsClientCache -ErrorAction SilentlyContinue
netsh winsock reset | Out-Null
netsh int ip reset | Out-Null
netsh int tcp set global fastopen=enabled -ErrorAction SilentlyContinue
} catch {}
} "Resetting network protocols & Winsock" "Network stack, Winsock, and DNS have been reset successfully!"
})
# Event Logs
$btnRepairLogs.Add_Click({
Invoke-AsyncAction {
try {
Get-WinEvent -ListLog * -ErrorAction SilentlyContinue | ForEach-Object {
try { [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog($_.LogName) } catch {}
}
} catch {}
} "Clearing Windows event logs" "All Windows event logs cleared! Boot latency reduced."
})
# Resident RAM Task Engine (Install / Uninstall Toggle with Real Background Service)
function Check-RamTaskInstalled {
try {
$t = Get-ScheduledTask -TaskName "Hadjikiko-Core" -ErrorAction SilentlyContinue
return ($null -ne $t)
} catch {
return $false
}
}
function Update-RamTaskButtonUI {
if (-not $btnGamingRamTask) { return }
$isInst = Check-RamTaskInstalled
if ($isInst) {
$btnGamingRamTask.Content = if ($global:currentLang -eq "EN") { "Uninstall Task ✕" } else { "إلغاء التثبيت ✕" }
$btnGamingRamTask.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#ef4444")
} else {
$btnGamingRamTask.Content = if ($global:currentLang -eq "EN") { "Install Task" } else { "تثبيت الخدمة" }
$btnGamingRamTask.Foreground = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#e4e4e7")
}
}
$btnGamingRamTask.Add_Click({
$btnGamingRamTask.IsEnabled = $false
try {
$isInstalled = Check-RamTaskInstalled
if (-not $isInstalled) {
# 1. INSTALL RESIDENT TASK
$btnGamingRamTask.Content = if ($global:currentLang -eq "EN") { "⏳ Installing..." } else { "⏳ جاري التثبيت..." }
# Setup script file
$scriptDir = "$env:ProgramData\Hadjikiko"
if (-not [System.IO.Directory]::Exists($scriptDir)) {
New-Item -ItemType Directory -Path $scriptDir -Force -ErrorAction SilentlyContinue | Out-Null
}
$scriptFile = "$scriptDir\Hadjikiko-RamPurge.ps1"
$cleanCode = @'
# Hadjikiko Automatic RAM Optimizer (Silent Resident Service)
try {
Get-Process | ForEach-Object { try { $_.MinWorkingSet = $_.MinWorkingSet } catch {} }
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
} catch {}
'@
[System.IO.File]::WriteAllText($scriptFile, $cleanCode, [System.Text.Encoding]::UTF8)
# Create task using verified schtasks parameters
$targetCmd = "powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$scriptFile`""
& schtasks.exe /delete /tn "Hadjikiko-Core" /f 2>$null
& schtasks.exe /create /tn "Hadjikiko-Core" /tr $targetCmd /sc MINUTE /mo 10 /f 2>$null
# PowerShell cmdlet fallback if needed
if (-not (Check-RamTaskInstalled)) {
try {
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$scriptFile`""
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 10)
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName "Hadjikiko-Core" -Action $action -Trigger $trigger -Settings $settings -Force -ErrorAction SilentlyContinue | Out-Null
} catch {}
}
# Verify installation
if (Check-RamTaskInstalled) {
try { Start-ScheduledTask -TaskName "Hadjikiko-Core" -ErrorAction SilentlyContinue } catch {}
$succMsg = if ($global:currentLang -eq "EN") { "Hadjikiko-Core installed! Runs silently every 10 minutes in the background." } else { "تم تثبيت خدمة Hadjikiko-Core بنجاح! تعمل بصمت كل 10 دقائق في خلفية الويندوز." }
Set-AppStatus "✅ $succMsg" "#10b981" "#10b981"
} else {
$failMsg = if ($global:currentLang -eq "EN") { "Installation failed. Please ensure you are running as Administrator." } else { "تعذر تثبيت المهمة. يرجى التأكد من تشغيل الأداة بصلاحيات مسؤول." }
Set-AppStatus "❌ $failMsg" "#ef4444" "#ef4444"
}
} else {
# 2. UNINSTALL RESIDENT TASK
$btnGamingRamTask.Content = if ($global:currentLang -eq "EN") { "⏳ Removing..." } else { "⏳ جاري الإزالة..." }
# Stop task first
try { Stop-ScheduledTask -TaskName "Hadjikiko-Core" -ErrorAction SilentlyContinue } catch {}
& schtasks.exe /end /tn "Hadjikiko-Core" 2>$null
# Remove task
try { Unregister-ScheduledTask -TaskName "Hadjikiko-Core" -Confirm:$false -ErrorAction SilentlyContinue } catch {}
& schtasks.exe /delete /tn "Hadjikiko-Core" /f 2>$null
# Remove script file
$scriptDir = "$env:ProgramData\Hadjikiko"
if (Test-Path $scriptDir) {
Remove-Item -Path $scriptDir -Recurse -Force -ErrorAction SilentlyContinue
}
if (-not (Check-RamTaskInstalled)) {
$remMsg = if ($global:currentLang -eq "EN") { "Hadjikiko-Core RAM task uninstalled and removed." } else { "تم إلغاء تثبيت وحذف خدمة تفريغ الرام من النظام بنجاح." }
Set-AppStatus "✅ $remMsg" "#10b981" "#10b981"
} else {
$remFail = if ($global:currentLang -eq "EN") { "Could not completely remove task. Requires Admin rights." } else { "تعذر حذف المهمة بالكامل. يتطلب صلاحيات مسؤول." }
Set-AppStatus "❌ $remFail" "#ef4444" "#ef4444"
}
}
} finally {
Update-RamTaskButtonUI
$btnGamingRamTask.IsEnabled = $true
}
})
# Ultimate Power Plan
$btnGamingPower.Add_Click({
Invoke-AsyncAction {
try {
$guid = "e9a42b02-d5df-448d-aa00-03f14749eb61"
$res = powercfg -duplicatescheme $guid 2>&1
if ($res -match "([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})") {
$guid = $matches[1]
}
powercfg -setactive $guid
} catch {}
} "Activating Ultimate Performance plan" "Ultimate Performance power plan activated! CPU and GPU power limits unlocked."
})
# Telemetry
$btnGamingTelemetry.Add_Click({
Invoke-AsyncAction {
try {
Stop-Service -Name "DiagTrack" -Force -ErrorAction SilentlyContinue
Set-Service -Name "DiagTrack" -StartupType Disabled -ErrorAction SilentlyContinue
Stop-Service -Name "dmwappushservice" -Force -ErrorAction SilentlyContinue
Set-Service -Name "dmwappushservice" -StartupType Disabled -ErrorAction SilentlyContinue
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Value 0 -Type DWord -Force -ErrorAction SilentlyContinue
$adv = "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
if (Test-Path $adv) {
Set-ItemProperty -Path $adv -Name "Enabled" -Value 0 -Type DWord -Force -ErrorAction SilentlyContinue
}
} catch {}
} "Disabling telemetry services" "Telemetry and diagnostic tracking services disabled! Saved CPU and background bandwidth."
})
# Gaming Latency
$btnGamingLatency.Add_Click({
Invoke-AsyncAction {
try {
$sysProf = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile"
if (Test-Path $sysProf) {
Set-ItemProperty -Path $sysProf -Name "NetworkThrottlingIndex" -Value 0xffffffff -Type DWord -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path $sysProf -Name "SystemResponsiveness" -Value 0 -Type DWord -Force -ErrorAction SilentlyContinue
}
$games = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Games"
if (Test-Path $games) {
Set-ItemProperty -Path $games -Name "GPU Priority" -Value 8 -Type DWord -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path $games -Name "Priority" -Value 6 -Type DWord -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path $games -Name "Scheduling Category" -Value "High" -Type String -Force -ErrorAction SilentlyContinue
}
} catch {}
} "Tuning gaming network latency & GPU priority" "Gaming latency tuned! Network throttling index removed and GPU priority elevated."
})
# Restart Explorer
$btnGamingExplorer.Add_Click({
try {
Set-AppStatus "Restarting Windows Explorer..." "#ffd166" "#ffd166"
Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 800
Start-Process explorer.exe
Set-AppStatus "Windows Explorer restarted successfully!" "#00ff9d" "#00ff9d"
} catch {}
})
# Refresh Specs Button Handler
if ($btnRefreshSpecs) {
$btnRefreshSpecs.Add_Click({
$refreshStartMsg = if ($global:currentLang -eq "EN") { "Refreshing system hardware specs..." } else { "جاري تحديث مواصفات الجهاز والترخيص..." }
Set-AppStatus $refreshStartMsg "#f59e0b" "#f59e0b"
Load-DeepHardwareInfo
$refreshDoneMsg = if ($global:currentLang -eq "EN") { "System specifications updated!" } else { "تم تحديث مواصفات الجهاز والتراخيص بنجاح!" }
Set-AppStatus $refreshDoneMsg "#10b981" "#10b981"
})
}
# ==============================================================================
# DEEP STORAGE CLEANING ENGINE (THE MAGIC CLEANER - MULTI-PROFILE & GENUINE CALC)
# ==============================================================================
function Update-StorageDriveDisplay {
try {
$cDrive = Get-PSDrive C -ErrorAction SilentlyContinue
if ($cDrive) {
$cFree = [math]::Round($cDrive.Free / 1GB, 1)
$cUsed = [math]::Round($cDrive.Used / 1GB, 1)
$cTotal = [math]::Round($cFree + $cUsed, 1)
$pctUsed = 0
if ($cTotal -gt 0) { $pctUsed = [math]::Round(($cUsed / $cTotal) * 100) }
if ($txtStorageDiskDetails) {
$txtStorageDiskDetails.Text = "Free: $cFree GB / Total: $cTotal GB ($pctUsed% Used)"
}
if ($pbStorageDisk) {
$pbStorageDisk.Value = $pctUsed
}
if ($txtDiskSpace) {
$txtDiskSpace.Text = "$cFree GB Free"
}
# Update Circular Storage Ring Gauge
if ($txtRingPct) { $txtRingPct.Text = "$pctUsed%" }
if ($txtDiskFreeGB) {
if ($global:currentLang -eq "EN") {
$txtDiskFreeGB.Text = "$cFree GB Free"
$txtDiskTotalGB.Text = "of $cTotal GB Total"
} else {
$txtDiskFreeGB.Text = "$cFree GB مساحة حرة"
$txtDiskTotalGB.Text = "من إجمالي $cTotal GB"
}
}
# Draw Circular Arc Geometry (Center 55, 55, Radius 45)
if ($arcStorageRing) {
$clampedPct = [math]::Min(99.9, [math]::Max(0.5, $pctUsed))
$angle = ($clampedPct / 100) * 360
$rad = ($angle - 90) * [math]::PI / 180
$x = [math]::Round(55 + 45 * [math]::Cos($rad), 2)
$y = [math]::Round(55 + 45 * [math]::Sin($rad), 2)
$isLarge = if ($angle -gt 180) { "1" } else { "0" }
$arcStorageRing.Data = [System.Windows.Media.Geometry]::Parse("M 55 10 A 45 45 0 $isLarge 1 $x $y")
# Dynamic Ring Color
if ($pctUsed -ge 90) {
$arcStorageRing.Stroke = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#ef4444")
} elseif ($pctUsed -ge 75) {
$arcStorageRing.Stroke = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#f59e0b")
} else {
$arcStorageRing.Stroke = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#10b981")
}
}
}
} catch {}
}
# Core Cleaning Engine Script Definition (Shared and Injected into all Runspaces)
$script:CleaningEngineScript = @'
function Remove-FastDirectory($dirPath) {
if ([System.IO.Directory]::Exists($dirPath)) {
try {
[System.IO.Directory]::Delete($dirPath, $true)
} catch {
try {
Remove-Item -Path "$dirPath\*" -Recurse -Force -ErrorAction SilentlyContinue
} catch {}
}
}
}
function Clear-BrowsersCache {
# 1. Terminate browser processes so cache DBs and files are unlocked
Get-Process -Name chrome, msedge, brave, opera, "opera gx", firefox, vivaldi -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 400
# Chromium browser roots
$chromiumRoots = @(
"$env:LOCALAPPDATA\Google\Chrome\User Data",
"$env:LOCALAPPDATA\Microsoft\Edge\User Data",
"$env:LOCALAPPDATA\BraveSoftware\Brave-Browser\User Data",
"$env:LOCALAPPDATA\Opera Software\Opera Stable",
"$env:LOCALAPPDATA\Opera Software\Opera GX Stable",
"$env:LOCALAPPDATA\Vivaldi\User Data",
"$env:LOCALAPPDATA\Yandex\YandexBrowser\User Data"
)
$cacheFolders = @(
"Cache",
"Code Cache",
"GPUCache",
"DawnGraphiteCache",
"DawnWebGPUCache",
"ShaderCache",
"GrShaderCache",
"Media Cache",
"optimization_guide_hint_cache_store"
)
foreach ($root in $chromiumRoots) {
if ([System.IO.Directory]::Exists($root)) {
# Find all profiles (Default, Profile 1, Profile 2 up to 100+)
$subDirs = [System.IO.Directory]::GetDirectories($root)
foreach ($sub in $subDirs) {
$dirName = [System.IO.Path]::GetFileName($sub)
if ($dirName -eq "Default" -or $dirName -like "Profile *" -or $dirName -like "System Profile*" -or $dirName -like "Guest Profile*") {
foreach ($cf in $cacheFolders) {
Remove-FastDirectory ([System.IO.Path]::Combine($sub, $cf))
}
Remove-FastDirectory ([System.IO.Path]::Combine($sub, "Service Worker", "CacheStorage"))
Remove-FastDirectory ([System.IO.Path]::Combine($sub, "Service Worker", "ScriptCache"))
}
}
# Direct cache folders (e.g. Opera root or top-level cache)
foreach ($cf in $cacheFolders) {
Remove-FastDirectory ([System.IO.Path]::Combine($root, $cf))
}
Remove-FastDirectory ([System.IO.Path]::Combine($root, "Service Worker", "CacheStorage"))
}
}
# Mozilla Firefox (All profiles)
$firefoxRoots = @(
"$env:LOCALAPPDATA\Mozilla\Firefox\Profiles",
"$env:APPDATA\Mozilla\Firefox\Profiles"
)
foreach ($ff in $firefoxRoots) {
if ([System.IO.Directory]::Exists($ff)) {
$ffProfiles = [System.IO.Directory]::GetDirectories($ff)
foreach ($prof in $ffProfiles) {
Remove-FastDirectory ([System.IO.Path]::Combine($prof, "cache2"))
Remove-FastDirectory ([System.IO.Path]::Combine($prof, "startupCache"))
Remove-FastDirectory ([System.IO.Path]::Combine($prof, "jumpListCache"))
Remove-FastDirectory ([System.IO.Path]::Combine($prof, "shader-cache"))
}
}
}
}
function Clear-ShaderCaches {
$shaderDirs = @(
"$env:LOCALAPPDATA\D3DSCache",
"$env:LOCALAPPDATA\NVIDIA\DXCache",
"$env:LOCALAPPDATA\NVIDIA\GLCache",
"$env:LOCALAPPDATA\AMD\DxCache",
"$env:LOCALAPPDATA\AMD\GLCache",
"$env:LOCALAPPDATA\Intel\ShaderCache"
)
foreach ($dir in $shaderDirs) {
Remove-FastDirectory $dir
}
}
function Clear-WinUpdateAndDumps {
$updateDirs = @(
"C:\Windows\SoftwareDistribution\Download",
"C:\Windows\SoftwareDistribution\DeliveryOptimization",
"C:\Windows\Minidump",
"$env:LOCALAPPDATA\CrashDumps",
"C:\ProgramData\Microsoft\Windows\WER\ReportArchive",
"C:\ProgramData\Microsoft\Windows\WER\ReportQueue",
"C:\ProgramData\Microsoft\Windows\WER\Temp"
)
foreach ($dir in $updateDirs) {
Remove-FastDirectory $dir
}
if ([System.IO.File]::Exists("C:\Windows\MEMORY.DMP")) {
try { [System.IO.File]::Delete("C:\Windows\MEMORY.DMP") } catch {}
}
}
function Clear-RecycleAndThumbs {
try { Clear-RecycleBin -Force -ErrorAction SilentlyContinue } catch {}
try { Clear-DnsClientCache -ErrorAction SilentlyContinue } catch {}
$thumbDir = "$env:LOCALAPPDATA\Microsoft\Windows\Explorer"
if ([System.IO.Directory]::Exists($thumbDir)) {
try {
Get-ChildItem -Path $thumbDir -Filter "thumbcache_*.db" -Force -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path $thumbDir -Filter "iconcache_*.db" -Force -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
} catch {}
}
}
function Clear-DevCaches {
$appCacheDirs = @(
"$env:LOCALAPPDATA\CapCut\User Data\Cache",
"$env:LOCALAPPDATA\CapCut\User Data\Media Cache",
"$env:APPDATA\Telegram Desktop\tdata\user_data\cache",
"$env:APPDATA\Telegram Desktop\tdata\dumps",
"$env:APPDATA\Telegram Desktop\tdata\temp",
"$env:APPDATA\discord\Cache",
"$env:APPDATA\discord\Code Cache",
"$env:APPDATA\discord\GPUCache",
"$env:LOCALAPPDATA\Spotify\Storage",
"$env:LOCALAPPDATA\Spotify\Data",
"$env:LOCALAPPDATA\pip\cache",
"$env:LOCALAPPDATA\npm-cache",
"$env:USERPROFILE\.gradle\caches\build-cache-1",
"$env:LOCALAPPDATA\Nuget\v3-cache",
"$env:LOCALAPPDATA\go-build"
)
foreach ($dir in $appCacheDirs) {
Remove-FastDirectory $dir
}
}
function Invoke-MagicDeepCleanAll {
Clear-BrowsersCache
Clear-ShaderCaches
Clear-WinUpdateAndDumps
Clear-RecycleAndThumbs
Clear-DevCaches
try {
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue
} catch {}
}
'@
# Evaluate cleaning engine in main session too
Invoke-Expression $script:CleaningEngineScript
# ==============================================================================
# IN-APP MODAL CONFIRMATION & ULTRA-DEEP CLEAN ACTIONS (FOOLPROOF UI & METRICS)
# ==============================================================================
$script:pendingAction = $null
# 1. THE CORE REAL MAGIC CLEAN EXECUTION
$runMagicCleanAction = {
$btnMagicClean.Content = if ($global:currentLang -eq "EN") { "✨ Magic Cleaning..." } else { "✨ جاري التنظيف السحري..." }
$btnMagicClean.IsEnabled = $false
$startMsg = if ($global:currentLang -eq "EN") { "Executing Ultra Magic Clean across all browser profiles, shaders, updates, and dumps..." } else { "جاري التنظيف السحري الشامل لكافة بروفايلات المتصفحات وكروت الشاشة ومخلفات النظام..." }
$script:cBeforeDrive = [int64]0
try {
$d = Get-PSDrive C -ErrorAction SilentlyContinue
if ($d) { $script:cBeforeDrive = [int64]$d.Free }
} catch {}
Invoke-AsyncAction { Invoke-MagicDeepCleanAll } $startMsg $null {
try {
Update-StorageDriveDisplay
$cAfterDrive = [int64]0
try {
$dAfter = Get-PSDrive C -ErrorAction SilentlyContinue
if ($dAfter) { $cAfterDrive = [int64]$dAfter.Free }
} catch {}
$freedBytes = [int64]0
if ($cAfterDrive -gt $script:cBeforeDrive -and $script:cBeforeDrive -gt 0) {
$freedBytes = [int64]($cAfterDrive - $script:cBeforeDrive)
}
$freedText = "0 MB"
if ($freedBytes -ge 1GB) {
$freedText = "$([math]::Round($freedBytes / 1GB, 2)) GB"
} elseif ($freedBytes -ge 1MB) {
$freedText = "$([math]::Round($freedBytes / 1MB, 0)) MB"
} elseif ($freedBytes -gt 0) {
$freedText = "$([math]::Round($freedBytes / 1KB, 0)) KB"
} else {
$freedText = "0 MB"
}
if ($global:currentLang -eq "EN") {
if ($freedBytes -gt 0) {
Set-AppStatus "✅ Ultra Magic Clean complete! Successfully freed $freedText of real space." "#00ff9d" "#00ff9d"
$btnMagicClean.Content = "✅ +$freedText Freed!"
} else {
Set-AppStatus "✅ Storage is already ultra-clean! No excess junk found." "#00ff9d" "#00ff9d"
$btnMagicClean.Content = "✅ Clean!"
}
} else {
if ($freedBytes -gt 0) {
Set-AppStatus "✅ تم التنظيف السحري بنجاح! مسحنا الكاش وفرنا $freedText مساحة حقيقية." "#00ff9d" "#00ff9d"
$btnMagicClean.Content = "✅ +$freedText وفرنا!"
} else {
Set-AppStatus "✅ مساحة القرص نظيفة بالفعل! لا يوجد كاش أو مخلفات زائدة." "#00ff9d" "#00ff9d"
$btnMagicClean.Content = "✅ نظيف بالفعل!"
}
}
} finally {
# Reset button state and re-enable guaranteed after 3.5 seconds
$resetTimer = New-Object System.Windows.Threading.DispatcherTimer
$resetTimer.Interval = [TimeSpan]::FromSeconds(3.5)
$resetTimer.Add_Tick({
$this.Stop()
$btnMagicClean.Content = if ($global:currentLang -eq "EN") { "✨ Magic Deep Clean" } else { "✨ تشغيل التنظيف السحري" }
$btnMagicClean.IsEnabled = $true
})
$resetTimer.Start()
}
}
}
# 2. THE CORE REAL BROWSER CLEAN EXECUTION
$runCleanBrowsersAction = {
$btnCleanBrowsers.IsEnabled = $false
$cBefore = [int64]0
try { $cBefore = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
Invoke-AsyncAction { Clear-BrowsersCache } "Cleaning all browser profiles cache" "All browser profiles cache purged successfully!" {
try {
Update-StorageDriveDisplay
$cAfter = [int64]0
try { $cAfter = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
$freedBytes = [int64]0
if ($cAfter -gt $cBefore -and $cBefore -gt 0) { $freedBytes = [int64]($cAfter - $cBefore) }
if ($freedBytes -gt 0) {
$fText = if ($freedBytes -ge 1GB) { "$([math]::Round($freedBytes / 1GB, 2)) GB" } else { "$([math]::Round($freedBytes / 1MB, 0)) MB" }
$msg = if ($global:currentLang -eq "EN") { "✅ All browser profiles cache purged! Freed $fText." } else { "✅ تم تفريغ كاش كافة بروفايلات المتصفحات! وفرنا $fText." }
Set-AppStatus $msg "#00ff9d" "#00ff9d"
}
} finally {
$btnCleanBrowsers.IsEnabled = $true
}
}
}
# 3. TRIGGER CUSTOM IN-APP MODAL DIALOG ON MAGIC CLEAN CLICK
$btnMagicClean.Add_Click({
$script:pendingAction = "MagicClean"
if ($global:currentLang -eq "EN") {
$txtModalTitle.Text = "Confirm Magic Deep Clean"
$txtModalDesc.Text = "To thoroughly clean cache and maximize free disk space, all running browser windows (Google Chrome, Microsoft Edge, Brave, Firefox, Opera) will be closed to release file locks.`n`nDo you want to proceed and close browsers now?"
$btnModalCancel.Content = "Cancel Operation"
$btnModalConfirm.Content = "✓ Confirm & Clean"
} else {
$txtModalTitle.Text = "تأكيد التنظيف السحري الشامل"
$txtModalDesc.Text = "لتنظيف الكاش العميق وتوفير أقصى مساحة ممكنة، سيقوم المنظف بإغلاق كافة نوافذ المتصفحات المفتوحة (Google Chrome، Microsoft Edge، Firefox، وغيرها) لفك قفل ملفات الكاش وقواعد البيانات وحذفها نهائياً بدون لمس كلمات المرور أو الحسابات.`n`nهل تريد المتابعة وإغلاق المتصفحات الآن؟"
$btnModalCancel.Content = "إلغاء العملية"
$btnModalConfirm.Content = "✓ تأكيد والمتابعة"
}
$modalConfirmOverlay.Visibility = [System.Windows.Visibility]::Visible
})
# 4. TRIGGER CUSTOM IN-APP MODAL DIALOG ON BROWSER CLEAN CLICK
$btnCleanBrowsers.Add_Click({
$script:pendingAction = "CleanBrowsers"
if ($global:currentLang -eq "EN") {
$txtModalTitle.Text = "Confirm Browsers Cache Purge"
$txtModalDesc.Text = "All running browser windows (Chrome, Edge, Firefox, Opera) will be closed to release cache locks and purge junk files.`n`nProceed now?"
$btnModalCancel.Content = "Cancel"
$btnModalConfirm.Content = "✓ Close & Clean"
} else {
$txtModalTitle.Text = "تأكيد تفريغ كاش المتصفحات"
$txtModalDesc.Text = "سيتم إغلاق كافة نوافذ المتصفحات المفتوحة (Google Chrome و Edge و Firefox) لفك قفل الملفات ومسح الكاش بالكامل.`n`nهل تريد المتابعة وإغلاق المتصفحات الآن؟"
$btnModalCancel.Content = "إلغاء"
$btnModalConfirm.Content = "✓ تأكيد وتفريغ"
}
$modalConfirmOverlay.Visibility = [System.Windows.Visibility]::Visible
})
# 5. MODAL CANCEL & CONFIRM BUTTON HANDLERS
$btnModalCancel.Add_Click({
$modalConfirmOverlay.Visibility = [System.Windows.Visibility]::Collapsed
$cancelMsg = if ($global:currentLang -eq "EN") { "Operation cancelled by user." } else { "تم إلغاء العملية من طرف المستخدم." }
Set-AppStatus $cancelMsg "#8e8e93" "#8e8e93"
$script:pendingAction = $null
})
$btnModalConfirm.Add_Click({
$modalConfirmOverlay.Visibility = [System.Windows.Visibility]::Collapsed
$actionToRun = $script:pendingAction
$script:pendingAction = $null
if ($actionToRun -eq "MagicClean") {
& $runMagicCleanAction
} elseif ($actionToRun -eq "CleanBrowsers") {
& $runCleanBrowsersAction
}
})
# 6. OTHER SPECIFIC CLEANERS
$btnCleanShaders.Add_Click({
$btnCleanShaders.IsEnabled = $false
$cBefore = [int64]0
try { $cBefore = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
Invoke-AsyncAction { Clear-ShaderCaches } "Cleaning GPU and shader caches" "DirectX and GPU shader caches purged successfully!" {
try {
Update-StorageDriveDisplay
$cAfter = [int64]0
try { $cAfter = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
$freedBytes = [int64]0
if ($cAfter -gt $cBefore -and $cBefore -gt 0) { $freedBytes = [int64]($cAfter - $cBefore) }
if ($freedBytes -gt 0) {
$fText = if ($freedBytes -ge 1GB) { "$([math]::Round($freedBytes / 1GB, 2)) GB" } else { "$([math]::Round($freedBytes / 1MB, 0)) MB" }
$msg = if ($global:currentLang -eq "EN") { "✅ GPU shader caches purged! Freed $fText." } else { "✅ تم مسح كاش الشيدرز والرندر بنجاح! وفرنا $fText." }
Set-AppStatus $msg "#00ff9d" "#00ff9d"
}
} finally {
$btnCleanShaders.IsEnabled = $true
}
}
})
$btnCleanWinUpdate.Add_Click({
$btnCleanWinUpdate.IsEnabled = $false
$cBefore = [int64]0
try { $cBefore = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
Invoke-AsyncAction { Clear-WinUpdateAndDumps } "Cleaning Windows Update backlog and crash dumps" "Windows Update download cache and error dumps purged successfully!" {
try {
Update-StorageDriveDisplay
$cAfter = [int64]0
try { $cAfter = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
$freedBytes = [int64]0
if ($cAfter -gt $cBefore -and $cBefore -gt 0) { $freedBytes = [int64]($cAfter - $cBefore) }
if ($freedBytes -gt 0) {
$fText = if ($freedBytes -ge 1GB) { "$([math]::Round($freedBytes / 1GB, 2)) GB" } else { "$([math]::Round($freedBytes / 1MB, 0)) MB" }
$msg = if ($global:currentLang -eq "EN") { "✅ Windows Update downloads & dumps purged! Freed $fText." } else { "✅ تم تفريغ مخلفات التحديثات والتقارير بنجاح! وفرنا $fText." }
Set-AppStatus $msg "#00ff9d" "#00ff9d"
}
} finally {
$btnCleanWinUpdate.IsEnabled = $true
}
}
})
$btnCleanRecycleThumbs.Add_Click({
$btnCleanRecycleThumbs.IsEnabled = $false
$cBefore = [int64]0
try { $cBefore = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
Invoke-AsyncAction { Clear-RecycleAndThumbs } "Emptying Recycle Bin and clearing thumbnails" "Recycle Bin emptied and image thumbnail cache cleared successfully!" {
try {
Update-StorageDriveDisplay
$cAfter = [int64]0
try { $cAfter = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
$freedBytes = [int64]0
if ($cAfter -gt $cBefore -and $cBefore -gt 0) { $freedBytes = [int64]($cAfter - $cBefore) }
if ($freedBytes -gt 0) {
$fText = if ($freedBytes -ge 1GB) { "$([math]::Round($freedBytes / 1GB, 2)) GB" } else { "$([math]::Round($freedBytes / 1MB, 0)) MB" }
$msg = if ($global:currentLang -eq "EN") { "✅ Recycle Bin emptied & thumbnails cleared! Freed $fText." } else { "✅ تم تفريغ سلة المهملات ومصغرات الصور! وفرنا $fText." }
Set-AppStatus $msg "#00ff9d" "#00ff9d"
}
} finally {
$btnCleanRecycleThumbs.IsEnabled = $true
}
}
})
$btnCleanDevCaches.Add_Click({
$btnCleanDevCaches.IsEnabled = $false
$cBefore = [int64]0
try { $cBefore = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
Invoke-AsyncAction { Clear-DevCaches } "Cleaning developer and app caches" "Developer package and app caches purged successfully!" {
try {
Update-StorageDriveDisplay
$cAfter = [int64]0
try { $cAfter = [int64](Get-PSDrive C -ErrorAction SilentlyContinue).Free } catch {}
$freedBytes = [int64]0
if ($cAfter -gt $cBefore -and $cBefore -gt 0) { $freedBytes = [int64]($cAfter - $cBefore) }
if ($freedBytes -gt 0) {
$fText = if ($freedBytes -ge 1GB) { "$([math]::Round($freedBytes / 1GB, 2)) GB" } else { "$([math]::Round($freedBytes / 1MB, 0)) MB" }
$msg = if ($global:currentLang -eq "EN") { "✅ Developer & app caches purged! Freed $fText." } else { "✅ تم تفريغ كاش حزم البرامج والتطبيقات! وفرنا $fText." }
Set-AppStatus $msg "#00ff9d" "#00ff9d"
}
} finally {
$btnCleanDevCaches.IsEnabled = $true
}
}
})
# ==============================================================================
# 💼 MICROSOFT OFFICE DEPLOYMENT & UNATTENDED MAS OHOOK ENGINE
# ==============================================================================
function New-OfficeConfigXml {
param(
[string]$ProductId,
[string]$Channel,
[string]$Edition = "64",
[string[]]$Languages = @("ar-sa"),
[string[]]$ExcludeApps = @()
)
$xml = "`n"
$xml += " `n"
$xml += " `n"
foreach ($lang in $Languages) {
$xml += " `n"
}
foreach ($app in $ExcludeApps) {
$xml += " `n"
}
$xml += " `n"
$xml += " `n"
$xml += " `n"
$xml += " `n"
$xml += ""
return $xml
}
function Get-OfficeDeployDirectory {
$dir = "$env:ProgramData\Hadjikiko\OfficeDeploy"
if (-not [System.IO.Directory]::Exists($dir)) {
[System.IO.Directory]::CreateDirectory($dir) | Out-Null
}
return $dir
}
function Get-OdtSetupExecutable {
$deployDir = Get-OfficeDeployDirectory
$setupExe = [System.IO.Path]::Combine($deployDir, "setup.exe")
if ([System.IO.File]::Exists($setupExe)) {
return $setupExe
}
$odtInstaller = [System.IO.Path]::Combine($deployDir, "odt_installer.exe")
$primaryUrl = "https://download.microsoft.com/download/6c1eeb25-cf8b-41d9-8d0d-cc1dbc032140/officedeploymenttool_20228-20124.exe"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($primaryUrl, $odtInstaller)
Unblock-File -Path $odtInstaller -ErrorAction SilentlyContinue
# Extract setup.exe silently
$extractArgs = "/extract:`"$deployDir`" /quiet"
$proc = Start-Process -FilePath $odtInstaller -ArgumentList $extractArgs -Wait -PassThru
if ([System.IO.File]::Exists($setupExe)) {
return $setupExe
}
throw "Failed to extract setup.exe from Office Deployment Tool package."
}
function Invoke-MasOfficeSilent {
param([switch]$Wait)
try {
$masCommand = '& ([scriptblock]::Create((irm https://get.activated.win))) /Ohook'
$proc = Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"$masCommand`"" -Wait:$Wait -PassThru
return $proc
} catch {
$fallback = 'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/MAS/All-In-One-Version-KL/MAS_AIO.cmd'
$tmp = "$env:TEMP\MAS_AIO.cmd"
(New-Object System.Net.WebClient).DownloadFile($fallback, $tmp)
$proc = Start-Process cmd.exe -ArgumentList "/c `"$tmp`" /Ohook" -Wait:$Wait -PassThru
return $proc
}
}
# App Selection Quick Buttons
if ($btnSelectAllApps) {
$btnSelectAllApps.Add_Click({
$chkWord.IsChecked = $true
$chkExcel.IsChecked = $true
$chkPowerPoint.IsChecked = $true
$chkOutlook.IsChecked = $true
$chkOneNote.IsChecked = $true
$chkAccess.IsChecked = $true
$chkPublisher.IsChecked = $true
$chkTeams.IsChecked = $true
})
}
if ($btnSelectMinimalApps) {
$btnSelectMinimalApps.Add_Click({
$chkWord.IsChecked = $true
$chkExcel.IsChecked = $true
$chkPowerPoint.IsChecked = $true
$chkOutlook.IsChecked = $false
$chkOneNote.IsChecked = $false
$chkAccess.IsChecked = $false
$chkPublisher.IsChecked = $false
$chkTeams.IsChecked = $false
})
}
# Helper to gather user config from GUI
function Get-CurrentOfficeConfig {
$versionIdx = if ($cbOfficeVersion.SelectedIndex -ge 0) { $cbOfficeVersion.SelectedIndex } else { 0 }
$langIdx = if ($cbOfficeLang.SelectedIndex -ge 0) { $cbOfficeLang.SelectedIndex } else { 0 }
$archIdx = if ($cbOfficeArch.SelectedIndex -ge 0) { $cbOfficeArch.SelectedIndex } else { 0 }
$versionTable = @(
@{ ProductId = "O365ProPlusRetail"; Channel = "Current"; Name = "Microsoft 365 Apps Pro (2026 Latest)" },
@{ ProductId = "O365ProPlusRetail"; Channel = "BetaChannel"; Name = "Microsoft 365 (2026 Beta Preview)" },
@{ ProductId = "ProPlus2024Volume"; Channel = "PerpetualVL2024"; Name = "Office 2024 LTSC ProPlus" },
@{ ProductId = "Standard2024Volume"; Channel = "PerpetualVL2024"; Name = "Office 2024 Standard" },
@{ ProductId = "ProPlus2021Volume"; Channel = "PerpetualVL2021"; Name = "Office 2021 LTSC ProPlus" },
@{ ProductId = "Standard2021Volume"; Channel = "PerpetualVL2021"; Name = "Office 2021 Standard" },
@{ ProductId = "ProPlus2019Volume"; Channel = "PerpetualVL2019"; Name = "Office 2019 ProPlus" },
@{ ProductId = "Standard2019Volume"; Channel = "PerpetualVL2019"; Name = "Office 2019 Standard" },
@{ ProductId = "ProPlusVolume"; Channel = "MonthlyEnterprise"; Name = "Office 2016 ProPlus" }
)
$selectedVer = $versionTable[$versionIdx]
$langTable = @(
@("ar-sa"),
@("en-us"),
@("fr-fr"),
@("ar-sa", "en-us")
)
$selectedLangs = $langTable[$langIdx]
$arch = if ($archIdx -eq 1) { "32" } else { "64" }
$excluded = @()
if (-not $chkWord.IsChecked) { $excluded += "Word" }
if (-not $chkExcel.IsChecked) { $excluded += "Excel" }
if (-not $chkPowerPoint.IsChecked) { $excluded += "PowerPoint" }
if (-not $chkOutlook.IsChecked) { $excluded += "Outlook" }
if (-not $chkOneNote.IsChecked) { $excluded += "OneNote" }
if (-not $chkAccess.IsChecked) { $excluded += "Access" }
if (-not $chkPublisher.IsChecked) { $excluded += "Publisher" }
if (-not $chkTeams.IsChecked) { $excluded += "Teams" }
$excluded += "Groove"
$excluded += "Lync"
return @{
Version = $selectedVer
Languages = $selectedLangs
Architecture = $arch
ExcludedApps = $excluded
}
}
# Export Configuration.xml Button
if ($btnOfficeExportXml) {
$btnOfficeExportXml.Add_Click({
try {
$cfg = Get-CurrentOfficeConfig
$xml = New-OfficeConfigXml -ProductId $cfg.Version.ProductId -Channel $cfg.Version.Channel -Edition $cfg.Architecture -Languages $cfg.Languages -ExcludeApps $cfg.ExcludedApps
$desktopPath = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::Desktop)
$targetFile = [System.IO.Path]::Combine($desktopPath, "Configuration.xml")
[System.IO.File]::WriteAllText($targetFile, $xml, [System.Text.Encoding]::UTF8)
$msg = if ($global:currentLang -eq "EN") {
"Configuration.xml exported to Desktop: $targetFile"
} else {
"تم حفظ ملف Configuration.xml على سطح المكتب بنجاح: $targetFile"
}
$txtOfficeLog.Text = "📄 $msg"
Set-AppStatus "✅ $msg" "#00ff9d" "#00ff9d"
Start-Process explorer.exe -ArgumentList "/select,`"$targetFile`""
} catch {
$txtOfficeLog.Text = "❌ Error exporting XML: $($_.Exception.Message)"
}
})
}
# Instant Activate Installed Office (Ohook Silent) Button
if ($btnOfficeActivateOnly) {
$btnOfficeActivateOnly.Add_Click({
$btnOfficeActivateOnly.IsEnabled = $false
$pbOfficeProgress.IsIndeterminate = $true
$pbOfficeProgress.Visibility = [System.Windows.Visibility]::Visible
$startText = if ($global:currentLang -eq "EN") {
"Executing unattended MAS Ohook activation for installed Microsoft Office..."
} else {
"جاري استدعاء سكريبت MAS لتفعيل Office المثبت بنظام Ohook الصامت تلقائياً..."
}
$txtOfficeLog.Text = "🔑 $startText"
Set-AppStatus $startText "#f59e0b" "#f59e0b"
$actTimer = New-Object System.Windows.Threading.DispatcherTimer
$actTimer.Interval = [TimeSpan]::FromMilliseconds(100)
$actTimer.Add_Tick({
$this.Stop()
try {
Invoke-MasOfficeSilent -Wait
$succText = if ($global:currentLang -eq "EN") {
"Office activated permanently via Ohook! Licenses refreshed."
} else {
"تم تفعيل Microsoft Office بنجاح ودائماً بنظام Ohook الرقمي الرسمي!"
}
$txtOfficeLog.Text = "✅ $succText"
Set-AppStatus "✅ $succText" "#00ff9d" "#00ff9d"
} catch {
$errText = if ($global:currentLang -eq "EN") { "Activation error: " } else { "خطأ أثناء التفعيل: " }
$txtOfficeLog.Text = "❌ $errText $($_.Exception.Message)"
Set-AppStatus "❌ $errText" "#ef4444" "#ef4444"
} finally {
$pbOfficeProgress.IsIndeterminate = $false
$pbOfficeProgress.Visibility = [System.Windows.Visibility]::Collapsed
$btnOfficeActivateOnly.IsEnabled = $true
}
})
$actTimer.Start()
})
}
# Full Download, Install & Auto-Activate Button
if ($btnOfficeInstall) {
$btnOfficeInstall.Add_Click({
$btnOfficeInstall.IsEnabled = $false
$btnOfficeActivateOnly.IsEnabled = $false
$btnOfficeExportXml.IsEnabled = $false
$pbOfficeProgress.IsIndeterminate = $true
$pbOfficeProgress.Visibility = [System.Windows.Visibility]::Visible
$step1Msg = if ($global:currentLang -eq "EN") {
"[1/4] Preparing official Microsoft Office Deployment Tool (ODT)..."
} else {
"[1/4] جاري تحضير أداة التثبيت الرسمية ODT من سيرفرات مايكروسوفت..."
}
$txtOfficeLog.Text = "⏳ $step1Msg"
Set-AppStatus $step1Msg "#f59e0b" "#f59e0b"
$installTimer = New-Object System.Windows.Threading.DispatcherTimer
$installTimer.Interval = [TimeSpan]::FromMilliseconds(100)
$installTimer.Add_Tick({
$this.Stop()
try {
# Step 1: Ensure setup.exe
$setupExe = Get-OdtSetupExecutable
# Step 2: Generate Configuration.xml in deploy directory
$deployDir = Get-OfficeDeployDirectory
$cfg = Get-CurrentOfficeConfig
$xml = New-OfficeConfigXml -ProductId $cfg.Version.ProductId -Channel $cfg.Version.Channel -Edition $cfg.Architecture -Languages $cfg.Languages -ExcludeApps $cfg.ExcludedApps
$configFile = [System.IO.Path]::Combine($deployDir, "Configuration.xml")
[System.IO.File]::WriteAllText($configFile, $xml, [System.Text.Encoding]::UTF8)
$step2Msg = if ($global:currentLang -eq "EN") {
"[2/4] Configuration ready ($($cfg.Version.Name) - $($cfg.Architecture)-bit). Launching official Click-to-Run installer..."
} else {
"[2/4] تم إنشاء ملف التكوين ($($cfg.Version.Name) - $($cfg.Architecture)-bit). جاري إطلاق مثبت مايكروسوفت Click-to-Run..."
}
$txtOfficeLog.Text = "🚀 $step2Msg"
Set-AppStatus $step2Msg "#3b82f6" "#3b82f6"
# Step 3: Run setup.exe /configure Configuration.xml
$instProc = Start-Process -FilePath $setupExe -ArgumentList "/configure `"$configFile`"" -Wait -PassThru
# Step 4: Silent Ohook Activation
$step3Msg = if ($global:currentLang -eq "EN") {
"[3/4] Installation finished. Executing unattended MAS Ohook permanent activation..."
} else {
"[3/4] اكتمل تثبيت Office من سيرفرات مايكروسوفت! جاري التفعيل الصامت الدائم عبر MAS Ohook..."
}
$txtOfficeLog.Text = "🔑 $step3Msg"
Set-AppStatus $step3Msg "#f59e0b" "#f59e0b"
Invoke-MasOfficeSilent -Wait
$step4Msg = if ($global:currentLang -eq "EN") {
"[4/4] ✅ Microsoft Office ($($cfg.Version.Name)) installed & permanently activated with Ohook!"
} else {
"[4/4] ✅ اكتملت العملية بنجاح! تم تثبيت وتفعيل ($($cfg.Version.Name)) برخصة Ohook دائمة."
}
$txtOfficeLog.Text = $step4Msg
Set-AppStatus $step4Msg "#00ff9d" "#00ff9d"
} catch {
$failMsg = if ($global:currentLang -eq "EN") { "Office deployment error: " } else { "خطأ أثناء تثبيت Office: " }
$txtOfficeLog.Text = "❌ $failMsg $($_.Exception.Message)"
Set-AppStatus "❌ $failMsg" "#ef4444" "#ef4444"
} finally {
$pbOfficeProgress.IsIndeterminate = $false
$pbOfficeProgress.Visibility = [System.Windows.Visibility]::Collapsed
$btnOfficeInstall.IsEnabled = $true
$btnOfficeActivateOnly.IsEnabled = $true
$btnOfficeExportXml.IsEnabled = $true
}
})
$installTimer.Start()
})
}
# 7. DASHBOARD SHORTCUT ACTIONS
if ($btnDashToStorage) {
$btnDashToStorage.Add_Click({ Switch-Tab $tabBtnStorage $panelStorage })
}
if ($btnDashRepairShortcut) {
$btnDashRepairShortcut.Add_Click({ Switch-Tab $tabBtnRepairs $panelRepairs })
}
if ($btnDashTweakGaming) {
$btnDashTweakGaming.Add_Click({ Switch-Tab $tabBtnGaming $panelGaming })
}
if ($btnDashTweakNet) {
$btnDashTweakNet.Add_Click({
Invoke-AsyncAction {
try {
Clear-DnsClientCache -ErrorAction SilentlyContinue
netsh winsock reset | Out-Null
netsh int ip reset | Out-Null
} catch {}
} "Quick Network Reset" "Network stack & DNS flushed!"
})
}
if ($btnDashTweakTrim) {
$btnDashTweakTrim.Add_Click({
Invoke-AsyncAction {
try {
Optimize-Volume -DriveLetter C -ReTrim -Verbose -ErrorAction SilentlyContinue
} catch {}
} "Executing SSD TRIM on C:" "SSD TRIM completed successfully!"
})
}
if ($btnDashRestartExp) {
$btnDashRestartExp.Add_Click({
try {
Set-AppStatus "Restarting Windows Explorer..." "#ffd166" "#ffd166"
Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 600
Start-Process explorer.exe
Set-AppStatus "Windows Explorer restarted!" "#00ff9d" "#00ff9d"
} catch {}
})
}
Update-StorageDriveDisplay
# 10. LAUNCH MODERN WINDOW
$window.Add_Loaded({
try {
$this.Activate()
$this.Focus()
} catch {}
# Run hardware specs smoothly in the background so GUI opens INSTANTLY with 0ms delay
$bgSpecsTimer = New-Object System.Windows.Threading.DispatcherTimer
$bgSpecsTimer.Interval = [TimeSpan]::FromMilliseconds(50)
$bgSpecsTimer.Add_Tick({
$this.Stop()
Load-DeepHardwareInfo
Update-RamTaskButtonUI
})
$bgSpecsTimer.Start()
})
[void]$window.ShowDialog()
$ramTimer.Stop()