Skip to content

Commit a977fd7

Browse files
committed
- Fixed some minor UI problems
1 parent b430c61 commit a977fd7

File tree

10 files changed

+86
-44
lines changed

10 files changed

+86
-44
lines changed

D-OS Save Editor/About.xaml

Lines changed: 2 additions & 1 deletion
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="About" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner">
8+
Title="About" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner"
9+
UseLayoutRounding="True">
910
<StackPanel Orientation="Vertical">
1011
<StackPanel Orientation="Vertical" Margin="30,20,30,0" HorizontalAlignment="Center" VerticalAlignment="Center">
1112
<TextBlock Text="D-OS Save Editor" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18"/>

D-OS Save Editor/ErrorReporting.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
</Grid.ColumnDefinitions>
2828
<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"/>
2929
<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>
30+
<TextBlock Text="{Binding Message}" Margin="20,20,20,0" TextWrapping="Wrap" MaxWidth="401"/>
31+
<TextBlock Text="If you would like to help, please click the &quot;Report&quot; button." Margin="20,0,20,0" TextWrapping="Wrap" MaxWidth="401"/>
3132
<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>
3233
</StackPanel>
3334

D-OS Save Editor/ErrorReporting.xaml.cs

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,97 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Diagnostics;
34
using System.Drawing;
45
using System.Globalization;
56
using System.Reflection;
7+
using System.Runtime.CompilerServices;
68
using System.Windows;
79
using System.Windows.Data;
810
using System.Windows.Interop;
911
using System.Windows.Media.Imaging;
12+
using D_OS_Save_Editor.Annotations;
1013

1114
namespace D_OS_Save_Editor
1215
{
1316
/// <summary>
1417
/// Interaction logic for ErrorReporting.xaml
1518
/// </summary>
16-
public partial class ErrorReporting
19+
public partial class ErrorReporting : INotifyPropertyChanged
1720
{
18-
public ErrorModel ErrorModel;
21+
private string _errorMessage;
22+
private object _errorData;
23+
private string _message = "An error has occurred.";
24+
25+
public string ErrorMessage
26+
{
27+
get => _errorMessage;
28+
set
29+
{
30+
_errorMessage = value;
31+
OnPropertyChanged();
32+
}
33+
}
34+
35+
public object ErrorData
36+
{
37+
get => _errorData;
38+
set
39+
{
40+
_errorData = value;
41+
OnPropertyChanged();
42+
}
43+
}
44+
45+
public string Message
46+
{
47+
get => _message;
48+
set
49+
{
50+
if (value == _message) return;
51+
_message = value;
52+
OnPropertyChanged();
53+
}
54+
}
55+
1956
public ErrorReporting()
2057
{
2158
InitializeComponent();
22-
ErrorModel = new ErrorModel();
23-
DataContext = ErrorModel;
59+
DataContext = this;
2460
}
2561

26-
public ErrorReporting(string message, object data)
62+
public ErrorReporting(string message, string exceptionMessage, object data)
2763
{
2864
InitializeComponent();
29-
ErrorModel = new ErrorModel(message, data);
30-
DataContext = ErrorModel;
65+
66+
Message = message;
67+
ErrorMessage = exceptionMessage;
68+
_errorData = data;
69+
DataContext = this;
70+
}
71+
72+
public ErrorReporting(string exceptionMessage, object data)
73+
{
74+
InitializeComponent();
75+
76+
_errorMessage = exceptionMessage;
77+
_errorData = data;
78+
DataContext = this;
3179
}
3280

3381
private void ReportButtonClicked(object sender, RoutedEventArgs e)
3482
{
35-
Clipboard.SetText($"{ErrorModel.ErrorMessage}\n\n{MainWindow.Version}");
83+
Clipboard.SetText($"{ErrorMessage}\n\n{MainWindow.Version}");
3684
Process.Start(
3785
@"https://docs.google.com/forms/d/e/1FAIpQLSeUeKYdV8InQslbvCvA1rmffJ5t1ieond4W6hpUHkHTH7I7dg/viewform?usp=pp_url&entry.1687355392=Error+report");
3886
Close();
3987
}
40-
}
41-
42-
public class ErrorModel
43-
{
44-
public string ErrorMessage { get; set; }
45-
public object ErrorData { get; set; }
4688

47-
public ErrorModel()
48-
{
49-
}
89+
public event PropertyChangedEventHandler PropertyChanged;
5090

51-
public ErrorModel(string message, object data)
91+
[NotifyPropertyChangedInvocator]
92+
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
5293
{
53-
ErrorMessage = message;
54-
ErrorData = data;
94+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
5595
}
5696
}
5797

D-OS Save Editor/MainWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
mc:Ignorable="d"
7-
Title="D-OS Save Editor: Select a save" Height="428.713" Width="624.947" WindowStartupLocation="CenterScreen" SizeToContent="Height" MinWidth="625" MinHeight="500" MaxHeight="700" ResizeMode="CanMinimize">
7+
Title="D-OS Save Editor: Select a save" Height="428.713" Width="624.947" SizeToContent="Height" MinWidth="625" MinHeight="500" MaxHeight="700" ResizeMode="CanMinimize"
8+
WindowStartupLocation="CenterScreen" UseLayoutRounding="True">
89
<Window.Resources>
910
<Style TargetType="Button">
1011
<Setter Property="Padding" Value="5,0"></Setter>

D-OS Save Editor/MainWindow.xaml.cs

Lines changed: 1 addition & 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.5.0";
34+
public static string Version { get; } = "v1.5.1";
3535
private string _updateLink;
3636

3737
public MainWindow()
@@ -44,7 +44,6 @@ public MainWindow()
4444
se.Show();
4545
this.Visibility = Visibility.Hidden;
4646
#endif
47-
4847
// set default savegame directory
4948
var dir = GetMostRecentProfile();
5049
if (dir != null)

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.5.0.0")]
55-
[assembly: AssemblyFileVersion("1.5.0.0")]
54+
[assembly: AssemblyVersion("1.5.1.0")]
55+
[assembly: AssemblyFileVersion("1.5.1.0")]

D-OS Save Editor/SE/InventoryTab.xaml.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Linq;
45
using System.Text.RegularExpressions;
56
using System.Windows;
67
using System.Windows.Controls;
78
using System.Windows.Input;
89
using System.Windows.Media;
10+
using System.Xml.Serialization;
911

1012
namespace D_OS_Save_Editor
1113
{
@@ -273,17 +275,14 @@ private void ApplyChangesButton_OnClick(object sender, RoutedEventArgs e)
273275
//Since Item.Stats == null is not likely to be possible, let's handle it later on if we have an report of this case.
274276
if (item.Stats == null)
275277
{
276-
var dlgResult = MessageBox.Show(
277-
"Sorry, it is not possible to add modifier to this item yet. No changes have been applied. If you would like to help, please click \"Yes\".", "Error", MessageBoxButton.YesNo, MessageBoxImage.Error);
278-
if (dlgResult == MessageBoxResult.No) return;
279-
280-
var fn = Savegame.DumpItem(item, "Item.Stats null");
281-
dlgResult = MessageBox.Show(
282-
$"Thank you for your help. Now please click \"OK\" to go to Github and file an issue. \n\nYou only need to go through the following steps:\n\n1. navigate to the application root folder;\n2. locate the {fn} file;\n3. drag {fn} to the issue reporting window;\n4. submit.",
283-
"Thank you",MessageBoxButton.OKCancel,MessageBoxImage.Information);
284-
if (dlgResult == MessageBoxResult.Cancel) return;
285-
286-
System.Diagnostics.Process.Start("https://github.com/tmxkn1/D-OS-Save-Editor/issues/new");
278+
var xmlSerializer = new XmlSerializer(item.GetType());
279+
280+
using (var sw = new StringWriter())
281+
{
282+
xmlSerializer.Serialize(sw, item);
283+
var er = new ErrorReporting("It is not possible to add modifier to this item yet. No changes have been applied.", $"Item.Stats Null. Cannot add item modifiers.\n\nItem XML:\n{sw}", null);
284+
er.ShowDialog();
285+
}
287286
return;
288287
}
289288
item.Generation = new Item.GenerationNode(item.StatsName, "0");

D-OS Save Editor/SE/SaveEditor.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
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="D-OS Save Editor: Save editor" SizeToContent="WidthAndHeight" MaxWidth="850" Width="655.916" Closed="SaveEditor_OnClosed" Closing="SaveEditor_OnClosing"
9-
WindowStartupLocation="CenterOwner">
8+
Title="D-OS Save Editor: Save editor" SizeToContent="WidthAndHeight" MaxWidth="850" Width="655.916" WindowStartupLocation="CenterOwner"
9+
Closed="SaveEditor_OnClosed" Closing="SaveEditor_OnClosing"
10+
UseLayoutRounding="True">
1011
<Window.Resources>
1112
<Style TargetType="TextBox">
1213
<Setter Property="Height" Value="23"/>

UpdateCheck

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
HandShake={ABCQWEZXCrtyfghvbnUIOJKLNM}
2-
LatestVersion={v1.5.0}
2+
LatestVersion={v1.5.1}
33
Link=linkStart{https://github.com/tmxkn1/D-OS-Save-Editor/releases}linkEnd
4-
Msg=msgStart{v1.5.0 is now available with a new feature: Talent editing. }msgEnd
4+
Msg=msgStart{v1.5.1 is now available with a new feature: Talent editing. }msgEnd

UpdateCheck1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
HandShake={ABCQWEZXCrtyfghvbnUIOJKLNM}
2-
LatestVersion={v1.4.4}
2+
LatestVersion={v1.5.1}
33
Link=linkStart{https://github.com/tmxkn1/D-OS-Save-Editor/releases}linkEnd
4-
Msg=msgStart{v1.4.4 is now available! }msgEnd
4+
Msg=msgStart{v1.5.1 is now available with a new feature: Talent editing. }msgEnd

0 commit comments

Comments
 (0)