<# CaiPhanMem.ps1 v3 - giao diện cửa sổ (WPF) Tải / cài phần mềm từ Google Drive qua Worker phanmem-dl. Cần Windows 10 (1803) trở lên. #> # ================== CẤU HÌNH ================== $DefaultDest = "C:\PhanMem" $SelfUrl = "https://winsoft.phuctools.online" $ListUrl = "https://script.google.com/macros/s/AKfycbyDzwjnN_RP46TNIWGX3ZTDVFrE9OMNNtiRH0VZ-NfkQkPVeiG7gvYRYjdvGi69vVV5/exec" $DlUrl = "https://phanmem-dl.zencom-apps.workers.dev" # Worker phanmem-dl (repo zenithbit/phanmem-dl) # ============================================== $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # ---------- Quyền Admin ---------- $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { if ($PSCommandPath) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs } else { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -Command `"[Net.ServicePointManager]::SecurityProtocol='Tls12'; irm $SelfUrl | iex`"" -Verb RunAs } return } Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms if (-not ('PhucAppItem' -as [type])) { Add-Type -Language CSharp -TypeDefinition @' using System; using System.ComponentModel; using System.Runtime.InteropServices; public class PhucAppItem : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; void N(string p) { PropertyChangedEventHandler h = PropertyChanged; if (h != null) h(this, new PropertyChangedEventArgs(p)); } public int No { get; set; } public string Group { get; set; } public string Name { get; set; } public string File { get; set; } public string Id { get; set; } public string Args { get; set; } public string Ext { get; set; } public string SearchKey { get; set; } public string Out { get; set; } public double Size { get; set; } public string SizeText { get; set; } bool _sel; public bool Selected { get { return _sel; } set { if (_sel != value) { _sel = value; N("Selected"); } } } string _st = ""; public string Status { get { return _st; } set { _st = value; N("Status"); } } string _kind = ""; public string Kind { get { return _kind; } set { _kind = value; N("Kind"); } } string _det = ""; public string Detail { get { return _det; } set { _det = value; N("Detail"); } } double _p; public double Progress { get { return _p; } set { _p = value; N("Progress"); } } bool _busy; public bool Busy { get { return _busy; } set { _busy = value; N("Busy"); } } } public static class PhucNative { [DllImport("kernel32.dll")] public static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h, int n); } '@ } $curl = Get-Command curl.exe -ErrorAction SilentlyContinue if (-not $curl) { [Windows.MessageBox]::Show("Máy này chưa có curl.exe (cần Windows 10 bản 1803 trở lên).", "Cài phần mềm") | Out-Null return } # ================== GIAO DIỆN ================== $xaml = @'