Skip to content

Commit 663238d

Browse files
committed
- added error/suggestion reporting function, accessible from the bottom left corner of the main window
- improved exception handling
1 parent 4cdef8d commit 663238d

17 files changed

+241
-82
lines changed

D-OS Save Editor/D-OS Save Editor.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@
242242
<Content Include="lslib\zlib.net.dll">
243243
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
244244
</Content>
245+
<Resource Include="Resources\ic_bug_black.png" />
246+
<Resource Include="Resources\ic_bug_red.png" />
245247
<Resource Include="Resources\ic_refresh3_blue.png" />
246248
<Resource Include="Resources\ic_refresh2_blue.png" />
247249
<Resource Include="Resources\ic_refresh2_black.png" />

D-OS Save Editor/ErrorReporting.xaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:D_OS_Save_Editor"
77
mc:Ignorable="d"
8-
Title="Error" SizeToContent="WidthAndHeight" UseLayoutRounding="True">
8+
WindowStyle="ToolWindow" UseLayoutRounding="True"
9+
Title="Error" SizeToContent="WidthAndHeight" Height="367.639" Width="514.335" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
910
<Window.Resources>
1011
<local:SystemIconConverter x:Key="iconConverter"/>
1112
<Style TargetType="Button">
@@ -14,12 +15,25 @@
1415
</Style>
1516
</Window.Resources>
1617
<Grid>
17-
<Grid.RowDefinitions><RowDefinition/><RowDefinition Height="Auto"/></Grid.RowDefinitions>
18-
<Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition/></Grid.ColumnDefinitions>
19-
<Image Margin="20" Stretch="Uniform" Height="25" VerticalAlignment="Top" HorizontalAlignment="Left" Source="{Binding Converter={StaticResource iconConverter}, ConverterParameter=Error}"/>
20-
<TextBox Grid.Column="1" Focusable="False" Margin="0,20,20,0" MaxWidth="300" MaxHeight="500" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Text="{Binding ErrorMessage}" Background="#FFE2E2E2"/>
21-
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
22-
<Button Content="Report"/>
18+
<Grid.RowDefinitions>
19+
<RowDefinition Height="Auto"/>
20+
<RowDefinition/>
21+
<RowDefinition Height="Auto"/>
22+
<RowDefinition Height="Auto"/>
23+
</Grid.RowDefinitions>
24+
<Grid.ColumnDefinitions>
25+
<ColumnDefinition Width="Auto"/>
26+
<ColumnDefinition/>
27+
</Grid.ColumnDefinitions>
28+
<Image Margin="20,20,20,0" Stretch="Uniform" Height="25" VerticalAlignment="Top" HorizontalAlignment="Left" Source="{Binding Converter={StaticResource iconConverter}, ConverterParameter=Error}" RenderTransformOrigin="0.549,4.213"/>
29+
<StackPanel Grid.Column="1">
30+
<TextBlock Text="An error has occurred. If you would like to help, please click the &quot;Report&quot; button." Margin="20,20,20,0" TextWrapping="Wrap" MaxWidth="401"></TextBlock>
31+
<TextBlock Text="By clicking the &quot;Report&quot; button, a website will be open. The texts you will need to submit will be copied automatically. You only need to paste them in the Description box." Margin="20,5,20,10" TextWrapping="Wrap" MaxWidth="401" FontStyle="Italic"></TextBlock>
32+
</StackPanel>
33+
34+
<TextBox Grid.Column="1" Grid.Row="1" Focusable="False" Margin="20,0,20,0" MaxWidth="400" MaxHeight="156" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Text="{Binding ErrorMessage}" Background="#FFE2E2E2"/>
35+
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right">
36+
<Button Content="Report" Click="ReportButtonClicked"/>
2337
<Button Content="Close" IsCancel="True"/>
2438
</StackPanel>
2539
</Grid>

D-OS Save Editor/ErrorReporting.xaml.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Diagnostics;
23
using System.Drawing;
34
using System.Globalization;
45
using System.Reflection;
@@ -14,16 +15,27 @@ namespace D_OS_Save_Editor
1415
/// </summary>
1516
public partial class ErrorReporting
1617
{
18+
public ErrorModel ErrorModel;
1719
public ErrorReporting()
1820
{
1921
InitializeComponent();
20-
DataContext = new ErrorModel();
22+
ErrorModel = new ErrorModel();
23+
DataContext = ErrorModel;
2124
}
2225

2326
public ErrorReporting(string message, object data)
2427
{
2528
InitializeComponent();
26-
DataContext = new ErrorModel(message, data);
29+
ErrorModel = new ErrorModel(message, data);
30+
DataContext = ErrorModel;
31+
}
32+
33+
private void ReportButtonClicked(object sender, RoutedEventArgs e)
34+
{
35+
Clipboard.SetText(ErrorModel.ErrorMessage);
36+
Process.Start(
37+
@"https://docs.google.com/forms/d/e/1FAIpQLSeUeKYdV8InQslbvCvA1rmffJ5t1ieond4W6hpUHkHTH7I7dg/viewform?usp=pp_url&entry.1687355392=Error+report");
38+
this.Close();
2739
}
2840
}
2941

D-OS Save Editor/MainWindow.xaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,27 @@
1313
<Image x:Key="OpenBrowserImage" Source="Resources/ic_openbrowser_black.png"/>
1414
<Image x:Key="RefreshImageMO" Source="Resources/ic_refresh3_blue.png"/>
1515
<Image x:Key="OpenBrowserImageMO" Source="Resources/ic_openbrowser_blue.png"/>
16+
<Image x:Key="BugIconImage" Source="Resources/ic_bug_black.png"/>
17+
<Image x:Key="BugIconImageMO" Source="Resources/ic_bug_red.png"/>
18+
<Style x:Key="BugReportButtonStyle" TargetType="Button">
19+
<Setter Property="Background" Value="Transparent" />
20+
<Setter Property="BorderBrush" Value="Transparent"/>
21+
<Setter Property="Content" Value="{StaticResource BugIconImage}"></Setter>
22+
<Setter Property="Template">
23+
<Setter.Value>
24+
<ControlTemplate TargetType="Button">
25+
<Grid>
26+
<ContentPresenter/>
27+
</Grid>
28+
<ControlTemplate.Triggers>
29+
<Trigger Property="IsMouseOver" Value="True">
30+
<Setter Property="Content" Value="{StaticResource BugIconImageMO}"></Setter>
31+
</Trigger>
32+
</ControlTemplate.Triggers>
33+
</ControlTemplate>
34+
</Setter.Value>
35+
</Setter>
36+
</Style>
1637
<Style x:Key="DismissButtonStyle" TargetType="Button">
1738
<Setter Property="Background" Value="#FFFBFBB5" />
1839
<Setter Property="BorderBrush" Value="Transparent"/>
@@ -136,7 +157,8 @@
136157
</Grid.ColumnDefinitions>
137158
<ListBox Grid.Row="0" x:Name="SavegameListBox" Margin="0,10,10,0" SelectionChanged="SavegameListBox_OnSelectionChanged" MaxHeight="400" MaxWidth="240" Width="240"/>
138159
<Button x:Name="RefreshButton" Style="{StaticResource RefreshImageButtonStyle}" Grid.Row="1" Width="20" Height="20" HorizontalAlignment="Right" Margin="0, 5,10,0" Padding="0" VerticalAlignment="Top" Click="RefreshButton_OnClick"/>
139-
<Button Content="About" Grid.Row="1" HorizontalAlignment="Left" Margin="0,30,0,0" Click="AboutButton_OnClick"/>
160+
<Button Content="About" Grid.Row="1" HorizontalAlignment="Left" Margin="35,30,0,0" Click="AboutButton_OnClick"/>
161+
<Button Style="{StaticResource BugReportButtonStyle}" Grid.Row="1" Width="20" Height="18" HorizontalAlignment="Left" Margin="0,30,20,0" Padding="0" VerticalAlignment="Top" Click="BugReportButton_OnClick" ToolTip="Bug report"/>
140162
<Grid Grid.Column="1" Grid.RowSpan="3" Margin="20,20,0,0" >
141163
<Grid.RowDefinitions>
142164
<RowDefinition/>

D-OS Save Editor/MainWindow.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public partial class MainWindow
3131
private readonly string _defaultProfileDir = $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}{DirectorySeparatorChar}Larian Studios{DirectorySeparatorChar}Divinity Original Sin Enhanced Edition{DirectorySeparatorChar}PlayerProfiles";
3232
private enum BackupStatus { None, Current, Old, NoChecksum, NoImage }
3333

34-
public static string Version { get; } = "v1.4.2";
34+
public static string Version { get; } = "v1.4.3";
3535
private string _updateLink;
3636

3737
public MainWindow()
@@ -236,7 +236,8 @@ private bool UnpackSave(Savegame savegame)
236236
}
237237
catch (Exception ex)
238238
{
239-
MessageBox.Show(this, $"Internal error!\n\n{ex}", "Failed", MessageBoxButton.OK, MessageBoxImage.Error);
239+
var er = new ErrorReporting($"Internal error!\n\n{ex}", null);
240+
er.ShowDialog();
240241
return false;
241242
}
242243
finally
@@ -531,5 +532,11 @@ private void DismissButton_OnClick(object sender, RoutedEventArgs e)
531532
{
532533
UpdatePanel.Visibility = Visibility.Collapsed;
533534
}
535+
536+
private void BugReportButton_OnClick(object sender, RoutedEventArgs e)
537+
{
538+
Process.Start(
539+
"https://docs.google.com/forms/d/e/1FAIpQLSeUeKYdV8InQslbvCvA1rmffJ5t1ieond4W6hpUHkHTH7I7dg/viewform");
540+
}
534541
}
535542
}

D-OS Save Editor/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.4.2.0")]
55-
[assembly: AssemblyFileVersion("1.4.2.0")]
54+
[assembly: AssemblyVersion("1.4.3.0")]
55+
[assembly: AssemblyFileVersion("1.4.3.0")]

D-OS Save Editor/Properties/Resources.Designer.cs

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

D-OS Save Editor/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,10 @@
148148
<data name="NoImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
149149
<value>..\Resources\NoImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
150150
</data>
151+
<data name="ic_bug_black" type="System.Resources.ResXFileRef, System.Windows.Forms">
152+
<value>..\Resources\ic_bug_black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
153+
</data>
154+
<data name="ic_bug_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
155+
<value>..\Resources\ic_bug_red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
156+
</data>
151157
</root>
10.8 KB
Loading
10.8 KB
Loading

0 commit comments

Comments
 (0)