v1.22 — Office 2016 MSI ISO telepítés támogatás
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) <noreply@anthropic.com>
This commit is contained in:
@@ -26,56 +26,179 @@ namespace InstaSoftOfficeTool.Pages
|
||||
{
|
||||
try
|
||||
{
|
||||
// Step 1: Download ODT
|
||||
SetStepActive(Step1Icon, Step1Text);
|
||||
AppendLog("ODT let\u00f6lt\u00e9se indul...");
|
||||
|
||||
var downloader = new OdtDownloader();
|
||||
downloader.StatusChanged += msg => 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user