Skip to content

Commit

Permalink
Add troubleshooting info tab to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Nov 30, 2023
1 parent 78a3e1a commit 16d5889
Show file tree
Hide file tree
Showing 45 changed files with 244 additions and 13 deletions.
2 changes: 1 addition & 1 deletion make_scripts/update_3p_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"LOCSettingsGeneralLabel", "LOCSelectDirectoryTooltip", "LOCSelectFileTooltip", "LOCCancelLabel",
"LOCSettingsAdvancedLabel", "LOCGameInstallDirTitle", "LOCLoadingLabel",
"LOCSaveLabel", "LOCFilters", "LOCGameNameTitle", "LOCInstallSizeLabel",
"LOCAddedLabel"]
"LOCAddedLabel", "LOCOpen"]

if os.path.exists(localization_path):
shutil.rmtree(localization_path)
Expand Down
1 change: 1 addition & 0 deletions src/LegendaryLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
<Compile Include="Models\OauthResponse.cs" />
<Compile Include="EpicMetadataProvider.cs" />
<Compile Include="Models\PlaytimesResponse.cs" />
<Compile Include="LegendaryTroubleshootingInformation.cs" />
<Compile Include="Models\WebStoreModels.cs" />
<Compile Include="NumericInput.xaml.cs">
<DependentUpon>NumericInput.xaml</DependentUpon>
Expand Down
82 changes: 72 additions & 10 deletions src/LegendaryLibrarySettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@
Margin="0,10,0,0"
IsChecked="{Binding Settings.SyncGameSaves}"
Content="{DynamicResource LOCLegendarySyncGameSaves}" Name="SyncGameSavesChk" Click="SyncGameSavesChk_Click" />

