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:
@@ -9,9 +9,9 @@
|
|||||||
<Company>InstaSoft Zrt.</Company>
|
<Company>InstaSoft Zrt.</Company>
|
||||||
<Product>InstaSoft Office Tool</Product>
|
<Product>InstaSoft Office Tool</Product>
|
||||||
<Copyright>Copyright (c) InstaSoft Zrt. 2026</Copyright>
|
<Copyright>Copyright (c) InstaSoft Zrt. 2026</Copyright>
|
||||||
<Version>1.21</Version>
|
<Version>1.22</Version>
|
||||||
<AssemblyVersion>1.21.0.0</AssemblyVersion>
|
<AssemblyVersion>1.22.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.21.0.0</FileVersion>
|
<FileVersion>1.22.0.0</FileVersion>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/>
|
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Text="v1.21" HorizontalAlignment="Right" VerticalAlignment="Center"
|
<TextBlock Text="v1.22" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"/>
|
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -174,6 +174,12 @@ namespace InstaSoftOfficeTool
|
|||||||
_wizardPages[1] = new EditionPage(this, _config);
|
_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();
|
ShowCurrentPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ namespace InstaSoftOfficeTool.Models
|
|||||||
public string ProductKey { get; set; }
|
public string ProductKey { get; set; }
|
||||||
public List<string> ExcludedApps { get; set; } = new List<string>();
|
public List<string> ExcludedApps { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
public bool IsMsiInstall => Edition != null && Edition.IsMsiInstall;
|
||||||
|
|
||||||
|
public string GetIsoUrl()
|
||||||
|
{
|
||||||
|
return Edition?.GetIsoUrl(Architecture);
|
||||||
|
}
|
||||||
|
|
||||||
public string GetVersionDisplayName()
|
public string GetVersionDisplayName()
|
||||||
{
|
{
|
||||||
switch (Version)
|
switch (Version)
|
||||||
@@ -18,6 +25,7 @@ namespace InstaSoftOfficeTool.Models
|
|||||||
case OfficeVersion.Office2024: return "Office 2024";
|
case OfficeVersion.Office2024: return "Office 2024";
|
||||||
case OfficeVersion.Office2021: return "Office 2021";
|
case OfficeVersion.Office2021: return "Office 2021";
|
||||||
case OfficeVersion.Office2019: return "Office 2019";
|
case OfficeVersion.Office2019: return "Office 2019";
|
||||||
|
case OfficeVersion.Office2016: return "Office 2016";
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,22 @@ namespace InstaSoftOfficeTool.Models
|
|||||||
public string Channel { get; set; }
|
public string Channel { get; set; }
|
||||||
public bool IsVolume { 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)
|
public static OfficeEdition[] GetEditions(OfficeVersion version)
|
||||||
{
|
{
|
||||||
switch (version)
|
switch (version)
|
||||||
@@ -108,7 +124,9 @@ namespace InstaSoftOfficeTool.Models
|
|||||||
Description = "Alapvető irodai alkalmazások: Word, Excel, PowerPoint, Outlook, OneNote",
|
Description = "Alapvető irodai alkalmazások: Word, Excel, PowerPoint, Outlook, OneNote",
|
||||||
ProductId = "Standard2016Volume",
|
ProductId = "Standard2016Volume",
|
||||||
Channel = "PerpetualVL2019",
|
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
|
new OfficeEdition
|
||||||
{
|
{
|
||||||
@@ -116,15 +134,8 @@ namespace InstaSoftOfficeTool.Models
|
|||||||
Description = "Teljes csomag: Word, Excel, PowerPoint, Outlook, Access, Publisher, OneNote, Skype for Business",
|
Description = "Teljes csomag: Word, Excel, PowerPoint, Outlook, Access, Publisher, OneNote, Skype for Business",
|
||||||
ProductId = "ProPlus2016Volume",
|
ProductId = "ProPlus2016Volume",
|
||||||
Channel = "PerpetualVL2019",
|
Channel = "PerpetualVL2019",
|
||||||
IsVolume = true
|
IsVolume = true,
|
||||||
},
|
IsoUrl64 = "https://soft.direct/Install/SW_DVD5_Office_Professional_Plus_2016_64Bit_Hungarian_MLF_X20-42439.ISO"
|
||||||
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
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,22 @@
|
|||||||
<TextBlock Text="Telepítési nyelv" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,8"/>
|
<TextBlock Text="Telepítési nyelv" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,8"/>
|
||||||
<ComboBox x:Name="CbLanguage" Style="{StaticResource FluentComboBox}"
|
<ComboBox x:Name="CbLanguage" Style="{StaticResource FluentComboBox}"
|
||||||
HorizontalAlignment="Stretch"/>
|
HorizontalAlignment="Stretch"/>
|
||||||
|
<TextBlock x:Name="LanguageNote" Visibility="Collapsed"
|
||||||
|
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"
|
||||||
|
Margin="0,4,0,0" TextWrapping="Wrap"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<TextBlock Text="Telepítendő alkalmazások" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,10"/>
|
<TextBlock x:Name="ArchNote" Visibility="Collapsed"
|
||||||
|
FontSize="12" Foreground="#E65100" Margin="0,-12,0,16" TextWrapping="Wrap"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="AppTitle" Text="Telepítendő alkalmazások" FontSize="15" FontWeight="SemiBold" Margin="0,0,0,10"/>
|
||||||
|
|
||||||
<WrapPanel x:Name="AppCheckBoxes" Orientation="Horizontal"/>
|
<WrapPanel x:Name="AppCheckBoxes" Orientation="Horizontal"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="AppNote" Visibility="Collapsed"
|
||||||
|
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"
|
||||||
|
Margin="0,8,0,0" TextWrapping="Wrap"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -17,12 +17,23 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
_main = main;
|
_main = main;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
|
bool isMsi = _config.IsMsiInstall;
|
||||||
|
|
||||||
// Restore arch
|
// Restore arch
|
||||||
if (_config.Architecture == "32")
|
if (_config.Architecture == "32")
|
||||||
{
|
{
|
||||||
Rb32.IsChecked = true;
|
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
|
// Populate language combo
|
||||||
foreach (var lang in LanguageList.Languages)
|
foreach (var lang in LanguageList.Languages)
|
||||||
{
|
{
|
||||||
@@ -45,10 +56,37 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
}
|
}
|
||||||
if (CbLanguage.SelectedIndex < 0) CbLanguage.SelectedIndex = 0;
|
if (CbLanguage.SelectedIndex < 0) CbLanguage.SelectedIndex = 0;
|
||||||
|
|
||||||
// Populate app checkboxes
|
// MSI: language is baked into the ISO
|
||||||
|
if (isMsi)
|
||||||
|
{
|
||||||
|
CbLanguage.IsEnabled = false;
|
||||||
|
// Force Hungarian selection
|
||||||
|
for (int i = 0; i < CbLanguage.Items.Count; i++)
|
||||||
|
{
|
||||||
|
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)
|
foreach (var app in ExcludableApps.Apps)
|
||||||
{
|
{
|
||||||
// Ha m\u00e1r van ment\u00e9s a configban, azt haszn\u00e1ljuk; k\u00fcl\u00f6nben a default\u00f6t
|
|
||||||
bool isChecked = _config.ExcludedApps.Count > 0
|
bool isChecked = _config.ExcludedApps.Count > 0
|
||||||
? !_config.ExcludedApps.Contains(app.Id)
|
? !_config.ExcludedApps.Contains(app.Id)
|
||||||
: app.DefaultChecked;
|
: app.DefaultChecked;
|
||||||
@@ -78,6 +116,7 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
AppCheckBoxes.Children.Add(cb);
|
AppCheckBoxes.Children.Add(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Validate()
|
public bool Validate()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<ProgressBar x:Name="MainProgress" Style="{StaticResource FluentProgressBar}"
|
<ProgressBar x:Name="MainProgress" Style="{StaticResource FluentProgressBar}"
|
||||||
IsIndeterminate="True" Margin="0,0,0,0"/>
|
IsIndeterminate="True" Margin="0,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="DownloadInfo" FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"
|
||||||
|
Margin="0,4,0,0" Visibility="Collapsed"/>
|
||||||
|
|
||||||
<Border Background="#F8F8F8" CornerRadius="6" Padding="12" Margin="0,12,0,0"
|
<Border Background="#F8F8F8" CornerRadius="6" Padding="12" Margin="0,12,0,0"
|
||||||
BorderBrush="{StaticResource BorderBrush}" BorderThickness="1">
|
BorderBrush="{StaticResource BorderBrush}" BorderThickness="1">
|
||||||
<TextBox x:Name="LogText" FontFamily="Consolas" FontSize="11"
|
<TextBox x:Name="LogText" FontFamily="Consolas" FontSize="11"
|
||||||
|
|||||||
@@ -25,10 +25,28 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
public async void StartInstallation()
|
public async void StartInstallation()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (_config.IsMsiInstall)
|
||||||
|
{
|
||||||
|
await StartMsiInstallation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await StartOdtInstallation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AppendLog("HIBA: " + ex.Message);
|
||||||
|
ShowDone(false, "Váratlan hiba történt.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task StartOdtInstallation()
|
||||||
{
|
{
|
||||||
// Step 1: Download ODT
|
// Step 1: Download ODT
|
||||||
SetStepActive(Step1Icon, Step1Text);
|
SetStepActive(Step1Icon, Step1Text);
|
||||||
AppendLog("ODT let\u00f6lt\u00e9se indul...");
|
AppendLog("ODT letöltése indul...");
|
||||||
|
|
||||||
var downloader = new OdtDownloader();
|
var downloader = new OdtDownloader();
|
||||||
downloader.StatusChanged += msg => Dispatcher.Invoke(() => AppendLog(msg));
|
downloader.StatusChanged += msg => Dispatcher.Invoke(() => AppendLog(msg));
|
||||||
@@ -37,14 +55,14 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
if (!downloaded)
|
if (!downloaded)
|
||||||
{
|
{
|
||||||
SetStepError(Step1Icon, Step1Text);
|
SetStepError(Step1Icon, Step1Text);
|
||||||
ShowDone(false, "Az ODT let\u00f6lt\u00e9se sikertelen.");
|
ShowDone(false, "Az ODT letöltése sikertelen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetStepDone(Step1Icon, Step1Text);
|
SetStepDone(Step1Icon, Step1Text);
|
||||||
|
|
||||||
// Step 2: Generate config XML
|
// Step 2: Generate config XML
|
||||||
SetStepActive(Step2Icon, Step2Text);
|
SetStepActive(Step2Icon, Step2Text);
|
||||||
AppendLog("Konfigur\u00e1ci\u00f3s XML gener\u00e1l\u00e1sa...");
|
AppendLog("Konfigurációs XML generálása...");
|
||||||
|
|
||||||
string xml = OdtXmlGenerator.Generate(_config);
|
string xml = OdtXmlGenerator.Generate(_config);
|
||||||
string xmlPath = Path.Combine(downloader.OdtFolder, "configuration.xml");
|
string xmlPath = Path.Combine(downloader.OdtFolder, "configuration.xml");
|
||||||
@@ -55,7 +73,7 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
|
|
||||||
// Step 3: Run setup.exe /configure
|
// Step 3: Run setup.exe /configure
|
||||||
SetStepActive(Step3Icon, Step3Text);
|
SetStepActive(Step3Icon, Step3Text);
|
||||||
AppendLog("Office telep\u00edt\u00e9s ind\u00edt\u00e1sa...");
|
AppendLog("Office telepítés indítása...");
|
||||||
AppendLog("setup.exe /configure \"" + xmlPath + "\"");
|
AppendLog("setup.exe /configure \"" + xmlPath + "\"");
|
||||||
|
|
||||||
int exitCode = await downloader.RunSetupAsync(xmlPath, msg =>
|
int exitCode = await downloader.RunSetupAsync(xmlPath, msg =>
|
||||||
@@ -64,18 +82,123 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
if (exitCode == 0)
|
if (exitCode == 0)
|
||||||
{
|
{
|
||||||
SetStepDone(Step3Icon, Step3Text);
|
SetStepDone(Step3Icon, Step3Text);
|
||||||
ShowDone(true, "Az Office sikeresen telep\u00fclt!");
|
ShowDone(true, "Az Office sikeresen települt!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetStepError(Step3Icon, Step3Text);
|
SetStepError(Step3Icon, Step3Text);
|
||||||
ShowDone(false, "A telep\u00edt\u00e9s hibak\u00f3ddal fejez\u0151d\u00f6tt be: " + exitCode);
|
ShowDone(false, "A telepítés hibakóddal fejeződött be: " + exitCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
|
private async Task StartMsiInstallation()
|
||||||
{
|
{
|
||||||
AppendLog("HIBA: " + ex.Message);
|
string isoUrl = _config.GetIsoUrl();
|
||||||
ShowDone(false, "V\u00e1ratlan hiba t\u00f6rt\u00e9nt.");
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,30 @@ namespace InstaSoftOfficeTool.Pages
|
|||||||
SumLanguage.Text = _config.GetLanguageDisplayName() + " (" + _config.Language + ")";
|
SumLanguage.Text = _config.GetLanguageDisplayName() + " (" + _config.Language + ")";
|
||||||
SumKey.Text = string.IsNullOrEmpty(_config.ProductKey) ? "Nincs megadva" : _config.ProductKey;
|
SumKey.Text = string.IsNullOrEmpty(_config.ProductKey) ? "Nincs megadva" : _config.ProductKey;
|
||||||
|
|
||||||
|
if (_config.IsMsiInstall)
|
||||||
|
{
|
||||||
|
// MSI mode: no app exclusion, show ISO info instead of XML
|
||||||
|
SumExcluded.Text = "(a Microsoft telepítőben választható)";
|
||||||
|
|
||||||
|
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)
|
if (_config.ExcludedApps.Count > 0)
|
||||||
SumExcluded.Text = string.Join(", ", _config.ExcludedApps);
|
SumExcluded.Text = string.Join(", ", _config.ExcludedApps);
|
||||||
else
|
else
|
||||||
SumExcluded.Text = "Nincs (minden alkalmaz\u00e1s telep\u00fcl)";
|
SumExcluded.Text = "Nincs (minden alkalmazás települ)";
|
||||||
|
|
||||||
_generatedXml = OdtXmlGenerator.Generate(_config);
|
_generatedXml = OdtXmlGenerator.Generate(_config);
|
||||||
XmlPreview.Text = _generatedXml;
|
XmlPreview.Text = _generatedXml;
|
||||||
|
BtnSaveXml.Visibility = System.Windows.Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnSaveXml_Click(object sender, RoutedEventArgs e)
|
private void BtnSaveXml_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0"/>
|
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="0,0,4,0">
|
||||||
<StackPanel VerticalAlignment="Top">
|
<StackPanel VerticalAlignment="Top">
|
||||||
<RadioButton x:Name="Rb2024" Style="{StaticResource CardRadioButton}"
|
<RadioButton x:Name="Rb2024" Style="{StaticResource CardRadioButton}"
|
||||||
GroupName="Version" IsChecked="True" Margin="0,0,0,10">
|
GroupName="Version" IsChecked="True" Margin="0,0,0,10">
|
||||||
|
|||||||
192
Services/MsiInstaller.cs
Normal file
192
Services/MsiInstaller.cs
Normal file
@@ -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<string> StatusChanged;
|
||||||
|
public event Action<long, long> 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<bool> 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<bool> 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<int> RunSetupAsync(Action<string> 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 { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user