diff --git a/App.config b/App.config
index 850feaa..f3a94ee 100644
--- a/App.config
+++ b/App.config
@@ -52,8 +52,11 @@
-
-
+
+ 800
+
+
+ 500
diff --git a/ExtraWorldFileEditWindow.xaml b/ExtraWorldFileEditWindow.xaml
new file mode 100644
index 0000000..0028c21
--- /dev/null
+++ b/ExtraWorldFileEditWindow.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ExtraWorldFileEditWindow.xaml.cs b/ExtraWorldFileEditWindow.xaml.cs
new file mode 100644
index 0000000..e9df88b
--- /dev/null
+++ b/ExtraWorldFileEditWindow.xaml.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ValheimSaveShield
+{
+ ///
+ /// Interaction logic for ExtraWorldFileEditWindow.xaml
+ ///
+ public partial class ExtraWorldFileEditWindow : Window
+ {
+ public ExtraWorldFileEditWindow(string ext)
+ {
+ InitializeComponent();
+ if (ext != null) txtExtension.Text = ext;
+ }
+ public ExtraWorldFileEditWindow() : this(null) { }
+
+ private void btnCancel_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+
+ private void btnOK_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ Tag = txtExtension.Text;
+ Close();
+ }
+ }
+}
diff --git a/ExtraWorldFilesWindow.xaml b/ExtraWorldFilesWindow.xaml
new file mode 100644
index 0000000..3e55ce5
--- /dev/null
+++ b/ExtraWorldFilesWindow.xaml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+ If you're using a mod that generates additional files in your worlds folder that you want backed up, you can list the additional file extensions here. To be supported, the additional world files must adhere to the Worldname.ext naming format where Worldname is the name of your world and .ext is the extension of the file.
+
+
+ For example: to back up an .ext file, you would add .ext to the list below.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ExtraWorldFilesWindow.xaml.cs b/ExtraWorldFilesWindow.xaml.cs
new file mode 100644
index 0000000..7bde53d
--- /dev/null
+++ b/ExtraWorldFilesWindow.xaml.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ValheimSaveShield
+{
+ ///
+ /// Interaction logic for ExtraWorldFilesWindow.xaml
+ ///
+ public partial class ExtraWorldFilesWindow : Window
+ {
+ public ExtraWorldFilesWindow()
+ {
+ InitializeComponent();
+ foreach (var ext in Properties.Settings.Default.WorldFileExtensions)
+ {
+ lstExtensions.Items.Add(ext);
+ }
+ }
+
+ private void menuExtensions_Opened(object sender, RoutedEventArgs e)
+ {
+ if (lstExtensions.SelectedIndex > -1)
+ {
+ menuEdit.Visibility = Visibility.Visible;
+ menuRemove.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ menuEdit.Visibility = Visibility.Collapsed;
+ menuRemove.Visibility = Visibility.Collapsed;
+ }
+ }
+
+ private void btnSave_Click(object sender, RoutedEventArgs e)
+ {
+ Properties.Settings.Default.WorldFileExtensions.Clear();
+ foreach (var ext in lstExtensions.Items)
+ {
+ Properties.Settings.Default.WorldFileExtensions.Add(ext.ToString());
+ }
+ Properties.Settings.Default.Save();
+ DialogResult = true;
+ Close();
+ }
+
+ private void btnCancel_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+
+ private void menuRemove_Click(object sender, RoutedEventArgs e)
+ {
+ lstExtensions.Items.Remove(lstExtensions.SelectedItem);
+ }
+
+ private void menuAdd_Click(object sender, RoutedEventArgs e)
+ {
+ var editWin = new ExtraWorldFileEditWindow();
+ editWin.Owner = this;
+ editWin.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ if (editWin.ShowDialog().GetValueOrDefault())
+ {
+ var ext = editWin.Tag.ToString();
+ if (ext.IndexOf(".") != 0) {
+ ext = "." + ext;
+ }
+ lstExtensions.Items.Add(ext);
+ }
+ }
+
+ private void menuEdit_Click(object sender, RoutedEventArgs e)
+ {
+ var editWin = new ExtraWorldFileEditWindow(lstExtensions.SelectedItem.ToString());
+ editWin.Owner = this;
+ editWin.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ if (editWin.ShowDialog().GetValueOrDefault())
+ {
+ var ext = editWin.Tag.ToString();
+ if (ext.IndexOf(".") != 0)
+ {
+ ext = "." + ext;
+ }
+ lstExtensions.Items[lstExtensions.SelectedIndex] = ext;
+ }
+ }
+ }
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index feb4888..d9aa92e 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -7,7 +7,7 @@
mc:Ignorable="d"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True"
- Title="Valheim Save Shield" Height="450" Width="800" Loaded="Window_Loaded" Icon="Resources/vss_32.png" Closing="Window_Closing" Closed="Window_Closed" Deactivated="Window_Deactivated" MinHeight="200" MinWidth="300" StateChanged="Window_StateChanged" IsVisibleChanged="Window_IsVisibleChanged" ContentRendered="Window_ContentRendered">
+ Title="Valheim Save Shield" Height="500" Width="800" Loaded="Window_Loaded" Icon="Resources/vss_32.png" Closing="Window_Closing" Closed="Window_Closed" Deactivated="Window_Deactivated" MinHeight="200" MinWidth="300" StateChanged="Window_StateChanged" IsVisibleChanged="Window_IsVisibleChanged" ContentRendered="Window_ContentRendered">
@@ -38,7 +38,15 @@
-->
-
+
+
+
+
+
+
+
+
+
@@ -141,7 +151,7 @@
-
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 9673a11..0cc1af8 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -117,6 +117,8 @@ public MainWindow()
Properties.Settings.Default.UpgradeRequired = false;
Properties.Settings.Default.Save();
}
+ Width = Properties.Settings.Default.MainWindowWidth;
+ Height = Properties.Settings.Default.MainWindowHeight;
if (Properties.Settings.Default.SaveFolders == null)
{
Properties.Settings.Default.SaveFolders = new StringCollection();
@@ -142,6 +144,11 @@ public MainWindow()
Properties.Settings.Default.CharBackupKeep = new StringDictionary();
Properties.Settings.Default.Save();
}
+ if (Properties.Settings.Default.WorldFileExtensions == null)
+ {
+ Properties.Settings.Default.WorldFileExtensions = new StringCollection();
+ Properties.Settings.Default.Save();
+ }
if (Properties.Settings.Default.BackupFolder.Length == 0)
{
logMessage("Backup folder not set; reverting to default.");
@@ -785,34 +792,13 @@ private Dictionary getBackupKeeps(string type)
return keeps;
}
- private void DataBackups_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
- {
- if (e.Column.Header.ToString().Equals("Name") ||
- e.Column.Header.ToString().Equals("Type") ||
- e.Column.Header.ToString().Equals("SaveDate") ||
- e.Column.Header.ToString().Equals("Active")) e.Cancel = true;
- }
-
- private void DataBackups_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
- {
- if (e.Column.Header.ToString().Equals("Name") && e.EditAction == DataGridEditAction.Commit)
- {
- SaveBackup sb = (SaveBackup)e.Row.Item;
- if (sb.Label.Equals(""))
- {
- sb.Label = sb.SaveDate.Ticks.ToString();
- }
- }
- }
-
private void updateSavedLabels()
{
var savedWorldLabels = new StringDictionary();
var savedCharLabels = new StringDictionary();
- for (int i = 0; i < listBackups.Count; i++)
+ foreach (var s in listBackups)
{
- SaveBackup s = listBackups[i];
- if (!s.Label.Equals(s.DefaultLabel))
+ if (s.Label != s.DefaultLabel)
{
if (s.Type.Equals("World"))
{
@@ -957,7 +943,9 @@ private void checkForUpdate()
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- //any cleanup to do before exit
+ Properties.Settings.Default.MainWindowWidth = Width;
+ Properties.Settings.Default.MainWindowHeight = Height;
+ Properties.Settings.Default.Save();
}
private void Window_Closed(object sender, EventArgs e)
@@ -1042,17 +1030,7 @@ public static void CopyFolder(DirectoryInfo source, DirectoryInfo target)
private void DataBackups_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
- if (e.Column.Header.Equals("DefaultLabel") ||
- e.Column.Header.Equals("FileName") ||
- e.Column.Header.Equals("FullPath") ||
- e.Column.Header.Equals("Folder") ||
- e.Column.Header.Equals("ActivePaths")) {
- e.Cancel = true;
- }
- else if (e.Column.Header.Equals("SaveDate"))
- {
- //e.Column.SortDirection = System.ComponentModel.ListSortDirection.Ascending;
- }
+ e.Cancel = true;
}
private void btnAppUpdate_Click(object sender, RoutedEventArgs e)
@@ -1554,6 +1532,26 @@ private void menuBackupsViewMap_Click(object sender, RoutedEventArgs e)
logMessage($"Error showing map: {ex.Message}", LogType.Error);
}
}
+
+ private void btnExtraWorldFiles_Click(object sender, RoutedEventArgs e)
+ {
+ var win = new ExtraWorldFilesWindow();
+ win.Owner = this;
+ win.WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ win.ShowDialog();
+ }
+
+ private void dataBackups_ContextMenuOpening(object sender, ContextMenuEventArgs e)
+ {
+ if (dataBackups.SelectedIndex > -1)
+ {
+ menuBackups.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ menuBackups.Visibility = Visibility.Collapsed;
+ }
+ }
}
public enum LogType
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 25d45d6..0db2f5b 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.4.2.0")]
-[assembly: AssemblyFileVersion("0.4.2.0")]
+[assembly: AssemblyVersion("0.4.3.0")]
+[assembly: AssemblyFileVersion("0.4.3.0")]
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
index b94b026..c5494b0 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -248,13 +248,36 @@ public string FtpSaveDest {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string Setting {
+ public global::System.Collections.Specialized.StringCollection WorldFileExtensions {
+ get {
+ return ((global::System.Collections.Specialized.StringCollection)(this["WorldFileExtensions"]));
+ }
+ set {
+ this["WorldFileExtensions"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("800")]
+ public double MainWindowWidth {
+ get {
+ return ((double)(this["MainWindowWidth"]));
+ }
+ set {
+ this["MainWindowWidth"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("500")]
+ public double MainWindowHeight {
get {
- return ((string)(this["Setting"]));
+ return ((double)(this["MainWindowHeight"]));
}
set {
- this["Setting"] = value;
+ this["MainWindowHeight"] = value;
}
}
}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
index dad27a2..6dcd3bd 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -59,8 +59,14 @@
-
+
+
+ 800
+
+
+ 500
+
\ No newline at end of file
diff --git a/Resources/ExclamationPoint_32x.png b/Resources/ExclamationPoint_32x.png
new file mode 100644
index 0000000..269865f
Binary files /dev/null and b/Resources/ExclamationPoint_32x.png differ
diff --git a/SaveBackup.cs b/SaveBackup.cs
index c1687cc..d27adc1 100644
--- a/SaveBackup.cs
+++ b/SaveBackup.cs
@@ -28,7 +28,7 @@ public string Label
{
get
{
- if (this.saveData.label == "")
+ if (this.saveData.label == "" || this.saveData.label == null)
{
return this.DefaultLabel;
}
@@ -39,7 +39,7 @@ public string Label
}
set
{
- if (value == "")
+ if (value == "" || value == null)
{
this.saveData.label = this.DefaultLabel;
} else
@@ -205,6 +205,15 @@ public void Restore(string path)
string sourcefwl = info.DirectoryName + "\\" + this.Name + ".fwl";
string destfwl = destInfo.DirectoryName + "\\" + this.Name + ".fwl";
File.Copy(sourcefwl, destfwl, true);
+ foreach (var ext in Properties.Settings.Default.WorldFileExtensions)
+ {
+ string sourcefile = info.DirectoryName + "\\" + this.Name + ext;
+ if (File.Exists(sourcefile))
+ {
+ string destfile = destInfo.DirectoryName + "\\" + this.Name + ext;
+ File.Copy(sourcefile, destfile, true);
+ }
+ }
}
}
diff --git a/SaveFile.cs b/SaveFile.cs
index 758b0ef..51c8dc3 100644
--- a/SaveFile.cs
+++ b/SaveFile.cs
@@ -146,6 +146,15 @@ public SaveBackup PerformBackup()
string sourcefwl = info.DirectoryName + "\\" + this.Name + ".fwl";
string destfwl = this.BackupFolder + "\\" + this.Name + ".fwl";
File.Copy(sourcefwl, destfwl, true);
+ foreach (var ext in Properties.Settings.Default.WorldFileExtensions)
+ {
+ string sourcefile = info.DirectoryName + "\\" + this.Name + ext;
+ if (File.Exists(sourcefile))
+ {
+ string destfile = this.BackupFolder + "\\" + this.Name + ext;
+ File.Copy(sourcefile, destfile, true);
+ }
+ }
}
return new SaveBackup(this.BackupPath);
}
diff --git a/ValheimSaveShield.csproj b/ValheimSaveShield.csproj
index 3b73899..3a42a81 100644
--- a/ValheimSaveShield.csproj
+++ b/ValheimSaveShield.csproj
@@ -109,6 +109,12 @@
MSBuild:Compile
Designer
+
+ ExtraWorldFileEditWindow.xaml
+
+
+ ExtraWorldFilesWindow.xaml
+
FtpSettingsWindow.xaml
@@ -122,6 +128,14 @@
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -180,6 +194,7 @@
+