update to api9
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin.Services;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text;
|
||||
@@ -8,12 +8,14 @@ namespace MareSynchronos.Interop;
|
||||
internal sealed class DalamudLogger : ILogger
|
||||
{
|
||||
private readonly MareConfigService _mareConfigService;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
private readonly string _name;
|
||||
|
||||
public DalamudLogger(string name, MareConfigService mareConfigService)
|
||||
public DalamudLogger(string name, MareConfigService mareConfigService, IPluginLog pluginLog)
|
||||
{
|
||||
_name = name;
|
||||
_mareConfigService = mareConfigService;
|
||||
_pluginLog = pluginLog;
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state) => default!;
|
||||
@@ -28,18 +30,18 @@ internal sealed class DalamudLogger : ILogger
|
||||
if (!IsEnabled(logLevel)) return;
|
||||
|
||||
if ((int)logLevel <= (int)LogLevel.Information)
|
||||
PluginLog.Information($"[{_name}]{{{(int)logLevel}}} {state}");
|
||||
_pluginLog.Information($"[{_name}]{{{(int)logLevel}}} {state}");
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
sb.AppendLine($"[{_name}]{{{(int)logLevel}}} {state}: {exception?.Message}");
|
||||
sb.AppendLine(exception?.StackTrace);
|
||||
if (logLevel == LogLevel.Warning)
|
||||
PluginLog.Warning(sb.ToString());
|
||||
_pluginLog.Warning(sb.ToString());
|
||||
else if (logLevel == LogLevel.Error)
|
||||
PluginLog.Error(sb.ToString());
|
||||
_pluginLog.Error(sb.ToString());
|
||||
else
|
||||
PluginLog.Fatal(sb.ToString());
|
||||
_pluginLog.Fatal(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Dalamud.Plugin.Services;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -11,10 +12,12 @@ public sealed class DalamudLoggingProvider : ILoggerProvider
|
||||
new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private readonly MareConfigService _mareConfigService;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
public DalamudLoggingProvider(MareConfigService mareConfigService)
|
||||
public DalamudLoggingProvider(MareConfigService mareConfigService, IPluginLog pluginLog)
|
||||
{
|
||||
_mareConfigService = mareConfigService;
|
||||
_pluginLog = pluginLog;
|
||||
}
|
||||
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
@@ -29,7 +32,7 @@ public sealed class DalamudLoggingProvider : ILoggerProvider
|
||||
catName = string.Join("", Enumerable.Range(0, 15 - catName.Length).Select(_ => " ")) + catName;
|
||||
}
|
||||
|
||||
return _loggers.GetOrAdd(catName, name => new DalamudLogger(catName, _mareConfigService));
|
||||
return _loggers.GetOrAdd(catName, name => new DalamudLogger(catName, _mareConfigService, _pluginLog));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Dalamud.Plugin.Services;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -6,11 +8,12 @@ namespace MareSynchronos.Interop;
|
||||
|
||||
public static class DalamudLoggingProviderExtensions
|
||||
{
|
||||
public static ILoggingBuilder AddDalamudLogging(this ILoggingBuilder builder)
|
||||
public static ILoggingBuilder AddDalamudLogging(this ILoggingBuilder builder, IPluginLog pluginLog)
|
||||
{
|
||||
builder.ClearProviders();
|
||||
|
||||
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DalamudLoggingProvider>());
|
||||
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DalamudLoggingProvider>
|
||||
(b => new DalamudLoggingProvider(b.GetRequiredService<MareConfigService>(), pluginLog)));
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
|
||||
namespace MareSynchronos.Interop.FFXIV;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct CharaExt
|
||||
{
|
||||
[FieldOffset(0x0)] public Character Character;
|
||||
[FieldOffset(0x650)] public Character* Mount;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
|
||||
namespace MareSynchronos.Interop.FFXIV;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct HumanExt
|
||||
{
|
||||
[FieldOffset(0x0)] public Human Human;
|
||||
[FieldOffset(0x9E8)] public ResourceHandle* Decal;
|
||||
[FieldOffset(0x9F0)] public ResourceHandle* LegacyBodyDecal;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MareSynchronos.Interop.FFXIV;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct Material
|
||||
{
|
||||
[FieldOffset(0x10)]
|
||||
public ResourceHandle* ResourceHandle;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MareSynchronos.Interop.FFXIV;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct MaterialData
|
||||
{
|
||||
[FieldOffset(0x0)]
|
||||
public byte* Data;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MareSynchronos.Interop.FFXIV;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public unsafe struct MtrlResource
|
||||
{
|
||||
[FieldOffset(0x00)]
|
||||
public ResourceHandle Handle;
|
||||
|
||||
[FieldOffset(0xD0)]
|
||||
public ushort* TexSpace; // Contains the offsets for the tex files inside the string list.
|
||||
|
||||
[FieldOffset(0xE0)]
|
||||
public byte* StringList;
|
||||
|
||||
[FieldOffset(0xF8)]
|
||||
public ushort ShpkOffset;
|
||||
|
||||
[FieldOffset(0xFA)]
|
||||
public byte NumTex;
|
||||
|
||||
public byte* ShpkString
|
||||
=> StringList + ShpkOffset;
|
||||
|
||||
public byte* TexString(int idx)
|
||||
=> StringList + *(TexSpace + 4 + idx * 8);
|
||||
}
|
||||
Reference in New Issue
Block a user