mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-26 23:24:00 +08:00
(GUI): added troubleshooting dialog.
This commit is contained in:
parent
1ec6e38e71
commit
5e0240e176
@ -6,6 +6,7 @@
|
|||||||
ShutdownMode="OnMainWindowClose" Exit="ApplicationExit">
|
ShutdownMode="OnMainWindowClose" Exit="ApplicationExit">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<sys:Uri x:Key="DevLink">https://github.com/morkt/GARbro#readme</sys:Uri>
|
<sys:Uri x:Key="DevLink">https://github.com/morkt/GARbro#readme</sys:Uri>
|
||||||
|
<sys:Uri x:Key="DevIssuesLink">https://github.com/morkt/GARbro/issues</sys:Uri>
|
||||||
<sys:Uri x:Key="UpdateUrl">https://morkt.github.io/GARbro/version.xml</sys:Uri>
|
<sys:Uri x:Key="UpdateUrl">https://morkt.github.io/GARbro/version.xml</sys:Uri>
|
||||||
<BitmapImage x:Key="IconSearch" UriSource="pack://application:,,,/Images/search4files.ico" />
|
<BitmapImage x:Key="IconSearch" UriSource="pack://application:,,,/Images/search4files.ico" />
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
@ -188,6 +188,9 @@
|
|||||||
<Compile Include="TextViewer.xaml.cs">
|
<Compile Include="TextViewer.xaml.cs">
|
||||||
<DependentUpon>TextViewer.xaml</DependentUpon>
|
<DependentUpon>TextViewer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="TroubleShootingDialog.xaml.cs">
|
||||||
|
<DependentUpon>TroubleShootingDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UpdateDialog.xaml.cs">
|
<Compile Include="UpdateDialog.xaml.cs">
|
||||||
<DependentUpon>UpdateDialog.xaml</DependentUpon>
|
<DependentUpon>UpdateDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -249,6 +252,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="TroubleShootingDialog.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="UpdateDialog.xaml">
|
<Page Include="UpdateDialog.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -154,6 +154,7 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{x:Static s:guiStrings.MenuHelp}">
|
<MenuItem Header="{x:Static s:guiStrings.MenuHelp}">
|
||||||
<MenuItem Header="{x:Static s:guiStrings.MenuAbout}" Command="{x:Static local:Commands.About}"/>
|
<MenuItem Header="{x:Static s:guiStrings.MenuAbout}" Command="{x:Static local:Commands.About}"/>
|
||||||
|
<MenuItem Header="Troubleshooting..." Command="{x:Static local:Commands.TroubleShooting}"/>
|
||||||
<MenuItem Header="{x:Static s:guiStrings.MenuCheckUpdates}" Command="{x:Static local:Commands.CheckUpdates}"/>
|
<MenuItem Header="{x:Static s:guiStrings.MenuCheckUpdates}" Command="{x:Static local:Commands.CheckUpdates}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
@ -292,6 +293,8 @@
|
|||||||
<KeyBinding Gesture="F2" Command="{x:Static local:Commands.RenameItem}"/>
|
<KeyBinding Gesture="F2" Command="{x:Static local:Commands.RenameItem}"/>
|
||||||
<KeyBinding Gesture="Space" Command="{x:Static local:Commands.NextItem}"/>
|
<KeyBinding Gesture="Space" Command="{x:Static local:Commands.NextItem}"/>
|
||||||
<KeyBinding Gesture="Ctrl+Insert" Command="{x:Static local:Commands.CopyNames}"/>
|
<KeyBinding Gesture="Ctrl+Insert" Command="{x:Static local:Commands.CopyNames}"/>
|
||||||
|
<KeyBinding Gesture="Ctrl+PageDown" Command="{x:Static local:Commands.Descend}"/>
|
||||||
|
<KeyBinding Gesture="Ctrl+PageUp" Command="{x:Static local:Commands.Ascend}"/>
|
||||||
<MouseBinding Gesture="LeftDoubleClick" Command="{x:Static local:Commands.OpenItem}" />
|
<MouseBinding Gesture="LeftDoubleClick" Command="{x:Static local:Commands.OpenItem}" />
|
||||||
</ListView.InputBindings>
|
</ListView.InputBindings>
|
||||||
<ListView.ItemContainerStyle>
|
<ListView.ItemContainerStyle>
|
||||||
@ -417,6 +420,9 @@
|
|||||||
<CommandBinding Command="{x:Static local:Commands.CheckUpdates}" Executed="CheckUpdatesExec" CanExecute="CanExecuteUpdate"/>
|
<CommandBinding Command="{x:Static local:Commands.CheckUpdates}" Executed="CheckUpdatesExec" CanExecute="CanExecuteUpdate"/>
|
||||||
<CommandBinding Command="{x:Static local:Commands.StopPlayback}" Executed="StopPlaybackExec" CanExecute="CanExecutePlaybackControl"/>
|
<CommandBinding Command="{x:Static local:Commands.StopPlayback}" Executed="StopPlaybackExec" CanExecute="CanExecutePlaybackControl"/>
|
||||||
<CommandBinding Command="{x:Static local:Commands.Preferences}" Executed="PreferencesExec" CanExecute="CanExecuteAlways"/>
|
<CommandBinding Command="{x:Static local:Commands.Preferences}" Executed="PreferencesExec" CanExecute="CanExecuteAlways"/>
|
||||||
|
<CommandBinding Command="{x:Static local:Commands.TroubleShooting}" Executed="TroubleShootingExec" CanExecute="CanExecuteAlways"/>
|
||||||
|
<CommandBinding Command="{x:Static local:Commands.Descend}" Executed="DescendExec" CanExecute="CanExecuteAlways"/>
|
||||||
|
<CommandBinding Command="{x:Static local:Commands.Ascend}" Executed="AscendExec" CanExecute="CanExecuteAlways"/>
|
||||||
<CommandBinding Command="{x:Static local:Commands.Exit}" Executed="ExitExec" CanExecute="CanExecuteAlways"/>
|
<CommandBinding Command="{x:Static local:Commands.Exit}" Executed="ExitExec" CanExecute="CanExecuteAlways"/>
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -901,6 +901,21 @@ namespace GARbro.GUI
|
|||||||
OpenDirectoryEntry (ViewModel, entry);
|
OpenDirectoryEntry (ViewModel, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DescendExec (object control, ExecutedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var entry = CurrentDirectory.SelectedItem as EntryViewModel;
|
||||||
|
if (entry != null)
|
||||||
|
OpenDirectoryEntry (ViewModel, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AscendExec (object control, ExecutedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var vm = ViewModel;
|
||||||
|
var parent_dir = vm.FirstOrDefault (entry => entry.Name == "..");
|
||||||
|
if (parent_dir != null)
|
||||||
|
OpenDirectoryEntry (vm, parent_dir);
|
||||||
|
}
|
||||||
|
|
||||||
private void OpenDirectoryEntry (DirectoryViewModel vm, EntryViewModel entry)
|
private void OpenDirectoryEntry (DirectoryViewModel vm, EntryViewModel entry)
|
||||||
{
|
{
|
||||||
string old_dir = null == vm ? "" : vm.Path.Last();
|
string old_dir = null == vm ? "" : vm.Path.Last();
|
||||||
@ -1296,6 +1311,13 @@ namespace GARbro.GUI
|
|||||||
settings.ShowDialog();
|
settings.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TroubleShootingExec (object sender, ExecutedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var dialog = new TroubleShootingDialog();
|
||||||
|
dialog.Owner = this;
|
||||||
|
dialog.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e)
|
private void CanExecuteAlways (object sender, CanExecuteRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
e.CanExecute = true;
|
e.CanExecute = true;
|
||||||
@ -1525,5 +1547,8 @@ namespace GARbro.GUI
|
|||||||
public static readonly RoutedCommand CopyNames = new RoutedCommand();
|
public static readonly RoutedCommand CopyNames = new RoutedCommand();
|
||||||
public static readonly RoutedCommand StopPlayback = new RoutedCommand();
|
public static readonly RoutedCommand StopPlayback = new RoutedCommand();
|
||||||
public static readonly RoutedCommand Preferences = new RoutedCommand();
|
public static readonly RoutedCommand Preferences = new RoutedCommand();
|
||||||
|
public static readonly RoutedCommand TroubleShooting = new RoutedCommand();
|
||||||
|
public static readonly RoutedCommand Descend = new RoutedCommand();
|
||||||
|
public static readonly RoutedCommand Ascend = new RoutedCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +511,7 @@
|
|||||||
<value>Что делать?</value>
|
<value>Что делать?</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TextErrorConverting" xml:space="preserve">
|
<data name="TextErrorConverting" xml:space="preserve">
|
||||||
<value>Не удадось конвертировать файл
|
<value>Не удалось конвертировать файл
|
||||||
{0}
|
{0}
|
||||||
{1}</value>
|
{1}</value>
|
||||||
</data>
|
</data>
|
||||||
|
21
GUI/TroubleShootingDialog.xaml
Normal file
21
GUI/TroubleShootingDialog.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Window x:Class="GARbro.GUI.TroubleShootingDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:s="clr-namespace:GARbro.GUI.Strings"
|
||||||
|
Title="Troubleshooting" Height="400" Width="340" ResizeMode="NoResize"
|
||||||
|
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
|
||||||
|
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
|
||||||
|
<DockPanel>
|
||||||
|
<DockPanel DockPanel.Dock="Bottom" Margin="10">
|
||||||
|
<Button DockPanel.Dock="Left" HorizontalAlignment="Left" Content="Copy"
|
||||||
|
Width="75" Height="25" Click="Button_Copy"/>
|
||||||
|
<Button DockPanel.Dock="Right" HorizontalAlignment="Right" Content="{x:Static s:guiStrings.ButtonOK}"
|
||||||
|
Width="75" Height="25" IsCancel="True"/>
|
||||||
|
</DockPanel>
|
||||||
|
<StackPanel Orientation="Vertical" DockPanel.Dock="Top">
|
||||||
|
<TextBlock Margin="10" TextWrapping="Wrap">If you experience troubles you may open an issue at <Hyperlink NavigateUri="{StaticResource DevIssuesLink}" RequestNavigate="Hyperlink_RequestNavigate">the developer's site</Hyperlink> (use English please).</TextBlock>
|
||||||
|
<TextBlock Margin="10,0,10,10">Following information might be useful in your report:</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBox x:Name="EnvironmentInfo" DockPanel.Dock="Top" Margin="10,0,10,0" IsReadOnly="True" VerticalScrollBarVisibility="Auto"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
118
GUI/TroubleShootingDialog.xaml.cs
Normal file
118
GUI/TroubleShootingDialog.xaml.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using GameRes;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace GARbro.GUI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for TroubleShooting.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class TroubleShootingDialog : Window
|
||||||
|
{
|
||||||
|
public TroubleShootingDialog ()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.EnvironmentInfo.Text = GetEnvironmentReportText();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hyperlink_RequestNavigate (object sender, RequestNavigateEventArgs e)
|
||||||
|
{
|
||||||
|
if (App.NavigateUri (e.Uri))
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Copy (object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Clipboard.SetText (this.EnvironmentInfo.Text);
|
||||||
|
}
|
||||||
|
catch (Exception X)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Trace.WriteLine (X.Message, "Clipboard error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string GetEnvironmentReportText ()
|
||||||
|
{
|
||||||
|
var gui = Assembly.GetExecutingAssembly();
|
||||||
|
var gui_path = Path.GetDirectoryName (gui.Location);
|
||||||
|
var report = new StringBuilder();
|
||||||
|
report.AppendFormat ("OS: {0}\n", GetOSVersion());
|
||||||
|
report.AppendFormat ("Framework version: {0}\n", Environment.Version);
|
||||||
|
report.AppendFormat ("Framework release: {0}\n", GetFrameWorkReleaseInfo());
|
||||||
|
report.AppendFormat ("{0}: {1}\n", App.Name, gui.GetName().Version);
|
||||||
|
report.AppendFormat ("Formats database version: {0}\n", FormatCatalog.Instance.CurrentSchemeVersion);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
report.Append ("\nLoaded assemblies:\n");
|
||||||
|
var local_assemblies = AppDomain.CurrentDomain.GetAssemblies().Where (a => !a.IsDynamic && a.Location.StartsWith (gui_path));
|
||||||
|
foreach (var assembly in local_assemblies.Select (a => a.GetName()))
|
||||||
|
{
|
||||||
|
report.AppendFormat ("{0} {1}\n", assembly.Name, assembly.Version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception X)
|
||||||
|
{
|
||||||
|
report.AppendFormat ("Assemblies enumeration failed:\n{0}", X.Message);
|
||||||
|
}
|
||||||
|
return report.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string GetOSVersion ()
|
||||||
|
{
|
||||||
|
string id = Registry.GetValue (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString();
|
||||||
|
if (string.IsNullOrEmpty (id))
|
||||||
|
{
|
||||||
|
id = Registry.GetValue (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "").ToString();
|
||||||
|
if (string.IsNullOrEmpty (id))
|
||||||
|
id = Environment.OSVersion.VersionString;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string sp = Environment.OSVersion.ServicePack;
|
||||||
|
if (!string.IsNullOrEmpty (sp))
|
||||||
|
id += ' '+sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static readonly SortedDictionary<int, string> FrameworkReleases = new SortedDictionary<int, string> {
|
||||||
|
{ 378389, "4.5" },
|
||||||
|
{ 378675, "4.5.1 from Windows 8.1" },
|
||||||
|
{ 378758, "4.5.1" },
|
||||||
|
{ 379893, "4.5.2" },
|
||||||
|
{ 393295, "4.6 from Windows 10" },
|
||||||
|
{ 393297, "4.6" },
|
||||||
|
{ 394254, "4.6.1 from Windows 10" },
|
||||||
|
{ 394271, "4.6.1" },
|
||||||
|
{ 394802, "4.6.2 from Windows 10 Anniversary Update" },
|
||||||
|
{ 394806, "4.6.2" },
|
||||||
|
{ 460798, "4.7 from Windows 10 Creators Update" },
|
||||||
|
{ 460805, "4.7" },
|
||||||
|
{ 461308, "4.7.1 from Windows 10 Fall Creators Update" },
|
||||||
|
{ 461310, "4.7.1+" },
|
||||||
|
};
|
||||||
|
|
||||||
|
internal static string GetFrameWorkReleaseInfo ()
|
||||||
|
{
|
||||||
|
int release = Convert.ToInt32 (Registry.GetValue (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", 0));
|
||||||
|
if (0 == release)
|
||||||
|
return "Unknown";
|
||||||
|
var version = FrameworkReleases.Reverse().Where (r => release >= r.Key).Select (r => r.Value).FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty (version))
|
||||||
|
version = release.ToString();
|
||||||
|
else
|
||||||
|
version = string.Format ("{0} ({1})", release, version);
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user