<TextBlock VerticalAlignment="Center" Margin="0,20,0,0" Height="24"
RenderTransformOrigin="0.5,0.5">
<Hyperlink
NavigateUri="https://github.com/hawkeye116477/playnite-legendary-plugin/wiki/troubleshooting"
Command="{x:Static pcmd:GlobalCommands.NavigateUrlCommand}"
CommandParameter="{Binding NavigateUri, RelativeSource={RelativeSource Self}}">
<Run Text="{DynamicResource LOCLegendary3P_EpicTroubleShootingIssues}" />
</Hyperlink>
</TextBlock>
</StackPanel>
</TabItem>
<TabItem Header="{DynamicResource LOCLegendary3P_PlayniteSettingsAdvancedLabel}">
Expand Down Expand Up @@ -236,5 +226,77 @@
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="{DynamicResource LOCLegendaryTroubleshootingInformation}">
<StackPanel Margin="20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource LOCLegendaryPlayniteVersion}" Grid.Column="0" Grid.Row="0"
Margin="0,0,10,5" VerticalAlignment="Center">
</TextBlock>
<TextBox x:Name="PlayniteVersionTxt" Grid.Column="1" Grid.Row="0" Margin="0,0,0,5"
VerticalAlignment="Center" IsReadOnly="True" HorizontalAlignment="Left"/>
<TextBlock Text="{DynamicResource LOCLegendaryPluginVersion}" Grid.Column="0" Grid.Row="1"
Margin="0,0,10,5" VerticalAlignment="Center" />
<TextBox x:Name="PluginVersionTxt" Grid.Column="1" Grid.Row="1" Margin="0,0,0,5"
VerticalAlignment="Center" IsReadOnly="True" HorizontalAlignment="Left"/>
<TextBlock Text="{DynamicResource LOCLegendaryLauncherVersion}" Grid.Column="0" Grid.Row="2"
Margin="0,0,10,5" VerticalAlignment="Center" />
<TextBox x:Name="LauncherVersionTxt" Text="" Grid.Column="1" Grid.Row="2" Margin="0,0,0,5" VerticalAlignment="Center"
IsReadOnly="True" HorizontalAlignment="Left"/>
<TextBlock Text="{DynamicResource LOCLegendaryLauncherBinary}" Grid.Column="0" Grid.Row="3"
Margin="0,0,10,5" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Grid.Row="3" Margin="0,0,0,5" Orientation="Horizontal" VerticalAlignment="Center">
<TextBox x:Name="LauncherBinaryTxt" VerticalAlignment="Center" IsReadOnly="True"/>
<Button x:Name="OpenLauncherBinaryBtn" Margin="10,0,0,0" Content="{DynamicResource LOCLegendary3P_PlayniteOpen}"
VerticalAlignment="Center" Click="OpenLauncherBinaryBtn_Click"/>
</StackPanel>
<TextBlock Text="{DynamicResource LOCLegendaryGamesInstallationPath}" Grid.Row="4" Grid.Column="0"
Margin="0,0,10,5" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,5">
<TextBox x:Name="GamesInstallationPathTxt" Margin="0,0,0,0" VerticalAlignment="Center" IsReadOnly="True" Grid.Column="0"/>
<Button x:Name="OpenGamesInstallationPathBtn" Margin="10,0,0,0" Content="{DynamicResource LOCLegendary3P_PlayniteOpen}"
VerticalAlignment="Center" Click="OpenGamesInstallationPathBtn_Click" Grid.Column="1"/>
</StackPanel>
<Button Margin="0,10,5,5" Grid.Column="0" Grid.Row="5" Name="CopyRawDataBtn" Click="CopyRawDataBtn_Click"
Grid.ColumnSpan="2" HorizontalAlignment="Left" Content="{DynamicResource LOCLegendaryCopyRawDataToClipboard}">
</Button>
<TextBlock VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="6" Margin="0,5,0,0">
<Hyperlink Name="LogFilesFolderHyp" Click="LogFilesFolderHyp_Click">
<Run Text="{DynamicResource LOCLegendaryLogFilesFolder}" />
</Hyperlink>
</TextBlock>
<TextBlock VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="7" Margin="0,10,0,0">
<Hyperlink
NavigateUri="https://github.com/hawkeye116477/playnite-legendary-plugin/wiki/troubleshooting"
Command="{x:Static pcmd:GlobalCommands.NavigateUrlCommand}"
CommandParameter="{Binding NavigateUri, RelativeSource={RelativeSource Self}}">
<Run Text="{DynamicResource LOCLegendary3P_EpicTroubleShootingIssues}" />
</Hyperlink>
</TextBlock>
<TextBlock VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="8" Margin="0,10,0,0">
<Hyperlink
Name="ReportBugHyp"
Command="{x:Static pcmd:GlobalCommands.NavigateUrlCommand}"
CommandParameter="{Binding NavigateUri, RelativeSource={RelativeSource Self}}">
<Run Text="{DynamicResource LOCLegendaryReportBug}" />
</Hyperlink>
</TextBlock>
</Grid>
</StackPanel>
</TabItem>
</TabControl>
</UserControl>
50 changes: 49 additions & 1 deletion src/LegendaryLibrarySettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -30,6 +31,8 @@ public partial class LegendaryLibrarySettingsView : UserControl
{
private ILogger logger = LogManager.GetLogger();
private IPlayniteAPI playniteAPI = API.Instance;
public LegendaryTroubleshootingInformation troubleshootingInformation;

public LegendaryLibrarySettingsView()
{
InitializeComponent();
Expand Down Expand Up @@ -135,7 +138,7 @@ await Cli.Wrap(LegendaryLauncher.ClientExecPath)
EOSOToggleBtn.Content = ResourceProvider.GetString(toggleTxt);
}

private void LegendarySettingsUC_Loaded(object sender, RoutedEventArgs e)
private async void LegendarySettingsUC_Loaded(object sender, RoutedEventArgs e)
{
var installedAddons = playniteAPI.Addons.Addons;
if (installedAddons.Contains("EpicGamesLibrary_Builtin"))
Expand Down Expand Up @@ -177,6 +180,23 @@ private void LegendarySettingsUC_Loaded(object sender, RoutedEventArgs e)
{ (int)ClearCacheTime.Never, ResourceProvider.GetString(LOC.Legendary3P_PlayniteSettingsPlaytimeImportModeNever) }
};
AutoClearCacheCBo.ItemsSource = autoClearOptions;

troubleshootingInformation = new LegendaryTroubleshootingInformation();
var verionCmd = await Cli.Wrap(LegendaryLauncher.ClientExecPath)
.WithArguments(new[] { "-V" })
.WithValidation(CommandResultValidation.None)
.ExecuteBufferedAsync();
if (verionCmd.StandardOutput.Contains("version"))
{
troubleshootingInformation.LauncherVersion = Regex.Match(verionCmd.StandardOutput, @"\d+(\.\d+)+").Value;
LauncherVersionTxt.Text = troubleshootingInformation.LauncherVersion;
}

PlayniteVersionTxt.Text = troubleshootingInformation.PlayniteVersion;
PluginVersionTxt.Text = troubleshootingInformation.PluginVersion;
LauncherBinaryTxt.Text = troubleshootingInformation.LauncherBinary;
GamesInstallationPathTxt.Text = troubleshootingInformation.GamesInstallationPath;
ReportBugHyp.NavigateUri = new Uri($"https://github.com/hawkeye116477/playnite-legendary-plugin/issues/new?assignees=&labels=bug&projects=&template=bugs.yml&legendaryV={troubleshootingInformation.PluginVersion}&playniteV={troubleshootingInformation.PlayniteVersion}&launcherV={troubleshootingInformation.LauncherVersion}");
}

private void ClearCacheBtn_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -274,5 +294,33 @@ private void MigrateEpicBtn_Click(object sender, RoutedEventArgs e)
}
}, globalProgressOptions);
}

private void CopyRawDataBtn_Click(object sender, RoutedEventArgs e)
{
var troubleshootingJSON = Playnite.SDK.Data.Serialization.ToJson(troubleshootingInformation, true);
Clipboard.SetText(troubleshootingJSON);
}

private void LogFilesFolderHyp_Click(object sender, RoutedEventArgs e)
{
ProcessStarter.StartProcess("explorer.exe", playniteAPI.Paths.ConfigurationPath);
}

private void OpenGamesInstallationPathBtn_Click(object sender, RoutedEventArgs e)
{
if (Directory.Exists(troubleshootingInformation.GamesInstallationPath))
{
ProcessStarter.StartProcess("explorer.exe", troubleshootingInformation.GamesInstallationPath);
}
else
{
playniteAPI.Dialogs.ShowErrorMessage(LOC.LegendaryPathNotExist);
}
}

private void OpenLauncherBinaryBtn_Click(object sender, RoutedEventArgs e)
{
LegendaryLauncher.StartClient();
}
}
}
33 changes: 33 additions & 0 deletions src/LegendaryTroubleshootingInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Playnite.SDK;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LegendaryLibraryNS
{
public class LegendaryTroubleshootingInformation
{
public string PlayniteVersion
{
get
{
var playniteAPI = API.Instance;
return playniteAPI.ApplicationInfo.ApplicationVersion.ToString();
}
}
public string PluginVersion
{
get
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
return fvi.FileVersion;
}
}
public string LauncherVersion { get; set; }
public string LauncherBinary => LegendaryLauncher.GetExecutablePath(LegendaryLauncher.LauncherPath);
public string GamesInstallationPath => LegendaryLauncher.GamesInstallationPath;
}
}
9 changes: 9 additions & 0 deletions src/Localization/en_US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,13 @@
<sys:String x:Key="LOCLegendaryMigrationNoGames">No games found for migration.</sys:String>
<sys:String x:Key="LOCLegendaryMigrationConfirm">All games will be removed from Epic plugin and moved to Legendary. Are you sure you want to do this?</sys:String>
<sys:String x:Key="LOCLegendarySignOut">Sign out</sys:String>
<sys:String x:Key="LOCLegendaryTroubleshootingInformation">Troubleshooting information</sys:String>
<sys:String x:Key="LOCLegendaryPlayniteVersion">Playnite version</sys:String>
<sys:String x:Key="LOCLegendaryPluginVersion">Plugin version</sys:String>
<sys:String x:Key="LOCLegendaryLauncherVersion">Launcher version</sys:String>
<sys:String x:Key="LOCLegendaryLauncherBinary">Launcher binary</sys:String>
<sys:String x:Key="LOCLegendaryCopyRawDataToClipboard">Copy raw data to clipboard</sys:String>
<sys:String x:Key="LOCLegendaryLogFilesFolder">Log files folder</sys:String>
<sys:String x:Key="LOCLegendaryPathNotExist">The specified path does not exist.</sys:String>
<sys:String x:Key="LOCLegendaryReportBug">Report a bug</sys:String>
</ResourceDictionary>
42 changes: 41 additions & 1 deletion src/LocalizationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public static class LOC
/// </summary>
public const string Legendary3P_PlayniteOptionOnceAWeek = "LOCLegendary3P_PlayniteOptionOnceAWeek";
/// <summary>
/// Open
/// </summary>
public const string Legendary3P_PlayniteOpen = "LOCLegendary3P_PlayniteOpen";
/// <summary>
/// Import installed games
/// </summary>
public const string Legendary3P_EpicSettingsImportInstalledLabel = "LOCLegendary3P_EpicSettingsImportInstalledLabel";
Expand Down Expand Up @@ -362,7 +366,7 @@ public static class LOC
/// </summary>
public const string LegendaryRemoveSelectedEntriesConfirm = "LOCLegendaryRemoveSelectedEntriesConfirm";
/// <summary>
/// Select all entires
/// Select all entries
/// </summary>
public const string LegendarySelectAllEntries = "LOCLegendarySelectAllEntries";
/// <summary>
Expand Down Expand Up @@ -477,5 +481,41 @@ public static class LOC
/// Sign out
/// </summary>
public const string LegendarySignOut = "LOCLegendarySignOut";
/// <summary>
/// Troubleshooting information
/// </summary>
public const string LegendaryTroubleshootingInformation = "LOCLegendaryTroubleshootingInformation";
/// <summary>
/// Playnite version
/// </summary>
public const string LegendaryPlayniteVersion = "LOCLegendaryPlayniteVersion";
/// <summary>
/// Plugin version
/// </summary>
public const string LegendaryPluginVersion = "LOCLegendaryPluginVersion";
/// <summary>
/// Launcher version
/// </summary>
public const string LegendaryLauncherVersion = "LOCLegendaryLauncherVersion";
/// <summary>
/// Launcher binary
/// </summary>
public const string LegendaryLauncherBinary = "LOCLegendaryLauncherBinary";
/// <summary>
/// Copy raw data to clipboard
/// </summary>
public const string LegendaryCopyRawDataToClipboard = "LOCLegendaryCopyRawDataToClipboard";
/// <summary>
/// Log files folder
/// </summary>
public const string LegendaryLogFilesFolder = "LOCLegendaryLogFilesFolder";
/// <summary>
/// The specified path does not exist.
/// </summary>
public const string LegendaryPathNotExist = "LOCLegendaryPathNotExist";
/// <summary>
/// Report a bug
/// </summary>
public const string LegendaryReportBug = "LOCLegendaryReportBug";
}
}
1 change: 1 addition & 0 deletions third_party/Localization/ar_SA.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:String x:Key="LOCLegendary3P_PlayniteSelectDirectoryTooltip">تحديد المجلد</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceADay">مرة في اليوم</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceAWeek">مرة في الأسبوع</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOpen">فتح</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportInstalledLabel">استيراد الألعاب المثبتة</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportUninstalledLabel">استيراد الألعاب الغير المثبتة</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsConnectAccount">ربط الحساب</sys:String>
Expand Down
1 change: 1 addition & 0 deletions third_party/Localization/bg_BG.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:String x:Key="LOCLegendary3P_PlayniteSelectDirectoryTooltip">Изберете папка...</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceADay">Веднъж на ден</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceAWeek">Веднъж седмично</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOpen">Отвори</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportInstalledLabel">Импортиране на инсталирани игри</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportUninstalledLabel">Импортиране на неинсталирани игри</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsConnectAccount">Свързване на акаун</sys:String>
Expand Down
1 change: 1 addition & 0 deletions third_party/Localization/ca_ES.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:String x:Key="LOCLegendary3P_PlayniteSelectDirectoryTooltip">Seleccionar carpeta...</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceADay">Un cop al dia</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceAWeek">Un cop per setmana</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOpen">Obrir</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportInstalledLabel">Importar jocs instal·lats</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportUninstalledLabel">Importar jocs no instal·lats</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsConnectAccount">Connectar compte</sys:String>
Expand Down
1 change: 1 addition & 0 deletions third_party/Localization/cs_CZ.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:String x:Key="LOCLegendary3P_PlayniteSelectDirectoryTooltip">Vybrat adresář...</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceADay">Jednou denně</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceAWeek">Jednou týdně</sys:String>
<sys:String x:Key="LOCLegendary3P_PlayniteOpen">Otevřít</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportInstalledLabel">Importovat nainstalované hry</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportUninstalledLabel">Importovat neinstalované hry</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsConnectAccount">Připojit účet</sys:String>
Expand Down
1 change: 1 addition & 0 deletions third_party/Localization/da_DK.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<sys:String x:Key="LOCLegendary3P_PlayniteSelectDirectoryTooltip" />
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceADay" />
<sys:String x:Key="LOCLegendary3P_PlayniteOptionOnceAWeek" />
<sys:String x:Key="LOCLegendary3P_PlayniteOpen" />
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportInstalledLabel">Importer installerede spil</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsImportUninstalledLabel">Importer ikke installerede spil</sys:String>
<sys:String x:Key="LOCLegendary3P_EpicSettingsConnectAccount">Forbind konto</sys:String>
Expand Down
Loading

0 comments on commit 16d5889

Please sign in to comment.