mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
chore: tidy-up, move files shared between dalamud and injector into separate assembly
This commit is contained in:
parent
6f99cfe48c
commit
f44c6794e7
29 changed files with 174 additions and 129 deletions
|
|
@ -74,7 +74,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudStartInfo startInfo = Service<DalamudStartInfo>.Get();
|
||||
private readonly Dalamud dalamud = Service<Dalamud>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly ProfileManager profileManager = Service<ProfileManager>.Get();
|
||||
|
|
@ -90,12 +90,12 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
[ServiceManager.ServiceConstructor]
|
||||
private PluginManager()
|
||||
{
|
||||
this.pluginDirectory = new DirectoryInfo(this.startInfo.PluginDirectory!);
|
||||
this.pluginDirectory = new DirectoryInfo(this.dalamud.StartInfo.PluginDirectory!);
|
||||
|
||||
if (!this.pluginDirectory.Exists)
|
||||
this.pluginDirectory.Create();
|
||||
|
||||
this.SafeMode = EnvironmentConfiguration.DalamudNoPlugins || this.configuration.PluginSafeMode || this.startInfo.NoLoadPlugins;
|
||||
this.SafeMode = EnvironmentConfiguration.DalamudNoPlugins || this.configuration.PluginSafeMode || this.dalamud.StartInfo.NoLoadPlugins;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -119,9 +119,9 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
this.configuration.QueueSave();
|
||||
}
|
||||
|
||||
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(this.startInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
|
||||
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(this.dalamud.StartInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
|
||||
|
||||
var bannedPluginsJson = File.ReadAllText(Path.Combine(this.startInfo.AssetDirectory!, "UIRes", "bannedplugin.json"));
|
||||
var bannedPluginsJson = File.ReadAllText(Path.Combine(this.dalamud.StartInfo.AssetDirectory!, "UIRes", "bannedplugin.json"));
|
||||
this.bannedPlugins = JsonConvert.DeserializeObject<BannedPlugin[]>(bannedPluginsJson);
|
||||
if (this.bannedPlugins == null)
|
||||
{
|
||||
|
|
@ -1168,7 +1168,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
|||
}
|
||||
|
||||
// Applicable version
|
||||
if (manifest.ApplicableVersion < this.startInfo.GameVersion)
|
||||
if (manifest.ApplicableVersion < this.dalamud.StartInfo.GameVersion)
|
||||
{
|
||||
Log.Verbose($"Game version: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Common.Game;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Gui.Dtr;
|
||||
|
|
@ -336,7 +336,7 @@ internal class LocalPlugin : IDisposable
|
|||
var framework = await Service<Framework>.GetAsync();
|
||||
var ioc = await Service<ServiceContainer>.GetAsync();
|
||||
var pluginManager = await Service<PluginManager>.GetAsync();
|
||||
var startInfo = await Service<DalamudStartInfo>.GetAsync();
|
||||
var dalamud = await Service<Dalamud>.GetAsync();
|
||||
|
||||
// UiBuilder constructor requires the following two.
|
||||
await Service<InterfaceManager>.GetAsync();
|
||||
|
|
@ -392,7 +392,7 @@ internal class LocalPlugin : IDisposable
|
|||
if (pluginManager.IsManifestBanned(this.manifest) && !this.IsDev)
|
||||
throw new BannedPluginException($"Unable to load {this.Name}, banned");
|
||||
|
||||
if (this.manifest.ApplicableVersion < startInfo.GameVersion)
|
||||
if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion)
|
||||
throw new InvalidPluginOperationException($"Unable to load {this.Name}, no applicable version");
|
||||
|
||||
if (this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
|
||||
|
|
@ -624,7 +624,7 @@ internal class LocalPlugin : IDisposable
|
|||
/// <returns>Whether or not this plugin shouldn't load.</returns>
|
||||
public bool CheckPolicy()
|
||||
{
|
||||
var startInfo = Service<DalamudStartInfo>.Get();
|
||||
var startInfo = Service<Dalamud>.Get().StartInfo;
|
||||
var manager = Service<PluginManager>.Get();
|
||||
|
||||
if (startInfo.NoLoadPlugins)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Common.Game;
|
||||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue