-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from LittleBigRefresh/core
Move non-UI components to new `Refresher.Core` project, move to NotEnoughLogs
- Loading branch information
Showing
34 changed files
with
241 additions
and
137 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
2 changes: 1 addition & 1 deletion
2
Refresher/Accessors/EmulatorPatchAccessor.cs → ...r.Core/Accessors/EmulatorPatchAccessor.cs
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
2 changes: 1 addition & 1 deletion
2
Refresher/Accessors/PatchAccessor.cs → Refresher.Core/Accessors/PatchAccessor.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Accessors; | ||
namespace Refresher.Core.Accessors; | ||
|
||
public abstract class PatchAccessor | ||
{ | ||
|
4 changes: 1 addition & 3 deletions
4
...ceptions/FTPConnectionFailureException.cs → ...ceptions/FTPConnectionFailureException.cs
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Refresher.Exceptions; | ||
namespace Refresher.Core.Exceptions; | ||
|
||
public class FTPConnectionFailureException() : Exception("Could not connect to the FTP server."); |
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 @@ | ||
global using static Refresher.Core.LogType; |
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,18 @@ | ||
namespace Refresher.Core; | ||
|
||
public enum LogType : byte | ||
{ | ||
Patcher, | ||
PPU, | ||
Verify, | ||
CLI, | ||
PatchAccessor, | ||
PatchForm, | ||
IntegratedPatchForm, | ||
InfoRetrieval, | ||
Crypto, | ||
IDPS, | ||
OSIntegration, | ||
AutoDiscover, | ||
PSP, | ||
} |
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,31 @@ | ||
using NotEnoughLogs; | ||
using NotEnoughLogs.Sinks; | ||
|
||
namespace Refresher.Core.Logging; | ||
|
||
public class SentryBreadcrumbSink : ILoggerSink | ||
{ | ||
private static BreadcrumbLevel GetLevel(LogLevel level) | ||
{ | ||
return level switch | ||
{ | ||
LogLevel.Critical => BreadcrumbLevel.Critical, | ||
LogLevel.Error => BreadcrumbLevel.Error, | ||
LogLevel.Warning => BreadcrumbLevel.Warning, | ||
LogLevel.Info => BreadcrumbLevel.Info, | ||
LogLevel.Debug => BreadcrumbLevel.Debug, | ||
LogLevel.Trace => BreadcrumbLevel.Debug, | ||
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null), | ||
}; | ||
} | ||
|
||
public void Log(LogLevel level, ReadOnlySpan<char> category, ReadOnlySpan<char> content) | ||
{ | ||
SentrySdk.AddBreadcrumb(content.ToString(), category.ToString(), level: GetLevel(level)); | ||
} | ||
|
||
public void Log(LogLevel level, ReadOnlySpan<char> category, ReadOnlySpan<char> format, params object[] args) | ||
{ | ||
SentrySdk.AddBreadcrumb(string.Format(format.ToString(), args), category.ToString(), level: GetLevel(level)); | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
Refresher/Patching/IPatcher.cs → Refresher.Core/Patching/IPatcher.cs
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
2 changes: 1 addition & 1 deletion
2
Refresher/Patching/PSP/PSPPluginListEntry.cs → ...r.Core/Patching/PSP/PSPPluginListEntry.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Patching.PSP; | ||
namespace Refresher.Core.Patching.PSP; | ||
|
||
public class PSPPluginListEntry | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
...esher/Patching/PSP/PSPPluginListParser.cs → ....Core/Patching/PSP/PSPPluginListParser.cs
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
6 changes: 3 additions & 3 deletions
6
Refresher/Patching/PSPPatcher.cs → Refresher.Core/Patching/PSPPatcher.cs
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
2 changes: 1 addition & 1 deletion
2
Refresher/Patching/PatchTargetInfo.cs → Refresher.Core/Patching/PatchTargetInfo.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Patching; | ||
namespace Refresher.Core.Patching; | ||
|
||
public struct PatchTargetInfo | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
Refresher/Patching/PatchTargetType.cs → Refresher.Core/Patching/PatchTargetType.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Patching; | ||
namespace Refresher.Core.Patching; | ||
|
||
public enum PatchTargetType | ||
{ | ||
|
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,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentFTP" Version="49.0.2" /> | ||
<PackageReference Include="NotEnoughLogs" Version="2.0.3" /> | ||
<PackageReference Include="SCEToolSharp" Version="1.2.2" /> | ||
<PackageReference Include="ELFSharp" Version="2.17.3" /> | ||
<PackageReference Include="Sentry" Version="4.4.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,23 @@ | ||
using NotEnoughLogs; | ||
using NotEnoughLogs.Behaviour; | ||
using NotEnoughLogs.Sinks; | ||
using Refresher.Core.Logging; | ||
|
||
namespace Refresher.Core; | ||
|
||
public static class State | ||
{ | ||
public static readonly Logger Logger = InitializeLogger([new ConsoleSink(), new SentryBreadcrumbSink()]); | ||
|
||
private static Logger InitializeLogger(IEnumerable<ILoggerSink> sinks) | ||
{ | ||
// if(Logger != null) | ||
// Logger.Dispose(); | ||
|
||
return new Logger(sinks, new LoggerConfiguration | ||
{ | ||
Behaviour = new DirectLoggingBehaviour(), | ||
MaxLevel = LogLevel.Trace, | ||
}); | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...tion/Autodiscover/AutodiscoverResponse.cs → ...tion/Autodiscover/AutodiscoverResponse.cs
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
using Newtonsoft.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Refresher.Verification.Autodiscover; | ||
namespace Refresher.Core.Verification.Autodiscover; | ||
|
||
#nullable disable | ||
|
||
public class AutodiscoverResponse | ||
{ | ||
private const int SupportedVersion = 2; | ||
|
||
[JsonProperty("version")] | ||
[JsonPropertyName("version")] | ||
public int Version { get; set; } | ||
|
||
[JsonProperty("serverBrand")] | ||
[JsonPropertyName("serverBrand")] | ||
public string ServerBrand { get; set; } | ||
|
||
[JsonProperty("url")] | ||
[JsonPropertyName("url")] | ||
public string Url { get; set; } | ||
|
||
[JsonProperty("usesCustomDigestKey")] | ||
[JsonPropertyName("usesCustomDigestKey")] | ||
public bool? UsesCustomDigestKey { get; set; } = false; // We mark as nullable, as this was added in version 2 | ||
} |
2 changes: 1 addition & 1 deletion
2
Refresher/Verification/Message.cs → Refresher.Core/Verification/Message.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Verification; | ||
namespace Refresher.Core.Verification; | ||
|
||
public readonly struct Message | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
Refresher/Verification/MessageLevel.cs → Refresher.Core/Verification/MessageLevel.cs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Refresher.Verification; | ||
namespace Refresher.Core.Verification; | ||
|
||
public enum MessageLevel | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
Refresher/Verification/ParamSfo.cs → Refresher.Core/Verification/ParamSfo.cs
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
Oops, something went wrong.