v1.02 — License troubleshoot UI improvements

- Fix ospp.vbs path: add root\Office16 for Click-to-Run installs
- Individual key cards with per-key remove buttons
- "Remove all" only shown when 2+ keys found
- Collapsible "Details" section (ospp.vbs path + raw output)
- All log/output fields now selectable and copyable (TextBox)
- Parse license entries (name, status, error, key) from dstatus output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hariel1985
2026-03-31 05:51:26 +02:00
szülő 4937ac4b1c
commit e8abb03eee
5 fájl változott, egészen pontosan 264 új sor hozzáadva és 54 régi sor törölve

Fájl megtekintése

@@ -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.0.0</Version> <Version>1.0.2</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion> <FileVersion>1.0.2.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>

Fájl megtekintése

@@ -41,7 +41,7 @@
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/> Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<TextBlock Text="v1.0" HorizontalAlignment="Right" VerticalAlignment="Center" <TextBlock Text="v1.02" HorizontalAlignment="Right" VerticalAlignment="Center"
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"/> FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"/>
</Grid> </Grid>
</Border> </Border>

Fájl megtekintése

@@ -5,41 +5,47 @@
<Grid Margin="40,30"> <Grid Margin="40,30">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Title -->
<StackPanel Grid.Row="0" Margin="0,0,0,16"> <StackPanel Grid.Row="0" Margin="0,0,0,16">
<TextBlock Text="Licenc-kezelés" FontSize="24" FontWeight="Light"/> <TextBlock Text="Licenc-kezelés" FontSize="24" FontWeight="Light"/>
<TextBlock Text="Office licenc állapot lekérdezése és termékkulcsok kezelése" <TextBlock Text="Office licenc állapot lekérdezése és termékkulcsok kezelése"
FontSize="14" Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0"/> FontSize="14" Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,0"/>
</StackPanel> </StackPanel>
<Border Grid.Row="1" Background="{StaticResource CardBrush}" CornerRadius="8" <!-- Key cards (scrollable) -->
BorderBrush="{StaticResource BorderBrush}" BorderThickness="1" <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Margin="0,0,0,8">
Padding="16,10" Margin="0,0,0,12"> <StackPanel x:Name="KeyCardsPanel"/>
<StackPanel Orientation="Horizontal"> </ScrollViewer>
<TextBlock x:Name="OsppStatusIcon" FontFamily="Segoe MDL2 Assets" FontSize="16"
VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock x:Name="OsppStatusText" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border Grid.Row="2" Background="#F8F8F8" CornerRadius="6" Padding="12" <!-- Details expander -->
<Expander x:Name="DetailsExpander" Grid.Row="2" Header="Részletek" FontSize="13"
Margin="0,0,0,8" Expanded="DetailsExpander_Expanded" Collapsed="DetailsExpander_Collapsed">
<StackPanel Margin="0,8,0,0">
<TextBlock x:Name="OsppPathText" FontSize="12"
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,6"/>
<Border Background="#F8F8F8" CornerRadius="4" Padding="10"
BorderBrush="{StaticResource BorderBrush}" BorderThickness="1"> BorderBrush="{StaticResource BorderBrush}" BorderThickness="1">
<TextBox x:Name="OutputText" FontFamily="Consolas" FontSize="12" <TextBox x:Name="OutputText" FontFamily="Consolas" FontSize="11"
TextWrapping="Wrap" Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap" Foreground="{StaticResource TextSecondaryBrush}"
IsReadOnly="True" Background="Transparent" BorderThickness="0" IsReadOnly="True" Background="Transparent" BorderThickness="0"
VerticalScrollBarVisibility="Auto" AcceptsReturn="True"/> VerticalScrollBarVisibility="Auto" AcceptsReturn="True"
Height="85"/>
</Border> </Border>
</StackPanel>
</Expander>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0"> <!-- Buttons -->
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,4,0,0">
<Button x:Name="BtnRefresh" Content="Állapot frissítése" Style="{StaticResource SecondaryButton}" <Button x:Name="BtnRefresh" Content="Állapot frissítése" Style="{StaticResource SecondaryButton}"
Click="BtnRefresh_Click" Margin="0,0,8,0"/> Click="BtnRefresh_Click" Margin="0,0,8,0"/>
<Button x:Name="BtnRemoveAll" Content="Összes kulcs eltávolítása" Style="{StaticResource PrimaryButton}" <Button x:Name="BtnRemoveAll" Content="Összes kulcs eltávolítása" Style="{StaticResource PrimaryButton}"
Click="BtnRemoveAll_Click" IsEnabled="False"/> Click="BtnRemoveAll_Click" IsEnabled="False" Visibility="Collapsed"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Page> </Page>

Fájl megtekintése

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
@@ -10,6 +11,7 @@ namespace InstaSoftOfficeTool.Pages
{ {
private readonly MainWindow _main; private readonly MainWindow _main;
private readonly LicenseManager _licenseManager = new LicenseManager(); private readonly LicenseManager _licenseManager = new LicenseManager();
private List<LicenseEntry> _entries = new List<LicenseEntry>();
public TroubleshootPage(MainWindow main) public TroubleshootPage(MainWindow main)
{ {
@@ -20,56 +22,200 @@ namespace InstaSoftOfficeTool.Pages
private async System.Threading.Tasks.Task RefreshStatus() private async System.Threading.Tasks.Task RefreshStatus()
{ {
OutputText.Text = "Keres\u00e9s folyamatban...\n"; OutputText.Text = "";
OsppPathText.Text = "";
KeyCardsPanel.Children.Clear();
BtnRemoveAll.IsEnabled = false; BtnRemoveAll.IsEnabled = false;
BtnRemoveAll.Visibility = Visibility.Collapsed;
BtnRefresh.IsEnabled = false; BtnRefresh.IsEnabled = false;
// Loading indicator
var loadingText = new TextBlock
{
Text = "Keres\u00e9s folyamatban...",
FontSize = 13,
Foreground = (Brush)FindResource("TextSecondaryBrush"),
Margin = new Thickness(0, 8, 0, 8)
};
KeyCardsPanel.Children.Add(loadingText);
bool found = _licenseManager.FindOspp(); bool found = _licenseManager.FindOspp();
if (!found) if (!found)
{ {
OsppStatusIcon.Text = "\uE711"; KeyCardsPanel.Children.Clear();
OsppStatusIcon.Foreground = (Brush)FindResource("ErrorBrush"); var errorCard = new Border
OsppStatusText.Text = "Az ospp.vbs nem tal\u00e1lhat\u00f3. Nincs telep\u00edtett Office?"; {
OutputText.Text = "Az ospp.vbs f\u00e1jl nem tal\u00e1lhat\u00f3 a sz\u00e1m\u00edt\u00f3g\u00e9pen.\n\n" + Background = (Brush)FindResource("CardBrush"),
"Lehets\u00e9ges okok:\n" + BorderBrush = (Brush)FindResource("BorderBrush"),
"- Nincs telep\u00edtett Microsoft Office\n" + BorderThickness = new Thickness(1),
"- Az Office nem a szok\u00e1sos helyre lett telep\u00edtve"; CornerRadius = new CornerRadius(8),
Padding = new Thickness(16, 14, 16, 14),
Margin = new Thickness(0, 0, 0, 6)
};
var errorPanel = new StackPanel();
errorPanel.Children.Add(new TextBlock
{
Text = "Az ospp.vbs nem tal\u00e1lhat\u00f3",
FontSize = 14, FontWeight = FontWeights.SemiBold,
Foreground = (Brush)FindResource("ErrorBrush")
});
errorPanel.Children.Add(new TextBlock
{
Text = "Nincs telep\u00edtett Microsoft Office, vagy nem a szok\u00e1sos helyre lett telep\u00edtve.",
FontSize = 12, Foreground = (Brush)FindResource("TextSecondaryBrush"),
TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 0)
});
errorCard.Child = errorPanel;
KeyCardsPanel.Children.Add(errorCard);
BtnRefresh.IsEnabled = true; BtnRefresh.IsEnabled = true;
return; return;
} }
OsppStatusIcon.Text = "\uE73E"; OsppPathText.Text = "ospp.vbs helye: " + _licenseManager.OsppPath;
OsppStatusIcon.Foreground = (Brush)FindResource("SuccessBrush");
OsppStatusText.Text = "ospp.vbs megtal\u00e1lva: " + _licenseManager.OsppPath;
OutputText.Text = "Licenc-\u00e1llapot lek\u00e9rdez\u00e9se...\n";
try try
{ {
string status = await _licenseManager.GetStatusAsync(); string status = await _licenseManager.GetStatusAsync();
OutputText.Text = status; OutputText.Text = status;
var keys = _licenseManager.ParseLicenseKeys(status); _entries = _licenseManager.ParseLicenseEntries(status);
BtnRemoveAll.IsEnabled = keys.Count > 0; BuildKeyCards();
if (keys.Count > 0)
{
OutputText.Text += "\n--- " + keys.Count + " term\u00e9kkulcs tal\u00e1lhat\u00f3 ---";
}
else
{
OutputText.Text += "\n--- Nincs telep\u00edtett term\u00e9kkulcs ---";
}
} }
catch (Exception ex) catch (Exception ex)
{ {
KeyCardsPanel.Children.Clear();
OutputText.Text = "Hiba a lek\u00e9rdez\u00e9s sor\u00e1n: " + ex.Message; OutputText.Text = "Hiba a lek\u00e9rdez\u00e9s sor\u00e1n: " + ex.Message;
} }
BtnRefresh.IsEnabled = true; BtnRefresh.IsEnabled = true;
} }
private void BuildKeyCards()
{
KeyCardsPanel.Children.Clear();
if (_entries.Count == 0)
{
var noKeyCard = new Border
{
Background = (Brush)FindResource("CardBrush"),
BorderBrush = (Brush)FindResource("BorderBrush"),
BorderThickness = new Thickness(1),
CornerRadius = new CornerRadius(8),
Padding = new Thickness(16, 14, 16, 14)
};
noKeyCard.Child = new TextBlock
{
Text = "Nincs telep\u00edtett term\u00e9kkulcs.",
FontSize = 13,
Foreground = (Brush)FindResource("TextSecondaryBrush")
};
KeyCardsPanel.Children.Add(noKeyCard);
return;
}
if (_entries.Count > 1)
{
BtnRemoveAll.Visibility = Visibility.Visible;
BtnRemoveAll.IsEnabled = true;
}
foreach (var entry in _entries)
{
KeyCardsPanel.Children.Add(CreateKeyCard(entry));
}
}
private Border CreateKeyCard(LicenseEntry entry)
{
var grid = new Grid();
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
var infoPanel = new StackPanel { VerticalAlignment = VerticalAlignment.Center };
infoPanel.Children.Add(new TextBlock
{
Text = string.IsNullOrEmpty(entry.LicenseName) ? "Ismeretlen licenc" : entry.LicenseName,
FontSize = 13, FontWeight = FontWeights.SemiBold,
TextTrimming = TextTrimming.CharacterEllipsis
});
var statusLine = !string.IsNullOrEmpty(entry.ErrorDescription)
? entry.ErrorDescription
: (!string.IsNullOrEmpty(entry.Status) ? entry.Status : entry.Description);
infoPanel.Children.Add(new TextBlock
{
Text = statusLine,
FontSize = 11, Foreground = (Brush)FindResource("TextSecondaryBrush"),
TextTrimming = TextTrimming.CharacterEllipsis
});
infoPanel.Children.Add(new TextBlock
{
Text = "Kulcs: *****-" + entry.Last5,
FontSize = 11, FontFamily = new FontFamily("Consolas"),
Foreground = (Brush)FindResource("TextSecondaryBrush"),
Margin = new Thickness(0, 2, 0, 0)
});
Grid.SetColumn(infoPanel, 0);
grid.Children.Add(infoPanel);
var removeBtn = new Button
{
Content = "Elt\u00e1vol\u00edt\u00e1s",
Style = (Style)FindResource("SecondaryButton"),
Padding = new Thickness(14, 6, 14, 6),
FontSize = 12,
VerticalAlignment = VerticalAlignment.Center,
Tag = entry.Last5
};
removeBtn.Click += BtnRemoveSingle_Click;
Grid.SetColumn(removeBtn, 1);
grid.Children.Add(removeBtn);
return new Border
{
Background = (Brush)FindResource("CardBrush"),
BorderBrush = (Brush)FindResource("BorderBrush"),
BorderThickness = new Thickness(1),
CornerRadius = new CornerRadius(8),
Padding = new Thickness(16, 10, 16, 10),
Margin = new Thickness(0, 0, 0, 6),
Child = grid
};
}
private async void BtnRemoveSingle_Click(object sender, RoutedEventArgs e)
{
var btn = (Button)sender;
var last5 = (string)btn.Tag;
var result = MessageBox.Show(
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani a *****-" + last5 + " kulcsot?",
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result != MessageBoxResult.Yes) return;
btn.IsEnabled = false;
btn.Content = "...";
try
{
await _licenseManager.RemoveKeyAsync(last5);
await RefreshStatus();
}
catch (Exception ex)
{
OutputText.Text += "\nHiba: " + ex.Message;
btn.IsEnabled = true;
btn.Content = "Elt\u00e1vol\u00edt\u00e1s";
}
}
private async void BtnRefresh_Click(object sender, RoutedEventArgs e) private async void BtnRefresh_Click(object sender, RoutedEventArgs e)
{ {
await RefreshStatus(); await RefreshStatus();
@@ -78,7 +224,7 @@ namespace InstaSoftOfficeTool.Pages
private async void BtnRemoveAll_Click(object sender, RoutedEventArgs e) private async void BtnRemoveAll_Click(object sender, RoutedEventArgs e)
{ {
var result = MessageBox.Show( var result = MessageBox.Show(
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani az \u00f6sszes telep\u00edtett term\u00e9kkulcsot?\n\n" + "Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani az \u00f6sszes telep\u00edtett term\u00e9kkulcsot (" + _entries.Count + " db)?\n\n" +
"Ez nem t\u00f6r\u00f6l adatot, csak az aktiv\u00e1ci\u00f3s \u00e1llapotot \u00e1ll\u00edtja vissza.", "Ez nem t\u00f6r\u00f6l adatot, csak az aktiv\u00e1ci\u00f3s \u00e1llapotot \u00e1ll\u00edtja vissza.",
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Warning); "Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Warning);
@@ -87,20 +233,32 @@ namespace InstaSoftOfficeTool.Pages
BtnRemoveAll.IsEnabled = false; BtnRemoveAll.IsEnabled = false;
BtnRefresh.IsEnabled = false; BtnRefresh.IsEnabled = false;
OutputText.Text += "\n\nTerm\u00e9kkulcsok elt\u00e1vol\u00edt\u00e1sa...\n";
try try
{ {
string cleanResult = await _licenseManager.RemoveAllKeysAsync(); await _licenseManager.RemoveAllKeysAsync();
OutputText.Text += cleanResult + "\n"; await RefreshStatus();
OutputText.Text += "\nK\u00e9sz. Kattintson az '\u00c1llapot friss\u00edt\u00e9se' gombra az eredm\u00e9ny ellen\u0151rz\u00e9s\u00e9hez.";
} }
catch (Exception ex) catch (Exception ex)
{ {
OutputText.Text += "Hiba: " + ex.Message; OutputText.Text += "\nHiba: " + ex.Message;
} }
BtnRefresh.IsEnabled = true; BtnRefresh.IsEnabled = true;
} }
private void DetailsExpander_Expanded(object sender, RoutedEventArgs e)
{
// Grow window to fit details
var window = Window.GetWindow(this);
if (window != null && window.Height < 680)
window.Height = 680;
}
private void DetailsExpander_Collapsed(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow(this);
if (window != null)
window.Height = 550;
}
} }
} }

Fájl megtekintése

@@ -6,6 +6,15 @@ using System.Threading.Tasks;
namespace InstaSoftOfficeTool.Services namespace InstaSoftOfficeTool.Services
{ {
public class LicenseEntry
{
public string LicenseName { get; set; } = "";
public string Description { get; set; } = "";
public string Status { get; set; } = "";
public string ErrorDescription { get; set; } = "";
public string Last5 { get; set; } = "";
}
public class LicenseManager public class LicenseManager
{ {
public string OsppPath { get; private set; } public string OsppPath { get; private set; }
@@ -88,6 +97,43 @@ namespace InstaSoftOfficeTool.Services
return keys; return keys;
} }
public List<LicenseEntry> ParseLicenseEntries(string dstatusOutput)
{
var entries = new List<LicenseEntry>();
// Split by "-------" separator blocks
var blocks = Regex.Split(dstatusOutput, @"-{10,}");
foreach (var block in blocks)
{
var trimmed = block.Trim();
if (string.IsNullOrEmpty(trimmed)) continue;
if (trimmed.StartsWith("---Processing") || trimmed.StartsWith("---Exiting")) continue;
var entry = new LicenseEntry();
var nameMatch = Regex.Match(trimmed, @"LICENSE NAME:\s*(.+)", RegexOptions.IgnoreCase);
if (nameMatch.Success) entry.LicenseName = nameMatch.Groups[1].Value.Trim();
var descMatch = Regex.Match(trimmed, @"LICENSE DESCRIPTION:\s*(.+)", RegexOptions.IgnoreCase);
if (descMatch.Success) entry.Description = descMatch.Groups[1].Value.Trim();
var statusMatch = Regex.Match(trimmed, @"LICENSE STATUS:\s*(.+)", RegexOptions.IgnoreCase);
if (statusMatch.Success) entry.Status = statusMatch.Groups[1].Value.Trim();
var errorMatch = Regex.Match(trimmed, @"ERROR DESCRIPTION:\s*(.+)", RegexOptions.IgnoreCase);
if (errorMatch.Success) entry.ErrorDescription = errorMatch.Groups[1].Value.Trim();
var keyMatch = Regex.Match(trimmed, @"Last 5 characters of installed product key:\s*(\S+)", RegexOptions.IgnoreCase);
if (keyMatch.Success) entry.Last5 = keyMatch.Groups[1].Value.Trim();
if (!string.IsNullOrEmpty(entry.Last5))
entries.Add(entry);
}
return entries;
}
public async Task<string> RemoveKeyAsync(string last5Chars) public async Task<string> RemoveKeyAsync(string last5Chars)
{ {
if (string.IsNullOrEmpty(OsppPath)) if (string.IsNullOrEmpty(OsppPath))