chore: clean up some warnings
This commit is contained in:
parent
883468f7cc
commit
e8971d32a8
|
@ -37,7 +37,7 @@ namespace XIVChatPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
public T GetPreference<T>(ClientPreference pref, T def = default) {
|
||||
public T? GetPreference<T>(ClientPreference pref, T? def = default) {
|
||||
var prefs = this.Preferences;
|
||||
|
||||
if (prefs == null) {
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace XIVChatPlugin {
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration {
|
||||
private Plugin? _plugin;
|
||||
|
||||
|
@ -26,7 +27,7 @@ namespace XIVChatPlugin {
|
|||
public KeyPair? KeyPair { get; set; }
|
||||
|
||||
public void Initialise(Plugin plugin) {
|
||||
this._plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "Plugin cannot be null");
|
||||
this._plugin = plugin;
|
||||
}
|
||||
|
||||
public void Save() {
|
||||
|
|
|
@ -9,26 +9,6 @@ namespace XIVChatPlugin {
|
|||
return string.Join(separator, bytes.Select(b => b.ToString(upper ? "X2" : "x2")));
|
||||
}
|
||||
|
||||
//public static List<uint> ToColours(this byte[] bytes) {
|
||||
// var colours = new List<uint>();
|
||||
|
||||
// uint colour = 0xFF;
|
||||
// for (int i = 0; i < bytes.Length; i++) {
|
||||
// var idx = i % 3;
|
||||
|
||||
// if (i != 0 && idx == 0) {
|
||||
// colours.Add(colour);
|
||||
// colour = 0xFF;
|
||||
// }
|
||||
|
||||
// colour |= (uint)bytes[i] << ((4 - idx - 1) * 8);
|
||||
// }
|
||||
|
||||
// colours.Add(colour);
|
||||
|
||||
// return colours;
|
||||
//}
|
||||
|
||||
public static List<Vector4> ToColours(this byte[] bytes) {
|
||||
var colours = new List<Vector4>();
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace XIVChatPlugin {
|
|||
public event ReceiveFriendListHandler? ReceiveFriendList;
|
||||
|
||||
public GameFunctions(Plugin plugin) {
|
||||
this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "Plugin cannot be null");
|
||||
this.Plugin = plugin;
|
||||
|
||||
var getUiModulePtr = this.Plugin.ScanText("E8 ?? ?? ?? ?? 48 83 7F ?? 00 48 8B F0");
|
||||
var easierProcessChatBoxPtr = this.Plugin.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 45 84 C9");
|
||||
|
|
|
@ -3,18 +3,20 @@ using Dalamud.Plugin;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
// #if DEBUG
|
||||
#if DEBUG
|
||||
using System.IO;
|
||||
// #endif
|
||||
#endif
|
||||
using System.Reflection;
|
||||
|
||||
namespace XIVChatPlugin {
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public class Plugin : IDalamudPlugin {
|
||||
private bool _disposedValue;
|
||||
|
||||
public string Name => "XIVChat";
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||
internal string Location { get; private set; } = Assembly.GetExecutingAssembly().Location;
|
||||
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
|
@ -33,13 +35,13 @@ namespace XIVChatPlugin {
|
|||
this.Interface = pluginInterface ?? throw new ArgumentNullException(nameof(pluginInterface), "DalamudPluginInterface cannot be null");
|
||||
|
||||
// load libsodium.so from debug location if in debug mode
|
||||
// #if DEBUG
|
||||
#if DEBUG
|
||||
string path = Environment.GetEnvironmentVariable("PATH")!;
|
||||
string newPath = Path.GetDirectoryName(this.Location)!;
|
||||
Environment.SetEnvironmentVariable("PATH", $"{path};{newPath}");
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
this.Config = (Configuration?) this.Interface.GetPluginConfig() ?? new Configuration();
|
||||
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
this.Config.Initialise(this);
|
||||
|
||||
this.Functions = new GameFunctions(this);
|
||||
|
|
|
@ -380,7 +380,7 @@ namespace XIVChatPlugin {
|
|||
continue;
|
||||
}
|
||||
|
||||
await this.ProcessMessage(id, client, handshake, msg);
|
||||
await this.ProcessMessage(id, client, msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -412,7 +412,7 @@ namespace XIVChatPlugin {
|
|||
client.Disconnect();
|
||||
}
|
||||
|
||||
private async Task ProcessMessage(Guid id, BaseClient client, HandshakeInfo handshake, byte[] msg) {
|
||||
private async Task ProcessMessage(Guid id, BaseClient client, byte[] msg) {
|
||||
var op = (ClientOperation) msg[0];
|
||||
|
||||
var payload = new byte[msg.Length - 1];
|
||||
|
@ -613,7 +613,7 @@ namespace XIVChatPlugin {
|
|||
void Append(string text) {
|
||||
chunks.Add(new TextChunk(text) {
|
||||
FallbackColour = defaultColour,
|
||||
Foreground = foreground.Count > 0 ? foreground.Peek() : (uint?) null,
|
||||
Foreground = foreground.Count > 0 ? foreground.Peek() : null,
|
||||
Glow = glow.Count > 0 ? glow.Peek() : null,
|
||||
Italic = italic,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue