Skip to content

Commit 1f49ebe

Browse files
Jakub SzczyrkJakub Szczyrk
authored andcommitted
Refactoring
1 parent 1763226 commit 1f49ebe

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

Assets/PatchKit Patcher/Scripts/AppData/Local/ILocalMetaData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ public interface ILocalMetaData
4949

5050
string GetMainExecutable();
5151

52-
string GetMainExecutableArgs();
52+
string MainExecutableArgs { get; }
5353
}
5454
}

Assets/PatchKit Patcher/Scripts/AppData/Local/LocalMetaData.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ private struct Data
4141
[JsonProperty("product_key_encryption", DefaultValueHandling = DefaultValueHandling.Populate)]
4242
public string ProductKeyEncryption;
4343

44-
[JsonProperty("main_executable")]
44+
[JsonProperty("start_exe_path")]
4545
public string MainExecutable;
4646

47-
[JsonProperty("main_executable_args")]
47+
[JsonProperty("start_exe_args")]
4848
public string MainExecutableArgs;
4949

5050
[JsonProperty("_fileVersions")] public Dictionary<string, int> FileVersionIds;
@@ -194,9 +194,9 @@ public string GetMainExecutable()
194194
return _data.MainExecutable;
195195
}
196196

197-
public string GetMainExecutableArgs()
197+
public string MainExecutableArgs
198198
{
199-
return _data.MainExecutableArgs;
199+
get { return _data.MainExecutableArgs; }
200200
}
201201

202202
private void CreateDataDir()

Assets/PatchKit Patcher/Scripts/AppStarter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ private void StartAppVersion(AppVersion? appVersion, string customArgs)
100100
{
101101
appArgs += " " + appVersion.Value.MainExecutableArgs;
102102
}
103-
else
103+
else if (string.IsNullOrEmpty(_app.LocalMetaData.MainExecutableArgs))
104104
{
105-
appArgs += " " + _app.LocalMetaData.GetMainExecutableArgs();
105+
appArgs += " " + _app.LocalMetaData.MainExecutableArgs;
106106
}
107107

108108
if (appFilePath == null)

Assets/PatchKit Patcher/Scripts/Patcher.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using UnityEngine;
1515
using CancellationToken = PatchKit.Unity.Patcher.Cancellation.CancellationToken;
1616
using System.IO;
17+
using PatchKit.Api.Models.Main;
1718
using PatchKit.Network;
1819
using PatchKit.Unity.Patcher.AppData;
1920
using PatchKit.Unity.Patcher.AppData.FileSystem;
@@ -899,9 +900,6 @@ private void ThreadUpdateApp(bool automatically, CancellationToken cancellationT
899900
{
900901
_appInfo.Value = _app.RemoteMetaData.GetAppInfo(!automatically, _updateAppCancellationTokenSource.Token);
901902
_remoteVersionId.Value = _app.GetLatestVersionId(!automatically, _updateAppCancellationTokenSource.Token);
902-
var latestAppVersion =
903-
_app.RemoteMetaData.GetAppVersionInfo(_remoteVersionId.Value.Value, false, cancellationToken);
904-
_app.LocalMetaData.SetMainExecutableAndArgs(latestAppVersion.MainExecutable, latestAppVersion.MainExecutableArgs);
905903

906904
if (_app.IsFullyInstalled())
907905
{
@@ -919,6 +917,10 @@ private void ThreadUpdateApp(bool automatically, CancellationToken cancellationT
919917
appUpdater.Update(_updateAppCancellationTokenSource.Token);
920918
_wasUpdateSuccessfulOrNotNecessary = true;
921919
}
920+
921+
AppVersion latestAppVersion =
922+
_app.RemoteMetaData.GetAppVersionInfo(_remoteVersionId.Value.Value, false, cancellationToken);
923+
_app.LocalMetaData.SetMainExecutableAndArgs(latestAppVersion.MainExecutable, latestAppVersion.MainExecutableArgs);
922924
}
923925
catch (OperationCanceledException)
924926
{

Assets/PatchKit Patcher/Scripts/Version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public static class Version
44
{
55
public const int Major = 3;
66
public const int Minor = 17;
7-
public const int Patch = 5;
7+
public const int Patch = 6;
88
public const int Hotfix = 0;
99

1010
public static string Value

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [3.17.6.0]
8+
### Fixed
9+
- Starting a valid executable in offline mode (#2146)
10+
711
## [3.17.5.0]
812
### Added
913
- Debug menu (available through Ctrl + Shift + D) (#2081)

0 commit comments

Comments
 (0)