Skip to content

Commit 7221005

Browse files
committed
Merge branch 'dev/v3.17.x.x'
2 parents 0180347 + 1dade67 commit 7221005

File tree

6 files changed

+52
-5
lines changed

6 files changed

+52
-5
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,11 @@ public interface ILocalMetaData
4444
void SetProductKey(string productKey);
4545

4646
string GetProductKey();
47+
48+
void SetMainExecutableAndArgs(string mainExecutable, string mainExecutableArgs);
49+
50+
string GetMainExecutable();
51+
52+
string MainExecutableArgs { get; }
4753
}
4854
}

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ private struct Data
4040
[DefaultValue("none")]
4141
[JsonProperty("product_key_encryption", DefaultValueHandling = DefaultValueHandling.Populate)]
4242
public string ProductKeyEncryption;
43+
44+
[JsonProperty("start_exe_path")]
45+
public string MainExecutable;
46+
47+
[JsonProperty("start_exe_args")]
48+
public string MainExecutableArgs;
4349

4450
[JsonProperty("_fileVersions")] public Dictionary<string, int> FileVersionIds;
4551
}
@@ -174,6 +180,24 @@ public string GetProductKey()
174180
{
175181
return _data.ProductKey;
176182
}
183+
184+
public void SetMainExecutableAndArgs(string mainExecutable, string mainExecutableArgs)
185+
{
186+
_data.MainExecutable = mainExecutable;
187+
_data.MainExecutableArgs = mainExecutableArgs;
188+
189+
SaveData();
190+
}
191+
192+
public string GetMainExecutable()
193+
{
194+
return _data.MainExecutable;
195+
}
196+
197+
public string MainExecutableArgs
198+
{
199+
get { return _data.MainExecutableArgs; }
200+
}
177201

178202
private void CreateDataDir()
179203
{

Assets/PatchKit Patcher/Scripts/AppStarter.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ public AppStarter(App app)
3131
private string ResolveExecutablePath(AppVersion? appVersion)
3232
{
3333
PlatformType platformType = Platform.GetPlatformType();
34-
35-
if (appVersion.HasValue &&
36-
!string.IsNullOrEmpty(appVersion.Value.MainExecutable))
34+
string mainExecutable = (appVersion.HasValue &&
35+
!string.IsNullOrEmpty(appVersion.Value.MainExecutable))
36+
? appVersion.Value.MainExecutable
37+
: _app.LocalMetaData.GetMainExecutable();
38+
39+
if (!string.IsNullOrEmpty(mainExecutable))
3740
{
3841
string executablePath = Path.Combine(
3942
_app.LocalDirectory.Path,
40-
appVersion.Value.MainExecutable);
43+
mainExecutable);
4144

4245
bool isOSXApp = platformType == PlatformType.OSX &&
4346
executablePath.EndsWith(".app") &&
@@ -97,6 +100,10 @@ private void StartAppVersion(AppVersion? appVersion, string customArgs)
97100
{
98101
appArgs += " " + appVersion.Value.MainExecutableArgs;
99102
}
103+
else if (!string.IsNullOrEmpty(_app.LocalMetaData.MainExecutableArgs))
104+
{
105+
appArgs += " " + _app.LocalMetaData.MainExecutableArgs;
106+
}
100107

101108
if (appFilePath == null)
102109
{

Assets/PatchKit Patcher/Scripts/Patcher.cs

Lines changed: 6 additions & 0 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,6 +900,7 @@ 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);
903+
902904
if (_app.IsFullyInstalled())
903905
{
904906
_localVersionId.Value = _app.GetInstalledVersionId();
@@ -915,6 +917,10 @@ private void ThreadUpdateApp(bool automatically, CancellationToken cancellationT
915917
appUpdater.Update(_updateAppCancellationTokenSource.Token);
916918
_wasUpdateSuccessfulOrNotNecessary = true;
917919
}
920+
921+
AppVersion latestAppVersion =
922+
_app.RemoteMetaData.GetAppVersionInfo(_remoteVersionId.Value.Value, false, cancellationToken);
923+
_app.LocalMetaData.SetMainExecutableAndArgs(latestAppVersion.MainExecutable, latestAppVersion.MainExecutableArgs);
918924
}
919925
catch (OperationCanceledException)
920926
{

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)