Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ public interface ILocalMetaData
void SetProductKey(string productKey);

string GetProductKey();

void SetMainExecutableAndArgs(string mainExecutable, string mainExecutableArgs);

string GetMainExecutable();

string MainExecutableArgs { get; }
}
}
24 changes: 24 additions & 0 deletions Assets/PatchKit Patcher/Scripts/AppData/Local/LocalMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ private struct Data
[DefaultValue("none")]
[JsonProperty("product_key_encryption", DefaultValueHandling = DefaultValueHandling.Populate)]
public string ProductKeyEncryption;

[JsonProperty("start_exe_path")]
public string MainExecutable;

[JsonProperty("start_exe_args")]
public string MainExecutableArgs;

[JsonProperty("_fileVersions")] public Dictionary<string, int> FileVersionIds;
}
Expand Down Expand Up @@ -174,6 +180,24 @@ public string GetProductKey()
{
return _data.ProductKey;
}

public void SetMainExecutableAndArgs(string mainExecutable, string mainExecutableArgs)
{
_data.MainExecutable = mainExecutable;
_data.MainExecutableArgs = mainExecutableArgs;

SaveData();
}

public string GetMainExecutable()
{
return _data.MainExecutable;
}

public string MainExecutableArgs
{
get { return _data.MainExecutableArgs; }
}

private void CreateDataDir()
{
Expand Down
15 changes: 11 additions & 4 deletions Assets/PatchKit Patcher/Scripts/AppStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ public AppStarter(App app)
private string ResolveExecutablePath(AppVersion? appVersion)
{
PlatformType platformType = Platform.GetPlatformType();

if (appVersion.HasValue &&
!string.IsNullOrEmpty(appVersion.Value.MainExecutable))
string mainExecutable = (appVersion.HasValue &&
!string.IsNullOrEmpty(appVersion.Value.MainExecutable))
? appVersion.Value.MainExecutable
: _app.LocalMetaData.GetMainExecutable();

if (!string.IsNullOrEmpty(mainExecutable))
{
string executablePath = Path.Combine(
_app.LocalDirectory.Path,
appVersion.Value.MainExecutable);
mainExecutable);

bool isOSXApp = platformType == PlatformType.OSX &&
executablePath.EndsWith(".app") &&
Expand Down Expand Up @@ -97,6 +100,10 @@ private void StartAppVersion(AppVersion? appVersion, string customArgs)
{
appArgs += " " + appVersion.Value.MainExecutableArgs;
}
else if (!string.IsNullOrEmpty(_app.LocalMetaData.MainExecutableArgs))
{
appArgs += " " + _app.LocalMetaData.MainExecutableArgs;
}

if (appFilePath == null)
{
Expand Down
6 changes: 6 additions & 0 deletions Assets/PatchKit Patcher/Scripts/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using UnityEngine;
using CancellationToken = PatchKit.Unity.Patcher.Cancellation.CancellationToken;
using System.IO;
using PatchKit.Api.Models.Main;
using PatchKit.Network;
using PatchKit.Unity.Patcher.AppData;
using PatchKit.Unity.Patcher.AppData.FileSystem;
Expand Down Expand Up @@ -899,6 +900,7 @@ private void ThreadUpdateApp(bool automatically, CancellationToken cancellationT
{
_appInfo.Value = _app.RemoteMetaData.GetAppInfo(!automatically, _updateAppCancellationTokenSource.Token);
_remoteVersionId.Value = _app.GetLatestVersionId(!automatically, _updateAppCancellationTokenSource.Token);

if (_app.IsFullyInstalled())
{
_localVersionId.Value = _app.GetInstalledVersionId();
Expand All @@ -915,6 +917,10 @@ private void ThreadUpdateApp(bool automatically, CancellationToken cancellationT
appUpdater.Update(_updateAppCancellationTokenSource.Token);
_wasUpdateSuccessfulOrNotNecessary = true;
}

AppVersion latestAppVersion =
_app.RemoteMetaData.GetAppVersionInfo(_remoteVersionId.Value.Value, false, cancellationToken);
_app.LocalMetaData.SetMainExecutableAndArgs(latestAppVersion.MainExecutable, latestAppVersion.MainExecutableArgs);
}
catch (OperationCanceledException)
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/PatchKit Patcher/Scripts/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public static class Version
{
public const int Major = 3;
public const int Minor = 17;
public const int Patch = 5;
public const int Patch = 6;
public const int Hotfix = 0;

public static string Value
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [3.17.6.0]
### Fixed
- Starting a valid executable in offline mode (#2146)

## [3.17.5.0]
### Added
- Debug menu (available through Ctrl + Shift + D) (#2081)
Expand Down