This repository was archived by the owner on Mar 17, 2018. It is now read-only.
forked from ParkitectNexus/ParkitectNexusClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed crashes when installing mod, fixed mods not disappearing after …
…delete, added crash reporter for linux
- Loading branch information
Showing
8 changed files
with
203 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// ParkitectNexusClient | ||
// Copyright 2016 Parkitect, Tim Potze | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using ParkitectNexus.Data.Assets; | ||
using ParkitectNexus.Data.Assets.Modding; | ||
using ParkitectNexus.Data.Game; | ||
using ParkitectNexus.Data.Utilities; | ||
|
||
namespace ParkitectNexus.Data.Reporting | ||
{ | ||
[JsonObject(MemberSerialization.OptIn)] | ||
public class LinuxCrashReport | ||
{ | ||
private readonly ILogger _logger; | ||
private readonly IParkitect _parkitect; | ||
|
||
public LinuxCrashReport(IParkitect parkitect, string action, Exception exception, ILogger logger) | ||
{ | ||
if (parkitect == null) throw new ArgumentNullException(nameof(parkitect)); | ||
if (exception == null) throw new ArgumentNullException(nameof(exception)); | ||
|
||
_logger = logger; | ||
_parkitect = parkitect; | ||
Action = action; | ||
Exception = exception; | ||
} | ||
|
||
[JsonProperty] | ||
public string Action { get; } | ||
|
||
[JsonProperty] | ||
public Exception Exception { get; } | ||
|
||
[JsonProperty] | ||
public string OS => "Unknown (Linux)"; | ||
|
||
[JsonProperty] | ||
public int ProcessBits => IntPtr.Size*8; | ||
|
||
[JsonProperty] | ||
public IEnumerable<string> Mods | ||
{ | ||
get | ||
{ | ||
try | ||
{ | ||
return _parkitect.Assets[AssetType.Mod].OfType<ModAsset>().Select( | ||
m => $"{m}(Enabled: ???, Directory: {m.InstallationPath})"); | ||
} | ||
catch | ||
{ | ||
return new[] {"Failed to list"}; | ||
} | ||
} | ||
} | ||
|
||
[JsonProperty] | ||
public string Log | ||
{ | ||
get | ||
{ | ||
try | ||
{ | ||
if (!_logger.IsOpened) | ||
return "not opened"; | ||
|
||
var path = _logger.LoggingPath; | ||
_logger.Close(); | ||
var result = File.ReadAllText(path); | ||
_logger.Open(path); | ||
return result; | ||
} | ||
catch (Exception e) | ||
{ | ||
return "failed to open: " + e.Message; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters