mirror of
https://github.com/sp-tarkov/patcher.git
synced 2025-02-13 00:50:46 -05:00
make patch client exit if an error occurs
This commit is contained in:
parent
79cbfe9600
commit
c7cf27acdc
BIN
Patcher/PatchGenerator/Resources/PatchClient.exe
(Stored with Git LFS)
BIN
Patcher/PatchGenerator/Resources/PatchClient.exe
(Stored with Git LFS)
Binary file not shown.
@ -7,6 +7,7 @@
|
|||||||
EftExeNotFound = 11,
|
EftExeNotFound = 11,
|
||||||
NoPatchFolder = 12,
|
NoPatchFolder = 12,
|
||||||
MissingFile = 13,
|
MissingFile = 13,
|
||||||
MissingDir = 14
|
MissingDir = 14,
|
||||||
|
PatchFailed = 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ namespace PatcherUtils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="SourceFilePath"></param>
|
/// <param name="SourceFilePath"></param>
|
||||||
/// <param name="DeltaFilePath"></param>
|
/// <param name="DeltaFilePath"></param>
|
||||||
private void ApplyDelta(string SourceFilePath, string DeltaFilePath)
|
private (bool, string) ApplyDelta(string SourceFilePath, string DeltaFilePath)
|
||||||
{
|
{
|
||||||
string decodedPath = SourceFilePath + ".decoded";
|
string decodedPath = SourceFilePath + ".decoded";
|
||||||
|
|
||||||
@ -115,15 +115,19 @@ namespace PatcherUtils
|
|||||||
{
|
{
|
||||||
File.Move(decodedPath, SourceFilePath, true);
|
File.Move(decodedPath, SourceFilePath, true);
|
||||||
PatchLogger.LogInfo($"Delta applied: {DeltaFilePath}");
|
PatchLogger.LogInfo($"Delta applied: {DeltaFilePath}");
|
||||||
|
return (true, "");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
PatchLogger.LogException(ex);
|
PatchLogger.LogException(ex);
|
||||||
|
return (false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PatchLogger.LogError($"Failed to decode file delta: {SourceFilePath}");
|
string error = $"Failed to decode file delta: {SourceFilePath}";
|
||||||
|
PatchLogger.LogError(error);
|
||||||
|
return (false, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +437,12 @@ namespace PatcherUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
PatchLogger.LogInfo("::: Applying Delta :::");
|
PatchLogger.LogInfo("::: Applying Delta :::");
|
||||||
ApplyDelta(sourceFile.FullName, deltaFile.FullName);
|
var result = ApplyDelta(sourceFile.FullName, deltaFile.FullName);
|
||||||
|
|
||||||
|
if(!result.Item1)
|
||||||
|
{
|
||||||
|
return new PatchMessage(result.Item2, PatcherExitCode.PatchFailed);
|
||||||
|
}
|
||||||
|
|
||||||
deltaCount--;
|
deltaCount--;
|
||||||
|
|
||||||
@ -455,6 +464,7 @@ namespace PatcherUtils
|
|||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
PatchLogger.LogException(ex);
|
PatchLogger.LogException(ex);
|
||||||
|
return new PatchMessage(ex.Message, PatcherExitCode.PatchFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
newCount--;
|
newCount--;
|
||||||
@ -476,6 +486,7 @@ namespace PatcherUtils
|
|||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
PatchLogger.LogException(ex);
|
PatchLogger.LogException(ex);
|
||||||
|
return new PatchMessage(ex.Message, PatcherExitCode.PatchFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
delCount--;
|
delCount--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user