Skip to content

Commit

Permalink
Merge pull request #9 from elpatron68/next-version
Browse files Browse the repository at this point in the history
Important fixes
  • Loading branch information
elpatron68 authored Oct 16, 2022
2 parents 89467d0 + d0e204c commit 0524d14
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 22 deletions.
10 changes: 10 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# SnowRunner-Tool Changes

## v1.0.5.1 (16.10.2022)
- Fixed a bug which deleted backup files while moving old backups to new location at the first start of v1.0.5.0
- Fixed a bug preventing the tool to start if Steam client is not installed
- Made update check more resistant against failures

## v1.0.5.0 (15.10.2022)
- Add support for Steam platform
- Remove PAK backup functionality
- UI changes

## v1.0.4.0 (21.08.2022)

- Option to restore a single save game slot (#1 - #4) or all slots from a backup
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The game *SnowRunner* is a pain! Don´t play it. But if you do, you will sooner

So, if you feel that restoring a saved game would sometimes be nice to have, here is the good news: The game creates backups from time to time, and it´s easy to restore them.

The *SnowRunner-Tool* does nothing that you could not do in a manual way, but it makes it safe and easy and it´s looking nice.
*SnowRunner-Tool* does nothing that you could not do in a manual way, but it makes it safe and easy and it´s looking beautiful.

In addition, this tool lets you change (cheat) the money and experience points of the current game state. So, if you feel, you are broke, don´t hesitate to rob the bank!

Expand Down
17 changes: 12 additions & 5 deletions SnowRunner-Tool/DiscoverPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ public static string FindBaseDirectory(string platform)
{
RegistryKey key;
key = Registry.CurrentUser.OpenSubKey(@"Software\Valve\Steam");
String value = (String)key.GetValue("SteamPath");
value = value.Replace("/", "\\");
value = value + @"\userdata";
if (Directory.Exists(value))
try
{
String value = (String)key.GetValue("SteamPath");
value = value.Replace("/", "\\");
value = value + @"\userdata";
if (Directory.Exists(value))
{
p = SteamParser.SteamSaveGameDirectory(value);
}
}
catch
{
p = SteamParser.SteamSaveGameDirectory(value);
// Registry key not found
}
}
if (platform == "epic")
Expand Down
4 changes: 4 additions & 0 deletions SnowRunner-Tool/EpicParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public static void MoveOldBackupsToNewLocation(string SRProfileDirectory, string
{
try
{
if (!Directory.Exists(MyBackupDir))
{
Directory.CreateDirectory(MyBackupDir);
}
File.Move(backupFile, MyBackupDir + @"\" + Path.GetFileName(backupFile));
}
catch
Expand Down
4 changes: 2 additions & 2 deletions SnowRunner-Tool/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</MenuItem.Icon>
<MenuItem x:Name="MnBackupSaveGame"
Header="Backup _save game"
Click="Button_Click"
Click="BtnBackupCurrentSave_Click"
>
<MenuItem.Icon>
<iconPacks:PackIconMaterial Kind="ContentSaveOutline" />
Expand Down Expand Up @@ -364,7 +364,7 @@
Margin="0,0,30,20"
Width="215"
RenderTransformOrigin="-0.29,0.04"
Click="Button_Click"
Click="BtnBackupCurrentSave_Click"
/>
<Label x:Name="lbTotalBackups" Grid.Column="1" Content="Label" Margin="0,90,20,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="148"/>
</Grid>
Expand Down
31 changes: 23 additions & 8 deletions SnowRunner-Tool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public MainWindow(ILogger logger, string[] args)
{
case 0:
// No platform found
Winforms.MessageBox.Show("No saved games were found. You have to have at least one save game to use SnowRunner-Tool", "Platform detection");
Winforms.MessageBox.Show("No saved games were found. You have to have at least one save game to use SnowRunner-Tool.\n\n" +
"Restart SnowRunner-Tool after you have saved the game at least once.", "Platform detection");
// Close();
Application.Current.Shutdown();
break;
case 1:
// Epic
Expand All @@ -81,7 +84,8 @@ public MainWindow(ILogger logger, string[] args)
Winforms.MessageBoxManager.OK = "Steam";
Winforms.MessageBoxManager.Cancel = "Epic Games";
Winforms.MessageBoxManager.Register();
var answer = Winforms.MessageBox.Show("Saved games from the Epic Games- and Steam- version of SnowRunner were found. Select the platform you want to use.", "Select SnowRunner platform", Winforms.MessageBoxButtons.OKCancel);
var answer = Winforms.MessageBox.Show("Saved games from the Epic Games- and Steam- version of SnowRunner were found.\n\n" +
"Select the platform you want to use.", "Select SnowRunner platform", Winforms.MessageBoxButtons.OKCancel);
Winforms.MessageBoxManager.Unregister();
switch (answer)
{
Expand Down Expand Up @@ -477,11 +481,19 @@ private async void MnChkUpd_Click(object sender, RoutedEventArgs e)

private async void CheckUpdate()
{
(int, string) r = await UpdateCheck.CheckGithubReleses(AssemblyVersion);
int result = r.Item1;
if (result > 0)
try
{
(int, string) r = await UpdateCheck.CheckGithubReleses(AssemblyVersion);
int result = r.Item1;
if (result > 0)
{
ToastNote.Notify("Update available", "A new version of SnowRunner-Tool is available. See menu 'Help - Check for update' to download the latest version.");
}
}
catch
{
ToastNote.Notify("Update available", "A new version of SnowRunner-Tool is available. See menu 'Help - Check for update' to download the latest version.");
_logger.Warning("Update check failed.");
// No internet connection
}
}

Expand Down Expand Up @@ -598,7 +610,7 @@ private void UpdateTitle()
}


private void Button_Click(object sender, RoutedEventArgs e)
private void BtnBackupCurrentSave_Click(object sender, RoutedEventArgs e)
{
_ = Backup.BackupCurrentSavegame(SRProfile, MyBackupDir, "manual-bak");
ReadBackups();
Expand Down Expand Up @@ -739,7 +751,10 @@ private void SetAutobackup(int interval)
default:
break;
}
fswGameBackup.EnableRaisingEvents = interval > 0;
if (Platform != null)
{
fswGameBackup.EnableRaisingEvents = interval > 0;
}
}

private void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions SnowRunner-Tool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyVersion("1.0.5.1")]
[assembly: AssemblyFileVersion("1.0.5.1")]
[assembly: Guid("fbc516d8-771f-414e-b57b-14211d6e0c62")]
2 changes: 1 addition & 1 deletion SnowRunner-Tool/SnowRunner-Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>P:\snowrunner\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
4 changes: 2 additions & 2 deletions SnowRunner-Tool/UpdateCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SnowRunner_Tool
{
class UpdateCheck
{
private readonly ILogger _log = Log.ForContext<UpdateCheck>();
//private readonly ILogger _log = Log.ForContext<UpdateCheck>();

public static async Task<(int, string)> CheckGithubReleses(string assemblyVersion)
{
Expand All @@ -24,7 +24,7 @@ class UpdateCheck
var thisVersion = new Version(assemblyVersion);
var latestVersion = new Version(latest);
int result = latestVersion.CompareTo(thisVersion);
Log.Debug("Updatecheck returned {UpdateCheckResult}", result);
//Log.Debug("Updatecheck returned {UpdateCheckResult}", result);
return (result, downloadUrl);
}
catch
Expand Down
2 changes: 1 addition & 1 deletion innosetup/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma include __INCLUDE__ + ";" + ReadReg(HKLM, "Software\Mitrich Software\Inno Download Plugin", "InstallDir")
#include <idp.iss>
#define MyAppName "SnowRunner-Tool"
#define MyAppVersion "1.0.5.0"
#define MyAppVersion "1.0.5.1"
#define MyAppPublisher "elpatron68"
#define MyAppURL "https://github.com/elpatron68/SnowRunner-Tool"
#define MyAppExeName "SnowRunner-Tool.exe"
Expand Down

0 comments on commit 0524d14

Please sign in to comment.