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
46 changes: 33 additions & 13 deletions Assets/PatchKit Patcher/Scripts/AppData/Local/Pack1Unarchiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using PatchKit.Unity.Patcher.Data;
using PatchKit.Unity.Patcher.Debug;
using PatchKit.Unity.Utilities;
using SharpRaven;
using SharpRaven.Data;

namespace PatchKit.Unity.Patcher.AppData.Local
{
Expand Down Expand Up @@ -149,23 +151,41 @@ private void UnpackRegularFile(Pack1Meta.FileEntry file, Action<double> onProgre
{
using (var gzipStream = new GZipStream(cryptoStream, Ionic.Zlib.CompressionMode.Decompress))
{
using (var fileWritter = new FileStream(destPath, FileMode.Create))
try
{
long bytesProcessed = 0;
const int bufferSize = 131072;
var buffer = new byte[bufferSize];
int count;
while ((count = gzipStream.Read(buffer, 0, bufferSize)) != 0)
using (var fileWritter = new FileStream(destPath, FileMode.Create))
{
fileWritter.Write(buffer, 0, count);
bytesProcessed += count;
onProgress(bytesProcessed / (double) file.Size.Value);
}
if (Platform.IsPosix())
{
Chmod.SetMode(file.Mode.Substring(3), destPath);
long bytesProcessed = 0;
const int bufferSize = 131072;
var buffer = new byte[bufferSize];
int count;
while ((count = gzipStream.Read(buffer, 0, bufferSize)) != 0)
{
fileWritter.Write(buffer, 0, count);
bytesProcessed += count;
onProgress(bytesProcessed / (double) file.Size.Value);
}
if (Platform.IsPosix())
{
Chmod.SetMode(file.Mode.Substring(3), destPath);
}
}
}
catch (Exception e)
{
DebugLogger.LogException(e);

var ravenClient
= new RavenClient("https://cb13d9a4a32f456c8411c79c6ad7be9d:90ba86762829401e925a9e5c4233100c@sentry.io/175617");

var sentryEvent = new SentryEvent(e);
var logManager = PatcherLogManager.Instance;
PatcherLogSentryRegistry.AddDataToSentryEvent(sentryEvent, logManager.Storage.Guid.ToString());

ravenClient.Capture(sentryEvent);

throw;
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Assets/PatchKit Patcher/Scripts/Debug/PatcherLogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public static PatcherLogManager Instance
private PatcherLogRegisterTriggers _registerTriggers;

private PatcherLogStorage _storage;

public PatcherLogStorage Storage { get { return _storage; } }

private PatcherLogSentryRegistry _sentryRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void RegisterWithException(Exception exception, string logFileGuid)
}, logFileGuid);
}

private static void AddDataToSentryEvent(SentryEvent sentryEvent, string logFileGuid)
public static void AddDataToSentryEvent(SentryEvent sentryEvent, string logFileGuid)
{
sentryEvent.Exception.Data.Add("log-guid", logFileGuid);
sentryEvent.Exception.Data.Add("log-link", string.Format(
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.9.2]
### Added
- Logging the probable cause of the Zlib exception when unpacking

## [3.9.1]
### Fixed
- Use 'any' instead of 'all' for publish method
Expand Down