Skip to content

Commit

Permalink
1.0.0.19 - Option to change zip compression level, 1 - fastest (defau…
Browse files Browse the repository at this point in the history
…lt), 0 - optimal, 2 - no compression, to set new value you need to modify Settings.xml (start and stop app for new option to show in file), .NET set to 4.8, libraries updated
  • Loading branch information
sebeksd committed Aug 13, 2023
1 parent 8b51407 commit 2d5f29f
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 25 deletions.
2 changes: 1 addition & 1 deletion SaveGame Backup Tool/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
3 changes: 2 additions & 1 deletion SaveGame Backup Tool/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ You should have received a copy of the GNU Lesser General Public License
*/

using System;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Windows;

Expand Down Expand Up @@ -56,7 +57,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
lFound = true;

// do backup
BackupMaker lBackupMaker = new BackupMaker();
BackupMaker lBackupMaker = new BackupMaker((CompressionLevel)lSettings.Settings.ZIP_CompressionLevel);
string lErrorMessage = "";

if (lBackupMaker.MakeBackup(lBackupTask, BackupType.btNormal, ref lErrorMessage))
Expand Down
10 changes: 5 additions & 5 deletions SaveGame Backup Tool/BackupMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public enum BackupType

public class BackupMaker
{
public BackupMaker()
private readonly CompressionLevel fZIP_CompressionLevel;
public BackupMaker(CompressionLevel lZIP_CompressionLevel)
{


fZIP_CompressionLevel = lZIP_CompressionLevel;
}

private string BackupTypeToFilePostfix(BackupType lType, string lManualPostfix)
Expand Down Expand Up @@ -252,9 +252,9 @@ public bool MakeBackup(BackupTask lBackupTask, BackupType lType, string lManualP

// try to make a backup
if (lBackupTask.Settings.SourcePathHelper.IsFile)
ZipHelper.CreateFromFile(lBackupTask.Settings.SourcePathHelper.FilePath, lDestinationPath + lBackupFileName, CompressionLevel.Fastest, false, null, null);
ZipHelper.CreateFromFile(lBackupTask.Settings.SourcePathHelper.FilePath, lDestinationPath + lBackupFileName, fZIP_CompressionLevel, false, null, null);
else
ZipHelper.CreateFromDirectory(lBackupTask.Settings.SourcePathHelper.DirectoryPath, lDestinationPath + lBackupFileName, CompressionLevel.Fastest, false, null, lFilterFileName => !CheckFilterForFile(lBackupTask.Settings.FileFilterRegex, lFilterFileName));
ZipHelper.CreateFromDirectory(lBackupTask.Settings.SourcePathHelper.DirectoryPath, lDestinationPath + lBackupFileName, fZIP_CompressionLevel, false, null, lFilterFileName => !CheckFilterForFile(lBackupTask.Settings.FileFilterRegex, lFilterFileName));

pErrorMessage = "";

Expand Down
6 changes: 3 additions & 3 deletions SaveGame Backup Tool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ You should have received a copy of the GNU Lesser General Public License
using ByteSizeLib;
using System.IO;
using Microsoft.Win32;
using System.IO.Compression;

namespace SaveGameBackupTool
{
Expand Down Expand Up @@ -122,12 +123,11 @@ public MainWindow()
fApplicationInstanceManager = new ApplicationInstanceManager();
CreateTypicalLocationsMenu();


fBackupMaker = new BackupMaker();

fSettings = new SettingsManager();
fSettings.LoadConfig();

fBackupMaker = new BackupMaker((CompressionLevel)fSettings.Settings.ZIP_CompressionLevel);

// set window position
if (fSettings.Settings.Window.PositionKnown)
{
Expand Down
4 changes: 2 additions & 2 deletions SaveGame Backup Tool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.17")]
[assembly: AssemblyFileVersion("1.0.0.17")]
[assembly: AssemblyVersion("1.0.0.19")]
[assembly: AssemblyFileVersion("1.0.0.19")]
2 changes: 1 addition & 1 deletion SaveGame Backup Tool/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion SaveGame Backup Tool/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions SaveGame Backup Tool/SaveGame Backup Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>SaveGameBackupTool</RootNamespace>
<AssemblyName>SaveGame Backup Tool</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -57,17 +57,17 @@
<ApplicationIcon>Save_128px_557023_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ByteSize, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ByteSize.2.0.0\lib\net45\ByteSize.dll</HintPath>
<Reference Include="ByteSize, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ByteSize.2.1.1\lib\net45\ByteSize.dll</HintPath>
</Reference>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
</Reference>
<Reference Include="Gat.Controls.OpenDialog, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OpenDialog.1.1.1\lib\net45\Gat.Controls.OpenDialog.dll</HintPath>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
<Reference Include="Hardcodet.NotifyIcon.Wpf, Version=1.1.0.0, Culture=neutral, PublicKeyToken=682384a853a08aad, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.1.0\lib\net472\Hardcodet.NotifyIcon.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand All @@ -86,8 +86,20 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.Toolkit, Version=4.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.0.1\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions SaveGame Backup Tool/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You should have received a copy of the GNU Lesser General Public License
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;

// Based on http://stackoverflow.com/a/33917532

Expand All @@ -30,6 +31,7 @@ namespace SaveGameBackupTool
public class AppSettings
{
public int LastSelectedTaskIndex;
public int ZIP_CompressionLevel = (int)CompressionLevel.Fastest;
public List<BackupTask> BackupTasks = new List<BackupTask>();

// window possition settings
Expand Down Expand Up @@ -345,6 +347,7 @@ public void SetDefaults()
fSettings.BackupTasks.Add(new BackupTask());

fSettings.LastSelectedTaskIndex = 0;
fSettings.ZIP_CompressionLevel = (int)CompressionLevel.Fastest;

//foreach (BackupTaskSettings lBackupTask in fSettings.BackupTasks)
// lBackupTask.SetDefault();
Expand All @@ -356,6 +359,9 @@ public void SetDefaults()
// Validate config and set defaults
public void ValidateConfig()
{
if (fSettings.ZIP_CompressionLevel < 0 || fSettings.ZIP_CompressionLevel > 9)
fSettings.ZIP_CompressionLevel = (int)CompressionLevel.Fastest;

if (fSettings.BackupTasks.Count == 0)
SetDefaults();
else
Expand Down
8 changes: 4 additions & 4 deletions SaveGame Backup Tool/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ByteSize" version="2.0.0" targetFramework="net452" />
<package id="CommandLineParser" version="1.9.71" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="4.0.1" targetFramework="net452" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
<package id="ByteSize" version="2.1.1" targetFramework="net48" />
<package id="CommandLineParser" version="1.9.71" targetFramework="net48" />
<package id="Extended.Wpf.Toolkit" version="4.5.0" targetFramework="net48" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.1.0" targetFramework="net48" />
<package id="OpenDialog" version="1.1.1" targetFramework="net452" />
</packages>

0 comments on commit 2d5f29f

Please sign in to comment.