mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Merge branch 'master' of https://github.com/goatcorp/Dalamud
This commit is contained in:
commit
84769ae5b7
5 changed files with 21 additions and 9 deletions
|
|
@ -5,6 +5,7 @@ using System.IO;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using Serilog.Events;
|
||||||
|
|
||||||
namespace Dalamud.Configuration
|
namespace Dalamud.Configuration
|
||||||
{
|
{
|
||||||
|
|
@ -12,7 +13,7 @@ namespace Dalamud.Configuration
|
||||||
/// Class containing Dalamud settings.
|
/// Class containing Dalamud settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
internal class DalamudConfiguration
|
public class DalamudConfiguration
|
||||||
{
|
{
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private string configPath;
|
private string configPath;
|
||||||
|
|
@ -113,6 +114,11 @@ namespace Dalamud.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DoButtonsSystemMenu { get; set; } = true;
|
public bool DoButtonsSystemMenu { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the default Dalamud debug log level on startup.
|
||||||
|
/// </summary>
|
||||||
|
public LogEventLevel LogLevel { get; set; } = LogEventLevel.Information;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether or not the debug log should scroll automatically.
|
/// Gets or sets a value indicating whether or not the debug log should scroll automatically.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ namespace Dalamud.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Third party repository for dalamud plugins.
|
/// Third party repository for dalamud plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ThirdRepoSetting
|
public class ThirdRepoSetting
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the third party repo url.
|
/// Gets or sets the third party repo url.
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,12 @@ namespace Dalamud
|
||||||
/// <param name="info">DalamudStartInfo instance.</param>
|
/// <param name="info">DalamudStartInfo instance.</param>
|
||||||
/// <param name="loggingLevelSwitch">LoggingLevelSwitch to control Serilog level.</param>
|
/// <param name="loggingLevelSwitch">LoggingLevelSwitch to control Serilog level.</param>
|
||||||
/// <param name="finishSignal">Signal signalling shutdown.</param>
|
/// <param name="finishSignal">Signal signalling shutdown.</param>
|
||||||
public Dalamud(DalamudStartInfo info, LoggingLevelSwitch loggingLevelSwitch, ManualResetEvent finishSignal)
|
/// <param name="configuration">The Dalamud configuration.</param>
|
||||||
|
public Dalamud(DalamudStartInfo info, LoggingLevelSwitch loggingLevelSwitch, ManualResetEvent finishSignal, DalamudConfiguration configuration)
|
||||||
{
|
{
|
||||||
this.StartInfo = info;
|
this.StartInfo = info;
|
||||||
this.LogLevelSwitch = loggingLevelSwitch;
|
this.LogLevelSwitch = loggingLevelSwitch;
|
||||||
|
this.Configuration = configuration;
|
||||||
|
|
||||||
this.baseDirectory = info.WorkingDirectory;
|
this.baseDirectory = info.WorkingDirectory;
|
||||||
|
|
||||||
|
|
@ -226,8 +228,6 @@ namespace Dalamud
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.Configuration = DalamudConfiguration.Load(this.StartInfo.ConfigurationPath);
|
|
||||||
|
|
||||||
this.AntiDebug = new AntiDebug(this.SigScanner);
|
this.AntiDebug = new AntiDebug(this.SigScanner);
|
||||||
if (this.Configuration.IsAntiAntiDebugEnabled)
|
if (this.Configuration.IsAntiAntiDebugEnabled)
|
||||||
this.AntiDebug.Enable();
|
this.AntiDebug.Enable();
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Dalamud.Configuration;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using EasyHook;
|
using EasyHook;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
@ -34,8 +35,11 @@ namespace Dalamud
|
||||||
/// <param name="info">The <see cref="DalamudStartInfo"/> containing information needed to initialize Dalamud.</param>
|
/// <param name="info">The <see cref="DalamudStartInfo"/> containing information needed to initialize Dalamud.</param>
|
||||||
public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info)
|
public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info)
|
||||||
{
|
{
|
||||||
|
// Load configuration first to get some early persistent state, like log level
|
||||||
|
var configuration = DalamudConfiguration.Load(info.ConfigurationPath);
|
||||||
|
|
||||||
// Setup logger
|
// Setup logger
|
||||||
var (logger, levelSwitch) = this.NewLogger(info.WorkingDirectory);
|
var (logger, levelSwitch) = this.NewLogger(info.WorkingDirectory, configuration.LogLevel);
|
||||||
Log.Logger = logger;
|
Log.Logger = logger;
|
||||||
|
|
||||||
var finishSignal = new ManualResetEvent(false);
|
var finishSignal = new ManualResetEvent(false);
|
||||||
|
|
@ -53,7 +57,7 @@ namespace Dalamud
|
||||||
AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException;
|
||||||
TaskScheduler.UnobservedTaskException += this.OnUnobservedTaskException;
|
TaskScheduler.UnobservedTaskException += this.OnUnobservedTaskException;
|
||||||
|
|
||||||
var dalamud = new Dalamud(info, levelSwitch, finishSignal);
|
var dalamud = new Dalamud(info, levelSwitch, finishSignal, configuration);
|
||||||
Log.Information("Starting a session..");
|
Log.Information("Starting a session..");
|
||||||
|
|
||||||
// Run session
|
// Run session
|
||||||
|
|
@ -77,7 +81,7 @@ namespace Dalamud
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private (Logger Logger, LoggingLevelSwitch LevelSwitch) NewLogger(string baseDirectory)
|
private (Logger Logger, LoggingLevelSwitch LevelSwitch) NewLogger(string baseDirectory, LogEventLevel logLevel)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var logPath = Path.Combine(baseDirectory, "dalamud.log");
|
var logPath = Path.Combine(baseDirectory, "dalamud.log");
|
||||||
|
|
@ -90,7 +94,7 @@ namespace Dalamud
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
levelSwitch.MinimumLevel = LogEventLevel.Verbose;
|
levelSwitch.MinimumLevel = LogEventLevel.Verbose;
|
||||||
#else
|
#else
|
||||||
levelSwitch.MinimumLevel = LogEventLevel.Information;
|
levelSwitch.MinimumLevel = logLevel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var newLogger = new LoggerConfiguration()
|
var newLogger = new LoggerConfiguration()
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,8 @@ namespace Dalamud.Interface
|
||||||
if (ImGui.MenuItem(logLevel + "##logLevelSwitch", string.Empty, this.dalamud.LogLevelSwitch.MinimumLevel == logLevel))
|
if (ImGui.MenuItem(logLevel + "##logLevelSwitch", string.Empty, this.dalamud.LogLevelSwitch.MinimumLevel == logLevel))
|
||||||
{
|
{
|
||||||
this.dalamud.LogLevelSwitch.MinimumLevel = logLevel;
|
this.dalamud.LogLevelSwitch.MinimumLevel = logLevel;
|
||||||
|
this.dalamud.Configuration.LogLevel = logLevel;
|
||||||
|
this.dalamud.Configuration.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue