From 12b86e07077caac2cd030e8e35b0fcefde3ab6cb Mon Sep 17 00:00:00 2001 From: hariel1985 Date: Mon, 13 Apr 2026 23:27:14 +0200 Subject: [PATCH] =?UTF-8?q?v1.22=20=E2=80=94=20Office=202016=20MSI=20ISO?= =?UTF-8?q?=20telep=C3=ADt=C3=A9s=20t=C3=A1mogat=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Office 2016 Standard és Professional Plus telepítése ISO letöltéssel (soft.direct), ISO csatolással és a Microsoft MSI telepítő indításával. A 2019/2021/2024 verziók továbbra is ODT-vel működnek. Co-Authored-By: Claude Opus 4.6 (1M context) --- InstaSoftOfficeTool.csproj | 6 +- MainWindow.xaml | 2 +- MainWindow.xaml.cs | 6 ++ Models/InstallConfig.cs | 8 ++ Models/OfficeEdition.cs | 31 ++++-- Pages/ConfigPage.xaml | 12 ++- Pages/ConfigPage.xaml.cs | 97 ++++++++++++------ Pages/ProgressPage.xaml | 3 + Pages/ProgressPage.xaml.cs | 205 +++++++++++++++++++++++++++++-------- Pages/SummaryPage.xaml.cs | 29 ++++-- Pages/VersionPage.xaml | 2 +- Services/MsiInstaller.cs | 192 ++++++++++++++++++++++++++++++++++ 12 files changed, 501 insertions(+), 92 deletions(-) create mode 100644 Services/MsiInstaller.cs diff --git a/InstaSoftOfficeTool.csproj b/InstaSoftOfficeTool.csproj index 2638518..34c39ba 100644 --- a/InstaSoftOfficeTool.csproj +++ b/InstaSoftOfficeTool.csproj @@ -9,9 +9,9 @@ InstaSoft Zrt. InstaSoft Office Tool Copyright (c) InstaSoft Zrt. 2026 - 1.21 - 1.21.0.0 - 1.21.0.0 + 1.22 + 1.22.0.0 + 1.22.0.0 app.manifest latest diff --git a/MainWindow.xaml b/MainWindow.xaml index f090830..d6ea473 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -45,7 +45,7 @@ Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/> - diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index ff85130..d3e22bb 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -174,6 +174,12 @@ namespace InstaSoftOfficeTool _wizardPages[1] = new EditionPage(this, _config); } + // Refresh config page when edition changes (MSI/ODT mode may differ) + if (_currentPageIndex == 2) + { + _wizardPages[2] = new ConfigPage(this, _config); + } + ShowCurrentPage(); } } diff --git a/Models/InstallConfig.cs b/Models/InstallConfig.cs index 127ad6e..583e254 100644 --- a/Models/InstallConfig.cs +++ b/Models/InstallConfig.cs @@ -11,6 +11,13 @@ namespace InstaSoftOfficeTool.Models public string ProductKey { get; set; } public List ExcludedApps { get; set; } = new List(); + public bool IsMsiInstall => Edition != null && Edition.IsMsiInstall; + + public string GetIsoUrl() + { + return Edition?.GetIsoUrl(Architecture); + } + public string GetVersionDisplayName() { switch (Version) @@ -18,6 +25,7 @@ namespace InstaSoftOfficeTool.Models case OfficeVersion.Office2024: return "Office 2024"; case OfficeVersion.Office2021: return "Office 2021"; case OfficeVersion.Office2019: return "Office 2019"; + case OfficeVersion.Office2016: return "Office 2016"; default: return ""; } } diff --git a/Models/OfficeEdition.cs b/Models/OfficeEdition.cs index b4177e3..7d8062b 100644 --- a/Models/OfficeEdition.cs +++ b/Models/OfficeEdition.cs @@ -8,6 +8,22 @@ namespace InstaSoftOfficeTool.Models public string Channel { get; set; } public bool IsVolume { get; set; } + // MSI ISO telepítés (Office 2016) + public string IsoUrl32 { get; set; } + public string IsoUrl64 { get; set; } + + public bool IsMsiInstall => IsoUrl64 != null || IsoUrl32 != null; + + public string GetIsoUrl(string architecture) + { + return architecture == "32" ? IsoUrl32 : IsoUrl64; + } + + public bool HasArchitecture(string architecture) + { + return architecture == "32" ? IsoUrl32 != null : IsoUrl64 != null; + } + public static OfficeEdition[] GetEditions(OfficeVersion version) { switch (version) @@ -108,7 +124,9 @@ namespace InstaSoftOfficeTool.Models Description = "Alapvető irodai alkalmazások: Word, Excel, PowerPoint, Outlook, OneNote", ProductId = "Standard2016Volume", Channel = "PerpetualVL2019", - IsVolume = true + IsVolume = true, + IsoUrl32 = "https://soft.direct/Install/SW_DVD5_Office_2016_W32_Hungarian_MLF_X20-41370.iso", + IsoUrl64 = "https://soft.direct/Install/SW_DVD5_Office_2016_W64_Hungarian_MLF_X20-41370.iso" }, new OfficeEdition { @@ -116,15 +134,8 @@ namespace InstaSoftOfficeTool.Models Description = "Teljes csomag: Word, Excel, PowerPoint, Outlook, Access, Publisher, OneNote, Skype for Business", ProductId = "ProPlus2016Volume", Channel = "PerpetualVL2019", - IsVolume = true - }, - new OfficeEdition - { - DisplayName = "Otthoni és kisvállalati verzió", - Description = "Word, Excel, PowerPoint, Outlook, OneNote — vállalkozásokban is használható", - ProductId = "HomeBusiness2016Retail", - Channel = "Current", - IsVolume = false + IsVolume = true, + IsoUrl64 = "https://soft.direct/Install/SW_DVD5_Office_Professional_Plus_2016_64Bit_Hungarian_MLF_X20-42439.ISO" } }; diff --git a/Pages/ConfigPage.xaml b/Pages/ConfigPage.xaml index 88ff480..75d8d6b 100644 --- a/Pages/ConfigPage.xaml +++ b/Pages/ConfigPage.xaml @@ -32,12 +32,22 @@ + - + + + + + diff --git a/Pages/ConfigPage.xaml.cs b/Pages/ConfigPage.xaml.cs index 136ae5b..64cdde1 100644 --- a/Pages/ConfigPage.xaml.cs +++ b/Pages/ConfigPage.xaml.cs @@ -17,12 +17,23 @@ namespace InstaSoftOfficeTool.Pages _main = main; _config = config; + bool isMsi = _config.IsMsiInstall; + // Restore arch if (_config.Architecture == "32") { Rb32.IsChecked = true; } + // MSI: handle architecture constraints + if (isMsi && _config.Edition != null && !_config.Edition.HasArchitecture("32")) + { + Rb32.IsEnabled = false; + Rb64.IsChecked = true; + ArchNote.Text = "A Professional Plus kiadáshoz csak 64-bites telepítő érhető el."; + ArchNote.Visibility = Visibility.Visible; + } + // Populate language combo foreach (var lang in LanguageList.Languages) { @@ -45,37 +56,65 @@ namespace InstaSoftOfficeTool.Pages } if (CbLanguage.SelectedIndex < 0) CbLanguage.SelectedIndex = 0; - // Populate app checkboxes - foreach (var app in ExcludableApps.Apps) + // MSI: language is baked into the ISO + if (isMsi) { - // Ha m\u00e1r van ment\u00e9s a configban, azt haszn\u00e1ljuk; k\u00fcl\u00f6nben a default\u00f6t - bool isChecked = _config.ExcludedApps.Count > 0 - ? !_config.ExcludedApps.Contains(app.Id) - : app.DefaultChecked; - - bool isProPlus = _config.Edition != null && - _config.Edition.ProductId.Contains("ProPlus"); - bool isStandard = _config.Edition != null && - _config.Edition.ProductId.Contains("Standard"); - - bool unavailable = false; - if (app.MinEdition == "proplus" && !isProPlus) - unavailable = true; - else if (app.MinEdition == "standard+" && !isProPlus && !isStandard) - unavailable = true; - - var cb = new CheckBox + CbLanguage.IsEnabled = false; + // Force Hungarian selection + for (int i = 0; i < CbLanguage.Items.Count; i++) { - Content = app.DisplayName, - IsChecked = unavailable ? false : isChecked, - IsEnabled = !unavailable, - Tag = app.Id, - Style = (Style)FindResource("FluentCheckBox"), - Margin = new Thickness(0, 4, 24, 4), - MinWidth = 160 - }; - _appCheckBoxes.Add(cb); - AppCheckBoxes.Children.Add(cb); + var item = (ComboBoxItem)CbLanguage.Items[i]; + if ((string)item.Tag == "hu-hu") + { + CbLanguage.SelectedIndex = i; + break; + } + } + LanguageNote.Text = "Az Office 2016 telepítő ISO magyar nyelvű. A nyelv nem módosítható."; + LanguageNote.Visibility = Visibility.Visible; + } + + // MSI: app exclusion not available through our tool + if (isMsi) + { + AppTitle.Visibility = Visibility.Collapsed; + AppCheckBoxes.Visibility = Visibility.Collapsed; + AppNote.Text = "Az alkalmazások kiválasztása a Microsoft telepítő felületén lehetséges."; + AppNote.Visibility = Visibility.Visible; + } + else + { + // Populate app checkboxes (ODT mode) + foreach (var app in ExcludableApps.Apps) + { + bool isChecked = _config.ExcludedApps.Count > 0 + ? !_config.ExcludedApps.Contains(app.Id) + : app.DefaultChecked; + + bool isProPlus = _config.Edition != null && + _config.Edition.ProductId.Contains("ProPlus"); + bool isStandard = _config.Edition != null && + _config.Edition.ProductId.Contains("Standard"); + + bool unavailable = false; + if (app.MinEdition == "proplus" && !isProPlus) + unavailable = true; + else if (app.MinEdition == "standard+" && !isProPlus && !isStandard) + unavailable = true; + + var cb = new CheckBox + { + Content = app.DisplayName, + IsChecked = unavailable ? false : isChecked, + IsEnabled = !unavailable, + Tag = app.Id, + Style = (Style)FindResource("FluentCheckBox"), + Margin = new Thickness(0, 4, 24, 4), + MinWidth = 160 + }; + _appCheckBoxes.Add(cb); + AppCheckBoxes.Children.Add(cb); + } } } diff --git a/Pages/ProgressPage.xaml b/Pages/ProgressPage.xaml index dff23e5..caf59c9 100644 --- a/Pages/ProgressPage.xaml +++ b/Pages/ProgressPage.xaml @@ -33,6 +33,9 @@ + + Dispatcher.Invoke(() => AppendLog(msg)); - - bool downloaded = await downloader.DownloadAndExtractAsync(); - if (!downloaded) + if (_config.IsMsiInstall) { - SetStepError(Step1Icon, Step1Text); - ShowDone(false, "Az ODT let\u00f6lt\u00e9se sikertelen."); - return; - } - SetStepDone(Step1Icon, Step1Text); - - // Step 2: Generate config XML - SetStepActive(Step2Icon, Step2Text); - AppendLog("Konfigur\u00e1ci\u00f3s XML gener\u00e1l\u00e1sa..."); - - string xml = OdtXmlGenerator.Generate(_config); - string xmlPath = Path.Combine(downloader.OdtFolder, "configuration.xml"); - File.WriteAllText(xmlPath, xml); - AppendLog("XML mentve: " + xmlPath); - - SetStepDone(Step2Icon, Step2Text); - - // Step 3: Run setup.exe /configure - SetStepActive(Step3Icon, Step3Text); - AppendLog("Office telep\u00edt\u00e9s ind\u00edt\u00e1sa..."); - AppendLog("setup.exe /configure \"" + xmlPath + "\""); - - int exitCode = await downloader.RunSetupAsync(xmlPath, msg => - Dispatcher.Invoke(() => AppendLog(msg))); - - if (exitCode == 0) - { - SetStepDone(Step3Icon, Step3Text); - ShowDone(true, "Az Office sikeresen telep\u00fclt!"); + await StartMsiInstallation(); } else { - SetStepError(Step3Icon, Step3Text); - ShowDone(false, "A telep\u00edt\u00e9s hibak\u00f3ddal fejez\u0151d\u00f6tt be: " + exitCode); + await StartOdtInstallation(); } } catch (Exception ex) { AppendLog("HIBA: " + ex.Message); - ShowDone(false, "V\u00e1ratlan hiba t\u00f6rt\u00e9nt."); + ShowDone(false, "Váratlan hiba történt."); + } + } + + private async Task StartOdtInstallation() + { + // Step 1: Download ODT + SetStepActive(Step1Icon, Step1Text); + AppendLog("ODT letöltése indul..."); + + var downloader = new OdtDownloader(); + downloader.StatusChanged += msg => Dispatcher.Invoke(() => AppendLog(msg)); + + bool downloaded = await downloader.DownloadAndExtractAsync(); + if (!downloaded) + { + SetStepError(Step1Icon, Step1Text); + ShowDone(false, "Az ODT letöltése sikertelen."); + return; + } + SetStepDone(Step1Icon, Step1Text); + + // Step 2: Generate config XML + SetStepActive(Step2Icon, Step2Text); + AppendLog("Konfigurációs XML generálása..."); + + string xml = OdtXmlGenerator.Generate(_config); + string xmlPath = Path.Combine(downloader.OdtFolder, "configuration.xml"); + File.WriteAllText(xmlPath, xml); + AppendLog("XML mentve: " + xmlPath); + + SetStepDone(Step2Icon, Step2Text); + + // Step 3: Run setup.exe /configure + SetStepActive(Step3Icon, Step3Text); + AppendLog("Office telepítés indítása..."); + AppendLog("setup.exe /configure \"" + xmlPath + "\""); + + int exitCode = await downloader.RunSetupAsync(xmlPath, msg => + Dispatcher.Invoke(() => AppendLog(msg))); + + if (exitCode == 0) + { + SetStepDone(Step3Icon, Step3Text); + ShowDone(true, "Az Office sikeresen települt!"); + } + else + { + SetStepError(Step3Icon, Step3Text); + ShowDone(false, "A telepítés hibakóddal fejeződött be: " + exitCode); + } + } + + private async Task StartMsiInstallation() + { + string isoUrl = _config.GetIsoUrl(); + if (string.IsNullOrEmpty(isoUrl)) + { + ShowDone(false, "Nincs elérhető ISO a kiválasztott architektúrához."); + return; + } + + // Update step labels for MSI flow + Dispatcher.Invoke(() => + { + Step1Text.Text = "Telepítő ISO letöltése..."; + Step2Text.Text = "ISO csatolása..."; + Step3Text.Text = "Office 2016 telepítése..."; + }); + + var installer = new MsiInstaller(); + installer.StatusChanged += msg => Dispatcher.Invoke(() => AppendLog(msg)); + installer.DownloadProgress += (received, total) => + { + Dispatcher.Invoke(() => + { + long receivedMb = received / 1024 / 1024; + if (total > 0) + { + long totalMb = total / 1024 / 1024; + int percent = (int)(received * 100 / total); + DownloadInfo.Text = receivedMb + " MB / " + totalMb + " MB (" + percent + "%)"; + MainProgress.IsIndeterminate = false; + MainProgress.Value = percent; + } + else + { + DownloadInfo.Text = receivedMb + " MB letöltve..."; + } + DownloadInfo.Visibility = Visibility.Visible; + }); + }; + + // Step 1: Download ISO + SetStepActive(Step1Icon, Step1Text); + AppendLog("ISO letöltése indul..."); + + bool downloaded = await installer.DownloadIsoAsync(isoUrl); + if (!downloaded) + { + SetStepError(Step1Icon, Step1Text); + ShowDone(false, "Az ISO letöltése sikertelen."); + return; + } + SetStepDone(Step1Icon, Step1Text); + + // Hide download progress, reset progress bar + Dispatcher.Invoke(() => + { + DownloadInfo.Visibility = Visibility.Collapsed; + MainProgress.IsIndeterminate = true; + }); + + // Step 2: Mount ISO + SetStepActive(Step2Icon, Step2Text); + bool mounted = await installer.MountIsoAsync(); + if (!mounted) + { + SetStepError(Step2Icon, Step2Text); + ShowDone(false, "Az ISO csatolása sikertelen."); + return; + } + SetStepDone(Step2Icon, Step2Text); + + // Step 3: Run setup.exe + SetStepActive(Step3Icon, Step3Text); + int exitCode = await installer.RunSetupAsync(msg => + Dispatcher.Invoke(() => AppendLog(msg))); + + // Dismount ISO regardless of result + await installer.DismountIsoAsync(); + + if (exitCode == 0) + { + SetStepDone(Step3Icon, Step3Text); + + // Apply product key if provided + if (!string.IsNullOrEmpty(_config.ProductKey)) + { + AppendLog("Termékkulcs telepítése..."); + var lm = new LicenseManager(); + if (lm.FindOspp()) + { + string inpResult = await lm.InstallKeyAsync(_config.ProductKey); + AppendLog(inpResult); + AppendLog("Aktiválás..."); + string actResult = await lm.ActivateAsync(); + AppendLog(actResult); + } + else + { + AppendLog("Az ospp.vbs nem található — a kulcsot később a Licenc-kezelésben adhatja meg."); + } + } + + ShowDone(true, "Az Office 2016 sikeresen települt!"); + } + else + { + SetStepError(Step3Icon, Step3Text); + ShowDone(false, "A telepítés hibakóddal fejeződött be: " + exitCode); } } diff --git a/Pages/SummaryPage.xaml.cs b/Pages/SummaryPage.xaml.cs index ba0f445..2bd1247 100644 --- a/Pages/SummaryPage.xaml.cs +++ b/Pages/SummaryPage.xaml.cs @@ -30,13 +30,30 @@ namespace InstaSoftOfficeTool.Pages SumLanguage.Text = _config.GetLanguageDisplayName() + " (" + _config.Language + ")"; SumKey.Text = string.IsNullOrEmpty(_config.ProductKey) ? "Nincs megadva" : _config.ProductKey; - if (_config.ExcludedApps.Count > 0) - SumExcluded.Text = string.Join(", ", _config.ExcludedApps); - else - SumExcluded.Text = "Nincs (minden alkalmaz\u00e1s telep\u00fcl)"; + if (_config.IsMsiInstall) + { + // MSI mode: no app exclusion, show ISO info instead of XML + SumExcluded.Text = "(a Microsoft telepítőben választható)"; - _generatedXml = OdtXmlGenerator.Generate(_config); - XmlPreview.Text = _generatedXml; + string isoUrl = _config.GetIsoUrl(); + XmlPreview.Text = "Telepítési mód: ISO letöltés + MSI telepítő\n" + + "ISO URL: " + (isoUrl ?? "Nem elérhető") + "\n\n" + + "A telepítő ISO fájl letöltése után a Microsoft Office\n" + + "saját telepítője indul el automatikusan."; + + BtnSaveXml.Visibility = System.Windows.Visibility.Collapsed; + } + else + { + if (_config.ExcludedApps.Count > 0) + SumExcluded.Text = string.Join(", ", _config.ExcludedApps); + else + SumExcluded.Text = "Nincs (minden alkalmazás települ)"; + + _generatedXml = OdtXmlGenerator.Generate(_config); + XmlPreview.Text = _generatedXml; + BtnSaveXml.Visibility = System.Windows.Visibility.Visible; + } } private void BtnSaveXml_Click(object sender, RoutedEventArgs e) diff --git a/Pages/VersionPage.xaml b/Pages/VersionPage.xaml index 0100bf1..b91bb05 100644 --- a/Pages/VersionPage.xaml +++ b/Pages/VersionPage.xaml @@ -15,7 +15,7 @@ Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0"/> - + diff --git a/Services/MsiInstaller.cs b/Services/MsiInstaller.cs new file mode 100644 index 0000000..e540ae9 --- /dev/null +++ b/Services/MsiInstaller.cs @@ -0,0 +1,192 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Net.Http; +using System.Threading.Tasks; + +namespace InstaSoftOfficeTool.Services +{ + public class MsiInstaller + { + public event Action StatusChanged; + public event Action DownloadProgress; + + private string _isoPath; + private string _mountedDrive; + + public string WorkFolder { get; private set; } + + public MsiInstaller() + { + WorkFolder = Path.Combine(Path.GetTempPath(), "InstaSoftODT"); + Directory.CreateDirectory(WorkFolder); + } + + public async Task DownloadIsoAsync(string url) + { + try + { + string fileName = Path.GetFileName(new Uri(url).AbsolutePath); + _isoPath = Path.Combine(WorkFolder, fileName); + + // Check if already downloaded + if (File.Exists(_isoPath)) + { + var fi = new FileInfo(_isoPath); + if (fi.Length > 100_000_000) + { + StatusChanged?.Invoke("ISO már letöltve: " + fileName + " (" + (fi.Length / 1024 / 1024) + " MB)"); + return true; + } + File.Delete(_isoPath); + } + + StatusChanged?.Invoke("ISO letöltése: " + fileName); + StatusChanged?.Invoke("URL: " + url); + + using (var handler = new HttpClientHandler { AllowAutoRedirect = true }) + using (var client = new HttpClient(handler)) + { + client.DefaultRequestHeaders.Add("User-Agent", "InstaSoftOfficeTool/1.0"); + client.Timeout = TimeSpan.FromMinutes(30); + + var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); + response.EnsureSuccessStatusCode(); + + long totalBytes = response.Content.Headers.ContentLength ?? -1; + + using (var stream = await response.Content.ReadAsStreamAsync()) + using (var fileStream = new FileStream(_isoPath, FileMode.Create, FileAccess.Write, FileShare.None, 65536)) + { + var buffer = new byte[65536]; + long totalRead = 0; + int bytesRead; + + while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) > 0) + { + await fileStream.WriteAsync(buffer, 0, bytesRead); + totalRead += bytesRead; + DownloadProgress?.Invoke(totalRead, totalBytes); + } + } + + var downloadedSize = new FileInfo(_isoPath).Length; + StatusChanged?.Invoke("ISO letöltve: " + (downloadedSize / 1024 / 1024) + " MB"); + } + + return true; + } + catch (HttpRequestException ex) + { + StatusChanged?.Invoke("Hálózati hiba: " + ex.Message); + return false; + } + catch (TaskCanceledException) + { + StatusChanged?.Invoke("Időtúllépés: A letöltés túl sokáig tartott."); + return false; + } + catch (Exception ex) + { + StatusChanged?.Invoke("ISO letöltési hiba: " + ex.Message); + return false; + } + } + + public async Task MountIsoAsync() + { + try + { + StatusChanged?.Invoke("ISO csatolása..."); + + var psi = new ProcessStartInfo + { + FileName = "powershell", + Arguments = "-NoProfile -Command \"" + + "$result = Mount-DiskImage -ImagePath '" + _isoPath + "' -PassThru; " + + "$vol = $result | Get-Volume; " + + "Write-Output $vol.DriveLetter\"", + UseShellExecute = false, + CreateNoWindow = true, + RedirectStandardOutput = true, + RedirectStandardError = true + }; + + using (var process = Process.Start(psi)) + { + string output = await Task.Run(() => process.StandardOutput.ReadToEnd()); + await Task.Run(() => process.WaitForExit()); + + string driveLetter = output.Trim(); + if (process.ExitCode != 0 || driveLetter.Length != 1 || !char.IsLetter(driveLetter[0])) + { + string error = await Task.Run(() => process.StandardError.ReadToEnd()); + StatusChanged?.Invoke("Hiba: Az ISO csatolása sikertelen."); + if (!string.IsNullOrEmpty(error)) + StatusChanged?.Invoke(error.Trim()); + return false; + } + + _mountedDrive = driveLetter + ":\\"; + StatusChanged?.Invoke("ISO csatolva: " + _mountedDrive); + return true; + } + } + catch (Exception ex) + { + StatusChanged?.Invoke("ISO csatolási hiba: " + ex.Message); + return false; + } + } + + public async Task RunSetupAsync(Action outputCallback) + { + string setupExe = Path.Combine(_mountedDrive, "setup.exe"); + if (!File.Exists(setupExe)) + { + StatusChanged?.Invoke("Hiba: setup.exe nem található: " + setupExe); + return -1; + } + + StatusChanged?.Invoke("Office 2016 telepítő indítása: " + setupExe); + outputCallback?.Invoke("A Microsoft Office telepítő ablaka megjelenik..."); + outputCallback?.Invoke("Kérjük, kövesse a telepítő utasításait."); + + var psi = new ProcessStartInfo + { + FileName = setupExe, + UseShellExecute = true + }; + + using (var process = Process.Start(psi)) + { + await Task.Run(() => process.WaitForExit()); + return process.ExitCode; + } + } + + public async Task DismountIsoAsync() + { + try + { + if (string.IsNullOrEmpty(_isoPath) || !File.Exists(_isoPath)) return; + + StatusChanged?.Invoke("ISO leválasztása..."); + var psi = new ProcessStartInfo + { + FileName = "powershell", + Arguments = "-NoProfile -Command \"Dismount-DiskImage -ImagePath '" + _isoPath + "'\"", + UseShellExecute = false, + CreateNoWindow = true + }; + + using (var process = Process.Start(psi)) + { + await Task.Run(() => process.WaitForExit()); + } + StatusChanged?.Invoke("ISO leválasztva."); + } + catch { } + } + } +}