Add LLib
This commit is contained in:
parent
74aaf1365e
commit
a3fe0d2d26
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "LLib"]
|
||||||
|
path = LLib
|
||||||
|
url = git@git.carvel.li:liza/LLib.git
|
@ -2,6 +2,8 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deliveroo", "Deliveroo\Deliveroo.csproj", "{978F4598-921A-4F9D-A975-1463D3BA96C3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deliveroo", "Deliveroo\Deliveroo.csproj", "{978F4598-921A-4F9D-A975-1463D3BA96C3}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{B4EFA106-69ED-4E45-8646-425C0708CBAC}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -12,5 +14,9 @@ Global
|
|||||||
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
{978F4598-921A-4F9D-A975-1463D3BA96C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B4EFA106-69ED-4E45-8646-425C0708CBAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4EFA106-69ED-4E45-8646-425C0708CBAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B4EFA106-69ED-4E45-8646-425C0708CBAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B4EFA106-69ED-4E45-8646-425C0708CBAC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
|
<PathMap Condition="$(SolutionDir) != ''">$(SolutionDir)=X:\</PathMap>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -21,6 +22,10 @@
|
|||||||
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
|
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LLib\LLib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -52,7 +57,6 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin">
|
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin">
|
||||||
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
|
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
113
Deliveroo/External/DalamudReflector.cs
vendored
113
Deliveroo/External/DalamudReflector.cs
vendored
@ -1,113 +0,0 @@
|
|||||||
using Dalamud.Plugin;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reflection;
|
|
||||||
using Dalamud.Plugin.Services;
|
|
||||||
|
|
||||||
namespace Deliveroo.External;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Originally part of ECommons by NightmareXIV.
|
|
||||||
///
|
|
||||||
/// https://github.com/NightmareXIV/ECommons/blob/master/ECommons/Reflection/DalamudReflector.cs
|
|
||||||
/// </summary>
|
|
||||||
internal sealed class DalamudReflector : IDisposable
|
|
||||||
{
|
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
|
||||||
private readonly IFramework _framework;
|
|
||||||
private readonly IPluginLog _pluginLog;
|
|
||||||
private readonly Dictionary<string, IDalamudPlugin> _pluginCache = new();
|
|
||||||
private bool _pluginsChanged = false;
|
|
||||||
|
|
||||||
public DalamudReflector(DalamudPluginInterface pluginInterface, IFramework framework, IPluginLog pluginLog)
|
|
||||||
{
|
|
||||||
_pluginInterface = pluginInterface;
|
|
||||||
_framework = framework;
|
|
||||||
_pluginLog = pluginLog;
|
|
||||||
var pm = GetPluginManager();
|
|
||||||
pm.GetType().GetEvent("OnInstalledPluginsChanged")!.AddEventHandler(pm, OnInstalledPluginsChanged);
|
|
||||||
|
|
||||||
_framework.Update += FrameworkUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
_framework.Update -= FrameworkUpdate;
|
|
||||||
|
|
||||||
var pm = GetPluginManager();
|
|
||||||
pm.GetType().GetEvent("OnInstalledPluginsChanged")!.RemoveEventHandler(pm, OnInstalledPluginsChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FrameworkUpdate(IFramework framework)
|
|
||||||
{
|
|
||||||
if (_pluginsChanged)
|
|
||||||
{
|
|
||||||
_pluginsChanged = false;
|
|
||||||
_pluginCache.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private object GetPluginManager()
|
|
||||||
{
|
|
||||||
return _pluginInterface.GetType().Assembly.GetType("Dalamud.Service`1", true)!
|
|
||||||
.MakeGenericType(
|
|
||||||
_pluginInterface.GetType().Assembly.GetType("Dalamud.Plugin.Internal.PluginManager", true)!)
|
|
||||||
.GetMethod("Get")!.Invoke(null, BindingFlags.Default, null, Array.Empty<object>(), null)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryGetDalamudPlugin(string internalName, out IDalamudPlugin? instance, bool suppressErrors = false,
|
|
||||||
bool ignoreCache = false)
|
|
||||||
{
|
|
||||||
if (!ignoreCache && _pluginCache.TryGetValue(internalName, out instance))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var pluginManager = GetPluginManager();
|
|
||||||
var installedPlugins =
|
|
||||||
(System.Collections.IList)pluginManager.GetType().GetProperty("InstalledPlugins")!.GetValue(
|
|
||||||
pluginManager)!;
|
|
||||||
|
|
||||||
foreach (var t in installedPlugins)
|
|
||||||
{
|
|
||||||
if ((string?)t.GetType().GetProperty("Name")!.GetValue(t) == internalName)
|
|
||||||
{
|
|
||||||
var type = t.GetType().Name == "LocalDevPlugin" ? t.GetType().BaseType : t.GetType();
|
|
||||||
var plugin = (IDalamudPlugin?)type!
|
|
||||||
.GetField("instance", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(t);
|
|
||||||
if (plugin == null)
|
|
||||||
{
|
|
||||||
_pluginLog.Warning($"[DalamudReflector] Found requested plugin {internalName} but it was null");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
instance = plugin;
|
|
||||||
_pluginCache[internalName] = plugin;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
instance = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
if (!suppressErrors)
|
|
||||||
{
|
|
||||||
_pluginLog.Error(e, $"Can't find {internalName} plugin: {e.Message}");
|
|
||||||
}
|
|
||||||
|
|
||||||
instance = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInstalledPluginsChanged()
|
|
||||||
{
|
|
||||||
_pluginLog.Verbose("Installed plugins changed event fired");
|
|
||||||
_pluginsChanged = true;
|
|
||||||
}
|
|
||||||
}
|
|
1
Deliveroo/External/ExternalPluginHandler.cs
vendored
1
Deliveroo/External/ExternalPluginHandler.cs
vendored
@ -1,5 +1,6 @@
|
|||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
using LLib;
|
||||||
|
|
||||||
namespace Deliveroo.External;
|
namespace Deliveroo.External;
|
||||||
|
|
||||||
|
2
Deliveroo/External/YesAlreadyIpc.cs
vendored
2
Deliveroo/External/YesAlreadyIpc.cs
vendored
@ -1,5 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Dalamud.Logging;
|
using LLib;
|
||||||
|
|
||||||
namespace Deliveroo.External;
|
namespace Deliveroo.External;
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using Dalamud.Plugin.Services;
|
|||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using LLib;
|
||||||
|
|
||||||
namespace Deliveroo.Windows;
|
namespace Deliveroo.Windows;
|
||||||
|
|
||||||
@ -51,6 +52,8 @@ internal sealed class ConfigWindow : Window
|
|||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
|
LImGui.AddPatreonIcon(_pluginInterface);
|
||||||
|
|
||||||
if (_configuration.AddVentureIfNoItemToPurchaseSelected())
|
if (_configuration.AddVentureIfNoItemToPurchaseSelected())
|
||||||
Save();
|
Save();
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using Deliveroo.GameData;
|
|||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using LLib;
|
||||||
|
|
||||||
namespace Deliveroo.Windows;
|
namespace Deliveroo.Windows;
|
||||||
|
|
||||||
@ -90,6 +91,8 @@ internal sealed class TurnInWindow : Window
|
|||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
|
LImGui.AddPatreonIcon(_pluginInterface);
|
||||||
|
|
||||||
GrandCompany grandCompany = _plugin.GetGrandCompany();
|
GrandCompany grandCompany = _plugin.GetGrandCompany();
|
||||||
if (grandCompany == GrandCompany.None)
|
if (grandCompany == GrandCompany.None)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"requested": "[2.1.12, )",
|
"requested": "[2.1.12, )",
|
||||||
"resolved": "2.1.12",
|
"resolved": "2.1.12",
|
||||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
||||||
|
},
|
||||||
|
"llib": {
|
||||||
|
"type": "Project"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
LLib
Submodule
1
LLib
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e7f5017cbfb0f52b767640cfd4eb1bc913df248c
|
Loading…
Reference in New Issue
Block a user