refactor: update for api 9
This commit is contained in:
parent
672e83e186
commit
3eda6e5e57
|
@ -1,6 +1,6 @@
|
|||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public abstract class BaseConfig {
|
||||
public bool Enabled { get; set; } = true;
|
||||
public bool DefaultExpanded { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public class CarrdConfig : BaseConfig {
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public class FListConfig : BaseConfig {
|
||||
[JsonConstructor]
|
||||
public FListConfig() {
|
||||
this.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public class PastebinConfig : BaseConfig {
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public class PlainTextConfig : BaseConfig {
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace ExpandedSearchInfo.Configs {
|
||||
namespace ExpandedSearchInfo.Configs;
|
||||
|
||||
public class RefsheetConfig : BaseConfig {
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Logging;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
public class GameFunctions : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace ExpandedSearchInfo {
|
|||
this.Plugin = plugin;
|
||||
|
||||
var sidPtr = this.Plugin.SigScanner.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 56 48 83 EC 20 49 8B E8 8B DA");
|
||||
this._searchInfoDownloadedHook = Hook<SearchInfoDownloadedDelegate>.FromAddress(sidPtr, this.SearchInfoDownloaded);
|
||||
this._searchInfoDownloadedHook = this.Plugin.GameInteropProvider.HookFromAddress<SearchInfoDownloadedDelegate>(sidPtr, this.SearchInfoDownloaded);
|
||||
this._searchInfoDownloadedHook.Enable();
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,9 @@ namespace ExpandedSearchInfo {
|
|||
|
||||
this.ReceiveSearchInfo?.Invoke(actorId, searchInfo);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Error in SearchInfoDownloaded hook");
|
||||
Plugin.Log.Error(ex, "Error in SearchInfoDownloaded hook");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public class Plugin : IDalamudPlugin {
|
||||
public string Name => "Expanded Search Info";
|
||||
internal static string Name => "Expanded Search Info";
|
||||
|
||||
[PluginService]
|
||||
internal static IPluginLog Log { get; private set; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal DalamudPluginInterface Interface { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal CommandManager CommandManager { get; init; } = null!;
|
||||
internal ICommandManager CommandManager { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal GameGui GameGui { get; init; } = null!;
|
||||
internal IGameGui GameGui { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal ObjectTable ObjectTable { get; init; } = null!;
|
||||
internal IObjectTable ObjectTable { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal SigScanner SigScanner { get; init; } = null!;
|
||||
internal ISigScanner SigScanner { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
|
||||
|
||||
internal PluginConfiguration Config { get; }
|
||||
internal GameFunctions Functions { get; }
|
||||
|
@ -54,4 +60,3 @@ namespace ExpandedSearchInfo {
|
|||
this.Ui.ConfigVisible = !this.Ui.ConfigVisible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
using Dalamud.Configuration;
|
||||
using ExpandedSearchInfo.Configs;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
[Serializable]
|
||||
public class PluginConfiguration : IPluginConfiguration {
|
||||
private Plugin Plugin { get; set; } = null!;
|
||||
|
@ -28,4 +29,3 @@ namespace ExpandedSearchInfo {
|
|||
public PlainTextConfig PlainText { get; set; } = new();
|
||||
public RefsheetConfig Refsheet { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
public class PluginUi : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
|
@ -59,7 +61,7 @@ namespace ExpandedSearchInfo {
|
|||
|
||||
ImGui.SetNextWindowSize(new Vector2(500, -1), ImGuiCond.FirstUseEver);
|
||||
|
||||
if (!ImGui.Begin($"{this.Plugin.Name} settings", ref this._configVisible)) {
|
||||
if (!ImGui.Begin($"{Plugin.Name} settings", ref this._configVisible)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -165,7 +167,7 @@ namespace ExpandedSearchInfo {
|
|||
);
|
||||
ImGui.SetNextWindowSize(new Vector2(-1, -1));
|
||||
|
||||
if (!ImGui.Begin(this.Plugin.Name, ImGuiWindowFlags.NoTitleBar)) {
|
||||
if (!ImGui.Begin(Plugin.Name, ImGuiWindowFlags.NoTitleBar)) {
|
||||
ImGui.End();
|
||||
return;
|
||||
}
|
||||
|
@ -230,4 +232,3 @@ namespace ExpandedSearchInfo {
|
|||
ImGui.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ using AngleSharp.Html.Parser;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public abstract class BaseHtmlProvider : IProvider {
|
||||
private IBrowsingContext Context { get; } = BrowsingContext.New();
|
||||
|
||||
|
@ -34,4 +35,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
return await parser.ParseDocumentAsync(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ using AngleSharp.Dom;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public class CarrdProvider : BaseHtmlProvider {
|
||||
private static readonly string[] Domains = {
|
||||
".carrd.co",
|
||||
|
@ -88,4 +89,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ using AngleSharp.Dom;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public class FListProvider : BaseHtmlProvider {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
|
@ -121,4 +122,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
return kinks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ using System.Threading.Tasks;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public interface IProvider {
|
||||
string Name { get; }
|
||||
|
||||
|
@ -53,4 +54,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
void ModifyRequest(HttpRequestMessage request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ using System.Threading.Tasks;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public class PastebinProvider : IProvider {
|
||||
private static readonly Regex Matcher = new(@"pb:(\S+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
|
@ -49,4 +50,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
return new TextSection(this, $"Pastebin ({id})", response.RequestMessage.RequestUri, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
|||
using ExpandedSearchInfo.Configs;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public class PlainTextProvider : IProvider {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
|
@ -44,4 +45,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ using ExpandedSearchInfo.Sections;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace ExpandedSearchInfo.Providers {
|
||||
namespace ExpandedSearchInfo.Providers;
|
||||
|
||||
public class RefsheetProvider : BaseHtmlProvider {
|
||||
private const string JsonLineStart = "var props = ";
|
||||
|
||||
|
@ -159,4 +160,3 @@ namespace ExpandedSearchInfo.Providers {
|
|||
}
|
||||
#pragma warning restore 8618
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@ using System.Net.Http;
|
|||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Logging;
|
||||
using ExpandedSearchInfo.Providers;
|
||||
using ExpandedSearchInfo.Sections;
|
||||
using Nager.PublicSuffix;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
public class ExpandedSearchInfo {
|
||||
public string Info { get; }
|
||||
public List<ISearchInfoSection> Sections { get; }
|
||||
|
@ -87,7 +87,7 @@ namespace ExpandedSearchInfo {
|
|||
try {
|
||||
await this.DoExtraction(objectId, info);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Error in extraction thread");
|
||||
Plugin.Log.Error(ex, "Error in extraction thread");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -202,4 +202,3 @@ namespace ExpandedSearchInfo {
|
|||
this.SearchInfos[objectId] = new ExpandedSearchInfo(info, sections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ using System.Linq;
|
|||
using ExpandedSearchInfo.Providers;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ExpandedSearchInfo.Sections {
|
||||
namespace ExpandedSearchInfo.Sections;
|
||||
|
||||
public class FListSection : ISearchInfoSection {
|
||||
public IProvider Provider { get; }
|
||||
public string Name { get; }
|
||||
|
@ -67,4 +68,3 @@ namespace ExpandedSearchInfo.Sections {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using ExpandedSearchInfo.Providers;
|
||||
|
||||
namespace ExpandedSearchInfo.Sections {
|
||||
namespace ExpandedSearchInfo.Sections;
|
||||
|
||||
public interface ISearchInfoSection {
|
||||
IProvider Provider { get; }
|
||||
string Name { get; }
|
||||
|
@ -9,4 +10,3 @@ namespace ExpandedSearchInfo.Sections {
|
|||
|
||||
void Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ using System.Collections.Generic;
|
|||
using ExpandedSearchInfo.Providers;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ExpandedSearchInfo.Sections {
|
||||
namespace ExpandedSearchInfo.Sections;
|
||||
|
||||
public class RefsheetSection : ISearchInfoSection {
|
||||
public IProvider Provider { get; }
|
||||
public string Name { get; }
|
||||
|
@ -42,4 +43,3 @@ namespace ExpandedSearchInfo.Sections {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using ExpandedSearchInfo.Providers;
|
||||
|
||||
namespace ExpandedSearchInfo.Sections {
|
||||
namespace ExpandedSearchInfo.Sections;
|
||||
|
||||
public class TextSection : ISearchInfoSection {
|
||||
public IProvider Provider { get; }
|
||||
public string Name { get; }
|
||||
|
@ -20,4 +21,3 @@ namespace ExpandedSearchInfo.Sections {
|
|||
Util.DrawLines(this.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ using System.Text.RegularExpressions;
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ExpandedSearchInfo {
|
||||
namespace ExpandedSearchInfo;
|
||||
|
||||
internal static class Util {
|
||||
private static readonly Regex BbCodeTag = new(@"\[/?\w+(?:=.+?)?\]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
|
@ -29,4 +30,3 @@ namespace ExpandedSearchInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue