Skip to content

Commit 5ad6a6a

Browse files
Converted to DS backup, built install 1.0.15
1 parent 74fa0c7 commit 5ad6a6a

16 files changed

+137
-92
lines changed

DS3Backup/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Application x:Class="DS3Backup.App"
1+
<Application x:Class="DSBackup.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
44
<Application.Resources>

DS3Backup/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System.Threading.Tasks;
77
using System.Windows;
88

9-
namespace DS3Backup
9+
namespace DSBackup
1010
{
1111
/// <summary>
1212
/// Interaction logic for App.xaml

DS3Backup/BackupLocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Threading.Tasks;
66

7-
namespace DS3Backup
7+
namespace DSBackup
88
{
99
[Serializable]
1010
public class BackupLocation : ViewModel

DS3Backup/BindingProxy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using System.Windows;
77

8-
namespace DS3Backup
8+
namespace DSBackup
99
{
1010
// http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/
1111
public class BindingProxy : Freezable
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{47BB7F23-CF26-4CDF-BD93-A997234189F3}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>DS3Backup</RootNamespace>
11-
<AssemblyName>DS3Backup</AssemblyName>
10+
<RootNamespace>DSBackup</RootNamespace>
11+
<AssemblyName>DSBackup</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -34,7 +34,7 @@
3434
<WarningLevel>4</WarningLevel>
3535
</PropertyGroup>
3636
<PropertyGroup>
37-
<ApplicationIcon>DarkSoulsIII.ico</ApplicationIcon>
37+
<ApplicationIcon>DarkSouls.ico</ApplicationIcon>
3838
</PropertyGroup>
3939
<ItemGroup>
4040
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
@@ -111,6 +111,9 @@
111111
<ItemGroup>
112112
<Resource Include="DarkSoulsIII.ico" />
113113
</ItemGroup>
114+
<ItemGroup>
115+
<Resource Include="DarkSouls.ico" />
116+
</ItemGroup>
114117
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
115118
<Import Project="$(ProjectDir)\Microsoft.VersionNumber.targets" />
116119
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

DS3Backup/DarkSouls.ico

126 KB
Binary file not shown.

DS3Backup/MainWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<Window x:Class="DS3Backup.MainWindow"
1+
<Window x:Class="DSBackup.MainWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:tb="http://www.hardcodet.net/taskbar"
5-
xmlns:local="clr-namespace:DS3Backup"
5+
xmlns:local="clr-namespace:DSBackup"
66
Visibility="{Binding Visibility, Mode=TwoWay}"
7-
Title="DS3 Backup" Icon="DarkSoulsIII.ico" Height="350" Width="525">
7+
Title="DS Backup" Icon="DarkSouls.ico" Height="350" Width="525">
88
<Window.Resources>
99
<local:BindingProxy x:Key="proxy" Data="{Binding}" />
1010
</Window.Resources>
@@ -20,7 +20,7 @@
2020
<ColumnDefinition Width="*" />
2121
</Grid.ColumnDefinitions>
2222

23-
<tb:TaskbarIcon MenuActivation="RightClick" IconSource="pack://application:,,,/DarkSoulsIII.ico" ToolTipText="DS3 Backup"
23+
<tb:TaskbarIcon MenuActivation="RightClick" IconSource="pack://application:,,,/DarkSouls.ico" ToolTipText="DS3 Backup"
2424
LeftClickCommand="{Binding Path=Data.ShowWindowCommand, Source={StaticResource proxy}}"
2525
DoubleClickCommand="{Binding Path=Data.ShowWindowCommand, Source={StaticResource proxy}}">
2626
<tb:TaskbarIcon.ContextMenu>

DS3Backup/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
1515

16-
namespace DS3Backup
16+
namespace DSBackup
1717
{
1818
/// <summary>
1919
/// Interaction logic for MainWindow.xaml

DS3Backup/MainWindowViewModel.cs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using System.Windows;
1313
using System.Windows.Input;
1414

15-
namespace DS3Backup
15+
namespace DSBackup
1616
{
1717
public class MainWindowViewModel : ViewModel
1818
{
@@ -26,7 +26,15 @@ public class MainWindowViewModel : ViewModel
2626
private static string SETTINGS_DIR = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DS3Backup");
2727
private static string SETTINGS_PATH = Path.Combine(SETTINGS_DIR, "ds3backup.settings");
2828
private static string SETTINGS_PATH_BAK = SETTINGS_PATH + ".bak";
29-
private static readonly string SAVES_PATH = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DarkSoulsIII");
29+
private static readonly List<string> DEFAULT_PATHS = new List<string>();
30+
31+
static MainWindowViewModel()
32+
{
33+
DEFAULT_PATHS.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "NBGI", "DarkSouls"));
34+
DEFAULT_PATHS.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DarkSoulsII"));
35+
DEFAULT_PATHS.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DarkSoulsIII"));
36+
DEFAULT_PATHS.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "NBGI", "DARK SOULS REMASTERED"));
37+
}
3038

3139
#region Commands
3240

@@ -117,16 +125,17 @@ private void Backup()
117125
}
118126

119127
if (Directory.Exists(location.Directory))
120-
foreach (string saveDirectory in GetSaveDirectories(SAVES_PATH))
128+
foreach (string saveDirectory in GetSaveDirectories(location.Directory))
121129
Backup(location, saveDirectory);
122-
123-
SaveSettings();
124130
}
125131
catch (Exception ex)
126132
{
127133
location.Accessible = false;
128134
MessageBox.Show("Error making backup. The location that caused the error will show as inaccessible. " + ex.Message, "DS3 Backup", MessageBoxButton.OK, MessageBoxImage.Error);
129135
}
136+
137+
try { SaveSettings(); }
138+
catch { }
130139
}
131140

132141
private void Backup(BackupLocation location, string saveDirectory)
@@ -158,6 +167,21 @@ private void Backup(BackupLocation location, string saveDirectory)
158167
location.LastBackup = modified.Value;
159168
location.Accessible = true;
160169
}
170+
else
171+
{
172+
location.LastBackup = modified.Value;
173+
try
174+
{
175+
string testPath = Path.Combine(location.Directory, "accessibilityTest.txt");
176+
File.WriteAllText(testPath, "DSBackup Accessibility Test");
177+
location.Accessible = true;
178+
File.Delete(testPath);
179+
}
180+
catch
181+
{
182+
location.Accessible = false;
183+
}
184+
}
161185
}
162186
}
163187

@@ -166,7 +190,9 @@ private IEnumerable<string> GetSaveDirectories(string path)
166190
foreach (string directory in Directory.GetDirectories(path))
167191
{
168192
string dirName = Path.GetFileName(directory);
169-
if (dirName.Length == 16)
193+
if (dirName.Length == 8 // Dark Souls
194+
|| dirName.Length == 16 // Dark Souls 2/3
195+
|| dirName.Length == 7) // Dark Souls Remastered
170196
yield return directory;
171197
}
172198
}
@@ -213,7 +239,10 @@ private void SaveSettings()
213239
private void LoadSettings()
214240
{
215241
if (!File.Exists(SETTINGS_PATH))
216-
BackupLocations.Add(new BackupLocation(SAVES_PATH));
242+
{
243+
foreach (var defaultPath in DEFAULT_PATHS)
244+
BackupLocations.Add(new BackupLocation(defaultPath));
245+
}
217246
else
218247
BackupLocations = new ObservableCollection<BackupLocation>(XmlHelper.FromXML<List<BackupLocation>>(File.ReadAllText(SETTINGS_PATH)));
219248
}

DS3Backup/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
// General Information about an assembly is controlled through the following
88
// set of attributes. Change these attribute values to modify the information
99
// associated with an assembly.
10-
[assembly: AssemblyTitle("DS3Backup")]
10+
[assembly: AssemblyTitle("DSBackup")]
1111
[assembly: AssemblyDescription("")]
1212
[assembly: AssemblyConfiguration("")]
1313
[assembly: AssemblyCompany("")]
14-
[assembly: AssemblyProduct("DS3Backup")]
14+
[assembly: AssemblyProduct("DSBackup")]
1515
[assembly: AssemblyCopyright("Copyright © 2016")]
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]
@@ -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.0.1803.05")]
55-
[assembly: AssemblyFileVersion("1.0.1803.05")]
54+
[assembly: AssemblyVersion("1.0.1807.44")]
55+
[assembly: AssemblyFileVersion("1.0.1807.44")]

0 commit comments

Comments
 (0)